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>
此提交包含在:
Jarek Poplawski
2009-11-15 07:20:12 +00:00
提交者 David S. Miller
父節點 cb43e23435
當前提交 9a1654ba0b
共有 3 個檔案被更改,包括 35 行新增47 行删除

查看文件

@@ -1924,23 +1924,6 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
return rc;
}
static inline bool dev_xmit_complete(int rc)
{
/* successful transmission */
if (rc == NETDEV_TX_OK)
return true;
/* error while transmitting, driver consumed skb */
if (rc < 0)
return true;
/* error while queueing to a different device, driver consumed skb */
if (rc & NET_XMIT_MASK)
return true;
return false;
}
/**
* dev_queue_xmit - transmit a buffer
* @skb: buffer to transmit