aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--net/sched/act_police.c4
-rw-r--r--net/sched/sch_cbq.c2
-rw-r--r--net/sched/sch_htb.c6
-rw-r--r--net/sched/sch_tbf.c4
5 files changed, 19 insertions, 9 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 8a67f24cbe02..4ebd615bd013 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -302,4 +302,16 @@ 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 */
308static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen)
309{
310 int slot = pktlen;
311 slot >>= rtab->rate.cell_log;
312 if (slot > 255)
313 return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]);
314 return rtab->data[slot];
315}
316
305#endif 317#endif
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 17f6f27e28a2..a73e3e6d87ea 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -21,8 +21,8 @@
21#include <net/act_api.h> 21#include <net/act_api.h>
22#include <net/netlink.h> 22#include <net/netlink.h>
23 23
24#define L2T(p,L) ((p)->tcfp_R_tab->data[(L)>>(p)->tcfp_R_tab->rate.cell_log]) 24#define L2T(p,L) qdisc_l2t((p)->tcfp_R_tab, L)
25#define L2T_P(p,L) ((p)->tcfp_P_tab->data[(L)>>(p)->tcfp_P_tab->rate.cell_log]) 25#define L2T_P(p,L) qdisc_l2t((p)->tcfp_P_tab, L)
26 26
27#define POL_TAB_MASK 15 27#define POL_TAB_MASK 15
28static struct tcf_common *tcf_police_ht[POL_TAB_MASK + 1]; 28static struct tcf_common *tcf_police_ht[POL_TAB_MASK + 1];
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index cbef3bbfc20f..4de3744e65c3 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -175,7 +175,7 @@ struct cbq_sched_data
175}; 175};
176 176
177 177
178#define L2T(cl,len) ((cl)->R_tab->data[(len)>>(cl)->R_tab->rate.cell_log]) 178#define L2T(cl,len) qdisc_l2t((cl)->R_tab,len)
179 179
180 180
181static __inline__ unsigned cbq_hash(u32 h) 181static __inline__ unsigned cbq_hash(u32 h)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 246a2f9765f1..5e608a64935a 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -132,10 +132,8 @@ struct htb_class {
132static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate, 132static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate,
133 int size) 133 int size)
134{ 134{
135 int slot = size >> rate->rate.cell_log; 135 long result = qdisc_l2t(rate, size);
136 if (slot > 255) 136 return result;
137 return (rate->data[255]*(slot >> 8) + rate->data[slot & 0xFF]);
138 return rate->data[slot];
139} 137}
140 138
141struct htb_sched { 139struct htb_sched {
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 8c2639af4c6a..b0d81098b0ee 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -115,8 +115,8 @@ struct tbf_sched_data
115 struct qdisc_watchdog watchdog; /* Watchdog timer */ 115 struct qdisc_watchdog watchdog; /* Watchdog timer */
116}; 116};
117 117
118#define L2T(q,L) ((q)->R_tab->data[(L)>>(q)->R_tab->rate.cell_log]) 118#define L2T(q,L) qdisc_l2t((q)->R_tab,L)
119#define L2T_P(q,L) ((q)->P_tab->data[(L)>>(q)->P_tab->rate.cell_log]) 119#define L2T_P(q,L) qdisc_l2t((q)->P_tab,L)
120 120
121static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) 121static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
122{ 122{