Message ID | 4A110C7B.4020407@cosmosbay.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <dada1@cosmosbay.com> Date: Mon, 18 May 2009 09:21:31 +0200 > Indeed we can do this factorization, just have to take care of not > adding a new cache line miss on loopback device, as this one doesnt > touch dev->trans_start. If you want to test IFF_LOOPBACK or similar, I can accept that. Or it can be some NETIF_F_* flag. > What do you think ? (following patch as RFC only, not even booted) This patch looks fine to me. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cd547d0..fe301b0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1773,8 +1773,10 @@ static inline void netif_tx_unlock_bh(struct net_device *dev) } \ } -#define HARD_TX_UNLOCK(dev, txq) { \ +#define HARD_TX_UNLOCK(dev, txq, update_trans) { \ if ((dev->features & NETIF_F_LLTX) == 0) { \ + if (update_trans) \ + txq->trans_start = jiffies; \ __netif_tx_unlock(txq); \ } \ } diff --git a/net/core/dev.c b/net/core/dev.c index 14dd725..f71a69d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1879,11 +1879,11 @@ gso: if (!netif_tx_queue_stopped(txq)) { rc = 0; if (!dev_hard_start_xmit(skb, dev, txq)) { - HARD_TX_UNLOCK(dev, txq); + HARD_TX_UNLOCK(dev, txq, 1); goto out; } } - HARD_TX_UNLOCK(dev, txq); + HARD_TX_UNLOCK(dev, txq, 0); if (net_ratelimit()) printk(KERN_CRIT "Virtual device %s asks to " "queue packet!\n", dev->name); diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 27d0381..2f69420 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -145,7 +145,7 @@ static inline int qdisc_restart(struct Qdisc *q) if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq)) ret = dev_hard_start_xmit(skb, dev, txq); - HARD_TX_UNLOCK(dev, txq); + HARD_TX_UNLOCK(dev, txq, ret == NETDEV_TX_OK); spin_lock(root_lock);