]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[netdevice] Report network-layer errors via network device statistics
authorMichael Brown <mcb30@ipxe.org>
Wed, 15 Sep 2010 03:56:28 +0000 (04:56 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 15 Sep 2010 04:08:16 +0000 (05:08 +0100)
Errors generated by the network layer in response to received packets
are liable to be lost, since nothing systematically records these
errors and often the packets do not propagate far enough through the
stack to impact upon user-visible processes.

Improve this situation by recording network-layer errors in the
network device statistics.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/netdevice.c

index 51bd344b299c7dd50f593d1ea171a3237db3b682..bb8a5b28130b82864a26b690775cc154bc4e1bcd 100644 (file)
@@ -658,7 +658,7 @@ int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
        DBGC ( netdev, "NETDEV %p unknown network protocol %04x\n",
               netdev, ntohs ( net_proto ) );
        free_iob ( iobuf );
-       return 0;
+       return -ENOTSUP;
 }
 
 /**
@@ -705,7 +705,12 @@ static void net_step ( struct process *process __unused ) {
                                continue;
                        }
 
-                       net_rx ( iobuf, netdev, net_proto, ll_source );
+                       /* Hand packet to network layer */
+                       if ( ( rc = net_rx ( iob_disown ( iobuf ), netdev,
+                                            net_proto, ll_source ) ) != 0 ) {
+                               /* Record error for diagnosis */
+                               netdev_rx_err ( netdev, NULL, rc );
+                       }
                }
        }
 }