diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-08-05 01:31:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-05 01:31:03 -0400 |
commit | 378a2f090f7a478704a372a4869b8a9ac206234e (patch) | |
tree | cf324a45a9dc21231d1d3225c51c9d5d2b57bbee /include | |
parent | 6e583ce5242f32e925dcb198f7123256d0798370 (diff) |
net_sched: Add qdisc __NET_XMIT_STOLEN flag
Patrick McHardy <kaber@trash.net> noticed:
"The other problem that affects all qdiscs supporting actions is
TC_ACT_QUEUED/TC_ACT_STOLEN getting mapped to NET_XMIT_SUCCESS
even though the packet is not queued, corrupting upper qdiscs'
qlen counters."
and later explained:
"The reason why it translates it at all seems to be to not increase
the drops counter. Within a single qdisc this could be avoided by
other means easily, upper qdiscs would still increase the counter
when we return anything besides NET_XMIT_SUCCESS though.
This means we need a new NET_XMIT return value to indicate this to
the upper qdiscs. So I'd suggest to introduce NET_XMIT_STOLEN,
return that to upper qdiscs and translate it to NET_XMIT_SUCCESS
in dev_queue_xmit, similar to NET_XMIT_BYPASS."
David Miller <davem@davemloft.net> noticed:
"Maybe these NET_XMIT_* values being passed around should be a set of
bits. They could be composed of base meanings, combined with specific
attributes.
So you could say "NET_XMIT_DROP | __NET_XMIT_NO_DROP_COUNT"
The attributes get masked out by the top-level ->enqueue() caller,
such that the base meanings are the only thing that make their
way up into the stack. If it's only about communication within the
qdisc tree, let's simply code it that way."
This patch is trying to realize these ideas.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netdevice.h | 1 | ||||
-rw-r--r-- | include/net/sch_generic.h | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ee583f642a9f..abbf5d52ec86 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -64,6 +64,7 @@ struct wireless_dev; | |||
64 | #define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue; | 64 | #define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue; |
65 | (TC use only - dev_queue_xmit | 65 | (TC use only - dev_queue_xmit |
66 | returns this as NET_XMIT_SUCCESS) */ | 66 | returns this as NET_XMIT_SUCCESS) */ |
67 | #define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */ | ||
67 | 68 | ||
68 | /* Backlog congestion levels */ | 69 | /* Backlog congestion levels */ |
69 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ | 70 | #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index c5bb13065051..f15b045a85e9 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -343,6 +343,18 @@ static inline unsigned int qdisc_pkt_len(struct sk_buff *skb) | |||
343 | return qdisc_skb_cb(skb)->pkt_len; | 343 | return qdisc_skb_cb(skb)->pkt_len; |
344 | } | 344 | } |
345 | 345 | ||
346 | #ifdef CONFIG_NET_CLS_ACT | ||
347 | /* additional qdisc xmit flags */ | ||
348 | enum net_xmit_qdisc_t { | ||
349 | __NET_XMIT_STOLEN = 0x00010000, | ||
350 | }; | ||
351 | |||
352 | #define net_xmit_drop_count(e) ((e) & __NET_XMIT_STOLEN ? 0 : 1) | ||
353 | |||
354 | #else | ||
355 | #define net_xmit_drop_count(e) (1) | ||
356 | #endif | ||
357 | |||
346 | 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) |
347 | { | 359 | { |
348 | #ifdef CONFIG_NET_SCHED | 360 | #ifdef CONFIG_NET_SCHED |
@@ -355,7 +367,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
355 | 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) |
356 | { | 368 | { |
357 | qdisc_skb_cb(skb)->pkt_len = skb->len; | 369 | qdisc_skb_cb(skb)->pkt_len = skb->len; |
358 | return qdisc_enqueue(skb, sch); | 370 | return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; |
359 | } | 371 | } |
360 | 372 | ||
361 | 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, |