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 /net/sched/sch_cbq.c | |
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 'net/sched/sch_cbq.c')
-rw-r--r-- | net/sched/sch_cbq.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 14954bf4a683..765ae5659000 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -256,7 +256,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
256 | switch (result) { | 256 | switch (result) { |
257 | case TC_ACT_QUEUED: | 257 | case TC_ACT_QUEUED: |
258 | case TC_ACT_STOLEN: | 258 | case TC_ACT_STOLEN: |
259 | *qerr = NET_XMIT_SUCCESS; | 259 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; |
260 | case TC_ACT_SHOT: | 260 | case TC_ACT_SHOT: |
261 | return NULL; | 261 | return NULL; |
262 | case TC_ACT_RECLASSIFY: | 262 | case TC_ACT_RECLASSIFY: |
@@ -397,9 +397,11 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
397 | return ret; | 397 | return ret; |
398 | } | 398 | } |
399 | 399 | ||
400 | sch->qstats.drops++; | 400 | if (net_xmit_drop_count(ret)) { |
401 | cbq_mark_toplevel(q, cl); | 401 | sch->qstats.drops++; |
402 | cl->qstats.drops++; | 402 | cbq_mark_toplevel(q, cl); |
403 | cl->qstats.drops++; | ||
404 | } | ||
403 | return ret; | 405 | return ret; |
404 | } | 406 | } |
405 | 407 | ||
@@ -430,8 +432,10 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch) | |||
430 | cbq_activate_class(cl); | 432 | cbq_activate_class(cl); |
431 | return 0; | 433 | return 0; |
432 | } | 434 | } |
433 | sch->qstats.drops++; | 435 | if (net_xmit_drop_count(ret)) { |
434 | cl->qstats.drops++; | 436 | sch->qstats.drops++; |
437 | cl->qstats.drops++; | ||
438 | } | ||
435 | return ret; | 439 | return ret; |
436 | } | 440 | } |
437 | 441 | ||
@@ -664,13 +668,15 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | |||
664 | q->rx_class = NULL; | 668 | q->rx_class = NULL; |
665 | 669 | ||
666 | if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) { | 670 | if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) { |
671 | int ret; | ||
667 | 672 | ||
668 | cbq_mark_toplevel(q, cl); | 673 | cbq_mark_toplevel(q, cl); |
669 | 674 | ||
670 | q->rx_class = cl; | 675 | q->rx_class = cl; |
671 | cl->q->__parent = sch; | 676 | cl->q->__parent = sch; |
672 | 677 | ||
673 | if (qdisc_enqueue(skb, cl->q) == 0) { | 678 | ret = qdisc_enqueue(skb, cl->q); |
679 | if (ret == NET_XMIT_SUCCESS) { | ||
674 | sch->q.qlen++; | 680 | sch->q.qlen++; |
675 | sch->bstats.packets++; | 681 | sch->bstats.packets++; |
676 | sch->bstats.bytes += qdisc_pkt_len(skb); | 682 | sch->bstats.bytes += qdisc_pkt_len(skb); |
@@ -678,7 +684,8 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | |||
678 | cbq_activate_class(cl); | 684 | cbq_activate_class(cl); |
679 | return 0; | 685 | return 0; |
680 | } | 686 | } |
681 | sch->qstats.drops++; | 687 | if (net_xmit_drop_count(ret)) |
688 | sch->qstats.drops++; | ||
682 | return 0; | 689 | return 0; |
683 | } | 690 | } |
684 | 691 | ||