netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel
@ 2007-09-12 10:14 Jesper Dangaard Brouer
  2007-09-12 11:05 ` Stephen Hemminger
  2007-09-12 16:07 ` Andy Furniss
  0 siblings, 2 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2007-09-12 10:14 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: Patrick McHardy, David S. Miller, Stephen Hemminger

commit 07a74a2613440fc1a68d0faa7235ed7027532d78
Author: Jesper Dangaard Brouer <hawk@comx.dk>
Date:   Tue Sep 11 16:59:58 2007 +0200

    [IPROUTE2]: Overhead calculation is now done in the kernel.
    
    The only current user is HTB. HTB overhead argument is now passed on
    to the kernel (in the struct tc_ratespec). Also correct the data
    types.
    
    Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>

diff --git a/tc/q_htb.c b/tc/q_htb.c
index 53e3f78..310d36d 100644
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -107,8 +107,9 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	__u32 rtab[256],ctab[256];
 	unsigned buffer=0,cbuffer=0;
 	int cell_log=-1,ccell_log = -1;
-	unsigned mtu, mpu;
-	unsigned char mpu8 = 0, overhead = 0;
+	unsigned mtu;
+	unsigned short mpu = 0;
+	unsigned short overhead = 0;
 	struct rtattr *tail;
 
 	memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
@@ -127,12 +128,12 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 			}
 		} else if (matches(*argv, "mpu") == 0) {
 			NEXT_ARG();
-			if (get_u8(&mpu8, *argv, 10)) {
+			if (get_u16(&mpu, *argv, 10)) {
 				explain1("mpu"); return -1;
 			}
 		} else if (matches(*argv, "overhead") == 0) {
 			NEXT_ARG();
-			if (get_u8(&overhead, *argv, 10)) {
+			if (get_u16(&overhead, *argv, 10)) {
 				explain1("overhead"); return -1;
 			}
 		} else if (matches(*argv, "quantum") == 0) {
@@ -206,9 +207,11 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
 	if (!buffer) buffer = opt.rate.rate / get_hz() + mtu;
 	if (!cbuffer) cbuffer = opt.ceil.rate / get_hz() + mtu;
 
-/* encode overhead and mpu, 8 bits each, into lower 16 bits */
-	mpu = (unsigned)mpu8 | (unsigned)overhead << 8;
-	opt.ceil.mpu = mpu; opt.rate.mpu = mpu;
+	opt.ceil.overhead = overhead;
+	opt.rate.overhead = overhead;
+
+	opt.ceil.mpu = mpu;
+	opt.rate.mpu = mpu;
 
 	if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, mpu)) < 0) {
 		fprintf(stderr, "htb: failed to calculate rate table.\n");
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 58155fb..1ab0ba0 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -73,8 +73,6 @@ int tc_calc_rtable(unsigned bps, __u32 *rtab, int cell_log, unsigned mtu,
 		   unsigned mpu)
 {
 	int i;
-	unsigned overhead = (mpu >> 8) & 0xFF;
-	mpu = mpu & 0xFF;
 
 	if (mtu == 0)
 		mtu = 2047;
@@ -86,8 +84,6 @@ int tc_calc_rtable(unsigned bps, __u32 *rtab, int cell_log, unsigned mtu,
 	}
 	for (i=0; i<256; i++) {
 		unsigned sz = (i<<cell_log);
-		if (overhead)
-			sz += overhead;
 		if (sz < mpu)
 			sz = mpu;
 		rtab[i] = tc_calc_xmittime(bps, sz);


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

* Re: [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel
  2007-09-12 10:14 [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel Jesper Dangaard Brouer
@ 2007-09-12 11:05 ` Stephen Hemminger
  2007-09-12 12:22   ` Jesper Dangaard Brouer
  2007-09-12 16:07 ` Andy Furniss
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2007-09-12 11:05 UTC (permalink / raw)
  To: jdb; +Cc: netdev@vger.kernel.org, Patrick McHardy, David S. Miller

On Wed, 12 Sep 2007 12:14:39 +0200
Jesper Dangaard Brouer <jdb@comx.dk> wrote:

> commit 07a74a2613440fc1a68d0faa7235ed7027532d78
> Author: Jesper Dangaard Brouer <hawk@comx.dk>
> Date:   Tue Sep 11 16:59:58 2007 +0200
> 
>     [IPROUTE2]: Overhead calculation is now done in the kernel.
>     
>     The only current user is HTB. HTB overhead argument is now passed on
>     to the kernel (in the struct tc_ratespec). Also correct the data
>     types.
>     
>     Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>

How is this binary compatable with older kernels?

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

* Re: [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel
  2007-09-12 11:05 ` Stephen Hemminger
@ 2007-09-12 12:22   ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2007-09-12 12:22 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev@vger.kernel.org, Patrick McHardy, David S. Miller

On Wed, 2007-09-12 at 13:05 +0200, Stephen Hemminger wrote:

> How is this binary compatable with older kernels?

It will be binary compatable, as I use/rename some unused variables in
struct tc_ratespec.

-- 
Med venlig hilsen / Best regards
  Jesper Brouer
  ComX Networks A/S
  Linux Network developer
  Cand. Scient Datalog / MSc.
  Author of http://adsl-optimizer.dk

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

* Re: [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel
  2007-09-12 10:14 [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel Jesper Dangaard Brouer
  2007-09-12 11:05 ` Stephen Hemminger
@ 2007-09-12 16:07 ` Andy Furniss
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Furniss @ 2007-09-12 16:07 UTC (permalink / raw)
  To: jdb
  Cc: netdev@vger.kernel.org, Patrick McHardy, David S. Miller,
	Stephen Hemminger

Jesper Dangaard Brouer wrote:
> commit 07a74a2613440fc1a68d0faa7235ed7027532d78
> Author: Jesper Dangaard Brouer <hawk@comx.dk>
> Date:   Tue Sep 11 16:59:58 2007 +0200
> 
>     [IPROUTE2]: Overhead calculation is now done in the kernel.
>     
>     The only current user is HTB. HTB overhead argument is now passed on
>     to the kernel (in the struct tc_ratespec). Also correct the data
>     types.

Thanks for getting this in.

It would be cool if mpu/overhead could be set per class > 255 and they 
would affect the way htb shares bandwidth.

I could be wrong but it doesn't look like this will change current 
behavior.Perhaps just allowing mpu/overhead > 255 for now, so that htb 
sharing could be fixed up in the future?

The use would be for ingress shaping, you could set a big mpu for an 
interactive class and it would cause bulk classes to get way less 
bandwidth than otherwise, so you wouldn't permanently have to sacrifice 
so much bandwidth on a slow link for latency - just when you needed to. 
It could also, with the aid of netfilter connbytes, be used to preempt 
the remote buffer filling when new bulk flows start.

One more thing, IIRC Devik acked your/Russels patch to change the 
HYSTERESIS define to 0 - any chance of resubmitting?

Thanks

Andy.


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

end of thread, other threads:[~2007-09-12 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-12 10:14 [PATCH 4/6] [IPROUTE2]: Overhead calculation is now done in the kernel Jesper Dangaard Brouer
2007-09-12 11:05 ` Stephen Hemminger
2007-09-12 12:22   ` Jesper Dangaard Brouer
2007-09-12 16:07 ` Andy Furniss

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