netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
@ 2004-06-29  6:06 Dmitry Torokhov
  2004-06-29 21:32 ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2004-06-29  6:06 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jamal Hadi Salim

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;
 }
 
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
  2004-06-29  6:06 [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue Dmitry Torokhov
@ 2004-06-29 21:32 ` David S. Miller
       [not found]   ` <1088545330.1157.88.camel@jzny.localdomain>
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-06-29 21:32 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: netdev, jamal

On Tue, 29 Jun 2004 01:06:36 -0500
Dmitry Torokhov <dtor_core@ameritech.net> wrote:

> 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.

Looks good to me, applied.

Thanks Dmitry.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
       [not found]   ` <1088545330.1157.88.camel@jzny.localdomain>
@ 2004-06-29 21:50     ` David S. Miller
  2004-06-29 22:16       ` jamal
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-06-29 21:50 UTC (permalink / raw)
  To: hadi; +Cc: dtor_core, netdev

On 29 Jun 2004 17:42:10 -0400
jamal <hadi@cyberus.ca> wrote:

> netdev swallowed my response to Dmitry earlier. Bacchus 
> please flog the admin for me.
> This fix will conflict with the other qdisc patch we are discussing.
> Basically thats what my message to Dmitry was earlier.

Should I back Dmitry's change out for now then?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
  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
  0 siblings, 2 replies; 6+ messages in thread
From: jamal @ 2004-06-29 22:16 UTC (permalink / raw)
  To: David S. Miller; +Cc: dtor_core, netdev


On Tue, 2004-06-29 at 17:50, David S. Miller wrote:

> Should I back Dmitry's change out for now then?

Yes please.

cheers,
jamal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
  2004-06-29 22:16       ` jamal
@ 2004-06-29 22:21         ` David S. Miller
  2004-06-29 22:26         ` Dmitry Torokhov
  1 sibling, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-06-29 22:21 UTC (permalink / raw)
  To: hadi; +Cc: dtor_core, netdev

On 29 Jun 2004 18:16:20 -0400
jamal <hadi@cyberus.ca> wrote:

> 
> On Tue, 2004-06-29 at 17:50, David S. Miller wrote:
> 
> > Should I back Dmitry's change out for now then?
> 
> Yes please.

Will do.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue
  2004-06-29 22:16       ` jamal
  2004-06-29 22:21         ` David S. Miller
@ 2004-06-29 22:26         ` Dmitry Torokhov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2004-06-29 22:26 UTC (permalink / raw)
  To: hadi; +Cc: David S. Miller, netdev

On Tuesday 29 June 2004 05:16 pm, jamal wrote:
> 
> On Tue, 2004-06-29 at 17:50, David S. Miller wrote:
> 
> > Should I back Dmitry's change out for now then?
> 
> Yes please.
> 

I'll be back ;) when your changes are committed.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-06-29 22:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-29  6:06 [PATCH] sch_prio - fix compile warning + some logic rearrangement in enqueue Dmitry Torokhov
2004-06-29 21:32 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).