Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 1 | /* |
| 2 | * net/sched/cls_matchll.c Match-all classifier |
| 3 | * |
| 4 | * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | |
| 16 | #include <net/sch_generic.h> |
| 17 | #include <net/pkt_cls.h> |
| 18 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 19 | struct cls_mall_head { |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 20 | struct tcf_exts exts; |
| 21 | struct tcf_result res; |
| 22 | u32 handle; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 23 | u32 flags; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 24 | struct rcu_head rcu; |
| 25 | }; |
| 26 | |
| 27 | static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
| 28 | struct tcf_result *res) |
| 29 | { |
| 30 | struct cls_mall_head *head = rcu_dereference_bh(tp->root); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 31 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 32 | if (tc_skip_sw(head->flags)) |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 33 | return -1; |
| 34 | |
Davide Caratti | 3ff4cbe | 2017-09-16 14:02:21 +0200 | [diff] [blame] | 35 | *res = head->res; |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 36 | return tcf_exts_exec(skb, &head->exts, res); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | static int mall_init(struct tcf_proto *tp) |
| 40 | { |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 41 | return 0; |
| 42 | } |
| 43 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 44 | static void mall_destroy_rcu(struct rcu_head *rcu) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 45 | { |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 46 | struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, |
| 47 | rcu); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 48 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 49 | tcf_exts_destroy(&head->exts); |
| 50 | kfree(head); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 51 | } |
| 52 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 53 | static void mall_destroy_hw_filter(struct tcf_proto *tp, |
| 54 | struct cls_mall_head *head, |
| 55 | unsigned long cookie) |
| 56 | { |
| 57 | struct net_device *dev = tp->q->dev_queue->dev; |
| 58 | struct tc_cls_matchall_offload cls_mall = {}; |
| 59 | struct tcf_block *block = tp->chain->block; |
| 60 | |
| 61 | tc_cls_common_offload_init(&cls_mall.common, tp); |
| 62 | cls_mall.command = TC_CLSMATCHALL_DESTROY; |
| 63 | cls_mall.cookie = cookie; |
| 64 | |
| 65 | if (tc_can_offload(dev)) |
| 66 | dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL, |
| 67 | &cls_mall); |
| 68 | tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, &cls_mall, false); |
| 69 | } |
| 70 | |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 71 | static int mall_replace_hw_filter(struct tcf_proto *tp, |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 72 | struct cls_mall_head *head, |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 73 | unsigned long cookie) |
| 74 | { |
| 75 | struct net_device *dev = tp->q->dev_queue->dev; |
Jiri Pirko | de4784c | 2017-08-07 10:15:32 +0200 | [diff] [blame] | 76 | struct tc_cls_matchall_offload cls_mall = {}; |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 77 | struct tcf_block *block = tp->chain->block; |
| 78 | bool skip_sw = tc_skip_sw(head->flags); |
Or Gerlitz | c7d2b2f | 2017-02-16 10:31:14 +0200 | [diff] [blame] | 79 | int err; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 80 | |
Jiri Pirko | de4784c | 2017-08-07 10:15:32 +0200 | [diff] [blame] | 81 | tc_cls_common_offload_init(&cls_mall.common, tp); |
| 82 | cls_mall.command = TC_CLSMATCHALL_REPLACE; |
| 83 | cls_mall.exts = &head->exts; |
| 84 | cls_mall.cookie = cookie; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 85 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 86 | if (tc_can_offload(dev)) { |
| 87 | err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL, |
| 88 | &cls_mall); |
| 89 | if (err) { |
| 90 | if (skip_sw) |
| 91 | return err; |
| 92 | } else { |
| 93 | head->flags |= TCA_CLS_FLAGS_IN_HW; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSMATCHALL, |
| 98 | &cls_mall, skip_sw); |
| 99 | if (err < 0) { |
| 100 | mall_destroy_hw_filter(tp, head, cookie); |
| 101 | return err; |
| 102 | } else if (err > 0) { |
Or Gerlitz | c7d2b2f | 2017-02-16 10:31:14 +0200 | [diff] [blame] | 103 | head->flags |= TCA_CLS_FLAGS_IN_HW; |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 104 | } |
Or Gerlitz | c7d2b2f | 2017-02-16 10:31:14 +0200 | [diff] [blame] | 105 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 106 | if (skip_sw && !(head->flags & TCA_CLS_FLAGS_IN_HW)) |
| 107 | return -EINVAL; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 108 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 109 | return 0; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 110 | } |
| 111 | |
WANG Cong | 763dbf6 | 2017-04-19 14:21:21 -0700 | [diff] [blame] | 112 | static void mall_destroy(struct tcf_proto *tp) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 113 | { |
| 114 | struct cls_mall_head *head = rtnl_dereference(tp->root); |
| 115 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 116 | if (!head) |
WANG Cong | 763dbf6 | 2017-04-19 14:21:21 -0700 | [diff] [blame] | 117 | return; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 118 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 119 | if (!tc_skip_hw(head->flags)) |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 120 | mall_destroy_hw_filter(tp, head, (unsigned long) head); |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 121 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 122 | call_rcu(&head->rcu, mall_destroy_rcu); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 123 | } |
| 124 | |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 125 | static void *mall_get(struct tcf_proto *tp, u32 handle) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 126 | { |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 127 | return NULL; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = { |
| 131 | [TCA_MATCHALL_UNSPEC] = { .type = NLA_UNSPEC }, |
| 132 | [TCA_MATCHALL_CLASSID] = { .type = NLA_U32 }, |
| 133 | }; |
| 134 | |
| 135 | static int mall_set_parms(struct net *net, struct tcf_proto *tp, |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 136 | struct cls_mall_head *head, |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 137 | unsigned long base, struct nlattr **tb, |
| 138 | struct nlattr *est, bool ovr) |
| 139 | { |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 140 | int err; |
| 141 | |
Jiri Pirko | a74cb36 | 2017-08-04 14:29:08 +0200 | [diff] [blame] | 142 | err = tcf_exts_validate(net, tp, tb, est, &head->exts, ovr); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 143 | if (err < 0) |
Jiri Pirko | a74cb36 | 2017-08-04 14:29:08 +0200 | [diff] [blame] | 144 | return err; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 145 | |
| 146 | if (tb[TCA_MATCHALL_CLASSID]) { |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 147 | head->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]); |
| 148 | tcf_bind_filter(tp, &head->res, base); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 149 | } |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 150 | return 0; |
| 151 | } |
| 152 | |
| 153 | static int mall_change(struct net *net, struct sk_buff *in_skb, |
| 154 | struct tcf_proto *tp, unsigned long base, |
| 155 | u32 handle, struct nlattr **tca, |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 156 | void **arg, bool ovr) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 157 | { |
| 158 | struct cls_mall_head *head = rtnl_dereference(tp->root); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 159 | struct nlattr *tb[TCA_MATCHALL_MAX + 1]; |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 160 | struct cls_mall_head *new; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 161 | u32 flags = 0; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 162 | int err; |
| 163 | |
| 164 | if (!tca[TCA_OPTIONS]) |
| 165 | return -EINVAL; |
| 166 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 167 | if (head) |
| 168 | return -EEXIST; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 169 | |
Johannes Berg | fceb643 | 2017-04-12 14:34:07 +0200 | [diff] [blame] | 170 | err = nla_parse_nested(tb, TCA_MATCHALL_MAX, tca[TCA_OPTIONS], |
| 171 | mall_policy, NULL); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 172 | if (err < 0) |
| 173 | return err; |
| 174 | |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 175 | if (tb[TCA_MATCHALL_FLAGS]) { |
| 176 | flags = nla_get_u32(tb[TCA_MATCHALL_FLAGS]); |
| 177 | if (!tc_flags_valid(flags)) |
| 178 | return -EINVAL; |
| 179 | } |
| 180 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 181 | new = kzalloc(sizeof(*new), GFP_KERNEL); |
| 182 | if (!new) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 183 | return -ENOBUFS; |
| 184 | |
David S. Miller | e216015 | 2017-02-02 16:54:00 -0500 | [diff] [blame] | 185 | err = tcf_exts_init(&new->exts, TCA_MATCHALL_ACT, 0); |
Yotam Gigi | ec2507d | 2017-01-03 19:20:24 +0200 | [diff] [blame] | 186 | if (err) |
| 187 | goto err_exts_init; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 188 | |
| 189 | if (!handle) |
| 190 | handle = 1; |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 191 | new->handle = handle; |
| 192 | new->flags = flags; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 193 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 194 | err = mall_set_parms(net, tp, new, base, tb, tca[TCA_RATE], ovr); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 195 | if (err) |
Yotam Gigi | ec2507d | 2017-01-03 19:20:24 +0200 | [diff] [blame] | 196 | goto err_set_parms; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 197 | |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 198 | if (!tc_skip_hw(new->flags)) { |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 199 | err = mall_replace_hw_filter(tp, new, (unsigned long) new); |
Jiri Pirko | 2447a96 | 2017-10-19 15:50:33 +0200 | [diff] [blame^] | 200 | if (err) |
| 201 | goto err_replace_hw_filter; |
Yotam Gigi | b87f793 | 2016-07-21 12:03:12 +0200 | [diff] [blame] | 202 | } |
| 203 | |
Or Gerlitz | c7d2b2f | 2017-02-16 10:31:14 +0200 | [diff] [blame] | 204 | if (!tc_in_hw(new->flags)) |
| 205 | new->flags |= TCA_CLS_FLAGS_NOT_IN_HW; |
| 206 | |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 207 | *arg = head; |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 208 | rcu_assign_pointer(tp->root, new); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 209 | return 0; |
| 210 | |
Yotam Gigi | ec2507d | 2017-01-03 19:20:24 +0200 | [diff] [blame] | 211 | err_replace_hw_filter: |
| 212 | err_set_parms: |
David S. Miller | e216015 | 2017-02-02 16:54:00 -0500 | [diff] [blame] | 213 | tcf_exts_destroy(&new->exts); |
Yotam Gigi | ec2507d | 2017-01-03 19:20:24 +0200 | [diff] [blame] | 214 | err_exts_init: |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 215 | kfree(new); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 216 | return err; |
| 217 | } |
| 218 | |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 219 | static int mall_delete(struct tcf_proto *tp, void *arg, bool *last) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 220 | { |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 221 | return -EOPNOTSUPP; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | static void mall_walk(struct tcf_proto *tp, struct tcf_walker *arg) |
| 225 | { |
| 226 | struct cls_mall_head *head = rtnl_dereference(tp->root); |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 227 | |
| 228 | if (arg->count < arg->skip) |
| 229 | goto skip; |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 230 | if (arg->fn(tp, head, arg) < 0) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 231 | arg->stop = 1; |
| 232 | skip: |
| 233 | arg->count++; |
| 234 | } |
| 235 | |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 236 | static int mall_dump(struct net *net, struct tcf_proto *tp, void *fh, |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 237 | struct sk_buff *skb, struct tcmsg *t) |
| 238 | { |
WANG Cong | 8113c09 | 2017-08-04 21:31:43 -0700 | [diff] [blame] | 239 | struct cls_mall_head *head = fh; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 240 | struct nlattr *nest; |
| 241 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 242 | if (!head) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 243 | return skb->len; |
| 244 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 245 | t->tcm_handle = head->handle; |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 246 | |
| 247 | nest = nla_nest_start(skb, TCA_OPTIONS); |
| 248 | if (!nest) |
| 249 | goto nla_put_failure; |
| 250 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 251 | if (head->res.classid && |
| 252 | nla_put_u32(skb, TCA_MATCHALL_CLASSID, head->res.classid)) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 253 | goto nla_put_failure; |
| 254 | |
Or Gerlitz | 7a335ad | 2017-02-16 10:31:11 +0200 | [diff] [blame] | 255 | if (head->flags && nla_put_u32(skb, TCA_MATCHALL_FLAGS, head->flags)) |
| 256 | goto nla_put_failure; |
| 257 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 258 | if (tcf_exts_dump(skb, &head->exts)) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 259 | goto nla_put_failure; |
| 260 | |
| 261 | nla_nest_end(skb, nest); |
| 262 | |
Yotam Gigi | fd62d9f | 2017-01-31 15:14:29 +0200 | [diff] [blame] | 263 | if (tcf_exts_dump_stats(skb, &head->exts) < 0) |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 264 | goto nla_put_failure; |
| 265 | |
| 266 | return skb->len; |
| 267 | |
| 268 | nla_put_failure: |
| 269 | nla_nest_cancel(skb, nest); |
| 270 | return -1; |
| 271 | } |
| 272 | |
Cong Wang | 07d79fc | 2017-08-30 14:30:36 -0700 | [diff] [blame] | 273 | static void mall_bind_class(void *fh, u32 classid, unsigned long cl) |
| 274 | { |
| 275 | struct cls_mall_head *head = fh; |
| 276 | |
| 277 | if (head && head->res.classid == classid) |
| 278 | head->res.class = cl; |
| 279 | } |
| 280 | |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 281 | static struct tcf_proto_ops cls_mall_ops __read_mostly = { |
| 282 | .kind = "matchall", |
| 283 | .classify = mall_classify, |
| 284 | .init = mall_init, |
| 285 | .destroy = mall_destroy, |
| 286 | .get = mall_get, |
| 287 | .change = mall_change, |
| 288 | .delete = mall_delete, |
| 289 | .walk = mall_walk, |
| 290 | .dump = mall_dump, |
Cong Wang | 07d79fc | 2017-08-30 14:30:36 -0700 | [diff] [blame] | 291 | .bind_class = mall_bind_class, |
Jiri Pirko | bf3994d | 2016-07-21 12:03:11 +0200 | [diff] [blame] | 292 | .owner = THIS_MODULE, |
| 293 | }; |
| 294 | |
| 295 | static int __init cls_mall_init(void) |
| 296 | { |
| 297 | return register_tcf_proto_ops(&cls_mall_ops); |
| 298 | } |
| 299 | |
| 300 | static void __exit cls_mall_exit(void) |
| 301 | { |
| 302 | unregister_tcf_proto_ops(&cls_mall_ops); |
| 303 | } |
| 304 | |
| 305 | module_init(cls_mall_init); |
| 306 | module_exit(cls_mall_exit); |
| 307 | |
| 308 | MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>"); |
| 309 | MODULE_DESCRIPTION("Match-all classifier"); |
| 310 | MODULE_LICENSE("GPL v2"); |