Commit 6fa9864b53f0680e432a2c431c2cf2055daa3a88

Authored by David S. Miller
1 parent 3e745dd695

net: Clean up explicit ->tx_queue references in link watch.

First, we add a qdisc_tx_changing() helper which returns true if the
qdisc attachment is in transition.

Second, we remove an assertion warning which is of limited value and
is hard to express precisely in a multiqueue environment.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 13 additions and 10 deletions Side-by-side Diff

include/net/sch_generic.h
... ... @@ -242,6 +242,14 @@
242 242 return (q->q.qlen == 0);
243 243 }
244 244  
  245 +/* Are any of the TX qdiscs changing? */
  246 +static inline bool qdisc_tx_changing(struct net_device *dev)
  247 +{
  248 + struct netdev_queue *txq = &dev->tx_queue;
  249 +
  250 + return (txq->qdisc != txq->qdisc_sleeping);
  251 +}
  252 +
245 253 static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
246 254 struct sk_buff_head *list)
247 255 {
net/core/link_watch.c
... ... @@ -77,12 +77,10 @@
77 77 }
78 78  
79 79  
80   -static int linkwatch_urgent_event(struct net_device *dev)
  80 +static bool linkwatch_urgent_event(struct net_device *dev)
81 81 {
82   - struct netdev_queue *txq = &dev->tx_queue;
83   -
84 82 return netif_running(dev) && netif_carrier_ok(dev) &&
85   - txq->qdisc != txq->qdisc_sleeping;
  83 + qdisc_tx_changing(dev);
86 84 }
87 85  
88 86  
89 87  
... ... @@ -182,12 +180,9 @@
182 180  
183 181 rfc2863_policy(dev);
184 182 if (dev->flags & IFF_UP) {
185   - if (netif_carrier_ok(dev)) {
186   - struct netdev_queue *txq = &dev->tx_queue;
187   -
188   - WARN_ON(txq->qdisc_sleeping == &noop_qdisc);
  183 + if (netif_carrier_ok(dev))
189 184 dev_activate(dev);
190   - } else
  185 + else
191 186 dev_deactivate(dev);
192 187  
193 188 netdev_state_change(dev);
... ... @@ -218,7 +213,7 @@
218 213  
219 214 void linkwatch_fire_event(struct net_device *dev)
220 215 {
221   - int urgent = linkwatch_urgent_event(dev);
  216 + bool urgent = linkwatch_urgent_event(dev);
222 217  
223 218 if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state)) {
224 219 dev_hold(dev);