public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/6] [NET_SCHED]: Making rate table lookups more flexible
@ 2007-09-12 10:14 Jesper Dangaard Brouer
  0 siblings, 0 replies; only message 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 57e993268df114a4270519b1004b8ea8086f671f
Author: Jesper Dangaard Brouer <hawk@comx.dk>
Date:   Tue Sep 11 15:44:15 2007 +0200

    [NET_SCHED]: Making rate table lookups more flexible.
    
     This is done in order to, add support to changing the rate table to
     use the upper-boundry L2T (length to time) value. Currently we use the
     lower-boundry, which result in under-estimating the actual bandwidth
     usage.
    
     Extend the tc_ratespec struct, with two parameters: 1) "cell_align"
     that allow adjusting the alignment of the rate table. 2) "overhead"
     that allow adding a packet overhead before the lookup.
    
    Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 268c515..919af93 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -77,8 +77,8 @@ struct tc_ratespec
 {
 	unsigned char	cell_log;
 	unsigned char	__reserved;
-	unsigned short	feature;
-	short		addend;
+	unsigned short	overhead;
+	short		cell_align;
 	unsigned short	mpu;
 	__u32		rate;
 };
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 4ebd615..a02ec9e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -307,7 +307,9 @@ drop:
  */
 static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
 {
-	int slot = pktlen;
+	int slot = pktlen + rtab->rate.cell_align + rtab->rate.overhead;
+	if (slot < 0)
+		slot = 0;
 	slot >>= rtab->rate.cell_log;
 	if (slot > 255)
 		return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]);


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-12 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-12 10:14 [PATCH 2/6] [NET_SCHED]: Making rate table lookups more flexible Jesper Dangaard Brouer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox