diff options
author | Jesper Dangaard Brouer <hawk@comx.dk> | 2007-09-12 16:35:24 +0200 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 16:49:20 -0700 |
commit | e9bef55d3d062ee7a78fde2913ec87ca9305a1e0 (patch) | |
tree | bb772650e7df49e94bd9c383b51f53bbb4e7bcab /include/net | |
parent | b6fa1a4d746488a7de95ec16afcaf3247fedb003 (diff) | |
download | kernel-crypto-e9bef55d3d062ee7a78fde2913ec87ca9305a1e0.tar.gz kernel-crypto-e9bef55d3d062ee7a78fde2913ec87ca9305a1e0.tar.xz kernel-crypto-e9bef55d3d062ee7a78fde2913ec87ca9305a1e0.zip |
[NET_SCHED]: Cleanup L2T macros and handle oversized packets
Change L2T (length to time) macros, in all rate based schedulers, to
call a common function qdisc_l2t() that does the rate table lookup.
This function handles if the packet size lookup is larger than the
rate table, which often occurs with TSO enabled.
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')
-rw-r--r-- | include/net/sch_generic.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 8a67f24cbe0..4ebd615bd01 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -302,4 +302,16 @@ drop: return NET_XMIT_DROP; } +/* Length to Time (L2T) lookup in a qdisc_rate_table, to determine how + long it will take to send a packet given its size. + */ +static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) +{ + int slot = pktlen; + slot >>= rtab->rate.cell_log; + if (slot > 255) + return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]); + return rtab->data[slot]; +} + #endif |