aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-18 00:51:03 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-18 00:51:03 -0400
commita9312ae89324438b0edc554eb36c3ec6bf927d04 (patch)
tree8a440aa75a9ac5aba1447082ec43ed48951aa121
parent08013fa353fdcfc0a03cae805393abfc56722387 (diff)
pkt_sched: Add 'deactivated' state.
This new state lets dev_deactivate() mark a qdisc as having been deactivated. dev_queue_xmit() and ing_filter() check for this bit and do not try to process the qdisc if the bit is set. dev_deactivate() polls the qdisc after setting the bit, waiting for both __QDISC_STATE_RUNNING and __QDISC_STATE_SCHED to clear. This isn't perfect yet, but subsequent changesets will make it so. This part is just one piece of the puzzle. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--net/core/dev.c9
-rw-r--r--net/sched/sch_generic.c6
3 files changed, 15 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a7abfda3e447..757ab087adbf 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -27,6 +27,7 @@ enum qdisc_state_t
27{ 27{
28 __QDISC_STATE_RUNNING, 28 __QDISC_STATE_RUNNING,
29 __QDISC_STATE_SCHED, 29 __QDISC_STATE_SCHED,
30 __QDISC_STATE_DEACTIVATED,
30}; 31};
31 32
32struct qdisc_size_table { 33struct qdisc_size_table {
diff --git a/net/core/dev.c b/net/core/dev.c
index 600bb23c4c2e..d9e31f63aded 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1800,6 +1800,12 @@ gso:
1800 1800
1801 spin_lock(root_lock); 1801 spin_lock(root_lock);
1802 1802
1803 if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
1804 spin_unlock(root_lock);
1805 rc = NET_XMIT_DROP;
1806 goto out_kfree_skb;
1807 }
1808
1803 rc = qdisc_enqueue_root(skb, q); 1809 rc = qdisc_enqueue_root(skb, q);
1804 qdisc_run(q); 1810 qdisc_run(q);
1805 1811
@@ -2084,7 +2090,8 @@ static int ing_filter(struct sk_buff *skb)
2084 q = rxq->qdisc; 2090 q = rxq->qdisc;
2085 if (q != &noop_qdisc) { 2091 if (q != &noop_qdisc) {
2086 spin_lock(qdisc_lock(q)); 2092 spin_lock(qdisc_lock(q));
2087 result = qdisc_enqueue_root(skb, q); 2093 if (likely(!test_bit(__QDISC_STATE_DEACTIVATED, &q->state)))
2094 result = qdisc_enqueue_root(skb, q);
2088 spin_unlock(qdisc_lock(q)); 2095 spin_unlock(qdisc_lock(q));
2089 } 2096 }
2090 2097
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 468574682caa..ff1c4557e5f8 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -597,6 +597,9 @@ static void transition_one_qdisc(struct net_device *dev,
597 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping; 597 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping;
598 int *need_watchdog_p = _need_watchdog; 598 int *need_watchdog_p = _need_watchdog;
599 599
600 if (!(new_qdisc->flags & TCQ_F_BUILTIN))
601 clear_bit(__QDISC_STATE_DEACTIVATED, &new_qdisc->state);
602
600 rcu_assign_pointer(dev_queue->qdisc, new_qdisc); 603 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
601 if (need_watchdog_p && new_qdisc != &noqueue_qdisc) 604 if (need_watchdog_p && new_qdisc != &noqueue_qdisc)
602 *need_watchdog_p = 1; 605 *need_watchdog_p = 1;
@@ -640,6 +643,9 @@ static void dev_deactivate_queue(struct net_device *dev,
640 if (qdisc) { 643 if (qdisc) {
641 spin_lock_bh(qdisc_lock(qdisc)); 644 spin_lock_bh(qdisc_lock(qdisc));
642 645
646 if (!(qdisc->flags & TCQ_F_BUILTIN))
647 set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
648
643 dev_queue->qdisc = qdisc_default; 649 dev_queue->qdisc = qdisc_default;
644 qdisc_reset(qdisc); 650 qdisc_reset(qdisc);
645 651