diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-02 06:23:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-02 06:23:51 -0400 |
commit | bc135b23d01acf7ee926aaf75b0020c86d3869f9 (patch) | |
tree | 29b338a0c54c00880720d808f2fede7c605f516d /include/net | |
parent | 9f26f547a587ce9015ffe495d2af604580b4b784 (diff) |
net: Define accessors to manipulate QDISC_STATE_RUNNING
Define three helpers to manipulate QDISC_STATE_RUNNIG flag, that a
second patch will move on another location.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/pkt_sched.h | 2 | ||||
-rw-r--r-- | include/net/sch_generic.h | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 9d4d87cc970e..d9549af6929a 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -95,7 +95,7 @@ extern void __qdisc_run(struct Qdisc *q); | |||
95 | 95 | ||
96 | static inline void qdisc_run(struct Qdisc *q) | 96 | static inline void qdisc_run(struct Qdisc *q) |
97 | { | 97 | { |
98 | if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) | 98 | if (qdisc_run_begin(q)) |
99 | __qdisc_run(q); | 99 | __qdisc_run(q); |
100 | } | 100 | } |
101 | 101 | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 03ca5d826757..9707daed761e 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -76,6 +76,21 @@ struct Qdisc { | |||
76 | struct rcu_head rcu_head; | 76 | struct rcu_head rcu_head; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static inline bool qdisc_is_running(struct Qdisc *qdisc) | ||
80 | { | ||
81 | return test_bit(__QDISC_STATE_RUNNING, &qdisc->state); | ||
82 | } | ||
83 | |||
84 | static inline bool qdisc_run_begin(struct Qdisc *qdisc) | ||
85 | { | ||
86 | return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state); | ||
87 | } | ||
88 | |||
89 | static inline void qdisc_run_end(struct Qdisc *qdisc) | ||
90 | { | ||
91 | clear_bit(__QDISC_STATE_RUNNING, &qdisc->state); | ||
92 | } | ||
93 | |||
79 | struct Qdisc_class_ops { | 94 | struct Qdisc_class_ops { |
80 | /* Child qdisc manipulation */ | 95 | /* Child qdisc manipulation */ |
81 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); | 96 | struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); |