diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-04-05 10:40:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-06 02:43:13 -0400 |
commit | e34fac1c2e9ec531c2d63a5e3aa9a6d0ef36a1d3 (patch) | |
tree | 4a7948644e33badd661ef6cff438ef6548716362 | |
parent | de7aca16fd6c32719b6a7d4480b8f4685f69f7ff (diff) |
doc, net: Update ndo_start_xmit return type and values
Commit dc1f8bf68b311b1537cb65893430b6796118498a ('netdev: change
transmit to limited range type') changed the required return type and
9a1654ba0b50402a6bd03c7b0fe9b0200a5ea7b1 ('net: Optimize
hard_start_xmit() return checking') changed the valid numerical
return values.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/driver.txt | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt index 2128e4169c5b..da59e2884130 100644 --- a/Documentation/networking/driver.txt +++ b/Documentation/networking/driver.txt | |||
@@ -2,16 +2,16 @@ Document about softnet driver issues | |||
2 | 2 | ||
3 | Transmit path guidelines: | 3 | Transmit path guidelines: |
4 | 4 | ||
5 | 1) The ndo_start_xmit method must never return '1' under any | 5 | 1) The ndo_start_xmit method must not return NETDEV_TX_BUSY under |
6 | normal circumstances. It is considered a hard error unless | 6 | any normal circumstances. It is considered a hard error unless |
7 | there is no way your device can tell ahead of time when it's | 7 | there is no way your device can tell ahead of time when it's |
8 | transmit function will become busy. | 8 | transmit function will become busy. |
9 | 9 | ||
10 | Instead it must maintain the queue properly. For example, | 10 | Instead it must maintain the queue properly. For example, |
11 | for a driver implementing scatter-gather this means: | 11 | for a driver implementing scatter-gather this means: |
12 | 12 | ||
13 | static int drv_hard_start_xmit(struct sk_buff *skb, | 13 | static netdev_tx_t drv_hard_start_xmit(struct sk_buff *skb, |
14 | struct net_device *dev) | 14 | struct net_device *dev) |
15 | { | 15 | { |
16 | struct drv *dp = netdev_priv(dev); | 16 | struct drv *dp = netdev_priv(dev); |
17 | 17 | ||
@@ -23,7 +23,7 @@ Transmit path guidelines: | |||
23 | unlock_tx(dp); | 23 | unlock_tx(dp); |
24 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", | 24 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", |
25 | dev->name); | 25 | dev->name); |
26 | return 1; | 26 | return NETDEV_TX_BUSY; |
27 | } | 27 | } |
28 | 28 | ||
29 | ... queue packet to card ... | 29 | ... queue packet to card ... |
@@ -35,6 +35,7 @@ Transmit path guidelines: | |||
35 | ... | 35 | ... |
36 | unlock_tx(dp); | 36 | unlock_tx(dp); |
37 | ... | 37 | ... |
38 | return NETDEV_TX_OK; | ||
38 | } | 39 | } |
39 | 40 | ||
40 | And then at the end of your TX reclamation event handling: | 41 | And then at the end of your TX reclamation event handling: |
@@ -61,9 +62,9 @@ Transmit path guidelines: | |||
61 | 2) An ndo_start_xmit method must not modify the shared parts of a | 62 | 2) An ndo_start_xmit method must not modify the shared parts of a |
62 | cloned SKB. | 63 | cloned SKB. |
63 | 64 | ||
64 | 3) Do not forget that once you return 0 from your ndo_start_xmit | 65 | 3) Do not forget that once you return NETDEV_TX_OK from your |
65 | method, it is your driver's responsibility to free up the SKB | 66 | ndo_start_xmit method, it is your driver's responsibility to free |
66 | and in some finite amount of time. | 67 | up the SKB and in some finite amount of time. |
67 | 68 | ||
68 | For example, this means that it is not allowed for your TX | 69 | For example, this means that it is not allowed for your TX |
69 | mitigation scheme to let TX packets "hang out" in the TX | 70 | mitigation scheme to let TX packets "hang out" in the TX |
@@ -71,8 +72,9 @@ Transmit path guidelines: | |||
71 | This error can deadlock sockets waiting for send buffer room | 72 | This error can deadlock sockets waiting for send buffer room |
72 | to be freed up. | 73 | to be freed up. |
73 | 74 | ||
74 | If you return 1 from the ndo_start_xmit method, you must not keep | 75 | If you return NETDEV_TX_BUSY from the ndo_start_xmit method, you |
75 | any reference to that SKB and you must not attempt to free it up. | 76 | must not keep any reference to that SKB and you must not attempt |
77 | to free it up. | ||
76 | 78 | ||
77 | Probing guidelines: | 79 | Probing guidelines: |
78 | 80 | ||