Commit f0cdf76c authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

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: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6086a89
...@@ -131,13 +131,11 @@ stack. Driver should not change behaviour based on them. ...@@ -131,13 +131,11 @@ stack. Driver should not change behaviour based on them.
* LLTX driver (deprecated for hardware drivers) * LLTX driver (deprecated for hardware drivers)
NETIF_F_LLTX should be set in drivers that implement their own locking in NETIF_F_LLTX is meant to be used by drivers that don't need locking at all,
transmit path or don't need locking at all (e.g. software tunnels). e.g. software tunnels.
In ndo_start_xmit, it is recommended to use a try_lock and return
NETDEV_TX_LOCKED when the spin lock fails. The locking should also properly
protect against other callbacks (the rules you need to find out).
Don't use it for new drivers. This is also used in a few legacy drivers that implement their
own locking, don't use it for new (hardware) drivers.
* netns-local device * netns-local device
......
...@@ -69,10 +69,9 @@ ndo_start_xmit: ...@@ -69,10 +69,9 @@ ndo_start_xmit:
When the driver sets NETIF_F_LLTX in dev->features this will be When the driver sets NETIF_F_LLTX in dev->features this will be
called without holding netif_tx_lock. In this case the driver called without holding netif_tx_lock. In this case the driver
has to lock by itself when needed. It is recommended to use a try lock has to lock by itself when needed.
for this and return NETDEV_TX_LOCKED when the spin lock fails. The locking there should also properly protect against
The locking there should also properly protect against set_rx_mode. WARNING: use of NETIF_F_LLTX is deprecated.
set_rx_mode. Note that the use of NETIF_F_LLTX is deprecated.
Don't use it for new drivers. Don't use it for new drivers.
Context: Process with BHs disabled or BH (timer), Context: Process with BHs disabled or BH (timer),
...@@ -83,8 +82,6 @@ ndo_start_xmit: ...@@ -83,8 +82,6 @@ ndo_start_xmit:
o NETDEV_TX_BUSY Cannot transmit packet, try later o NETDEV_TX_BUSY Cannot transmit packet, try later
Usually a bug, means queue start/stop flow control is broken in Usually a bug, means queue start/stop flow control is broken in
the driver. Note: the driver must NOT put the skb in its DMA ring. the driver. Note: the driver must NOT put the skb in its DMA ring.
o NETDEV_TX_LOCKED Locking failed, please retry quickly.
Only valid when NETIF_F_LLTX is set.
ndo_tx_timeout: ndo_tx_timeout:
Synchronization: netif_tx_lock spinlock; all TX queues frozen. Synchronization: netif_tx_lock spinlock; all TX queues frozen.
......
...@@ -106,7 +106,6 @@ enum netdev_tx { ...@@ -106,7 +106,6 @@ enum netdev_tx {
__NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */ __NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */
NETDEV_TX_OK = 0x00, /* driver took care of packet */ NETDEV_TX_OK = 0x00, /* driver took care of packet */
NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/ NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/
NETDEV_TX_LOCKED = 0x20, /* driver tx lock was already taken */
}; };
typedef enum netdev_tx netdev_tx_t; typedef enum netdev_tx netdev_tx_t;
...@@ -831,7 +830,6 @@ struct tc_to_netdev { ...@@ -831,7 +830,6 @@ struct tc_to_netdev {
* the queue before that can happen; it's for obsolete devices and weird * the queue before that can happen; it's for obsolete devices and weird
* corner cases, but the stack really does a non-trivial amount * corner cases, but the stack really does a non-trivial amount
* of useless work if you return NETDEV_TX_BUSY. * of useless work if you return NETDEV_TX_BUSY.
* (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
* Required; cannot be NULL. * Required; cannot be NULL.
* *
* netdev_features_t (*ndo_fix_features)(struct net_device *dev, * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
...@@ -2737,7 +2735,6 @@ struct softnet_data { ...@@ -2737,7 +2735,6 @@ struct softnet_data {
/* stats */ /* stats */
unsigned int processed; unsigned int processed;
unsigned int time_squeeze; unsigned int time_squeeze;
unsigned int cpu_collision;
unsigned int received_rps; unsigned int received_rps;
#ifdef CONFIG_RPS #ifdef CONFIG_RPS
struct softnet_data *rps_ipi_list; struct softnet_data *rps_ipi_list;
......
...@@ -162,7 +162,8 @@ static int softnet_seq_show(struct seq_file *seq, void *v) ...@@ -162,7 +162,8 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
"%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
sd->processed, sd->dropped, sd->time_squeeze, 0, sd->processed, sd->dropped, sd->time_squeeze, 0,
0, 0, 0, 0, /* was fastroute */ 0, 0, 0, 0, /* was fastroute */
sd->cpu_collision, sd->received_rps, flow_limit_count); 0, /* was cpu_collision */
sd->received_rps, flow_limit_count);
return 0; return 0;
} }
......
...@@ -3472,7 +3472,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) ...@@ -3472,7 +3472,6 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
pkt_dev->odevname, ret); pkt_dev->odevname, ret);
pkt_dev->errors++; pkt_dev->errors++;
/* fallthru */ /* fallthru */
case NETDEV_TX_LOCKED:
case NETDEV_TX_BUSY: case NETDEV_TX_BUSY:
/* Retry it next time */ /* Retry it next time */
atomic_dec(&(pkt_dev->skb->users)); atomic_dec(&(pkt_dev->skb->users));
......
...@@ -108,35 +108,6 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, ...@@ -108,35 +108,6 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate,
return skb; return skb;
} }
static inline int handle_dev_cpu_collision(struct sk_buff *skb,
struct netdev_queue *dev_queue,
struct Qdisc *q)
{
int ret;
if (unlikely(dev_queue->xmit_lock_owner == smp_processor_id())) {
/*
* Same CPU holding the lock. It may be a transient
* configuration error, when hard_start_xmit() recurses. We
* detect it by checking xmit owner and drop the packet when
* deadloop is detected. Return OK to try the next skb.
*/
kfree_skb_list(skb);
net_warn_ratelimited("Dead loop on netdevice %s, fix it urgently!\n",
dev_queue->dev->name);
ret = qdisc_qlen(q);
} else {
/*
* Another cpu is holding lock, requeue & delay xmits for
* some time.
*/
__this_cpu_inc(softnet_data.cpu_collision);
ret = dev_requeue_skb(skb, q);
}
return ret;
}
/* /*
* Transmit possibly several skbs, and handle the return status as * Transmit possibly several skbs, and handle the return status as
* required. Holding the __QDISC___STATE_RUNNING bit guarantees that * required. Holding the __QDISC___STATE_RUNNING bit guarantees that
...@@ -174,9 +145,6 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, ...@@ -174,9 +145,6 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
if (dev_xmit_complete(ret)) { if (dev_xmit_complete(ret)) {
/* Driver sent out skb successfully or skb was consumed */ /* Driver sent out skb successfully or skb was consumed */
ret = qdisc_qlen(q); ret = qdisc_qlen(q);
} else if (ret == NETDEV_TX_LOCKED) {
/* Driver try lock failed */
ret = handle_dev_cpu_collision(skb, txq, q);
} else { } else {
/* Driver returned NETDEV_TX_BUSY - requeue skb */ /* Driver returned NETDEV_TX_BUSY - requeue skb */
if (unlikely(ret != NETDEV_TX_BUSY)) if (unlikely(ret != NETDEV_TX_BUSY))
......
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