diff options
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 8a67f24cbe02..a02ec9e5fea5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -302,4 +302,18 @@ drop: | |||
302 | return NET_XMIT_DROP; | 302 | return NET_XMIT_DROP; |
303 | } | 303 | } |
304 | 304 | ||
305 | /* Length to Time (L2T) lookup in a qdisc_rate_table, to determine how | ||
306 | long it will take to send a packet given its size. | ||
307 | */ | ||
308 | static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) | ||
309 | { | ||
310 | int slot = pktlen + rtab->rate.cell_align + rtab->rate.overhead; | ||
311 | if (slot < 0) | ||
312 | slot = 0; | ||
313 | slot >>= rtab->rate.cell_log; | ||
314 | if (slot > 255) | ||
315 | return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]); | ||
316 | return rtab->data[slot]; | ||
317 | } | ||
318 | |||
305 | #endif | 319 | #endif |