0001
0002
0003
0004
0005
0006 #include <linux/module.h>
0007 #include <linux/slab.h>
0008 #include <linux/init.h>
0009 #include <linux/interrupt.h>
0010 #include <linux/string.h>
0011 #include <linux/errno.h>
0012 #include <linux/skbuff.h>
0013 #include <linux/atmdev.h>
0014 #include <linux/atmclip.h>
0015 #include <linux/rtnetlink.h>
0016 #include <linux/file.h> /* for fput */
0017 #include <net/netlink.h>
0018 #include <net/pkt_sched.h>
0019 #include <net/pkt_cls.h>
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)->user_back))
0043
0044 struct atm_flow_data {
0045 struct Qdisc_class_common common;
0046 struct Qdisc *q;
0047 struct tcf_proto __rcu *filter_list;
0048 struct tcf_block *block;
0049 struct atm_vcc *vcc;
0050 void (*old_pop)(struct atm_vcc *vcc,
0051 struct sk_buff *skb);
0052 struct atm_qdisc_data *parent;
0053 struct socket *sock;
0054 int ref;
0055 struct gnet_stats_basic_sync bstats;
0056 struct gnet_stats_queue qstats;
0057 struct list_head list;
0058 struct atm_flow_data *excess;
0059
0060 int hdr_len;
0061 unsigned char hdr[];
0062 };
0063
0064 struct atm_qdisc_data {
0065 struct atm_flow_data link;
0066 struct list_head flows;
0067
0068 struct tasklet_struct task;
0069 };
0070
0071
0072
0073 static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid)
0074 {
0075 struct atm_qdisc_data *p = qdisc_priv(sch);
0076 struct atm_flow_data *flow;
0077
0078 list_for_each_entry(flow, &p->flows, list) {
0079 if (flow->common.classid == classid)
0080 return flow;
0081 }
0082 return NULL;
0083 }
0084
0085 static int atm_tc_graft(struct Qdisc *sch, unsigned long arg,
0086 struct Qdisc *new, struct Qdisc **old,
0087 struct netlink_ext_ack *extack)
0088 {
0089 struct atm_qdisc_data *p = qdisc_priv(sch);
0090 struct atm_flow_data *flow = (struct atm_flow_data *)arg;
0091
0092 pr_debug("atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n",
0093 sch, p, flow, new, old);
0094 if (list_empty(&flow->list))
0095 return -EINVAL;
0096 if (!new)
0097 new = &noop_qdisc;
0098 *old = flow->q;
0099 flow->q = new;
0100 if (*old)
0101 qdisc_reset(*old);
0102 return 0;
0103 }
0104
0105 static struct Qdisc *atm_tc_leaf(struct Qdisc *sch, unsigned long cl)
0106 {
0107 struct atm_flow_data *flow = (struct atm_flow_data *)cl;
0108
0109 pr_debug("atm_tc_leaf(sch %p,flow %p)\n", sch, flow);
0110 return flow ? flow->q : NULL;
0111 }
0112
0113 static unsigned long atm_tc_find(struct Qdisc *sch, u32 classid)
0114 {
0115 struct atm_qdisc_data *p __maybe_unused = qdisc_priv(sch);
0116 struct atm_flow_data *flow;
0117
0118 pr_debug("%s(sch %p,[qdisc %p],classid %x)\n", __func__, sch, p, classid);
0119 flow = lookup_flow(sch, classid);
0120 pr_debug("%s: flow %p\n", __func__, flow);
0121 return (unsigned long)flow;
0122 }
0123
0124 static unsigned long atm_tc_bind_filter(struct Qdisc *sch,
0125 unsigned long parent, u32 classid)
0126 {
0127 struct atm_qdisc_data *p __maybe_unused = qdisc_priv(sch);
0128 struct atm_flow_data *flow;
0129
0130 pr_debug("%s(sch %p,[qdisc %p],classid %x)\n", __func__, sch, p, classid);
0131 flow = lookup_flow(sch, classid);
0132 if (flow)
0133 flow->ref++;
0134 pr_debug("%s: flow %p\n", __func__, flow);
0135 return (unsigned long)flow;
0136 }
0137
0138
0139
0140
0141
0142
0143 static void atm_tc_put(struct Qdisc *sch, unsigned long cl)
0144 {
0145 struct atm_qdisc_data *p = qdisc_priv(sch);
0146 struct atm_flow_data *flow = (struct atm_flow_data *)cl;
0147
0148 pr_debug("atm_tc_put(sch %p,[qdisc %p],flow %p)\n", sch, p, flow);
0149 if (--flow->ref)
0150 return;
0151 pr_debug("atm_tc_put: destroying\n");
0152 list_del_init(&flow->list);
0153 pr_debug("atm_tc_put: qdisc %p\n", flow->q);
0154 qdisc_put(flow->q);
0155 tcf_block_put(flow->block);
0156 if (flow->sock) {
0157 pr_debug("atm_tc_put: f_count %ld\n",
0158 file_count(flow->sock->file));
0159 flow->vcc->pop = flow->old_pop;
0160 sockfd_put(flow->sock);
0161 }
0162 if (flow->excess)
0163 atm_tc_put(sch, (unsigned long)flow->excess);
0164 if (flow != &p->link)
0165 kfree(flow);
0166
0167
0168
0169
0170 }
0171
0172 static void sch_atm_pop(struct atm_vcc *vcc, struct sk_buff *skb)
0173 {
0174 struct atm_qdisc_data *p = VCC2FLOW(vcc)->parent;
0175
0176 pr_debug("sch_atm_pop(vcc %p,skb %p,[qdisc %p])\n", vcc, skb, p);
0177 VCC2FLOW(vcc)->old_pop(vcc, skb);
0178 tasklet_schedule(&p->task);
0179 }
0180
0181 static const u8 llc_oui_ip[] = {
0182 0xaa,
0183 0xaa,
0184 0x03,
0185 0x00,
0186 0x00, 0x00,
0187 0x08, 0x00
0188 };
0189
0190 static const struct nla_policy atm_policy[TCA_ATM_MAX + 1] = {
0191 [TCA_ATM_FD] = { .type = NLA_U32 },
0192 [TCA_ATM_EXCESS] = { .type = NLA_U32 },
0193 };
0194
0195 static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
0196 struct nlattr **tca, unsigned long *arg,
0197 struct netlink_ext_ack *extack)
0198 {
0199 struct atm_qdisc_data *p = qdisc_priv(sch);
0200 struct atm_flow_data *flow = (struct atm_flow_data *)*arg;
0201 struct atm_flow_data *excess = NULL;
0202 struct nlattr *opt = tca[TCA_OPTIONS];
0203 struct nlattr *tb[TCA_ATM_MAX + 1];
0204 struct socket *sock;
0205 int fd, error, hdr_len;
0206 void *hdr;
0207
0208 pr_debug("atm_tc_change(sch %p,[qdisc %p],classid %x,parent %x,"
0209 "flow %p,opt %p)\n", sch, p, classid, parent, flow, opt);
0210
0211
0212
0213 if (parent && parent != TC_H_ROOT && parent != sch->handle)
0214 return -EINVAL;
0215
0216
0217
0218
0219
0220
0221
0222 if (flow)
0223 return -EBUSY;
0224 if (opt == NULL)
0225 return -EINVAL;
0226
0227 error = nla_parse_nested_deprecated(tb, TCA_ATM_MAX, opt, atm_policy,
0228 NULL);
0229 if (error < 0)
0230 return error;
0231
0232 if (!tb[TCA_ATM_FD])
0233 return -EINVAL;
0234 fd = nla_get_u32(tb[TCA_ATM_FD]);
0235 pr_debug("atm_tc_change: fd %d\n", fd);
0236 if (tb[TCA_ATM_HDR]) {
0237 hdr_len = nla_len(tb[TCA_ATM_HDR]);
0238 hdr = nla_data(tb[TCA_ATM_HDR]);
0239 } else {
0240 hdr_len = RFC1483LLC_LEN;
0241 hdr = NULL;
0242 }
0243 if (!tb[TCA_ATM_EXCESS])
0244 excess = NULL;
0245 else {
0246 excess = (struct atm_flow_data *)
0247 atm_tc_find(sch, nla_get_u32(tb[TCA_ATM_EXCESS]));
0248 if (!excess)
0249 return -ENOENT;
0250 }
0251 pr_debug("atm_tc_change: type %d, payload %d, hdr_len %d\n",
0252 opt->nla_type, nla_len(opt), hdr_len);
0253 sock = sockfd_lookup(fd, &error);
0254 if (!sock)
0255 return error;
0256 pr_debug("atm_tc_change: f_count %ld\n", file_count(sock->file));
0257 if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) {
0258 error = -EPROTOTYPE;
0259 goto err_out;
0260 }
0261
0262
0263 if (classid) {
0264 if (TC_H_MAJ(classid ^ sch->handle)) {
0265 pr_debug("atm_tc_change: classid mismatch\n");
0266 error = -EINVAL;
0267 goto err_out;
0268 }
0269 } else {
0270 int i;
0271 unsigned long cl;
0272
0273 for (i = 1; i < 0x8000; i++) {
0274 classid = TC_H_MAKE(sch->handle, 0x8000 | i);
0275 cl = atm_tc_find(sch, classid);
0276 if (!cl)
0277 break;
0278 }
0279 }
0280 pr_debug("atm_tc_change: new id %x\n", classid);
0281 flow = kzalloc(sizeof(struct atm_flow_data) + hdr_len, GFP_KERNEL);
0282 pr_debug("atm_tc_change: flow %p\n", flow);
0283 if (!flow) {
0284 error = -ENOBUFS;
0285 goto err_out;
0286 }
0287
0288 error = tcf_block_get(&flow->block, &flow->filter_list, sch,
0289 extack);
0290 if (error) {
0291 kfree(flow);
0292 goto err_out;
0293 }
0294
0295 flow->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid,
0296 extack);
0297 if (!flow->q)
0298 flow->q = &noop_qdisc;
0299 pr_debug("atm_tc_change: qdisc %p\n", flow->q);
0300 flow->sock = sock;
0301 flow->vcc = ATM_SD(sock);
0302 flow->vcc->user_back = flow;
0303 pr_debug("atm_tc_change: vcc %p\n", flow->vcc);
0304 flow->old_pop = flow->vcc->pop;
0305 flow->parent = p;
0306 flow->vcc->pop = sch_atm_pop;
0307 flow->common.classid = classid;
0308 flow->ref = 1;
0309 flow->excess = excess;
0310 list_add(&flow->list, &p->link.list);
0311 flow->hdr_len = hdr_len;
0312 if (hdr)
0313 memcpy(flow->hdr, hdr, hdr_len);
0314 else
0315 memcpy(flow->hdr, llc_oui_ip, sizeof(llc_oui_ip));
0316 *arg = (unsigned long)flow;
0317 return 0;
0318 err_out:
0319 sockfd_put(sock);
0320 return error;
0321 }
0322
0323 static int atm_tc_delete(struct Qdisc *sch, unsigned long arg,
0324 struct netlink_ext_ack *extack)
0325 {
0326 struct atm_qdisc_data *p = qdisc_priv(sch);
0327 struct atm_flow_data *flow = (struct atm_flow_data *)arg;
0328
0329 pr_debug("atm_tc_delete(sch %p,[qdisc %p],flow %p)\n", sch, p, flow);
0330 if (list_empty(&flow->list))
0331 return -EINVAL;
0332 if (rcu_access_pointer(flow->filter_list) || flow == &p->link)
0333 return -EBUSY;
0334
0335
0336
0337
0338 if (flow->ref < 2) {
0339 pr_err("atm_tc_delete: flow->ref == %d\n", flow->ref);
0340 return -EINVAL;
0341 }
0342 if (flow->ref > 2)
0343 return -EBUSY;
0344 atm_tc_put(sch, arg);
0345 return 0;
0346 }
0347
0348 static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker)
0349 {
0350 struct atm_qdisc_data *p = qdisc_priv(sch);
0351 struct atm_flow_data *flow;
0352
0353 pr_debug("atm_tc_walk(sch %p,[qdisc %p],walker %p)\n", sch, p, walker);
0354 if (walker->stop)
0355 return;
0356 list_for_each_entry(flow, &p->flows, list) {
0357 if (walker->count >= walker->skip &&
0358 walker->fn(sch, (unsigned long)flow, walker) < 0) {
0359 walker->stop = 1;
0360 break;
0361 }
0362 walker->count++;
0363 }
0364 }
0365
0366 static struct tcf_block *atm_tc_tcf_block(struct Qdisc *sch, unsigned long cl,
0367 struct netlink_ext_ack *extack)
0368 {
0369 struct atm_qdisc_data *p = qdisc_priv(sch);
0370 struct atm_flow_data *flow = (struct atm_flow_data *)cl;
0371
0372 pr_debug("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n", sch, p, flow);
0373 return flow ? flow->block : p->link.block;
0374 }
0375
0376
0377
0378 static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
0379 struct sk_buff **to_free)
0380 {
0381 struct atm_qdisc_data *p = qdisc_priv(sch);
0382 struct atm_flow_data *flow;
0383 struct tcf_result res;
0384 int result;
0385 int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
0386
0387 pr_debug("atm_tc_enqueue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p);
0388 result = TC_ACT_OK;
0389 flow = NULL;
0390 if (TC_H_MAJ(skb->priority) != sch->handle ||
0391 !(flow = (struct atm_flow_data *)atm_tc_find(sch, skb->priority))) {
0392 struct tcf_proto *fl;
0393
0394 list_for_each_entry(flow, &p->flows, list) {
0395 fl = rcu_dereference_bh(flow->filter_list);
0396 if (fl) {
0397 result = tcf_classify(skb, NULL, fl, &res, true);
0398 if (result < 0)
0399 continue;
0400 flow = (struct atm_flow_data *)res.class;
0401 if (!flow)
0402 flow = lookup_flow(sch, res.classid);
0403 goto done;
0404 }
0405 }
0406 flow = NULL;
0407 done:
0408 ;
0409 }
0410 if (!flow) {
0411 flow = &p->link;
0412 } else {
0413 if (flow->vcc)
0414 ATM_SKB(skb)->atm_options = flow->vcc->atm_options;
0415
0416 #ifdef CONFIG_NET_CLS_ACT
0417 switch (result) {
0418 case TC_ACT_QUEUED:
0419 case TC_ACT_STOLEN:
0420 case TC_ACT_TRAP:
0421 __qdisc_drop(skb, to_free);
0422 return NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
0423 case TC_ACT_SHOT:
0424 __qdisc_drop(skb, to_free);
0425 goto drop;
0426 case TC_ACT_RECLASSIFY:
0427 if (flow->excess)
0428 flow = flow->excess;
0429 else
0430 ATM_SKB(skb)->atm_options |= ATM_ATMOPT_CLP;
0431 break;
0432 }
0433 #endif
0434 }
0435
0436 ret = qdisc_enqueue(skb, flow->q, to_free);
0437 if (ret != NET_XMIT_SUCCESS) {
0438 drop: __maybe_unused
0439 if (net_xmit_drop_count(ret)) {
0440 qdisc_qstats_drop(sch);
0441 if (flow)
0442 flow->qstats.drops++;
0443 }
0444 return ret;
0445 }
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455 if (flow == &p->link) {
0456 sch->q.qlen++;
0457 return NET_XMIT_SUCCESS;
0458 }
0459 tasklet_schedule(&p->task);
0460 return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
0461 }
0462
0463
0464
0465
0466
0467
0468
0469
0470 static void sch_atm_dequeue(struct tasklet_struct *t)
0471 {
0472 struct atm_qdisc_data *p = from_tasklet(p, t, task);
0473 struct Qdisc *sch = qdisc_from_priv(p);
0474 struct atm_flow_data *flow;
0475 struct sk_buff *skb;
0476
0477 pr_debug("sch_atm_dequeue(sch %p,[qdisc %p])\n", sch, p);
0478 list_for_each_entry(flow, &p->flows, list) {
0479 if (flow == &p->link)
0480 continue;
0481
0482
0483
0484
0485 while ((skb = flow->q->ops->peek(flow->q))) {
0486 if (!atm_may_send(flow->vcc, skb->truesize))
0487 break;
0488
0489 skb = qdisc_dequeue_peeked(flow->q);
0490 if (unlikely(!skb))
0491 break;
0492
0493 qdisc_bstats_update(sch, skb);
0494 bstats_update(&flow->bstats, skb);
0495 pr_debug("atm_tc_dequeue: sending on class %p\n", flow);
0496
0497 skb_pull(skb, skb_network_offset(skb));
0498 if (skb_headroom(skb) < flow->hdr_len) {
0499 struct sk_buff *new;
0500
0501 new = skb_realloc_headroom(skb, flow->hdr_len);
0502 dev_kfree_skb(skb);
0503 if (!new)
0504 continue;
0505 skb = new;
0506 }
0507 pr_debug("sch_atm_dequeue: ip %p, data %p\n",
0508 skb_network_header(skb), skb->data);
0509 ATM_SKB(skb)->vcc = flow->vcc;
0510 memcpy(skb_push(skb, flow->hdr_len), flow->hdr,
0511 flow->hdr_len);
0512 refcount_add(skb->truesize,
0513 &sk_atm(flow->vcc)->sk_wmem_alloc);
0514
0515 flow->vcc->send(flow->vcc, skb);
0516 }
0517 }
0518 }
0519
0520 static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch)
0521 {
0522 struct atm_qdisc_data *p = qdisc_priv(sch);
0523 struct sk_buff *skb;
0524
0525 pr_debug("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p);
0526 tasklet_schedule(&p->task);
0527 skb = qdisc_dequeue_peeked(p->link.q);
0528 if (skb)
0529 sch->q.qlen--;
0530 return skb;
0531 }
0532
0533 static struct sk_buff *atm_tc_peek(struct Qdisc *sch)
0534 {
0535 struct atm_qdisc_data *p = qdisc_priv(sch);
0536
0537 pr_debug("atm_tc_peek(sch %p,[qdisc %p])\n", sch, p);
0538
0539 return p->link.q->ops->peek(p->link.q);
0540 }
0541
0542 static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt,
0543 struct netlink_ext_ack *extack)
0544 {
0545 struct atm_qdisc_data *p = qdisc_priv(sch);
0546 int err;
0547
0548 pr_debug("atm_tc_init(sch %p,[qdisc %p],opt %p)\n", sch, p, opt);
0549 INIT_LIST_HEAD(&p->flows);
0550 INIT_LIST_HEAD(&p->link.list);
0551 gnet_stats_basic_sync_init(&p->link.bstats);
0552 list_add(&p->link.list, &p->flows);
0553 p->link.q = qdisc_create_dflt(sch->dev_queue,
0554 &pfifo_qdisc_ops, sch->handle, extack);
0555 if (!p->link.q)
0556 p->link.q = &noop_qdisc;
0557 pr_debug("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q);
0558 p->link.vcc = NULL;
0559 p->link.sock = NULL;
0560 p->link.common.classid = sch->handle;
0561 p->link.ref = 1;
0562
0563 err = tcf_block_get(&p->link.block, &p->link.filter_list, sch,
0564 extack);
0565 if (err)
0566 return err;
0567
0568 tasklet_setup(&p->task, sch_atm_dequeue);
0569 return 0;
0570 }
0571
0572 static void atm_tc_reset(struct Qdisc *sch)
0573 {
0574 struct atm_qdisc_data *p = qdisc_priv(sch);
0575 struct atm_flow_data *flow;
0576
0577 pr_debug("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p);
0578 list_for_each_entry(flow, &p->flows, list)
0579 qdisc_reset(flow->q);
0580 sch->q.qlen = 0;
0581 }
0582
0583 static void atm_tc_destroy(struct Qdisc *sch)
0584 {
0585 struct atm_qdisc_data *p = qdisc_priv(sch);
0586 struct atm_flow_data *flow, *tmp;
0587
0588 pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p);
0589 list_for_each_entry(flow, &p->flows, list) {
0590 tcf_block_put(flow->block);
0591 flow->block = NULL;
0592 }
0593
0594 list_for_each_entry_safe(flow, tmp, &p->flows, list) {
0595 if (flow->ref > 1)
0596 pr_err("atm_destroy: %p->ref = %d\n", flow, flow->ref);
0597 atm_tc_put(sch, (unsigned long)flow);
0598 }
0599 tasklet_kill(&p->task);
0600 }
0601
0602 static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
0603 struct sk_buff *skb, struct tcmsg *tcm)
0604 {
0605 struct atm_qdisc_data *p = qdisc_priv(sch);
0606 struct atm_flow_data *flow = (struct atm_flow_data *)cl;
0607 struct nlattr *nest;
0608
0609 pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n",
0610 sch, p, flow, skb, tcm);
0611 if (list_empty(&flow->list))
0612 return -EINVAL;
0613 tcm->tcm_handle = flow->common.classid;
0614 tcm->tcm_info = flow->q->handle;
0615
0616 nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
0617 if (nest == NULL)
0618 goto nla_put_failure;
0619
0620 if (nla_put(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr))
0621 goto nla_put_failure;
0622 if (flow->vcc) {
0623 struct sockaddr_atmpvc pvc;
0624 int state;
0625
0626 memset(&pvc, 0, sizeof(pvc));
0627 pvc.sap_family = AF_ATMPVC;
0628 pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
0629 pvc.sap_addr.vpi = flow->vcc->vpi;
0630 pvc.sap_addr.vci = flow->vcc->vci;
0631 if (nla_put(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc))
0632 goto nla_put_failure;
0633 state = ATM_VF2VS(flow->vcc->flags);
0634 if (nla_put_u32(skb, TCA_ATM_STATE, state))
0635 goto nla_put_failure;
0636 }
0637 if (flow->excess) {
0638 if (nla_put_u32(skb, TCA_ATM_EXCESS, flow->common.classid))
0639 goto nla_put_failure;
0640 } else {
0641 if (nla_put_u32(skb, TCA_ATM_EXCESS, 0))
0642 goto nla_put_failure;
0643 }
0644 return nla_nest_end(skb, nest);
0645
0646 nla_put_failure:
0647 nla_nest_cancel(skb, nest);
0648 return -1;
0649 }
0650 static int
0651 atm_tc_dump_class_stats(struct Qdisc *sch, unsigned long arg,
0652 struct gnet_dump *d)
0653 {
0654 struct atm_flow_data *flow = (struct atm_flow_data *)arg;
0655
0656 if (gnet_stats_copy_basic(d, NULL, &flow->bstats, true) < 0 ||
0657 gnet_stats_copy_queue(d, NULL, &flow->qstats, flow->q->q.qlen) < 0)
0658 return -1;
0659
0660 return 0;
0661 }
0662
0663 static int atm_tc_dump(struct Qdisc *sch, struct sk_buff *skb)
0664 {
0665 return 0;
0666 }
0667
0668 static const struct Qdisc_class_ops atm_class_ops = {
0669 .graft = atm_tc_graft,
0670 .leaf = atm_tc_leaf,
0671 .find = atm_tc_find,
0672 .change = atm_tc_change,
0673 .delete = atm_tc_delete,
0674 .walk = atm_tc_walk,
0675 .tcf_block = atm_tc_tcf_block,
0676 .bind_tcf = atm_tc_bind_filter,
0677 .unbind_tcf = atm_tc_put,
0678 .dump = atm_tc_dump_class,
0679 .dump_stats = atm_tc_dump_class_stats,
0680 };
0681
0682 static struct Qdisc_ops atm_qdisc_ops __read_mostly = {
0683 .cl_ops = &atm_class_ops,
0684 .id = "atm",
0685 .priv_size = sizeof(struct atm_qdisc_data),
0686 .enqueue = atm_tc_enqueue,
0687 .dequeue = atm_tc_dequeue,
0688 .peek = atm_tc_peek,
0689 .init = atm_tc_init,
0690 .reset = atm_tc_reset,
0691 .destroy = atm_tc_destroy,
0692 .dump = atm_tc_dump,
0693 .owner = THIS_MODULE,
0694 };
0695
0696 static int __init atm_init(void)
0697 {
0698 return register_qdisc(&atm_qdisc_ops);
0699 }
0700
0701 static void __exit atm_exit(void)
0702 {
0703 unregister_qdisc(&atm_qdisc_ops);
0704 }
0705
0706 module_init(atm_init)
0707 module_exit(atm_exit)
0708 MODULE_LICENSE("GPL");