diff options
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index b5f40d7ef724..a7abfda3e447 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -193,10 +193,22 @@ static inline struct Qdisc *qdisc_root(struct Qdisc *qdisc) | |||
193 | return qdisc->dev_queue->qdisc; | 193 | return qdisc->dev_queue->qdisc; |
194 | } | 194 | } |
195 | 195 | ||
196 | /* The qdisc root lock is a mechanism by which to top level | ||
197 | * of a qdisc tree can be locked from any qdisc node in the | ||
198 | * forest. This allows changing the configuration of some | ||
199 | * aspect of the qdisc tree while blocking out asynchronous | ||
200 | * qdisc access in the packet processing paths. | ||
201 | * | ||
202 | * It is only legal to do this when the root will not change | ||
203 | * on us. Otherwise we'll potentially lock the wrong qdisc | ||
204 | * root. This is enforced by holding the RTNL semaphore, which | ||
205 | * all users of this lock accessor must do. | ||
206 | */ | ||
196 | static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) | 207 | static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) |
197 | { | 208 | { |
198 | struct Qdisc *root = qdisc_root(qdisc); | 209 | struct Qdisc *root = qdisc_root(qdisc); |
199 | 210 | ||
211 | ASSERT_RTNL(); | ||
200 | return qdisc_lock(root); | 212 | return qdisc_lock(root); |
201 | } | 213 | } |
202 | 214 | ||
@@ -331,6 +343,18 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb) | |||
331 | return qdisc_skb_cb(skb)->pkt_len; | 343 | return qdisc_skb_cb(skb)->pkt_len; |
332 | } | 344 | } |
333 | 345 | ||
346 | /* additional qdisc xmit flags (NET_XMIT_MASK in linux/netdevice.h) */ | ||
347 | enum net_xmit_qdisc_t { | ||
348 | __NET_XMIT_STOLEN = 0x00010000, | ||
349 | __NET_XMIT_BYPASS = 0x00020000, | ||
350 | }; | ||
351 | |||
352 | #ifdef CONFIG_NET_CLS_ACT | ||
353 | #define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1) | ||
354 | #else | ||
355 | #define net_xmit_drop_count(e) (1) | ||
356 | #endif | ||
357 | |||
334 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 358 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
335 | { | 359 | { |
336 | #ifdef CONFIG_NET_SCHED | 360 | #ifdef CONFIG_NET_SCHED |
@@ -343,7 +367,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
343 | static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch) | 367 | static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch) |
344 | { | 368 | { |
345 | qdisc_skb_cb(skb)->pkt_len = skb->len; | 369 | qdisc_skb_cb(skb)->pkt_len = skb->len; |
346 | return qdisc_enqueue(skb, sch); | 370 | return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; |
347 | } | 371 | } |
348 | 372 | ||
349 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | 373 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |