Commit 6fa9864b authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent 3e745dd6
...@@ -242,6 +242,14 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev) ...@@ -242,6 +242,14 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev)
return (q->q.qlen == 0); return (q->q.qlen == 0);
} }
/* Are any of the TX qdiscs changing? */
static inline bool qdisc_tx_changing(struct net_device *dev)
{
struct netdev_queue *txq = &dev->tx_queue;
return (txq->qdisc != txq->qdisc_sleeping);
}
static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff_head *list) struct sk_buff_head *list)
{ {
......
...@@ -77,12 +77,10 @@ static void rfc2863_policy(struct net_device *dev) ...@@ -77,12 +77,10 @@ static void rfc2863_policy(struct net_device *dev)
} }
static int linkwatch_urgent_event(struct net_device *dev) static bool linkwatch_urgent_event(struct net_device *dev)
{ {
struct netdev_queue *txq = &dev->tx_queue;
return netif_running(dev) && netif_carrier_ok(dev) && return netif_running(dev) && netif_carrier_ok(dev) &&
txq->qdisc != txq->qdisc_sleeping; qdisc_tx_changing(dev);
} }
...@@ -182,12 +180,9 @@ static void __linkwatch_run_queue(int urgent_only) ...@@ -182,12 +180,9 @@ static void __linkwatch_run_queue(int urgent_only)
rfc2863_policy(dev); rfc2863_policy(dev);
if (dev->flags & IFF_UP) { if (dev->flags & IFF_UP) {
if (netif_carrier_ok(dev)) { if (netif_carrier_ok(dev))
struct netdev_queue *txq = &dev->tx_queue;
WARN_ON(txq->qdisc_sleeping == &noop_qdisc);
dev_activate(dev); dev_activate(dev);
} else else
dev_deactivate(dev); dev_deactivate(dev);
netdev_state_change(dev); netdev_state_change(dev);
...@@ -218,7 +213,7 @@ static void linkwatch_event(struct work_struct *dummy) ...@@ -218,7 +213,7 @@ static void linkwatch_event(struct work_struct *dummy)
void linkwatch_fire_event(struct net_device *dev) void linkwatch_fire_event(struct net_device *dev)
{ {
int urgent = linkwatch_urgent_event(dev); bool urgent = linkwatch_urgent_event(dev);
if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state)) { if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state)) {
dev_hold(dev); dev_hold(dev);
......
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