Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: remove NETDEV_TX_LOCKED support

No more users in the tree, remove NETDEV_TX_LOCKED support.
Adds another hole in softnet_stats struct, but better than keeping
the unused collision counter around.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Westphal and committed by
David S. Miller
f0cdf76c a6086a89

+9 -49
+4 -6
Documentation/networking/netdev-features.txt
··· 131 131 132 132 * LLTX driver (deprecated for hardware drivers) 133 133 134 - NETIF_F_LLTX should be set in drivers that implement their own locking in 135 - transmit path or don't need locking at all (e.g. software tunnels). 136 - In ndo_start_xmit, it is recommended to use a try_lock and return 137 - NETDEV_TX_LOCKED when the spin lock fails. The locking should also properly 138 - protect against other callbacks (the rules you need to find out). 134 + NETIF_F_LLTX is meant to be used by drivers that don't need locking at all, 135 + e.g. software tunnels. 139 136 140 - Don't use it for new drivers. 137 + This is also used in a few legacy drivers that implement their 138 + own locking, don't use it for new (hardware) drivers. 141 139 142 140 * netns-local device 143 141
+3 -6
Documentation/networking/netdevices.txt
··· 69 69 70 70 When the driver sets NETIF_F_LLTX in dev->features this will be 71 71 called without holding netif_tx_lock. In this case the driver 72 - has to lock by itself when needed. It is recommended to use a try lock 73 - for this and return NETDEV_TX_LOCKED when the spin lock fails. 74 - The locking there should also properly protect against 75 - set_rx_mode. Note that the use of NETIF_F_LLTX is deprecated. 72 + has to lock by itself when needed. 73 + The locking there should also properly protect against 74 + set_rx_mode. WARNING: use of NETIF_F_LLTX is deprecated. 76 75 Don't use it for new drivers. 77 76 78 77 Context: Process with BHs disabled or BH (timer), ··· 82 83 o NETDEV_TX_BUSY Cannot transmit packet, try later 83 84 Usually a bug, means queue start/stop flow control is broken in 84 85 the driver. Note: the driver must NOT put the skb in its DMA ring. 85 - o NETDEV_TX_LOCKED Locking failed, please retry quickly. 86 - Only valid when NETIF_F_LLTX is set. 87 86 88 87 ndo_tx_timeout: 89 88 Synchronization: netif_tx_lock spinlock; all TX queues frozen.
-3
include/linux/netdevice.h
··· 106 106 __NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */ 107 107 NETDEV_TX_OK = 0x00, /* driver took care of packet */ 108 108 NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/ 109 - NETDEV_TX_LOCKED = 0x20, /* driver tx lock was already taken */ 110 109 }; 111 110 typedef enum netdev_tx netdev_tx_t; 112 111 ··· 830 831 * the queue before that can happen; it's for obsolete devices and weird 831 832 * corner cases, but the stack really does a non-trivial amount 832 833 * of useless work if you return NETDEV_TX_BUSY. 833 - * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 834 834 * Required; cannot be NULL. 835 835 * 836 836 * netdev_features_t (*ndo_fix_features)(struct net_device *dev, ··· 2735 2737 /* stats */ 2736 2738 unsigned int processed; 2737 2739 unsigned int time_squeeze; 2738 - unsigned int cpu_collision; 2739 2740 unsigned int received_rps; 2740 2741 #ifdef CONFIG_RPS 2741 2742 struct softnet_data *rps_ipi_list;
+2 -1
net/core/net-procfs.c
··· 162 162 "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", 163 163 sd->processed, sd->dropped, sd->time_squeeze, 0, 164 164 0, 0, 0, 0, /* was fastroute */ 165 - sd->cpu_collision, sd->received_rps, flow_limit_count); 165 + 0, /* was cpu_collision */ 166 + sd->received_rps, flow_limit_count); 166 167 return 0; 167 168 } 168 169
-1
net/core/pktgen.c
··· 3472 3472 pkt_dev->odevname, ret); 3473 3473 pkt_dev->errors++; 3474 3474 /* fallthru */ 3475 - case NETDEV_TX_LOCKED: 3476 3475 case NETDEV_TX_BUSY: 3477 3476 /* Retry it next time */ 3478 3477 atomic_dec(&(pkt_dev->skb->users));
-32
net/sched/sch_generic.c
··· 108 108 return skb; 109 109 } 110 110 111 - static inline int handle_dev_cpu_collision(struct sk_buff *skb, 112 - struct netdev_queue *dev_queue, 113 - struct Qdisc *q) 114 - { 115 - int ret; 116 - 117 - if (unlikely(dev_queue->xmit_lock_owner == smp_processor_id())) { 118 - /* 119 - * Same CPU holding the lock. It may be a transient 120 - * configuration error, when hard_start_xmit() recurses. We 121 - * detect it by checking xmit owner and drop the packet when 122 - * deadloop is detected. Return OK to try the next skb. 123 - */ 124 - kfree_skb_list(skb); 125 - net_warn_ratelimited("Dead loop on netdevice %s, fix it urgently!\n", 126 - dev_queue->dev->name); 127 - ret = qdisc_qlen(q); 128 - } else { 129 - /* 130 - * Another cpu is holding lock, requeue & delay xmits for 131 - * some time. 132 - */ 133 - __this_cpu_inc(softnet_data.cpu_collision); 134 - ret = dev_requeue_skb(skb, q); 135 - } 136 - 137 - return ret; 138 - } 139 - 140 111 /* 141 112 * Transmit possibly several skbs, and handle the return status as 142 113 * required. Holding the __QDISC___STATE_RUNNING bit guarantees that ··· 145 174 if (dev_xmit_complete(ret)) { 146 175 /* Driver sent out skb successfully or skb was consumed */ 147 176 ret = qdisc_qlen(q); 148 - } else if (ret == NETDEV_TX_LOCKED) { 149 - /* Driver try lock failed */ 150 - ret = handle_dev_cpu_collision(skb, txq, q); 151 177 } else { 152 178 /* Driver returned NETDEV_TX_BUSY - requeue skb */ 153 179 if (unlikely(ret != NETDEV_TX_BUSY))