diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index dc5e35f..ab9966f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1271,6 +1271,12 @@ static inline void netif_tx_lock(struct net_device *dev) dev->xmit_lock_owner = smp_processor_id(); } +static inline void netif_tx_lock_irq(struct net_device *dev) +{ + spin_lock_irq(&dev->_xmit_lock); + dev->xmit_lock_owner = smp_processor_id(); +} + static inline void netif_tx_lock_bh(struct net_device *dev) { spin_lock_bh(&dev->_xmit_lock); @@ -1291,6 +1297,12 @@ static inline void netif_tx_unlock(struct net_device *dev) spin_unlock(&dev->_xmit_lock); } +static inline void netif_tx_unlock_irq(struct net_device *dev) +{ + dev->xmit_lock_owner = -1; + spin_unlock_irq(&dev->_xmit_lock); +} + static inline void netif_tx_unlock_bh(struct net_device *dev) { dev->xmit_lock_owner = -1; diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index e970e8e..f75a924 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -134,34 +134,23 @@ static inline int qdisc_restart(struct net_device *dev) { struct Qdisc *q = dev->qdisc; struct sk_buff *skb; - unsigned lockless; + unsigned lockless = (dev->features & NETIF_F_LLTX); int ret; /* Dequeue packet */ if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL)) return 0; - /* - * When the driver has LLTX set, it does its own locking in - * start_xmit. These checks are worth it because even uncongested - * locks can be quite expensive. The driver can do a trylock, as - * is being done here; in case of lock contention it should return - * NETDEV_TX_LOCKED and the packet will be requeued. - */ - lockless = (dev->features & NETIF_F_LLTX); - - if (!lockless && !netif_tx_trylock(dev)) { - /* Another CPU grabbed the driver tx lock */ - return handle_dev_cpu_collision(skb, dev, q); - } - /* And release queue */ spin_unlock(&dev->queue_lock); + if (!lockless) + netif_tx_lock_irq(dev); + ret = dev_hard_start_xmit(skb, dev); if (!lockless) - netif_tx_unlock(dev); + netif_tx_unlock_irq(dev); spin_lock(&dev->queue_lock); q = dev->qdisc;