Commit e08b0998 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by David S. Miller

[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: default avatarJesper Dangaard Brouer <hawk@comx.dk>
Acked-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e9bef55d
...@@ -77,8 +77,8 @@ struct tc_ratespec ...@@ -77,8 +77,8 @@ struct tc_ratespec
{ {
unsigned char cell_log; unsigned char cell_log;
unsigned char __reserved; unsigned char __reserved;
unsigned short feature; unsigned short overhead;
short addend; short cell_align;
unsigned short mpu; unsigned short mpu;
__u32 rate; __u32 rate;
}; };
......
...@@ -307,7 +307,9 @@ static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch) ...@@ -307,7 +307,9 @@ static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch)
*/ */
static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) 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; slot >>= rtab->rate.cell_log;
if (slot > 255) if (slot > 255)
return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]); return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment