Commit 67981583 authored by Ying Xue's avatar Ying Xue Committed by David S. Miller

tipc: correct return value of recv_msg routine

Currently, rcv_msg() always returns zero on a packet delivery upcall
from net_device.

To make its behavior more compliant with the way this API should be
used, we change this to let it return NET_RX_SUCCESS (which is zero
anyway) when it is able to handle the packet, and NET_RX_DROP otherwise.
The latter does not imply any functional change, it only enables the
driver to keep more accurate statistics about the fate of delivered
packets.
Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
Reviewed-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f2875c3c
...@@ -132,18 +132,18 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, ...@@ -132,18 +132,18 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
if (!net_eq(dev_net(dev), &init_net)) { if (!net_eq(dev_net(dev), &init_net)) {
kfree_skb(buf); kfree_skb(buf);
return 0; return NET_RX_DROP;
} }
if (likely(eb_ptr->bearer)) { if (likely(eb_ptr->bearer)) {
if (likely(buf->pkt_type <= PACKET_BROADCAST)) { if (likely(buf->pkt_type <= PACKET_BROADCAST)) {
buf->next = NULL; buf->next = NULL;
tipc_recv_msg(buf, eb_ptr->bearer); tipc_recv_msg(buf, eb_ptr->bearer);
return 0; return NET_RX_SUCCESS;
} }
} }
kfree_skb(buf); kfree_skb(buf);
return 0; return NET_RX_DROP;
} }
/** /**
......
...@@ -125,18 +125,18 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, ...@@ -125,18 +125,18 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
if (!net_eq(dev_net(dev), &init_net)) { if (!net_eq(dev_net(dev), &init_net)) {
kfree_skb(buf); kfree_skb(buf);
return 0; return NET_RX_DROP;
} }
if (likely(ib_ptr->bearer)) { if (likely(ib_ptr->bearer)) {
if (likely(buf->pkt_type <= PACKET_BROADCAST)) { if (likely(buf->pkt_type <= PACKET_BROADCAST)) {
buf->next = NULL; buf->next = NULL;
tipc_recv_msg(buf, ib_ptr->bearer); tipc_recv_msg(buf, ib_ptr->bearer);
return 0; return NET_RX_SUCCESS;
} }
} }
kfree_skb(buf); kfree_skb(buf);
return 0; return NET_RX_DROP;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment