diff options
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r-- | net/sched/sch_tbf.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index e93165820c3f..1dcfb5223a86 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -97,8 +97,7 @@ | |||
97 | changed the limit is not effective anymore. | 97 | changed the limit is not effective anymore. |
98 | */ | 98 | */ |
99 | 99 | ||
100 | struct tbf_sched_data | 100 | struct tbf_sched_data { |
101 | { | ||
102 | /* Parameters */ | 101 | /* Parameters */ |
103 | u32 limit; /* Maximal length of backlog: bytes */ | 102 | u32 limit; /* Maximal length of backlog: bytes */ |
104 | u32 buffer; /* Token bucket depth/rate: MUST BE >= MTU/B */ | 103 | u32 buffer; /* Token bucket depth/rate: MUST BE >= MTU/B */ |
@@ -115,10 +114,10 @@ struct tbf_sched_data | |||
115 | struct qdisc_watchdog watchdog; /* Watchdog timer */ | 114 | struct qdisc_watchdog watchdog; /* Watchdog timer */ |
116 | }; | 115 | }; |
117 | 116 | ||
118 | #define L2T(q,L) qdisc_l2t((q)->R_tab,L) | 117 | #define L2T(q, L) qdisc_l2t((q)->R_tab, L) |
119 | #define L2T_P(q,L) qdisc_l2t((q)->P_tab,L) | 118 | #define L2T_P(q, L) qdisc_l2t((q)->P_tab, L) |
120 | 119 | ||
121 | static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) | 120 | static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
122 | { | 121 | { |
123 | struct tbf_sched_data *q = qdisc_priv(sch); | 122 | struct tbf_sched_data *q = qdisc_priv(sch); |
124 | int ret; | 123 | int ret; |
@@ -137,7 +136,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
137 | return NET_XMIT_SUCCESS; | 136 | return NET_XMIT_SUCCESS; |
138 | } | 137 | } |
139 | 138 | ||
140 | static unsigned int tbf_drop(struct Qdisc* sch) | 139 | static unsigned int tbf_drop(struct Qdisc *sch) |
141 | { | 140 | { |
142 | struct tbf_sched_data *q = qdisc_priv(sch); | 141 | struct tbf_sched_data *q = qdisc_priv(sch); |
143 | unsigned int len = 0; | 142 | unsigned int len = 0; |
@@ -149,7 +148,7 @@ static unsigned int tbf_drop(struct Qdisc* sch) | |||
149 | return len; | 148 | return len; |
150 | } | 149 | } |
151 | 150 | ||
152 | static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | 151 | static struct sk_buff *tbf_dequeue(struct Qdisc *sch) |
153 | { | 152 | { |
154 | struct tbf_sched_data *q = qdisc_priv(sch); | 153 | struct tbf_sched_data *q = qdisc_priv(sch); |
155 | struct sk_buff *skb; | 154 | struct sk_buff *skb; |
@@ -185,7 +184,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
185 | q->tokens = toks; | 184 | q->tokens = toks; |
186 | q->ptokens = ptoks; | 185 | q->ptokens = ptoks; |
187 | sch->q.qlen--; | 186 | sch->q.qlen--; |
188 | sch->flags &= ~TCQ_F_THROTTLED; | 187 | qdisc_unthrottled(sch); |
189 | qdisc_bstats_update(sch, skb); | 188 | qdisc_bstats_update(sch, skb); |
190 | return skb; | 189 | return skb; |
191 | } | 190 | } |
@@ -209,7 +208,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
209 | return NULL; | 208 | return NULL; |
210 | } | 209 | } |
211 | 210 | ||
212 | static void tbf_reset(struct Qdisc* sch) | 211 | static void tbf_reset(struct Qdisc *sch) |
213 | { | 212 | { |
214 | struct tbf_sched_data *q = qdisc_priv(sch); | 213 | struct tbf_sched_data *q = qdisc_priv(sch); |
215 | 214 | ||
@@ -227,7 +226,7 @@ static const struct nla_policy tbf_policy[TCA_TBF_MAX + 1] = { | |||
227 | [TCA_TBF_PTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, | 226 | [TCA_TBF_PTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, |
228 | }; | 227 | }; |
229 | 228 | ||
230 | static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | 229 | static int tbf_change(struct Qdisc *sch, struct nlattr *opt) |
231 | { | 230 | { |
232 | int err; | 231 | int err; |
233 | struct tbf_sched_data *q = qdisc_priv(sch); | 232 | struct tbf_sched_data *q = qdisc_priv(sch); |
@@ -236,7 +235,7 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | |||
236 | struct qdisc_rate_table *rtab = NULL; | 235 | struct qdisc_rate_table *rtab = NULL; |
237 | struct qdisc_rate_table *ptab = NULL; | 236 | struct qdisc_rate_table *ptab = NULL; |
238 | struct Qdisc *child = NULL; | 237 | struct Qdisc *child = NULL; |
239 | int max_size,n; | 238 | int max_size, n; |
240 | 239 | ||
241 | err = nla_parse_nested(tb, TCA_TBF_PTAB, opt, tbf_policy); | 240 | err = nla_parse_nested(tb, TCA_TBF_PTAB, opt, tbf_policy); |
242 | if (err < 0) | 241 | if (err < 0) |
@@ -259,15 +258,18 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | |||
259 | } | 258 | } |
260 | 259 | ||
261 | for (n = 0; n < 256; n++) | 260 | for (n = 0; n < 256; n++) |
262 | if (rtab->data[n] > qopt->buffer) break; | 261 | if (rtab->data[n] > qopt->buffer) |
263 | max_size = (n << qopt->rate.cell_log)-1; | 262 | break; |
263 | max_size = (n << qopt->rate.cell_log) - 1; | ||
264 | if (ptab) { | 264 | if (ptab) { |
265 | int size; | 265 | int size; |
266 | 266 | ||
267 | for (n = 0; n < 256; n++) | 267 | for (n = 0; n < 256; n++) |
268 | if (ptab->data[n] > qopt->mtu) break; | 268 | if (ptab->data[n] > qopt->mtu) |
269 | size = (n << qopt->peakrate.cell_log)-1; | 269 | break; |
270 | if (size < max_size) max_size = size; | 270 | size = (n << qopt->peakrate.cell_log) - 1; |
271 | if (size < max_size) | ||
272 | max_size = size; | ||
271 | } | 273 | } |
272 | if (max_size < 0) | 274 | if (max_size < 0) |
273 | goto done; | 275 | goto done; |
@@ -310,7 +312,7 @@ done: | |||
310 | return err; | 312 | return err; |
311 | } | 313 | } |
312 | 314 | ||
313 | static int tbf_init(struct Qdisc* sch, struct nlattr *opt) | 315 | static int tbf_init(struct Qdisc *sch, struct nlattr *opt) |
314 | { | 316 | { |
315 | struct tbf_sched_data *q = qdisc_priv(sch); | 317 | struct tbf_sched_data *q = qdisc_priv(sch); |
316 | 318 | ||
@@ -422,8 +424,7 @@ static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker) | |||
422 | } | 424 | } |
423 | } | 425 | } |
424 | 426 | ||
425 | static const struct Qdisc_class_ops tbf_class_ops = | 427 | static const struct Qdisc_class_ops tbf_class_ops = { |
426 | { | ||
427 | .graft = tbf_graft, | 428 | .graft = tbf_graft, |
428 | .leaf = tbf_leaf, | 429 | .leaf = tbf_leaf, |
429 | .get = tbf_get, | 430 | .get = tbf_get, |