summaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <hawk@comx.dk>2007-09-12 16:36:28 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-11 01:49:20 +0200
commite08b09983fe9cf379faf1aefdf9164268d4610e7 (patch)
tree579988b32bba063fa5e143b01887eb525176fc98 /include/net/sch_generic.h
parent[NET_SCHED]: Cleanup L2T macros and handle oversized packets (diff)
downloadlinux-e08b09983fe9cf379faf1aefdf9164268d4610e7.tar.xz
linux-e08b09983fe9cf379faf1aefdf9164268d4610e7.zip
[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> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 4ebd615bd013..a02ec9e5fea5 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]);