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
 			break;
128
 			break;
129
 		iobuf = alloc_iob ( ETH_FRAME_LEN );
129
 		iobuf = alloc_iob ( ETH_FRAME_LEN );
130
 		if ( ! iobuf ) {
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
 			break;
133
 			break;
133
 		}
134
 		}
134
 		if ( pnic_command ( pnic, PNIC_CMD_RECV, NULL, 0,
135
 		if ( pnic_command ( pnic, PNIC_CMD_RECV, NULL, 0,
135
 				    iobuf->data, ETH_FRAME_LEN, &length )
136
 				    iobuf->data, ETH_FRAME_LEN, &length )
136
 		     != PNIC_STATUS_OK ) {
137
 		     != PNIC_STATUS_OK ) {
137
-			free_iob ( iobuf );
138
+			netdev_rx_err ( netdev, iobuf, -EIO );
138
 			break;
139
 			break;
139
 		}
140
 		}
140
 		iob_put ( iobuf, length );
141
 		iob_put ( iobuf, length );

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

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

Loading…
Cancel
Save