]> Git Repo - linux.git/blob - net/sched/cls_tcindex.c
net/sched: Retire dsmark qdisc
[linux.git] / net / sched / cls_tcindex.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * net/sched/cls_tcindex.c      Packet classifier for skb->tc_index
4  *
5  * Written 1998,1999 by Werner Almesberger, EPFL ICA
6  */
7
8 #include <linux/module.h>
9 #include <linux/types.h>
10 #include <linux/kernel.h>
11 #include <linux/skbuff.h>
12 #include <linux/errno.h>
13 #include <linux/slab.h>
14 #include <linux/refcount.h>
15 #include <net/act_api.h>
16 #include <net/netlink.h>
17 #include <net/pkt_cls.h>
18 #include <net/sch_generic.h>
19 #include <net/tc_wrapper.h>
20
21 /*
22  * Passing parameters to the root seems to be done more awkwardly than really
23  * necessary. At least, u32 doesn't seem to use such dirty hacks. To be
24  * verified. FIXME.
25  */
26
27 #define PERFECT_HASH_THRESHOLD  64      /* use perfect hash if not bigger */
28 #define DEFAULT_HASH_SIZE       64      /* optimized for diffserv */
29
30
31 struct tcindex_data;
32
33 struct tcindex_filter_result {
34         struct tcf_exts         exts;
35         struct tcf_result       res;
36         struct tcindex_data     *p;
37         struct rcu_work         rwork;
38 };
39
40 struct tcindex_filter {
41         u16 key;
42         struct tcindex_filter_result result;
43         struct tcindex_filter __rcu *next;
44         struct rcu_work rwork;
45 };
46
47
48 struct tcindex_data {
49         struct tcindex_filter_result *perfect; /* perfect hash; NULL if none */
50         struct tcindex_filter __rcu **h; /* imperfect hash; */
51         struct tcf_proto *tp;
52         u16 mask;               /* AND key with mask */
53         u32 shift;              /* shift ANDed key to the right */
54         u32 hash;               /* hash table size; 0 if undefined */
55         u32 alloc_hash;         /* allocated size */
56         u32 fall_through;       /* 0: only classify if explicit match */
57         refcount_t refcnt;      /* a temporary refcnt for perfect hash */
58         struct rcu_work rwork;
59 };
60
61 static inline int tcindex_filter_is_set(struct tcindex_filter_result *r)
62 {
63         return tcf_exts_has_actions(&r->exts) || r->res.classid;
64 }
65
66 static void tcindex_data_get(struct tcindex_data *p)
67 {
68         refcount_inc(&p->refcnt);
69 }
70
71 static void tcindex_data_put(struct tcindex_data *p)
72 {
73         if (refcount_dec_and_test(&p->refcnt)) {
74                 kfree(p->perfect);
75                 kfree(p->h);
76                 kfree(p);
77         }
78 }
79
80 static struct tcindex_filter_result *tcindex_lookup(struct tcindex_data *p,
81                                                     u16 key)
82 {
83         if (p->perfect) {
84                 struct tcindex_filter_result *f = p->perfect + key;
85
86                 return tcindex_filter_is_set(f) ? f : NULL;
87         } else if (p->h) {
88                 struct tcindex_filter __rcu **fp;
89                 struct tcindex_filter *f;
90
91                 fp = &p->h[key % p->hash];
92                 for (f = rcu_dereference_bh_rtnl(*fp);
93                      f;
94                      fp = &f->next, f = rcu_dereference_bh_rtnl(*fp))
95                         if (f->key == key)
96                                 return &f->result;
97         }
98
99         return NULL;
100 }
101
102 TC_INDIRECT_SCOPE int tcindex_classify(struct sk_buff *skb,
103                                        const struct tcf_proto *tp,
104                                        struct tcf_result *res)
105 {
106         struct tcindex_data *p = rcu_dereference_bh(tp->root);
107         struct tcindex_filter_result *f;
108         int key = (skb->tc_index & p->mask) >> p->shift;
109
110         pr_debug("tcindex_classify(skb %p,tp %p,res %p),p %p\n",
111                  skb, tp, res, p);
112
113         f = tcindex_lookup(p, key);
114         if (!f) {
115                 struct Qdisc *q = tcf_block_q(tp->chain->block);
116
117                 if (!p->fall_through)
118                         return -1;
119                 res->classid = TC_H_MAKE(TC_H_MAJ(q->handle), key);
120                 res->class = 0;
121                 pr_debug("alg 0x%x\n", res->classid);
122                 return 0;
123         }
124         *res = f->res;
125         pr_debug("map 0x%x\n", res->classid);
126
127         return tcf_exts_exec(skb, &f->exts, res);
128 }
129
130
131 static void *tcindex_get(struct tcf_proto *tp, u32 handle)
132 {
133         struct tcindex_data *p = rtnl_dereference(tp->root);
134         struct tcindex_filter_result *r;
135
136         pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle);
137         if (p->perfect && handle >= p->alloc_hash)
138                 return NULL;
139         r = tcindex_lookup(p, handle);
140         return r && tcindex_filter_is_set(r) ? r : NULL;
141 }
142
143 static int tcindex_init(struct tcf_proto *tp)
144 {
145         struct tcindex_data *p;
146
147         pr_debug("tcindex_init(tp %p)\n", tp);
148         p = kzalloc(sizeof(struct tcindex_data), GFP_KERNEL);
149         if (!p)
150                 return -ENOMEM;
151
152         p->mask = 0xffff;
153         p->hash = DEFAULT_HASH_SIZE;
154         p->fall_through = 1;
155         refcount_set(&p->refcnt, 1); /* Paired with tcindex_destroy_work() */
156
157         rcu_assign_pointer(tp->root, p);
158         return 0;
159 }
160
161 static void __tcindex_destroy_rexts(struct tcindex_filter_result *r)
162 {
163         tcf_exts_destroy(&r->exts);
164         tcf_exts_put_net(&r->exts);
165         tcindex_data_put(r->p);
166 }
167
168 static void tcindex_destroy_rexts_work(struct work_struct *work)
169 {
170         struct tcindex_filter_result *r;
171
172         r = container_of(to_rcu_work(work),
173                          struct tcindex_filter_result,
174                          rwork);
175         rtnl_lock();
176         __tcindex_destroy_rexts(r);
177         rtnl_unlock();
178 }
179
180 static void __tcindex_destroy_fexts(struct tcindex_filter *f)
181 {
182         tcf_exts_destroy(&f->result.exts);
183         tcf_exts_put_net(&f->result.exts);
184         kfree(f);
185 }
186
187 static void tcindex_destroy_fexts_work(struct work_struct *work)
188 {
189         struct tcindex_filter *f = container_of(to_rcu_work(work),
190                                                 struct tcindex_filter,
191                                                 rwork);
192
193         rtnl_lock();
194         __tcindex_destroy_fexts(f);
195         rtnl_unlock();
196 }
197
198 static int tcindex_delete(struct tcf_proto *tp, void *arg, bool *last,
199                           bool rtnl_held, struct netlink_ext_ack *extack)
200 {
201         struct tcindex_data *p = rtnl_dereference(tp->root);
202         struct tcindex_filter_result *r = arg;
203         struct tcindex_filter __rcu **walk;
204         struct tcindex_filter *f = NULL;
205
206         pr_debug("tcindex_delete(tp %p,arg %p),p %p\n", tp, arg, p);
207         if (p->perfect) {
208                 if (!r->res.class)
209                         return -ENOENT;
210         } else {
211                 int i;
212
213                 for (i = 0; i < p->hash; i++) {
214                         walk = p->h + i;
215                         for (f = rtnl_dereference(*walk); f;
216                              walk = &f->next, f = rtnl_dereference(*walk)) {
217                                 if (&f->result == r)
218                                         goto found;
219                         }
220                 }
221                 return -ENOENT;
222
223 found:
224                 rcu_assign_pointer(*walk, rtnl_dereference(f->next));
225         }
226         tcf_unbind_filter(tp, &r->res);
227         /* all classifiers are required to call tcf_exts_destroy() after rcu
228          * grace period, since converted-to-rcu actions are relying on that
229          * in cleanup() callback
230          */
231         if (f) {
232                 if (tcf_exts_get_net(&f->result.exts))
233                         tcf_queue_work(&f->rwork, tcindex_destroy_fexts_work);
234                 else
235                         __tcindex_destroy_fexts(f);
236         } else {
237                 tcindex_data_get(p);
238
239                 if (tcf_exts_get_net(&r->exts))
240                         tcf_queue_work(&r->rwork, tcindex_destroy_rexts_work);
241                 else
242                         __tcindex_destroy_rexts(r);
243         }
244
245         *last = false;
246         return 0;
247 }
248
249 static void tcindex_destroy_work(struct work_struct *work)
250 {
251         struct tcindex_data *p = container_of(to_rcu_work(work),
252                                               struct tcindex_data,
253                                               rwork);
254
255         tcindex_data_put(p);
256 }
257
258 static inline int
259 valid_perfect_hash(struct tcindex_data *p)
260 {
261         return  p->hash > (p->mask >> p->shift);
262 }
263
264 static const struct nla_policy tcindex_policy[TCA_TCINDEX_MAX + 1] = {
265         [TCA_TCINDEX_HASH]              = { .type = NLA_U32 },
266         [TCA_TCINDEX_MASK]              = { .type = NLA_U16 },
267         [TCA_TCINDEX_SHIFT]             = { .type = NLA_U32 },
268         [TCA_TCINDEX_FALL_THROUGH]      = { .type = NLA_U32 },
269         [TCA_TCINDEX_CLASSID]           = { .type = NLA_U32 },
270 };
271
272 static int tcindex_filter_result_init(struct tcindex_filter_result *r,
273                                       struct tcindex_data *p,
274                                       struct net *net)
275 {
276         memset(r, 0, sizeof(*r));
277         r->p = p;
278         return tcf_exts_init(&r->exts, net, TCA_TCINDEX_ACT,
279                              TCA_TCINDEX_POLICE);
280 }
281
282 static void tcindex_free_perfect_hash(struct tcindex_data *cp);
283
284 static void tcindex_partial_destroy_work(struct work_struct *work)
285 {
286         struct tcindex_data *p = container_of(to_rcu_work(work),
287                                               struct tcindex_data,
288                                               rwork);
289
290         rtnl_lock();
291         if (p->perfect)
292                 tcindex_free_perfect_hash(p);
293         kfree(p);
294         rtnl_unlock();
295 }
296
297 static void tcindex_free_perfect_hash(struct tcindex_data *cp)
298 {
299         int i;
300
301         for (i = 0; i < cp->hash; i++)
302                 tcf_exts_destroy(&cp->perfect[i].exts);
303         kfree(cp->perfect);
304 }
305
306 static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp)
307 {
308         int i, err = 0;
309
310         cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result),
311                               GFP_KERNEL | __GFP_NOWARN);
312         if (!cp->perfect)
313                 return -ENOMEM;
314
315         for (i = 0; i < cp->hash; i++) {
316                 err = tcf_exts_init(&cp->perfect[i].exts, net,
317                                     TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE);
318                 if (err < 0)
319                         goto errout;
320                 cp->perfect[i].p = cp;
321         }
322
323         return 0;
324
325 errout:
326         tcindex_free_perfect_hash(cp);
327         return err;
328 }
329
330 static int
331 tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
332                   u32 handle, struct tcindex_data *p,
333                   struct tcindex_filter_result *r, struct nlattr **tb,
334                   struct nlattr *est, u32 flags, struct netlink_ext_ack *extack)
335 {
336         struct tcindex_filter_result new_filter_result;
337         struct tcindex_data *cp = NULL, *oldp;
338         struct tcindex_filter *f = NULL; /* make gcc behave */
339         struct tcf_result cr = {};
340         int err, balloc = 0;
341         struct tcf_exts e;
342
343         err = tcf_exts_init(&e, net, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE);
344         if (err < 0)
345                 return err;
346         err = tcf_exts_validate(net, tp, tb, est, &e, flags, extack);
347         if (err < 0)
348                 goto errout;
349
350         err = -ENOMEM;
351         /* tcindex_data attributes must look atomic to classifier/lookup so
352          * allocate new tcindex data and RCU assign it onto root. Keeping
353          * perfect hash and hash pointers from old data.
354          */
355         cp = kzalloc(sizeof(*cp), GFP_KERNEL);
356         if (!cp)
357                 goto errout;
358
359         cp->mask = p->mask;
360         cp->shift = p->shift;
361         cp->hash = p->hash;
362         cp->alloc_hash = p->alloc_hash;
363         cp->fall_through = p->fall_through;
364         cp->tp = tp;
365         refcount_set(&cp->refcnt, 1); /* Paired with tcindex_destroy_work() */
366
367         if (tb[TCA_TCINDEX_HASH])
368                 cp->hash = nla_get_u32(tb[TCA_TCINDEX_HASH]);
369
370         if (tb[TCA_TCINDEX_MASK])
371                 cp->mask = nla_get_u16(tb[TCA_TCINDEX_MASK]);
372
373         if (tb[TCA_TCINDEX_SHIFT]) {
374                 cp->shift = nla_get_u32(tb[TCA_TCINDEX_SHIFT]);
375                 if (cp->shift > 16) {
376                         err = -EINVAL;
377                         goto errout;
378                 }
379         }
380         if (!cp->hash) {
381                 /* Hash not specified, use perfect hash if the upper limit
382                  * of the hashing index is below the threshold.
383                  */
384                 if ((cp->mask >> cp->shift) < PERFECT_HASH_THRESHOLD)
385                         cp->hash = (cp->mask >> cp->shift) + 1;
386                 else
387                         cp->hash = DEFAULT_HASH_SIZE;
388         }
389
390         if (p->perfect) {
391                 int i;
392
393                 if (tcindex_alloc_perfect_hash(net, cp) < 0)
394                         goto errout;
395                 cp->alloc_hash = cp->hash;
396                 for (i = 0; i < min(cp->hash, p->hash); i++)
397                         cp->perfect[i].res = p->perfect[i].res;
398                 balloc = 1;
399         }
400         cp->h = p->h;
401
402         err = tcindex_filter_result_init(&new_filter_result, cp, net);
403         if (err < 0)
404                 goto errout_alloc;
405         if (r)
406                 cr = r->res;
407
408         err = -EBUSY;
409
410         /* Hash already allocated, make sure that we still meet the
411          * requirements for the allocated hash.
412          */
413         if (cp->perfect) {
414                 if (!valid_perfect_hash(cp) ||
415                     cp->hash > cp->alloc_hash)
416                         goto errout_alloc;
417         } else if (cp->h && cp->hash != cp->alloc_hash) {
418                 goto errout_alloc;
419         }
420
421         err = -EINVAL;
422         if (tb[TCA_TCINDEX_FALL_THROUGH])
423                 cp->fall_through = nla_get_u32(tb[TCA_TCINDEX_FALL_THROUGH]);
424
425         if (!cp->perfect && !cp->h)
426                 cp->alloc_hash = cp->hash;
427
428         /* Note: this could be as restrictive as if (handle & ~(mask >> shift))
429          * but then, we'd fail handles that may become valid after some future
430          * mask change. While this is extremely unlikely to ever matter,
431          * the check below is safer (and also more backwards-compatible).
432          */
433         if (cp->perfect || valid_perfect_hash(cp))
434                 if (handle >= cp->alloc_hash)
435                         goto errout_alloc;
436
437
438         err = -ENOMEM;
439         if (!cp->perfect && !cp->h) {
440                 if (valid_perfect_hash(cp)) {
441                         if (tcindex_alloc_perfect_hash(net, cp) < 0)
442                                 goto errout_alloc;
443                         balloc = 1;
444                 } else {
445                         struct tcindex_filter __rcu **hash;
446
447                         hash = kcalloc(cp->hash,
448                                        sizeof(struct tcindex_filter *),
449                                        GFP_KERNEL);
450
451                         if (!hash)
452                                 goto errout_alloc;
453
454                         cp->h = hash;
455                         balloc = 2;
456                 }
457         }
458
459         if (cp->perfect)
460                 r = cp->perfect + handle;
461         else
462                 r = tcindex_lookup(cp, handle) ? : &new_filter_result;
463
464         if (r == &new_filter_result) {
465                 f = kzalloc(sizeof(*f), GFP_KERNEL);
466                 if (!f)
467                         goto errout_alloc;
468                 f->key = handle;
469                 f->next = NULL;
470                 err = tcindex_filter_result_init(&f->result, cp, net);
471                 if (err < 0) {
472                         kfree(f);
473                         goto errout_alloc;
474                 }
475         }
476
477         if (tb[TCA_TCINDEX_CLASSID]) {
478                 cr.classid = nla_get_u32(tb[TCA_TCINDEX_CLASSID]);
479                 tcf_bind_filter(tp, &cr, base);
480         }
481
482         oldp = p;
483         r->res = cr;
484         tcf_exts_change(&r->exts, &e);
485
486         rcu_assign_pointer(tp->root, cp);
487
488         if (r == &new_filter_result) {
489                 struct tcindex_filter *nfp;
490                 struct tcindex_filter __rcu **fp;
491
492                 f->result.res = r->res;
493                 tcf_exts_change(&f->result.exts, &r->exts);
494
495                 fp = cp->h + (handle % cp->hash);
496                 for (nfp = rtnl_dereference(*fp);
497                      nfp;
498                      fp = &nfp->next, nfp = rtnl_dereference(*fp))
499                                 ; /* nothing */
500
501                 rcu_assign_pointer(*fp, f);
502         } else {
503                 tcf_exts_destroy(&new_filter_result.exts);
504         }
505
506         if (oldp)
507                 tcf_queue_work(&oldp->rwork, tcindex_partial_destroy_work);
508         return 0;
509
510 errout_alloc:
511         if (balloc == 1)
512                 tcindex_free_perfect_hash(cp);
513         else if (balloc == 2)
514                 kfree(cp->h);
515         tcf_exts_destroy(&new_filter_result.exts);
516 errout:
517         kfree(cp);
518         tcf_exts_destroy(&e);
519         return err;
520 }
521
522 static int
523 tcindex_change(struct net *net, struct sk_buff *in_skb,
524                struct tcf_proto *tp, unsigned long base, u32 handle,
525                struct nlattr **tca, void **arg, u32 flags,
526                struct netlink_ext_ack *extack)
527 {
528         struct nlattr *opt = tca[TCA_OPTIONS];
529         struct nlattr *tb[TCA_TCINDEX_MAX + 1];
530         struct tcindex_data *p = rtnl_dereference(tp->root);
531         struct tcindex_filter_result *r = *arg;
532         int err;
533
534         pr_debug("tcindex_change(tp %p,handle 0x%08x,tca %p,arg %p),opt %p,"
535             "p %p,r %p,*arg %p\n",
536             tp, handle, tca, arg, opt, p, r, *arg);
537
538         if (!opt)
539                 return 0;
540
541         err = nla_parse_nested_deprecated(tb, TCA_TCINDEX_MAX, opt,
542                                           tcindex_policy, NULL);
543         if (err < 0)
544                 return err;
545
546         return tcindex_set_parms(net, tp, base, handle, p, r, tb,
547                                  tca[TCA_RATE], flags, extack);
548 }
549
550 static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker,
551                          bool rtnl_held)
552 {
553         struct tcindex_data *p = rtnl_dereference(tp->root);
554         struct tcindex_filter *f, *next;
555         int i;
556
557         pr_debug("tcindex_walk(tp %p,walker %p),p %p\n", tp, walker, p);
558         if (p->perfect) {
559                 for (i = 0; i < p->hash; i++) {
560                         if (!p->perfect[i].res.class)
561                                 continue;
562                         if (!tc_cls_stats_dump(tp, walker, p->perfect + i))
563                                 return;
564                 }
565         }
566         if (!p->h)
567                 return;
568         for (i = 0; i < p->hash; i++) {
569                 for (f = rtnl_dereference(p->h[i]); f; f = next) {
570                         next = rtnl_dereference(f->next);
571                         if (!tc_cls_stats_dump(tp, walker, &f->result))
572                                 return;
573                 }
574         }
575 }
576
577 static void tcindex_destroy(struct tcf_proto *tp, bool rtnl_held,
578                             struct netlink_ext_ack *extack)
579 {
580         struct tcindex_data *p = rtnl_dereference(tp->root);
581         int i;
582
583         pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p);
584
585         if (p->perfect) {
586                 for (i = 0; i < p->hash; i++) {
587                         struct tcindex_filter_result *r = p->perfect + i;
588
589                         /* tcf_queue_work() does not guarantee the ordering we
590                          * want, so we have to take this refcnt temporarily to
591                          * ensure 'p' is freed after all tcindex_filter_result
592                          * here. Imperfect hash does not need this, because it
593                          * uses linked lists rather than an array.
594                          */
595                         tcindex_data_get(p);
596
597                         tcf_unbind_filter(tp, &r->res);
598                         if (tcf_exts_get_net(&r->exts))
599                                 tcf_queue_work(&r->rwork,
600                                                tcindex_destroy_rexts_work);
601                         else
602                                 __tcindex_destroy_rexts(r);
603                 }
604         }
605
606         for (i = 0; p->h && i < p->hash; i++) {
607                 struct tcindex_filter *f, *next;
608                 bool last;
609
610                 for (f = rtnl_dereference(p->h[i]); f; f = next) {
611                         next = rtnl_dereference(f->next);
612                         tcindex_delete(tp, &f->result, &last, rtnl_held, NULL);
613                 }
614         }
615
616         tcf_queue_work(&p->rwork, tcindex_destroy_work);
617 }
618
619
620 static int tcindex_dump(struct net *net, struct tcf_proto *tp, void *fh,
621                         struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
622 {
623         struct tcindex_data *p = rtnl_dereference(tp->root);
624         struct tcindex_filter_result *r = fh;
625         struct nlattr *nest;
626
627         pr_debug("tcindex_dump(tp %p,fh %p,skb %p,t %p),p %p,r %p\n",
628                  tp, fh, skb, t, p, r);
629         pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h);
630
631         nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
632         if (nest == NULL)
633                 goto nla_put_failure;
634
635         if (!fh) {
636                 t->tcm_handle = ~0; /* whatever ... */
637                 if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) ||
638                     nla_put_u16(skb, TCA_TCINDEX_MASK, p->mask) ||
639                     nla_put_u32(skb, TCA_TCINDEX_SHIFT, p->shift) ||
640                     nla_put_u32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through))
641                         goto nla_put_failure;
642                 nla_nest_end(skb, nest);
643         } else {
644                 if (p->perfect) {
645                         t->tcm_handle = r - p->perfect;
646                 } else {
647                         struct tcindex_filter *f;
648                         struct tcindex_filter __rcu **fp;
649                         int i;
650
651                         t->tcm_handle = 0;
652                         for (i = 0; !t->tcm_handle && i < p->hash; i++) {
653                                 fp = &p->h[i];
654                                 for (f = rtnl_dereference(*fp);
655                                      !t->tcm_handle && f;
656                                      fp = &f->next, f = rtnl_dereference(*fp)) {
657                                         if (&f->result == r)
658                                                 t->tcm_handle = f->key;
659                                 }
660                         }
661                 }
662                 pr_debug("handle = %d\n", t->tcm_handle);
663                 if (r->res.class &&
664                     nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid))
665                         goto nla_put_failure;
666
667                 if (tcf_exts_dump(skb, &r->exts) < 0)
668                         goto nla_put_failure;
669                 nla_nest_end(skb, nest);
670
671                 if (tcf_exts_dump_stats(skb, &r->exts) < 0)
672                         goto nla_put_failure;
673         }
674
675         return skb->len;
676
677 nla_put_failure:
678         nla_nest_cancel(skb, nest);
679         return -1;
680 }
681
682 static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl,
683                                void *q, unsigned long base)
684 {
685         struct tcindex_filter_result *r = fh;
686
687         tc_cls_bind_class(classid, cl, q, &r->res, base);
688 }
689
690 static struct tcf_proto_ops cls_tcindex_ops __read_mostly = {
691         .kind           =       "tcindex",
692         .classify       =       tcindex_classify,
693         .init           =       tcindex_init,
694         .destroy        =       tcindex_destroy,
695         .get            =       tcindex_get,
696         .change         =       tcindex_change,
697         .delete         =       tcindex_delete,
698         .walk           =       tcindex_walk,
699         .dump           =       tcindex_dump,
700         .bind_class     =       tcindex_bind_class,
701         .owner          =       THIS_MODULE,
702 };
703
704 static int __init init_tcindex(void)
705 {
706         return register_tcf_proto_ops(&cls_tcindex_ops);
707 }
708
709 static void __exit exit_tcindex(void)
710 {
711         unregister_tcf_proto_ops(&cls_tcindex_ops);
712 }
713
714 module_init(init_tcindex)
715 module_exit(exit_tcindex)
716 MODULE_LICENSE("GPL");
This page took 0.078228 seconds and 4 git commands to generate.