diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-23 01:11:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:11:10 -0500 |
commit | 1e90474c377e92db7262a8968a45c1dd980ca9e5 (patch) | |
tree | 645af56dcb17cf1a76fd3b7f1a8b833a3fffc3d7 /net/sched/sch_prio.c | |
parent | 01480e1cf5e2118eba8a8968239f3242072f9563 (diff) |
[NET_SCHED]: Convert packet schedulers from rtnetlink to new netlink API
Convert packet schedulers to use the netlink API. Unfortunately a gradual
conversion is not possible without breaking compilation in the middle or
adding lots of casts, so this patch converts them all in one step. The
patch has been mostly generated automatically with some minor edits to
at least allow seperate conversion of classifiers and actions.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_prio.c')
-rw-r--r-- | net/sched/sch_prio.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 2243aaa8d85..a4f932df86e 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -224,15 +224,15 @@ prio_destroy(struct Qdisc* sch) | |||
224 | qdisc_destroy(q->queues[prio]); | 224 | qdisc_destroy(q->queues[prio]); |
225 | } | 225 | } |
226 | 226 | ||
227 | static int prio_tune(struct Qdisc *sch, struct rtattr *opt) | 227 | static int prio_tune(struct Qdisc *sch, struct nlattr *opt) |
228 | { | 228 | { |
229 | struct prio_sched_data *q = qdisc_priv(sch); | 229 | struct prio_sched_data *q = qdisc_priv(sch); |
230 | struct tc_prio_qopt *qopt; | 230 | struct tc_prio_qopt *qopt; |
231 | struct rtattr *tb[TCA_PRIO_MAX]; | 231 | struct nlattr *tb[TCA_PRIO_MAX + 1]; |
232 | int i; | 232 | int i; |
233 | 233 | ||
234 | if (rtattr_parse_nested_compat(tb, TCA_PRIO_MAX, opt, qopt, | 234 | if (nla_parse_nested_compat(tb, TCA_PRIO_MAX, opt, NULL, qopt, |
235 | sizeof(*qopt))) | 235 | sizeof(*qopt))) |
236 | return -EINVAL; | 236 | return -EINVAL; |
237 | q->bands = qopt->bands; | 237 | q->bands = qopt->bands; |
238 | /* If we're multiqueue, make sure the number of incoming bands | 238 | /* If we're multiqueue, make sure the number of incoming bands |
@@ -242,7 +242,7 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt) | |||
242 | * only one that is enabled for multiqueue, since it's the only one | 242 | * only one that is enabled for multiqueue, since it's the only one |
243 | * that interacts with the underlying device. | 243 | * that interacts with the underlying device. |
244 | */ | 244 | */ |
245 | q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]); | 245 | q->mq = nla_get_flag(tb[TCA_PRIO_MQ]); |
246 | if (q->mq) { | 246 | if (q->mq) { |
247 | if (sch->parent != TC_H_ROOT) | 247 | if (sch->parent != TC_H_ROOT) |
248 | return -EINVAL; | 248 | return -EINVAL; |
@@ -296,7 +296,7 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt) | |||
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int prio_init(struct Qdisc *sch, struct rtattr *opt) | 299 | static int prio_init(struct Qdisc *sch, struct nlattr *opt) |
300 | { | 300 | { |
301 | struct prio_sched_data *q = qdisc_priv(sch); | 301 | struct prio_sched_data *q = qdisc_priv(sch); |
302 | int i; | 302 | int i; |
@@ -319,20 +319,24 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
319 | { | 319 | { |
320 | struct prio_sched_data *q = qdisc_priv(sch); | 320 | struct prio_sched_data *q = qdisc_priv(sch); |
321 | unsigned char *b = skb_tail_pointer(skb); | 321 | unsigned char *b = skb_tail_pointer(skb); |
322 | struct rtattr *nest; | 322 | struct nlattr *nest; |
323 | struct tc_prio_qopt opt; | 323 | struct tc_prio_qopt opt; |
324 | 324 | ||
325 | opt.bands = q->bands; | 325 | opt.bands = q->bands; |
326 | memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX+1); | 326 | memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX+1); |
327 | 327 | ||
328 | nest = RTA_NEST_COMPAT(skb, TCA_OPTIONS, sizeof(opt), &opt); | 328 | nest = nla_nest_compat_start(skb, TCA_OPTIONS, sizeof(opt), &opt); |
329 | if (q->mq) | 329 | if (nest == NULL) |
330 | RTA_PUT_FLAG(skb, TCA_PRIO_MQ); | 330 | goto nla_put_failure; |
331 | RTA_NEST_COMPAT_END(skb, nest); | 331 | if (q->mq) { |
332 | if (nla_put_flag(skb, TCA_PRIO_MQ) < 0) | ||
333 | goto nla_put_failure; | ||
334 | } | ||
335 | nla_nest_compat_end(skb, nest); | ||
332 | 336 | ||
333 | return skb->len; | 337 | return skb->len; |
334 | 338 | ||
335 | rtattr_failure: | 339 | nla_put_failure: |
336 | nlmsg_trim(skb, b); | 340 | nlmsg_trim(skb, b); |
337 | return -1; | 341 | return -1; |
338 | } | 342 | } |
@@ -392,7 +396,7 @@ static void prio_put(struct Qdisc *q, unsigned long cl) | |||
392 | return; | 396 | return; |
393 | } | 397 | } |
394 | 398 | ||
395 | static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr **tca, unsigned long *arg) | 399 | static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct nlattr **tca, unsigned long *arg) |
396 | { | 400 | { |
397 | unsigned long cl = *arg; | 401 | unsigned long cl = *arg; |
398 | struct prio_sched_data *q = qdisc_priv(sch); | 402 | struct prio_sched_data *q = qdisc_priv(sch); |