Patchwork [4/3,v2] pkt_sched: sch_htb: Clean L2T()

login
register
mail settings
Submitter Jarek Poplawski
Date Dec. 3, 2008, 7:54 a.m.
Message ID <20081203075433.GA7137@ff.dom.local>
Download mbox | patch
Permalink /patch/11906/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Jarek Poplawski - Dec. 3, 2008, 7:54 a.m.
On Tue, Dec 02, 2008 at 11:25:22PM -0800, David Miller wrote:
...
> Jarek, please just kill the macro and expand the calculation inline.

Hmm.. no problem... unless you think about the other macro?

Jarek P.
--------------->
pkt_sched: sch_htb: Clean L2T()

L2T() is currently used only in one place, so let's move it closer to
this place, remove unused cl parameter.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---

 net/sched/sch_htb.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Dec. 3, 2008, 8:20 a.m.
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Wed, 3 Dec 2008 07:54:33 +0000

> On Tue, Dec 02, 2008 at 11:25:22PM -0800, David Miller wrote:
> ...
> > Jarek, please just kill the macro and expand the calculation inline.
> 
> Hmm.. no problem... unless you think about the other macro?

You misunderstood me.

I meant get rid of L2T completely, and just use
"qdisc_l2t(rate, size)" directly.

Macros like this one:

1) are used in only one spot
2) give no new information to the reader

so are just extra noise.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 80cb94d..4e9b8f4 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -125,13 +125,6 @@  struct htb_class {
 	psched_time_t t_c;	/* checkpoint time */
 };
 
-static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate,
-			   int size)
-{
-	long result = qdisc_l2t(rate, size);
-	return result;
-}
-
 struct htb_sched {
 	struct Qdisc_class_hash clhash;
 	struct list_head drops[TC_HTB_NUMPRIO];/* active leaves (for drops) */
@@ -584,6 +577,12 @@  static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 	return NET_XMIT_SUCCESS;
 }
 
+static inline long L2T(struct qdisc_rate_table *rate, int size)
+{
+	long result = qdisc_l2t(rate, size);
+	return result;
+}
+
 /**
  * htb_charge_class - charges amount "bytes" to leaf and ancestors
  *
@@ -604,7 +603,7 @@  static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
 
 #define HTB_ACCNT(T,B,R) toks = diff + cl->T; \
 	if (toks > cl->B) toks = cl->B; \
-	toks -= L2T(cl, cl->R, bytes); \
+	toks -= L2T(cl->R, bytes); \
 	if (toks <= -cl->mbuffer) toks = 1-cl->mbuffer; \
 	cl->T = toks