1 /* net/sched/sch_atm.c - ATM VC selection "queueing discipline" */
3 /* Written 1998-2000 by Werner Almesberger, EPFL ICA */
6 #include <linux/module.h>
7 #include <linux/init.h>
8 #include <linux/string.h>
9 #include <linux/errno.h>
10 #include <linux/skbuff.h>
11 #include <linux/interrupt.h>
12 #include <linux/atmdev.h>
13 #include <linux/atmclip.h>
14 #include <linux/netdevice.h>
15 #include <linux/rtnetlink.h>
16 #include <linux/file.h> /* for fput */
17 #include <net/pkt_sched.h>
21 extern struct socket
*sockfd_lookup(int fd
, int *err
); /* @@@ fix this */
24 #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
26 #define DPRINTK(format,args...)
30 #define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args)
32 #define D2PRINTK(format,args...)
37 * The ATM queuing discipline provides a framework for invoking classifiers
38 * (aka "filters"), which in turn select classes of this queuing discipline.
39 * Each class maps the flow(s) it is handling to a given VC. Multiple classes
40 * may share the same VC.
42 * When creating a class, VCs are specified by passing the number of the open
43 * socket descriptor by which the calling process references the VC. The kernel
44 * keeps the VC open at least until all classes using it are removed.
46 * In this file, most functions are named atm_tc_* to avoid confusion with all
47 * the atm_* in net/atm. This naming convention differs from what's used in the
51 * - sometimes messes up the IP stack
52 * - any manipulations besides the few operations described in the README, are
53 * untested and likely to crash the system
54 * - should lock the flow while there is data in the queue (?)
58 #define PRIV(sch) qdisc_priv(sch)
59 #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)->user_back))
62 struct atm_flow_data
{
63 struct Qdisc
*q
; /* FIFO, TBF, etc. */
64 struct tcf_proto
*filter_list
;
65 struct atm_vcc
*vcc
; /* VCC; NULL if VCC is closed */
66 void (*old_pop
)(struct atm_vcc
*vcc
,struct sk_buff
*skb
); /* chaining */
67 struct atm_qdisc_data
*parent
; /* parent qdisc */
68 struct socket
*sock
; /* for closing */
69 u32 classid
; /* x:y type ID */
70 int ref
; /* reference count */
71 struct gnet_stats_basic bstats
;
72 struct gnet_stats_queue qstats
;
73 spinlock_t
*stats_lock
;
74 struct atm_flow_data
*next
;
75 struct atm_flow_data
*excess
; /* flow for excess traffic;
76 NULL to set CLP instead */
78 unsigned char hdr
[0]; /* header data; MUST BE LAST */
81 struct atm_qdisc_data
{
82 struct atm_flow_data link
; /* unclassified skbs go here */
83 struct atm_flow_data
*flows
; /* NB: "link" is also on this
85 struct tasklet_struct task
; /* requeue tasklet */
89 /* ------------------------- Class/flow operations ------------------------- */
92 static int find_flow(struct atm_qdisc_data
*qdisc
,struct atm_flow_data
*flow
)
94 struct atm_flow_data
*walk
;
96 DPRINTK("find_flow(qdisc %p,flow %p)\n",qdisc
,flow
);
97 for (walk
= qdisc
->flows
; walk
; walk
= walk
->next
)
98 if (walk
== flow
) return 1;
99 DPRINTK("find_flow: not found\n");
104 static __inline__
struct atm_flow_data
*lookup_flow(struct Qdisc
*sch
,
107 struct atm_qdisc_data
*p
= PRIV(sch
);
108 struct atm_flow_data
*flow
;
110 for (flow
= p
->flows
; flow
; flow
= flow
->next
)
111 if (flow
->classid
== classid
) break;
116 static int atm_tc_graft(struct Qdisc
*sch
,unsigned long arg
,
117 struct Qdisc
*new,struct Qdisc
**old
)
119 struct atm_qdisc_data
*p
= PRIV(sch
);
120 struct atm_flow_data
*flow
= (struct atm_flow_data
*) arg
;
122 DPRINTK("atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n",sch
,
124 if (!find_flow(p
,flow
)) return -EINVAL
;
125 if (!new) new = &noop_qdisc
;
126 *old
= xchg(&flow
->q
,new);
127 if (*old
) qdisc_reset(*old
);
132 static struct Qdisc
*atm_tc_leaf(struct Qdisc
*sch
,unsigned long cl
)
134 struct atm_flow_data
*flow
= (struct atm_flow_data
*) cl
;
136 DPRINTK("atm_tc_leaf(sch %p,flow %p)\n",sch
,flow
);
137 return flow
? flow
->q
: NULL
;
141 static unsigned long atm_tc_get(struct Qdisc
*sch
,u32 classid
)
143 struct atm_qdisc_data
*p
__attribute__((unused
)) = PRIV(sch
);
144 struct atm_flow_data
*flow
;
146 DPRINTK("atm_tc_get(sch %p,[qdisc %p],classid %x)\n",sch
,p
,classid
);
147 flow
= lookup_flow(sch
,classid
);
148 if (flow
) flow
->ref
++;
149 DPRINTK("atm_tc_get: flow %p\n",flow
);
150 return (unsigned long) flow
;
154 static unsigned long atm_tc_bind_filter(struct Qdisc
*sch
,
155 unsigned long parent
, u32 classid
)
157 return atm_tc_get(sch
,classid
);
161 static void destroy_filters(struct atm_flow_data
*flow
)
163 struct tcf_proto
*filter
;
165 while ((filter
= flow
->filter_list
)) {
166 DPRINTK("destroy_filters: destroying filter %p\n",filter
);
167 flow
->filter_list
= filter
->next
;
174 * atm_tc_put handles all destructions, including the ones that are explicitly
175 * requested (atm_tc_destroy, etc.). The assumption here is that we never drop
176 * anything that still seems to be in use.
179 static void atm_tc_put(struct Qdisc
*sch
, unsigned long cl
)
181 struct atm_qdisc_data
*p
= PRIV(sch
);
182 struct atm_flow_data
*flow
= (struct atm_flow_data
*) cl
;
183 struct atm_flow_data
**prev
;
185 DPRINTK("atm_tc_put(sch %p,[qdisc %p],flow %p)\n",sch
,p
,flow
);
186 if (--flow
->ref
) return;
187 DPRINTK("atm_tc_put: destroying\n");
188 for (prev
= &p
->flows
; *prev
; prev
= &(*prev
)->next
)
189 if (*prev
== flow
) break;
191 printk(KERN_CRIT
"atm_tc_put: class %p not found\n",flow
);
195 DPRINTK("atm_tc_put: qdisc %p\n",flow
->q
);
196 qdisc_destroy(flow
->q
);
197 destroy_filters(flow
);
199 DPRINTK("atm_tc_put: f_count %d\n",
200 file_count(flow
->sock
->file
));
201 flow
->vcc
->pop
= flow
->old_pop
;
202 sockfd_put(flow
->sock
);
204 if (flow
->excess
) atm_tc_put(sch
,(unsigned long) flow
->excess
);
205 if (flow
!= &p
->link
) kfree(flow
);
207 * If flow == &p->link, the qdisc no longer works at this point and
208 * needs to be removed. (By the caller of atm_tc_put.)
213 static void sch_atm_pop(struct atm_vcc
*vcc
,struct sk_buff
*skb
)
215 struct atm_qdisc_data
*p
= VCC2FLOW(vcc
)->parent
;
217 D2PRINTK("sch_atm_pop(vcc %p,skb %p,[qdisc %p])\n",vcc
,skb
,p
);
218 VCC2FLOW(vcc
)->old_pop(vcc
,skb
);
219 tasklet_schedule(&p
->task
);
222 static const u8 llc_oui_ip
[] = {
223 0xaa, /* DSAP: non-ISO */
224 0xaa, /* SSAP: non-ISO */
225 0x03, /* Ctrl: Unnumbered Information Command PDU */
226 0x00, /* OUI: EtherType */
228 0x08, 0x00 }; /* Ethertype IP (0800) */
230 static int atm_tc_change(struct Qdisc
*sch
, u32 classid
, u32 parent
,
231 struct rtattr
**tca
, unsigned long *arg
)
233 struct atm_qdisc_data
*p
= PRIV(sch
);
234 struct atm_flow_data
*flow
= (struct atm_flow_data
*) *arg
;
235 struct atm_flow_data
*excess
= NULL
;
236 struct rtattr
*opt
= tca
[TCA_OPTIONS
-1];
237 struct rtattr
*tb
[TCA_ATM_MAX
];
239 int fd
,error
,hdr_len
;
242 DPRINTK("atm_tc_change(sch %p,[qdisc %p],classid %x,parent %x,"
243 "flow %p,opt %p)\n",sch
,p
,classid
,parent
,flow
,opt
);
245 * The concept of parents doesn't apply for this qdisc.
247 if (parent
&& parent
!= TC_H_ROOT
&& parent
!= sch
->handle
)
250 * ATM classes cannot be changed. In order to change properties of the
251 * ATM connection, that socket needs to be modified directly (via the
252 * native ATM API. In order to send a flow to a different VC, the old
253 * class needs to be removed and a new one added. (This may be changed
256 if (flow
) return -EBUSY
;
257 if (opt
== NULL
|| rtattr_parse_nested(tb
, TCA_ATM_MAX
, opt
))
259 if (!tb
[TCA_ATM_FD
-1] || RTA_PAYLOAD(tb
[TCA_ATM_FD
-1]) < sizeof(fd
))
261 fd
= *(int *) RTA_DATA(tb
[TCA_ATM_FD
-1]);
262 DPRINTK("atm_tc_change: fd %d\n",fd
);
263 if (tb
[TCA_ATM_HDR
-1]) {
264 hdr_len
= RTA_PAYLOAD(tb
[TCA_ATM_HDR
-1]);
265 hdr
= RTA_DATA(tb
[TCA_ATM_HDR
-1]);
268 hdr_len
= RFC1483LLC_LEN
;
269 hdr
= NULL
; /* default LLC/SNAP for IP */
271 if (!tb
[TCA_ATM_EXCESS
-1]) excess
= NULL
;
273 if (RTA_PAYLOAD(tb
[TCA_ATM_EXCESS
-1]) != sizeof(u32
))
275 excess
= (struct atm_flow_data
*) atm_tc_get(sch
,
276 *(u32
*) RTA_DATA(tb
[TCA_ATM_EXCESS
-1]));
277 if (!excess
) return -ENOENT
;
279 DPRINTK("atm_tc_change: type %d, payload %d, hdr_len %d\n",
280 opt
->rta_type
,RTA_PAYLOAD(opt
),hdr_len
);
281 if (!(sock
= sockfd_lookup(fd
,&error
))) return error
; /* f_count++ */
282 DPRINTK("atm_tc_change: f_count %d\n",file_count(sock
->file
));
283 if (sock
->ops
->family
!= PF_ATMSVC
&& sock
->ops
->family
!= PF_ATMPVC
) {
287 /* @@@ should check if the socket is really operational or we'll crash
290 if (TC_H_MAJ(classid
^ sch
->handle
)) {
291 DPRINTK("atm_tc_change: classid mismatch\n");
295 if (find_flow(p
,flow
)) {
304 for (i
= 1; i
< 0x8000; i
++) {
305 classid
= TC_H_MAKE(sch
->handle
,0x8000 | i
);
306 if (!(cl
= atm_tc_get(sch
,classid
))) break;
310 DPRINTK("atm_tc_change: new id %x\n",classid
);
311 flow
= kmalloc(sizeof(struct atm_flow_data
)+hdr_len
,GFP_KERNEL
);
312 DPRINTK("atm_tc_change: flow %p\n",flow
);
317 memset(flow
,0,sizeof(*flow
));
318 flow
->filter_list
= NULL
;
319 if (!(flow
->q
= qdisc_create_dflt(sch
->dev
,&pfifo_qdisc_ops
)))
320 flow
->q
= &noop_qdisc
;
321 DPRINTK("atm_tc_change: qdisc %p\n",flow
->q
);
323 flow
->vcc
= ATM_SD(sock
); /* speedup */
324 flow
->vcc
->user_back
= flow
;
325 DPRINTK("atm_tc_change: vcc %p\n",flow
->vcc
);
326 flow
->old_pop
= flow
->vcc
->pop
;
328 flow
->vcc
->pop
= sch_atm_pop
;
329 flow
->classid
= classid
;
331 flow
->excess
= excess
;
332 flow
->next
= p
->link
.next
;
334 flow
->hdr_len
= hdr_len
;
336 memcpy(flow
->hdr
,hdr
,hdr_len
);
338 memcpy(flow
->hdr
,llc_oui_ip
,sizeof(llc_oui_ip
));
339 *arg
= (unsigned long) flow
;
342 if (excess
) atm_tc_put(sch
,(unsigned long) excess
);
348 static int atm_tc_delete(struct Qdisc
*sch
,unsigned long arg
)
350 struct atm_qdisc_data
*p
= PRIV(sch
);
351 struct atm_flow_data
*flow
= (struct atm_flow_data
*) arg
;
353 DPRINTK("atm_tc_delete(sch %p,[qdisc %p],flow %p)\n",sch
,p
,flow
);
354 if (!find_flow(PRIV(sch
),flow
)) return -EINVAL
;
355 if (flow
->filter_list
|| flow
== &p
->link
) return -EBUSY
;
357 * Reference count must be 2: one for "keepalive" (set at class
358 * creation), and one for the reference held when calling delete.
361 printk(KERN_ERR
"atm_tc_delete: flow->ref == %d\n",flow
->ref
);
364 if (flow
->ref
> 2) return -EBUSY
; /* catch references via excess, etc.*/
370 static void atm_tc_walk(struct Qdisc
*sch
,struct qdisc_walker
*walker
)
372 struct atm_qdisc_data
*p
= PRIV(sch
);
373 struct atm_flow_data
*flow
;
375 DPRINTK("atm_tc_walk(sch %p,[qdisc %p],walker %p)\n",sch
,p
,walker
);
376 if (walker
->stop
) return;
377 for (flow
= p
->flows
; flow
; flow
= flow
->next
) {
378 if (walker
->count
>= walker
->skip
)
379 if (walker
->fn(sch
,(unsigned long) flow
,walker
) < 0) {
388 static struct tcf_proto
**atm_tc_find_tcf(struct Qdisc
*sch
,unsigned long cl
)
390 struct atm_qdisc_data
*p
= PRIV(sch
);
391 struct atm_flow_data
*flow
= (struct atm_flow_data
*) cl
;
393 DPRINTK("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n",sch
,p
,flow
);
394 return flow
? &flow
->filter_list
: &p
->link
.filter_list
;
398 /* --------------------------- Qdisc operations ---------------------------- */
401 static int atm_tc_enqueue(struct sk_buff
*skb
,struct Qdisc
*sch
)
403 struct atm_qdisc_data
*p
= PRIV(sch
);
404 struct atm_flow_data
*flow
= NULL
; /* @@@ */
405 struct tcf_result res
;
407 int ret
= NET_XMIT_POLICED
;
409 D2PRINTK("atm_tc_enqueue(skb %p,sch %p,[qdisc %p])\n",skb
,sch
,p
);
410 result
= TC_POLICE_OK
; /* be nice to gcc */
411 if (TC_H_MAJ(skb
->priority
) != sch
->handle
||
412 !(flow
= (struct atm_flow_data
*) atm_tc_get(sch
,skb
->priority
)))
413 for (flow
= p
->flows
; flow
; flow
= flow
->next
)
414 if (flow
->filter_list
) {
415 result
= tc_classify(skb
,flow
->filter_list
,
417 if (result
< 0) continue;
418 flow
= (struct atm_flow_data
*) res
.class;
419 if (!flow
) flow
= lookup_flow(sch
,res
.classid
);
422 if (!flow
) flow
= &p
->link
;
425 ATM_SKB(skb
)->atm_options
= flow
->vcc
->atm_options
;
426 /*@@@ looks good ... but it's not supposed to work :-)*/
427 #ifdef CONFIG_NET_CLS_POLICE
432 case TC_POLICE_RECLASSIFY
:
433 if (flow
->excess
) flow
= flow
->excess
;
435 ATM_SKB(skb
)->atm_options
|=
448 #ifdef CONFIG_NET_CLS_POLICE
449 result
== TC_POLICE_SHOT
||
451 (ret
= flow
->q
->enqueue(skb
,flow
->q
)) != 0) {
453 if (flow
) flow
->qstats
.drops
++;
456 sch
->bstats
.bytes
+= skb
->len
;
457 sch
->bstats
.packets
++;
458 flow
->bstats
.bytes
+= skb
->len
;
459 flow
->bstats
.packets
++;
461 * Okay, this may seem weird. We pretend we've dropped the packet if
462 * it goes via ATM. The reason for this is that the outer qdisc
463 * expects to be able to q->dequeue the packet later on if we return
464 * success at this place. Also, sch->q.qdisc needs to reflect whether
465 * there is a packet egligible for dequeuing or not. Note that the
466 * statistics of the outer qdisc are necessarily wrong because of all
467 * this. There's currently no correct solution for this.
469 if (flow
== &p
->link
) {
473 tasklet_schedule(&p
->task
);
474 return NET_XMIT_BYPASS
;
479 * Dequeue packets and send them over ATM. Note that we quite deliberately
480 * avoid checking net_device's flow control here, simply because sch_atm
481 * uses its own channels, which have nothing to do with any CLIP/LANE/or
482 * non-ATM interfaces.
486 static void sch_atm_dequeue(unsigned long data
)
488 struct Qdisc
*sch
= (struct Qdisc
*) data
;
489 struct atm_qdisc_data
*p
= PRIV(sch
);
490 struct atm_flow_data
*flow
;
493 D2PRINTK("sch_atm_dequeue(sch %p,[qdisc %p])\n",sch
,p
);
494 for (flow
= p
->link
.next
; flow
; flow
= flow
->next
)
496 * If traffic is properly shaped, this won't generate nasty
497 * little bursts. Otherwise, it may ... (but that's okay)
499 while ((skb
= flow
->q
->dequeue(flow
->q
))) {
500 if (!atm_may_send(flow
->vcc
,skb
->truesize
)) {
501 (void) flow
->q
->ops
->requeue(skb
,flow
->q
);
504 D2PRINTK("atm_tc_dequeue: sending on class %p\n",flow
);
505 /* remove any LL header somebody else has attached */
506 skb_pull(skb
,(char *) skb
->nh
.iph
-(char *) skb
->data
);
507 if (skb_headroom(skb
) < flow
->hdr_len
) {
510 new = skb_realloc_headroom(skb
,flow
->hdr_len
);
515 D2PRINTK("sch_atm_dequeue: ip %p, data %p\n",
516 skb
->nh
.iph
,skb
->data
);
517 ATM_SKB(skb
)->vcc
= flow
->vcc
;
518 memcpy(skb_push(skb
,flow
->hdr_len
),flow
->hdr
,
520 atomic_add(skb
->truesize
,
521 &sk_atm(flow
->vcc
)->sk_wmem_alloc
);
522 /* atm.atm_options are already set by atm_tc_enqueue */
523 (void) flow
->vcc
->send(flow
->vcc
,skb
);
528 static struct sk_buff
*atm_tc_dequeue(struct Qdisc
*sch
)
530 struct atm_qdisc_data
*p
= PRIV(sch
);
533 D2PRINTK("atm_tc_dequeue(sch %p,[qdisc %p])\n",sch
,p
);
534 tasklet_schedule(&p
->task
);
535 skb
= p
->link
.q
->dequeue(p
->link
.q
);
536 if (skb
) sch
->q
.qlen
--;
541 static int atm_tc_requeue(struct sk_buff
*skb
,struct Qdisc
*sch
)
543 struct atm_qdisc_data
*p
= PRIV(sch
);
546 D2PRINTK("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n",skb
,sch
,p
);
547 ret
= p
->link
.q
->ops
->requeue(skb
,p
->link
.q
);
550 sch
->qstats
.requeues
++;
553 p
->link
.qstats
.drops
++;
559 static unsigned int atm_tc_drop(struct Qdisc
*sch
)
561 struct atm_qdisc_data
*p
= PRIV(sch
);
562 struct atm_flow_data
*flow
;
565 DPRINTK("atm_tc_drop(sch %p,[qdisc %p])\n",sch
,p
);
566 for (flow
= p
->flows
; flow
; flow
= flow
->next
)
567 if (flow
->q
->ops
->drop
&& (len
= flow
->q
->ops
->drop(flow
->q
)))
573 static int atm_tc_init(struct Qdisc
*sch
,struct rtattr
*opt
)
575 struct atm_qdisc_data
*p
= PRIV(sch
);
577 DPRINTK("atm_tc_init(sch %p,[qdisc %p],opt %p)\n",sch
,p
,opt
);
579 if(!(p
->link
.q
= qdisc_create_dflt(sch
->dev
,&pfifo_qdisc_ops
)))
580 p
->link
.q
= &noop_qdisc
;
581 DPRINTK("atm_tc_init: link (%p) qdisc %p\n",&p
->link
,p
->link
.q
);
582 p
->link
.filter_list
= NULL
;
585 p
->link
.classid
= sch
->handle
;
588 tasklet_init(&p
->task
,sch_atm_dequeue
,(unsigned long) sch
);
593 static void atm_tc_reset(struct Qdisc
*sch
)
595 struct atm_qdisc_data
*p
= PRIV(sch
);
596 struct atm_flow_data
*flow
;
598 DPRINTK("atm_tc_reset(sch %p,[qdisc %p])\n",sch
,p
);
599 for (flow
= p
->flows
; flow
; flow
= flow
->next
) qdisc_reset(flow
->q
);
604 static void atm_tc_destroy(struct Qdisc
*sch
)
606 struct atm_qdisc_data
*p
= PRIV(sch
);
607 struct atm_flow_data
*flow
;
609 DPRINTK("atm_tc_destroy(sch %p,[qdisc %p])\n",sch
,p
);
611 while ((flow
= p
->flows
)) {
612 destroy_filters(flow
);
614 printk(KERN_ERR
"atm_destroy: %p->ref = %d\n",flow
,
616 atm_tc_put(sch
,(unsigned long) flow
);
617 if (p
->flows
== flow
) {
618 printk(KERN_ERR
"atm_destroy: putting flow %p didn't "
620 p
->flows
= flow
->next
; /* brute force */
624 tasklet_kill(&p
->task
);
628 static int atm_tc_dump_class(struct Qdisc
*sch
, unsigned long cl
,
629 struct sk_buff
*skb
, struct tcmsg
*tcm
)
631 struct atm_qdisc_data
*p
= PRIV(sch
);
632 struct atm_flow_data
*flow
= (struct atm_flow_data
*) cl
;
633 unsigned char *b
= skb
->tail
;
636 DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n",
638 if (!find_flow(p
,flow
)) return -EINVAL
;
639 tcm
->tcm_handle
= flow
->classid
;
640 tcm
->tcm_info
= flow
->q
->handle
;
641 rta
= (struct rtattr
*) b
;
642 RTA_PUT(skb
,TCA_OPTIONS
,0,NULL
);
643 RTA_PUT(skb
,TCA_ATM_HDR
,flow
->hdr_len
,flow
->hdr
);
645 struct sockaddr_atmpvc pvc
;
648 pvc
.sap_family
= AF_ATMPVC
;
649 pvc
.sap_addr
.itf
= flow
->vcc
->dev
? flow
->vcc
->dev
->number
: -1;
650 pvc
.sap_addr
.vpi
= flow
->vcc
->vpi
;
651 pvc
.sap_addr
.vci
= flow
->vcc
->vci
;
652 RTA_PUT(skb
,TCA_ATM_ADDR
,sizeof(pvc
),&pvc
);
653 state
= ATM_VF2VS(flow
->vcc
->flags
);
654 RTA_PUT(skb
,TCA_ATM_STATE
,sizeof(state
),&state
);
657 RTA_PUT(skb
,TCA_ATM_EXCESS
,sizeof(u32
),&flow
->classid
);
661 RTA_PUT(skb
,TCA_ATM_EXCESS
,sizeof(zero
),&zero
);
663 rta
->rta_len
= skb
->tail
-b
;
667 skb_trim(skb
,b
-skb
->data
);
671 atm_tc_dump_class_stats(struct Qdisc
*sch
, unsigned long arg
,
674 struct atm_flow_data
*flow
= (struct atm_flow_data
*) arg
;
676 flow
->qstats
.qlen
= flow
->q
->q
.qlen
;
678 if (gnet_stats_copy_basic(d
, &flow
->bstats
) < 0 ||
679 gnet_stats_copy_queue(d
, &flow
->qstats
) < 0)
685 static int atm_tc_dump(struct Qdisc
*sch
, struct sk_buff
*skb
)
690 static struct Qdisc_class_ops atm_class_ops
= {
691 .graft
= atm_tc_graft
,
695 .change
= atm_tc_change
,
696 .delete = atm_tc_delete
,
698 .tcf_chain
= atm_tc_find_tcf
,
699 .bind_tcf
= atm_tc_bind_filter
,
700 .unbind_tcf
= atm_tc_put
,
701 .dump
= atm_tc_dump_class
,
702 .dump_stats
= atm_tc_dump_class_stats
,
705 static struct Qdisc_ops atm_qdisc_ops
= {
707 .cl_ops
= &atm_class_ops
,
709 .priv_size
= sizeof(struct atm_qdisc_data
),
710 .enqueue
= atm_tc_enqueue
,
711 .dequeue
= atm_tc_dequeue
,
712 .requeue
= atm_tc_requeue
,
715 .reset
= atm_tc_reset
,
716 .destroy
= atm_tc_destroy
,
719 .owner
= THIS_MODULE
,
723 static int __init
atm_init(void)
725 return register_qdisc(&atm_qdisc_ops
);
728 static void __exit
atm_exit(void)
730 unregister_qdisc(&atm_qdisc_ops
);
733 module_init(atm_init
)
734 module_exit(atm_exit
)
735 MODULE_LICENSE("GPL");