diff options
author | David S. Miller <davem@davemloft.net> | 2014-08-30 00:07:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-01 20:39:55 -0400 |
commit | 10b3ad8c21bb4b135768c30dd4c51a1c744da699 (patch) | |
tree | 02acb0d328818c9216c93b6b46d62717e09cdc61 | |
parent | dace1b54726bffe1c009f7661e3cee6b762f30c8 (diff) |
net: Do txq_trans_update() in netdev_start_xmit()
That way we don't have to audit every call site to make sure it is
doing this properly.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wan/dlci.c | 6 | ||||
-rw-r--r-- | include/linux/netdevice.h | 10 | ||||
-rw-r--r-- | net/core/dev.c | 7 | ||||
-rw-r--r-- | net/core/netpoll.c | 4 | ||||
-rw-r--r-- | net/core/pktgen.c | 3 | ||||
-rw-r--r-- | net/packet/af_packet.c | 7 | ||||
-rw-r--r-- | net/sched/sch_teql.c | 3 |
7 files changed, 19 insertions, 21 deletions
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 81b22a180aad..6427e8283419 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -192,8 +192,10 @@ static netdev_tx_t dlci_transmit(struct sk_buff *skb, struct net_device *dev) | |||
192 | { | 192 | { |
193 | struct dlci_local *dlp = netdev_priv(dev); | 193 | struct dlci_local *dlp = netdev_priv(dev); |
194 | 194 | ||
195 | if (skb) | 195 | if (skb) { |
196 | netdev_start_xmit(skb, dlp->slave); | 196 | struct netdev_queue *txq = skb_get_tx_queue(dev, skb); |
197 | netdev_start_xmit(skb, dlp->slave, txq); | ||
198 | } | ||
197 | return NETDEV_TX_OK; | 199 | return NETDEV_TX_OK; |
198 | } | 200 | } |
199 | 201 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 456eb1fe51e8..16171802ea7d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3437,11 +3437,17 @@ static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops, | |||
3437 | return ops->ndo_start_xmit(skb, dev); | 3437 | return ops->ndo_start_xmit(skb, dev); |
3438 | } | 3438 | } |
3439 | 3439 | ||
3440 | static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev) | 3440 | static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev, |
3441 | struct netdev_queue *txq) | ||
3441 | { | 3442 | { |
3442 | const struct net_device_ops *ops = dev->netdev_ops; | 3443 | const struct net_device_ops *ops = dev->netdev_ops; |
3444 | int rc; | ||
3443 | 3445 | ||
3444 | return __netdev_start_xmit(ops, skb, dev); | 3446 | rc = __netdev_start_xmit(ops, skb, dev); |
3447 | if (rc == NETDEV_TX_OK) | ||
3448 | txq_trans_update(txq); | ||
3449 | |||
3450 | return rc; | ||
3445 | } | 3451 | } |
3446 | 3452 | ||
3447 | int netdev_class_create_file_ns(struct class_attribute *class_attr, | 3453 | int netdev_class_create_file_ns(struct class_attribute *class_attr, |
diff --git a/net/core/dev.c b/net/core/dev.c index a6077ef56345..6392adaaa22f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2666,10 +2666,8 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
2666 | 2666 | ||
2667 | skb_len = skb->len; | 2667 | skb_len = skb->len; |
2668 | trace_net_dev_start_xmit(skb, dev); | 2668 | trace_net_dev_start_xmit(skb, dev); |
2669 | rc = netdev_start_xmit(skb, dev); | 2669 | rc = netdev_start_xmit(skb, dev, txq); |
2670 | trace_net_dev_xmit(skb, rc, dev, skb_len); | 2670 | trace_net_dev_xmit(skb, rc, dev, skb_len); |
2671 | if (rc == NETDEV_TX_OK) | ||
2672 | txq_trans_update(txq); | ||
2673 | return rc; | 2671 | return rc; |
2674 | } | 2672 | } |
2675 | 2673 | ||
@@ -2685,7 +2683,7 @@ gso: | |||
2685 | 2683 | ||
2686 | skb_len = nskb->len; | 2684 | skb_len = nskb->len; |
2687 | trace_net_dev_start_xmit(nskb, dev); | 2685 | trace_net_dev_start_xmit(nskb, dev); |
2688 | rc = netdev_start_xmit(nskb, dev); | 2686 | rc = netdev_start_xmit(nskb, dev, txq); |
2689 | trace_net_dev_xmit(nskb, rc, dev, skb_len); | 2687 | trace_net_dev_xmit(nskb, rc, dev, skb_len); |
2690 | if (unlikely(rc != NETDEV_TX_OK)) { | 2688 | if (unlikely(rc != NETDEV_TX_OK)) { |
2691 | if (rc & ~NETDEV_TX_MASK) | 2689 | if (rc & ~NETDEV_TX_MASK) |
@@ -2694,7 +2692,6 @@ gso: | |||
2694 | skb->next = nskb; | 2692 | skb->next = nskb; |
2695 | return rc; | 2693 | return rc; |
2696 | } | 2694 | } |
2697 | txq_trans_update(txq); | ||
2698 | if (unlikely(netif_xmit_stopped(txq) && skb->next)) | 2695 | if (unlikely(netif_xmit_stopped(txq) && skb->next)) |
2699 | return NETDEV_TX_BUSY; | 2696 | return NETDEV_TX_BUSY; |
2700 | } while (skb->next); | 2697 | } while (skb->next); |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 12b1df976562..05bc57edaa81 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -91,9 +91,7 @@ static int netpoll_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
91 | skb->vlan_tci = 0; | 91 | skb->vlan_tci = 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | status = netdev_start_xmit(skb, dev); | 94 | status = netdev_start_xmit(skb, dev, txq); |
95 | if (status == NETDEV_TX_OK) | ||
96 | txq_trans_update(txq); | ||
97 | 95 | ||
98 | out: | 96 | out: |
99 | return status; | 97 | return status; |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d81b540096c3..34bd2ff9f121 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3335,11 +3335,10 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3335 | goto unlock; | 3335 | goto unlock; |
3336 | } | 3336 | } |
3337 | atomic_inc(&(pkt_dev->skb->users)); | 3337 | atomic_inc(&(pkt_dev->skb->users)); |
3338 | ret = netdev_start_xmit(pkt_dev->skb, odev); | 3338 | ret = netdev_start_xmit(pkt_dev->skb, odev, txq); |
3339 | 3339 | ||
3340 | switch (ret) { | 3340 | switch (ret) { |
3341 | case NETDEV_TX_OK: | 3341 | case NETDEV_TX_OK: |
3342 | txq_trans_update(txq); | ||
3343 | pkt_dev->last_ok = 1; | 3342 | pkt_dev->last_ok = 1; |
3344 | pkt_dev->sofar++; | 3343 | pkt_dev->sofar++; |
3345 | pkt_dev->seq_num++; | 3344 | pkt_dev->seq_num++; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index b7a7f5a721bd..fe305a05a8fc 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -258,11 +258,8 @@ static int packet_direct_xmit(struct sk_buff *skb) | |||
258 | local_bh_disable(); | 258 | local_bh_disable(); |
259 | 259 | ||
260 | HARD_TX_LOCK(dev, txq, smp_processor_id()); | 260 | HARD_TX_LOCK(dev, txq, smp_processor_id()); |
261 | if (!netif_xmit_frozen_or_drv_stopped(txq)) { | 261 | if (!netif_xmit_frozen_or_drv_stopped(txq)) |
262 | ret = netdev_start_xmit(skb, dev); | 262 | ret = netdev_start_xmit(skb, dev, txq); |
263 | if (ret == NETDEV_TX_OK) | ||
264 | txq_trans_update(txq); | ||
265 | } | ||
266 | HARD_TX_UNLOCK(dev, txq); | 263 | HARD_TX_UNLOCK(dev, txq); |
267 | 264 | ||
268 | local_bh_enable(); | 265 | local_bh_enable(); |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 64cd93ca8104..193dc2cba1ec 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -316,8 +316,7 @@ restart: | |||
316 | unsigned int length = qdisc_pkt_len(skb); | 316 | unsigned int length = qdisc_pkt_len(skb); |
317 | 317 | ||
318 | if (!netif_xmit_frozen_or_stopped(slave_txq) && | 318 | if (!netif_xmit_frozen_or_stopped(slave_txq) && |
319 | netdev_start_xmit(skb, slave) == NETDEV_TX_OK) { | 319 | netdev_start_xmit(skb, slave, slave_txq) == NETDEV_TX_OK) { |
320 | txq_trans_update(slave_txq); | ||
321 | __netif_tx_unlock(slave_txq); | 320 | __netif_tx_unlock(slave_txq); |
322 | master->slaves = NEXT_SLAVE(q); | 321 | master->slaves = NEXT_SLAVE(q); |
323 | netif_wake_queue(dev); | 322 | netif_wake_queue(dev); |