aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/networking/driver.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/networking/driver.txt')
-rw-r--r--Documentation/networking/driver.txt31
1 files changed, 15 insertions, 16 deletions
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt
index 03283daa64fe..da59e2884130 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -2,16 +2,16 @@ Document about softnet driver issues
2 2
3Transmit path guidelines: 3Transmit path guidelines:
4 4
51) The hard_start_xmit method must never return '1' under any 51) 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:
@@ -58,15 +59,12 @@ Transmit path guidelines:
58 TX_BUFFS_AVAIL(dp) > 0) 59 TX_BUFFS_AVAIL(dp) > 0)
59 netif_wake_queue(dp->dev); 60 netif_wake_queue(dp->dev);
60 61
612) Do not forget to update netdev->trans_start to jiffies after 622) An ndo_start_xmit method must not modify the shared parts of a
62 each new tx packet is given to the hardware.
63
643) A hard_start_xmit method must not modify the shared parts of a
65 cloned SKB. 63 cloned SKB.
66 64
674) Do not forget that once you return 0 from your hard_start_xmit 653) Do not forget that once you return NETDEV_TX_OK from your
68 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
69 and in some finite amount of time. 67 up the SKB and in some finite amount of time.
70 68
71 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
72 mitigation scheme to let TX packets "hang out" in the TX 70 mitigation scheme to let TX packets "hang out" in the TX
@@ -74,8 +72,9 @@ Transmit path guidelines:
74 This error can deadlock sockets waiting for send buffer room 72 This error can deadlock sockets waiting for send buffer room
75 to be freed up. 73 to be freed up.
76 74
77 If you return 1 from the hard_start_xmit method, you must not keep 75 If you return NETDEV_TX_BUSY from the ndo_start_xmit method, you
78 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.
79 78
80Probing guidelines: 79Probing guidelines:
81 80
@@ -85,10 +84,10 @@ Probing guidelines:
85 84
86Close/stop guidelines: 85Close/stop guidelines:
87 86
881) After the dev->stop routine has been called, the hardware must 871) After the ndo_stop routine has been called, the hardware must
89 not receive or transmit any data. All in flight packets must 88 not receive or transmit any data. All in flight packets must
90 be aborted. If necessary, poll or wait for completion of 89 be aborted. If necessary, poll or wait for completion of
91 any reset commands. 90 any reset commands.
92 91
932) The dev->stop routine will be called by unregister_netdevice 922) The ndo_stop routine will be called by unregister_netdevice
94 if device is still UP. 93 if device is still UP.