Commit e34fac1c authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

doc, net: Update ndo_start_xmit return type and values

Commit dc1f8bf6 ('netdev: change
transmit to limited range type') changed the required return type and
9a1654ba ('net: Optimize
hard_start_xmit() return checking') changed the valid numerical
return values.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de7aca16
...@@ -2,16 +2,16 @@ Document about softnet driver issues ...@@ -2,16 +2,16 @@ Document about softnet driver issues
Transmit path guidelines: Transmit path guidelines:
1) The ndo_start_xmit method must never return '1' under any 1) The ndo_start_xmit method must not return NETDEV_TX_BUSY under
normal circumstances. It is considered a hard error unless any normal circumstances. It is considered a hard error unless
there is no way your device can tell ahead of time when it's there is no way your device can tell ahead of time when it's
transmit function will become busy. transmit function will become busy.
Instead it must maintain the queue properly. For example, Instead it must maintain the queue properly. For example,
for a driver implementing scatter-gather this means: for a driver implementing scatter-gather this means:
static int drv_hard_start_xmit(struct sk_buff *skb, static netdev_tx_t drv_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
struct drv *dp = netdev_priv(dev); struct drv *dp = netdev_priv(dev);
...@@ -23,7 +23,7 @@ Transmit path guidelines: ...@@ -23,7 +23,7 @@ Transmit path guidelines:
unlock_tx(dp); unlock_tx(dp);
printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
dev->name); dev->name);
return 1; return NETDEV_TX_BUSY;
} }
... queue packet to card ... ... queue packet to card ...
...@@ -35,6 +35,7 @@ Transmit path guidelines: ...@@ -35,6 +35,7 @@ Transmit path guidelines:
... ...
unlock_tx(dp); unlock_tx(dp);
... ...
return NETDEV_TX_OK;
} }
And then at the end of your TX reclamation event handling: And then at the end of your TX reclamation event handling:
...@@ -61,9 +62,9 @@ Transmit path guidelines: ...@@ -61,9 +62,9 @@ Transmit path guidelines:
2) An ndo_start_xmit method must not modify the shared parts of a 2) An ndo_start_xmit method must not modify the shared parts of a
cloned SKB. cloned SKB.
3) Do not forget that once you return 0 from your ndo_start_xmit 3) Do not forget that once you return NETDEV_TX_OK from your
method, it is your driver's responsibility to free up the SKB ndo_start_xmit method, it is your driver's responsibility to free
and in some finite amount of time. up the SKB and in some finite amount of time.
For example, this means that it is not allowed for your TX For example, this means that it is not allowed for your TX
mitigation scheme to let TX packets "hang out" in the TX mitigation scheme to let TX packets "hang out" in the TX
...@@ -71,8 +72,9 @@ Transmit path guidelines: ...@@ -71,8 +72,9 @@ Transmit path guidelines:
This error can deadlock sockets waiting for send buffer room This error can deadlock sockets waiting for send buffer room
to be freed up. to be freed up.
If you return 1 from the ndo_start_xmit method, you must not keep If you return NETDEV_TX_BUSY from the ndo_start_xmit method, you
any reference to that SKB and you must not attempt to free it up. must not keep any reference to that SKB and you must not attempt
to free it up.
Probing guidelines: Probing guidelines:
......
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