aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_atm.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-23 01:11:17 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:10 -0500
commit1e90474c377e92db7262a8968a45c1dd980ca9e5 (patch)
tree645af56dcb17cf1a76fd3b7f1a8b833a3fffc3d7 /net/sched/sch_atm.c
parent01480e1cf5e2118eba8a8968239f3242072f9563 (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_atm.c')
-rw-r--r--net/sched/sch_atm.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 734be9d37d46..eb01aae117df 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -196,13 +196,13 @@ static const u8 llc_oui_ip[] = {
196}; /* Ethertype IP (0800) */ 196}; /* Ethertype IP (0800) */
197 197
198static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, 198static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
199 struct rtattr **tca, unsigned long *arg) 199 struct nlattr **tca, unsigned long *arg)
200{ 200{
201 struct atm_qdisc_data *p = qdisc_priv(sch); 201 struct atm_qdisc_data *p = qdisc_priv(sch);
202 struct atm_flow_data *flow = (struct atm_flow_data *)*arg; 202 struct atm_flow_data *flow = (struct atm_flow_data *)*arg;
203 struct atm_flow_data *excess = NULL; 203 struct atm_flow_data *excess = NULL;
204 struct rtattr *opt = tca[TCA_OPTIONS - 1]; 204 struct nlattr *opt = tca[TCA_OPTIONS];
205 struct rtattr *tb[TCA_ATM_MAX]; 205 struct nlattr *tb[TCA_ATM_MAX + 1];
206 struct socket *sock; 206 struct socket *sock;
207 int fd, error, hdr_len; 207 int fd, error, hdr_len;
208 void *hdr; 208 void *hdr;
@@ -223,31 +223,31 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
223 */ 223 */
224 if (flow) 224 if (flow)
225 return -EBUSY; 225 return -EBUSY;
226 if (opt == NULL || rtattr_parse_nested(tb, TCA_ATM_MAX, opt)) 226 if (opt == NULL || nla_parse_nested(tb, TCA_ATM_MAX, opt, NULL))
227 return -EINVAL; 227 return -EINVAL;
228 if (!tb[TCA_ATM_FD - 1] || RTA_PAYLOAD(tb[TCA_ATM_FD - 1]) < sizeof(fd)) 228 if (!tb[TCA_ATM_FD] || nla_len(tb[TCA_ATM_FD]) < sizeof(fd))
229 return -EINVAL; 229 return -EINVAL;
230 fd = *(int *)RTA_DATA(tb[TCA_ATM_FD - 1]); 230 fd = *(int *)nla_data(tb[TCA_ATM_FD]);
231 pr_debug("atm_tc_change: fd %d\n", fd); 231 pr_debug("atm_tc_change: fd %d\n", fd);
232 if (tb[TCA_ATM_HDR - 1]) { 232 if (tb[TCA_ATM_HDR]) {
233 hdr_len = RTA_PAYLOAD(tb[TCA_ATM_HDR - 1]); 233 hdr_len = nla_len(tb[TCA_ATM_HDR]);
234 hdr = RTA_DATA(tb[TCA_ATM_HDR - 1]); 234 hdr = nla_data(tb[TCA_ATM_HDR]);
235 } else { 235 } else {
236 hdr_len = RFC1483LLC_LEN; 236 hdr_len = RFC1483LLC_LEN;
237 hdr = NULL; /* default LLC/SNAP for IP */ 237 hdr = NULL; /* default LLC/SNAP for IP */
238 } 238 }
239 if (!tb[TCA_ATM_EXCESS - 1]) 239 if (!tb[TCA_ATM_EXCESS])
240 excess = NULL; 240 excess = NULL;
241 else { 241 else {
242 if (RTA_PAYLOAD(tb[TCA_ATM_EXCESS - 1]) != sizeof(u32)) 242 if (nla_len(tb[TCA_ATM_EXCESS]) != sizeof(u32))
243 return -EINVAL; 243 return -EINVAL;
244 excess = (struct atm_flow_data *) 244 excess = (struct atm_flow_data *)
245 atm_tc_get(sch, *(u32 *)RTA_DATA(tb[TCA_ATM_EXCESS - 1])); 245 atm_tc_get(sch, *(u32 *)nla_data(tb[TCA_ATM_EXCESS]));
246 if (!excess) 246 if (!excess)
247 return -ENOENT; 247 return -ENOENT;
248 } 248 }
249 pr_debug("atm_tc_change: type %d, payload %lu, hdr_len %d\n", 249 pr_debug("atm_tc_change: type %d, payload %lu, hdr_len %d\n",
250 opt->rta_type, RTA_PAYLOAD(opt), hdr_len); 250 opt->nla_type, nla_len(opt), hdr_len);
251 sock = sockfd_lookup(fd, &error); 251 sock = sockfd_lookup(fd, &error);
252 if (!sock) 252 if (!sock)
253 return error; /* f_count++ */ 253 return error; /* f_count++ */
@@ -541,7 +541,7 @@ static unsigned int atm_tc_drop(struct Qdisc *sch)
541 return 0; 541 return 0;
542} 542}
543 543
544static int atm_tc_init(struct Qdisc *sch, struct rtattr *opt) 544static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt)
545{ 545{
546 struct atm_qdisc_data *p = qdisc_priv(sch); 546 struct atm_qdisc_data *p = qdisc_priv(sch);
547 547
@@ -602,7 +602,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
602 struct atm_qdisc_data *p = qdisc_priv(sch); 602 struct atm_qdisc_data *p = qdisc_priv(sch);
603 struct atm_flow_data *flow = (struct atm_flow_data *)cl; 603 struct atm_flow_data *flow = (struct atm_flow_data *)cl;
604 unsigned char *b = skb_tail_pointer(skb); 604 unsigned char *b = skb_tail_pointer(skb);
605 struct rtattr *rta; 605 struct nlattr *nla;
606 606
607 pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", 607 pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n",
608 sch, p, flow, skb, tcm); 608 sch, p, flow, skb, tcm);
@@ -610,9 +610,9 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
610 return -EINVAL; 610 return -EINVAL;
611 tcm->tcm_handle = flow->classid; 611 tcm->tcm_handle = flow->classid;
612 tcm->tcm_info = flow->q->handle; 612 tcm->tcm_info = flow->q->handle;
613 rta = (struct rtattr *)b; 613 nla = (struct nlattr *)b;
614 RTA_PUT(skb, TCA_OPTIONS, 0, NULL); 614 NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
615 RTA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr); 615 NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr);
616 if (flow->vcc) { 616 if (flow->vcc) {
617 struct sockaddr_atmpvc pvc; 617 struct sockaddr_atmpvc pvc;
618 int state; 618 int state;
@@ -621,21 +621,21 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
621 pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; 621 pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
622 pvc.sap_addr.vpi = flow->vcc->vpi; 622 pvc.sap_addr.vpi = flow->vcc->vpi;
623 pvc.sap_addr.vci = flow->vcc->vci; 623 pvc.sap_addr.vci = flow->vcc->vci;
624 RTA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc); 624 NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc);
625 state = ATM_VF2VS(flow->vcc->flags); 625 state = ATM_VF2VS(flow->vcc->flags);
626 RTA_PUT(skb, TCA_ATM_STATE, sizeof(state), &state); 626 NLA_PUT(skb, TCA_ATM_STATE, sizeof(state), &state);
627 } 627 }
628 if (flow->excess) 628 if (flow->excess)
629 RTA_PUT(skb, TCA_ATM_EXCESS, sizeof(u32), &flow->classid); 629 NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(u32), &flow->classid);
630 else { 630 else {
631 static u32 zero; 631 static u32 zero;
632 632
633 RTA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero); 633 NLA_PUT(skb, TCA_ATM_EXCESS, sizeof(zero), &zero);
634 } 634 }
635 rta->rta_len = skb_tail_pointer(skb) - b; 635 nla->nla_len = skb_tail_pointer(skb) - b;
636 return skb->len; 636 return skb->len;
637 637
638rtattr_failure: 638nla_put_failure:
639 nlmsg_trim(skb, b); 639 nlmsg_trim(skb, b);
640 return -1; 640 return -1;
641} 641}