Commit 9e1b865c authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by David S. Miller

[PKT_SCHED]: Compile warning and logic rearrangement in sch_prio enqueue.

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.
Signed-off-by: default avatarDmitry Torokhov <dtor_core@ameritech.net>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent fd325c20
...@@ -47,20 +47,19 @@ struct prio_sched_data ...@@ -47,20 +47,19 @@ struct prio_sched_data
}; };
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 prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct tcf_result res; struct tcf_result res;
u32 band; u32 band;
int result = 0;
band = skb->priority; band = skb->priority;
if (TC_H_MAJ(skb->priority) != sch->handle) { if (TC_H_MAJ(skb->priority) != sch->handle) {
#ifdef CONFIG_NET_CLS_ACT #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_SHOT:
case TC_ACT_STOLEN: case TC_ACT_STOLEN:
case TC_ACT_QUEUED: case TC_ACT_QUEUED:
...@@ -70,22 +69,22 @@ struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r) ...@@ -70,22 +69,22 @@ struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r)
case TC_ACT_OK: case TC_ACT_OK:
case TC_ACT_UNSPEC: case TC_ACT_UNSPEC:
default: default:
break; break;
}; };
if (!q->filter_list ) { if (!q->filter_list) {
#else #else
if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) { if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
#endif #endif
if (TC_H_MAJ(band)) if (TC_H_MAJ(band))
band = 0; band = 0;
return q->queues[q->prio2band[band&TC_PRIO_MAX]]; return q->queues[q->prio2band[band & TC_PRIO_MAX]];
} }
band = res.classid; band = res.classid;
} }
band = TC_H_MIN(band) - 1; band = TC_H_MIN(band) - 1;
if (band > q->bands) if (band > q->bands)
return q->queues[q->prio2band[0]]; band = q->prio2band[0];
return q->queues[band]; return q->queues[band];
} }
...@@ -112,17 +111,16 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -112,17 +111,16 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc* sch)
} }
dropped: dropped:
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
if (TC_ACT_SHOT == ret || NET_XMIT_DROP == ret) { if (ret != TC_ACT_SHOT && ret != NET_XMIT_DROP) {
#endif sch->stats.overlimits++; /* abuse, but noone uses it */
sch->stats.drops++; return NET_XMIT_BYPASS; /* we dont want to confuse TCP */
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 */
} }
#endif #endif
sch->stats.drops++;
return NET_XMIT_DROP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment