Browse Source

Use netdev_rx_err() to report receive errors.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
ed7eae6005
2 changed files with 5 additions and 2 deletions
  1. 3
    2
      src/drivers/net/pnic.c
  2. 2
    0
      src/drivers/net/rtl8139.c

+ 3
- 2
src/drivers/net/pnic.c View File

@@ -128,13 +128,14 @@ static void pnic_poll ( struct net_device *netdev, unsigned int rx_quota ) {
128 128
 			break;
129 129
 		iobuf = alloc_iob ( ETH_FRAME_LEN );
130 130
 		if ( ! iobuf ) {
131
-			printf ( "could not allocate buffer\n" );
131
+			DBG ( "could not allocate buffer\n" );
132
+			netdev_rx_err ( netdev, NULL, -ENOMEM );
132 133
 			break;
133 134
 		}
134 135
 		if ( pnic_command ( pnic, PNIC_CMD_RECV, NULL, 0,
135 136
 				    iobuf->data, ETH_FRAME_LEN, &length )
136 137
 		     != PNIC_STATUS_OK ) {
137
-			free_iob ( iobuf );
138
+			netdev_rx_err ( netdev, iobuf, -EIO );
138 139
 			break;
139 140
 		}
140 141
 		iob_put ( iobuf, length );

+ 2
- 0
src/drivers/net/rtl8139.c View File

@@ -444,6 +444,7 @@ static void rtl_poll ( struct net_device *netdev, unsigned int rx_quota ) {
444 444
 
445 445
 			rx_iob = alloc_iob ( rx_len );
446 446
 			if ( ! rx_iob ) {
447
+				netdev_rx_err ( netdev, NULL, -ENOMEM );
447 448
 				/* Leave packet for next call to poll() */
448 449
 				break;
449 450
 			}
@@ -464,6 +465,7 @@ static void rtl_poll ( struct net_device *netdev, unsigned int rx_quota ) {
464 465
 		} else {
465 466
 			DBG ( "RX bad packet (status %#04x len %d)\n",
466 467
 			      rx_status, rx_len );
468
+			netdev_rx_err ( netdev, NULL, -EINVAL );
467 469
 		}
468 470
 		rtl->rx.offset = ( ( ( rtl->rx.offset + 4 + rx_len + 3 ) & ~3 )
469 471
 				   % RX_BUF_LEN );

Loading…
Cancel
Save