[NET_SCHED]: Making rate table lookups more flexible.
authorJesper Dangaard Brouer <hawk@comx.dk>
Wed, 12 Sep 2007 14:36:28 +0000 (16:36 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:49:20 +0000 (16:49 -0700)
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>
include/linux/pkt_sched.h
include/net/sch_generic.h

index 268c515..919af93 100644 (file)
@@ -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;
 };
index 4ebd615..a02ec9e 100644 (file)
@@ -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]);