From: Dmitry Torokhov <dtor_core@ameritech.net>
To: netdev@oss.sgi.com
Cc: "David S. Miller" <davem@redhat.com>, Jamal Hadi Salim <jamal@znyx.com>
Subject: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
Date: Tue, 29 Jun 2004 01:06:36 -0500 [thread overview]
Message-ID: <200406290106.38304.dtor_core@ameritech.net> (raw)
Hi,
When CONFIG_NET_CLS_ACT is not set 'result' variable in prio_classify is
unused. Also I was looking over the rest of the module and had hard time
understanding the logic in prio_enqueue - I rearranged it a bit for better
readability. Plus there are some formatting changes.
Please consider for inclusion.
--
Dmitry
===================================================================
ChangeSet@1.1875, 2004-06-29 00:45:12-05:00, dtor_core@ameritech.net
NET: sch_prio
- fix compile warning in prio_classify
- rearrange prio_enqueue conditional compilation maze
- minor formatting changes
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
sch_prio.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
===================================================================
diff -Nru a/net/sched/sch_prio.c b/net/sched/sch_prio.c
--- a/net/sched/sch_prio.c 2004-06-29 00:58:52 -05:00
+++ b/net/sched/sch_prio.c 2004-06-29 00:58:52 -05:00
@@ -47,20 +47,19 @@
};
-struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r)
+struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *r)
{
struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct tcf_result res;
u32 band;
- int result = 0;
band = skb->priority;
if (TC_H_MAJ(skb->priority) != sch->handle) {
#ifdef CONFIG_NET_CLS_ACT
- *r = result = tc_classify(skb, q->filter_list, &res);
+ *r = tc_classify(skb, q->filter_list, &res);
- switch (result) {
+ switch (*r) {
case TC_ACT_SHOT:
case TC_ACT_STOLEN:
case TC_ACT_QUEUED:
@@ -70,22 +69,22 @@
case TC_ACT_OK:
case TC_ACT_UNSPEC:
default:
- break;
+ break;
};
- if (!q->filter_list ) {
+ if (!q->filter_list) {
#else
if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
#endif
if (TC_H_MAJ(band))
band = 0;
- return q->queues[q->prio2band[band&TC_PRIO_MAX]];
+ return q->queues[q->prio2band[band & TC_PRIO_MAX]];
}
band = res.classid;
}
band = TC_H_MIN(band) - 1;
if (band > q->bands)
- return q->queues[q->prio2band[0]];
+ band = q->prio2band[0];
return q->queues[band];
}
@@ -112,17 +111,16 @@
}
dropped:
+
#ifdef CONFIG_NET_CLS_ACT
- if (TC_ACT_SHOT == ret || NET_XMIT_DROP == ret) {
-#endif
- sch->stats.drops++;
- return NET_XMIT_DROP;
-#ifdef CONFIG_NET_CLS_ACT
- } else {
- sch->stats.overlimits++; /* abuse, but noone uses it */
- return NET_XMIT_BYPASS; /* we dont want to confuse TCP */
+ if (ret != TC_ACT_SHOT && ret != NET_XMIT_DROP) {
+ sch->stats.overlimits++; /* abuse, but noone uses it */
+ return NET_XMIT_BYPASS; /* we dont want to confuse TCP */
}
#endif
+
+ sch->stats.drops++;
+ return NET_XMIT_DROP;
}
next reply other threads:[~2004-06-29 6:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-29 6:06 Dmitry Torokhov [this message]
2004-06-29 21:32 ` [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue David S. Miller
[not found] ` <1088545330.1157.88.camel@jzny.localdomain>
2004-06-29 21:50 ` David S. Miller
2004-06-29 22:16 ` jamal
2004-06-29 22:21 ` David S. Miller
2004-06-29 22:26 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200406290106.38304.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=davem@redhat.com \
--cc=jamal@znyx.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.