diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-01-19 14:26:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-20 02:31:12 -0500 |
commit | cc7ec456f82da7f89a5b376e613b3ac4311b3e9a (patch) | |
tree | 534729db08c10f40c090261cdc191dd2303dfc5c /net/sched/sch_tbf.c | |
parent | 7180a03118cac7256fb04f929fe34d0aeee92c40 (diff) |
net_sched: cleanups
Cleanup net/sched code to current CodingStyle and practices.
Reduce inline abuse
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r-- | net/sched/sch_tbf.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 77565e721811..475edfb69c22 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; |
@@ -138,7 +137,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
138 | return NET_XMIT_SUCCESS; | 137 | return NET_XMIT_SUCCESS; |
139 | } | 138 | } |
140 | 139 | ||
141 | static unsigned int tbf_drop(struct Qdisc* sch) | 140 | static unsigned int tbf_drop(struct Qdisc *sch) |
142 | { | 141 | { |
143 | struct tbf_sched_data *q = qdisc_priv(sch); | 142 | struct tbf_sched_data *q = qdisc_priv(sch); |
144 | unsigned int len = 0; | 143 | unsigned int len = 0; |
@@ -150,7 +149,7 @@ static unsigned int tbf_drop(struct Qdisc* sch) | |||
150 | return len; | 149 | return len; |
151 | } | 150 | } |
152 | 151 | ||
153 | static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | 152 | static struct sk_buff *tbf_dequeue(struct Qdisc *sch) |
154 | { | 153 | { |
155 | struct tbf_sched_data *q = qdisc_priv(sch); | 154 | struct tbf_sched_data *q = qdisc_priv(sch); |
156 | struct sk_buff *skb; | 155 | struct sk_buff *skb; |
@@ -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, |