netif_receive_skb return value in bridging scenario

Message ID 1361896528.11403.6.camel@edumazet-glaptop
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Feb. 26, 2013, 4:35 p.m.
On Tue, 2013-02-26 at 14:57 +0000, Bercaru Cristian-B43982 wrote:
> Hello!
> I noticed that the return value of __netif_receive_skb is initialized
> If the bridging code handles the packet and successfully returns
> RX_HANDLER_CONSUMED, __netif_receive_skb returns the default value,
> NET_RX_DROP. I don't think it is fair to consider the packet dropped,
> since it is received successfully.
> I thought the return value of __netif_receive_skb was used by Ethernet
> NIC drivers for updating their RX_DROP and RX_OX counters, but I
> studied the source code of various drivers and they seem to ignore
> whatever the return value. It seems strange. Then shouldn't the
> function header look like      " void netif_receive_skb(... "  ?

It seems better to factorize whatever is needed in core network layer,
instead of adding code in all drivers to check netif_receive_skb()
return code.

Check the follwing "atomic_long_inc(&skb->dev->rx_dropped);"
in __netif_receive_skb_core()

For the case you mention, I guess we need the following patch 

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at


diff --git a/net/core/dev.c b/net/core/dev.c
index 17bc535..e98fb4d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3446,6 +3446,7 @@  ncls:
 		switch (rx_handler(&skb)) {
+			ret = NET_RX_SUCCESS;
 			goto unlock;
 			goto another_round;