cls_tcindex.c 16 KB

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