diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2009-11-15 02:20:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-16 01:08:33 -0500 |
commit | 9a1654ba0b50402a6bd03c7b0fe9b0200a5ea7b1 (patch) | |
tree | 3defd37672da2069e6c0ffd86b0b99c694324985 /net/core | |
parent | cb43e23435a66d5ed90f804af9efe9096503979f (diff) |
net: Optimize hard_start_xmit() return checking
Recent changes in the TX error propagation require additional checking
and masking of values returned from hard_start_xmit(), mainly to
separate cases where skb was consumed. This aim can be simplified by
changing the order of NETDEV_TX and NET_XMIT codes, because the latter
are treated similarly to negative (ERRNO) values.
After this change much simpler dev_xmit_complete() is also used in
sch_direct_xmit(), so it is moved to netdevice.h.
Additionally NET_RX definitions in netdevice.h are moved up from
between TX codes to avoid confusion while reading the TX comment.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 32045df1da5c..4b24d79414e3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1924,23 +1924,6 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, | |||
1924 | return rc; | 1924 | return rc; |
1925 | } | 1925 | } |
1926 | 1926 | ||
1927 | static inline bool dev_xmit_complete(int rc) | ||
1928 | { | ||
1929 | /* successful transmission */ | ||
1930 | if (rc == NETDEV_TX_OK) | ||
1931 | return true; | ||
1932 | |||
1933 | /* error while transmitting, driver consumed skb */ | ||
1934 | if (rc < 0) | ||
1935 | return true; | ||
1936 | |||
1937 | /* error while queueing to a different device, driver consumed skb */ | ||
1938 | if (rc & NET_XMIT_MASK) | ||
1939 | return true; | ||
1940 | |||
1941 | return false; | ||
1942 | } | ||
1943 | |||
1944 | /** | 1927 | /** |
1945 | * dev_queue_xmit - transmit a buffer | 1928 | * dev_queue_xmit - transmit a buffer |
1946 | * @skb: buffer to transmit | 1929 | * @skb: buffer to transmit |