]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __NET_PKT_CLS_H |
2 | #define __NET_PKT_CLS_H | |
3 | ||
4 | #include <linux/pkt_cls.h> | |
5 | #include <net/sch_generic.h> | |
6 | #include <net/act_api.h> | |
7 | ||
8 | /* Basic packet classifier frontend definitions. */ | |
9 | ||
fd2c3ef7 | 10 | struct tcf_walker { |
1da177e4 LT |
11 | int stop; |
12 | int skip; | |
13 | int count; | |
14 | int (*fn)(struct tcf_proto *, unsigned long node, struct tcf_walker *); | |
15 | }; | |
16 | ||
5c15257f JP |
17 | int register_tcf_proto_ops(struct tcf_proto_ops *ops); |
18 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops); | |
1da177e4 | 19 | |
8ae70032 | 20 | #ifdef CONFIG_NET_CLS |
367a8ce8 WC |
21 | struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, |
22 | bool create); | |
5bc17018 | 23 | void tcf_chain_put(struct tcf_chain *chain); |
6529eaba JP |
24 | int tcf_block_get(struct tcf_block **p_block, |
25 | struct tcf_proto __rcu **p_filter_chain); | |
26 | void tcf_block_put(struct tcf_block *block); | |
87d83093 JP |
27 | int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
28 | struct tcf_result *res, bool compat_mode); | |
29 | ||
8ae70032 | 30 | #else |
6529eaba JP |
31 | static inline |
32 | int tcf_block_get(struct tcf_block **p_block, | |
33 | struct tcf_proto __rcu **p_filter_chain) | |
34 | { | |
35 | return 0; | |
36 | } | |
37 | ||
38 | static inline void tcf_block_put(struct tcf_block *block) | |
8ae70032 JP |
39 | { |
40 | } | |
87d83093 JP |
41 | |
42 | static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |
43 | struct tcf_result *res, bool compat_mode) | |
44 | { | |
45 | return TC_ACT_UNSPEC; | |
46 | } | |
8ae70032 | 47 | #endif |
cf1facda | 48 | |
1da177e4 LT |
49 | static inline unsigned long |
50 | __cls_set_class(unsigned long *clp, unsigned long cl) | |
51 | { | |
a0efb80c | 52 | return xchg(clp, cl); |
1da177e4 LT |
53 | } |
54 | ||
55 | static inline unsigned long | |
56 | cls_set_class(struct tcf_proto *tp, unsigned long *clp, | |
57 | unsigned long cl) | |
58 | { | |
59 | unsigned long old_cl; | |
60 | ||
61 | tcf_tree_lock(tp); | |
62 | old_cl = __cls_set_class(clp, cl); | |
63 | tcf_tree_unlock(tp); | |
64 | ||
65 | return old_cl; | |
66 | } | |
67 | ||
68 | static inline void | |
69 | tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base) | |
70 | { | |
71 | unsigned long cl; | |
72 | ||
73 | cl = tp->q->ops->cl_ops->bind_tcf(tp->q, base, r->classid); | |
74 | cl = cls_set_class(tp, &r->class, cl); | |
75 | if (cl) | |
76 | tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); | |
77 | } | |
78 | ||
79 | static inline void | |
80 | tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) | |
81 | { | |
82 | unsigned long cl; | |
83 | ||
84 | if ((cl = __cls_set_class(&r->class, 0)) != 0) | |
85 | tp->q->ops->cl_ops->unbind_tcf(tp->q, cl); | |
86 | } | |
87 | ||
fd2c3ef7 | 88 | struct tcf_exts { |
1da177e4 | 89 | #ifdef CONFIG_NET_CLS_ACT |
33be6271 | 90 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
22dc13c8 WC |
91 | int nr_actions; |
92 | struct tc_action **actions; | |
1da177e4 | 93 | #endif |
5da57f42 WC |
94 | /* Map to export classifier specific extension TLV types to the |
95 | * generic extensions API. Unsupported extensions must be set to 0. | |
96 | */ | |
1da177e4 LT |
97 | int action; |
98 | int police; | |
99 | }; | |
100 | ||
b9a24bb7 | 101 | static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police) |
33be6271 WC |
102 | { |
103 | #ifdef CONFIG_NET_CLS_ACT | |
5da57f42 | 104 | exts->type = 0; |
22dc13c8 WC |
105 | exts->nr_actions = 0; |
106 | exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *), | |
107 | GFP_KERNEL); | |
b9a24bb7 WC |
108 | if (!exts->actions) |
109 | return -ENOMEM; | |
33be6271 | 110 | #endif |
5da57f42 WC |
111 | exts->action = action; |
112 | exts->police = police; | |
b9a24bb7 | 113 | return 0; |
33be6271 WC |
114 | } |
115 | ||
1da177e4 LT |
116 | /** |
117 | * tcf_exts_is_predicative - check if a predicative extension is present | |
118 | * @exts: tc filter extensions handle | |
119 | * | |
120 | * Returns 1 if a predicative extension is present, i.e. an extension which | |
121 | * might cause further actions and thus overrule the regular tcf_result. | |
122 | */ | |
123 | static inline int | |
124 | tcf_exts_is_predicative(struct tcf_exts *exts) | |
125 | { | |
126 | #ifdef CONFIG_NET_CLS_ACT | |
22dc13c8 | 127 | return exts->nr_actions; |
1da177e4 LT |
128 | #else |
129 | return 0; | |
130 | #endif | |
131 | } | |
132 | ||
133 | /** | |
134 | * tcf_exts_is_available - check if at least one extension is present | |
135 | * @exts: tc filter extensions handle | |
136 | * | |
137 | * Returns 1 if at least one extension is present. | |
138 | */ | |
139 | static inline int | |
140 | tcf_exts_is_available(struct tcf_exts *exts) | |
141 | { | |
142 | /* All non-predicative extensions must be added here. */ | |
143 | return tcf_exts_is_predicative(exts); | |
144 | } | |
145 | ||
22dc13c8 WC |
146 | static inline void tcf_exts_to_list(const struct tcf_exts *exts, |
147 | struct list_head *actions) | |
148 | { | |
149 | #ifdef CONFIG_NET_CLS_ACT | |
150 | int i; | |
151 | ||
152 | for (i = 0; i < exts->nr_actions; i++) { | |
153 | struct tc_action *a = exts->actions[i]; | |
154 | ||
fa5effe7 | 155 | list_add_tail(&a->list, actions); |
22dc13c8 WC |
156 | } |
157 | #endif | |
158 | } | |
159 | ||
1da177e4 LT |
160 | /** |
161 | * tcf_exts_exec - execute tc filter extensions | |
162 | * @skb: socket buffer | |
163 | * @exts: tc filter extensions handle | |
164 | * @res: desired result | |
165 | * | |
166 | * Executes all configured extensions. Returns 0 on a normal execution, | |
167 | * a negative number if the filter must be considered unmatched or | |
168 | * a positive action code (TC_ACT_*) which must be returned to the | |
169 | * underlying layer. | |
170 | */ | |
171 | static inline int | |
172 | tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, | |
173 | struct tcf_result *res) | |
174 | { | |
175 | #ifdef CONFIG_NET_CLS_ACT | |
22dc13c8 WC |
176 | if (exts->nr_actions) |
177 | return tcf_action_exec(skb, exts->actions, exts->nr_actions, | |
178 | res); | |
1da177e4 | 179 | #endif |
1da177e4 LT |
180 | return 0; |
181 | } | |
182 | ||
2734437e WC |
183 | #ifdef CONFIG_NET_CLS_ACT |
184 | ||
22dc13c8 WC |
185 | #define tc_no_actions(_exts) ((_exts)->nr_actions == 0) |
186 | #define tc_single_action(_exts) ((_exts)->nr_actions == 1) | |
2734437e WC |
187 | |
188 | #else /* CONFIG_NET_CLS_ACT */ | |
189 | ||
190 | #define tc_no_actions(_exts) true | |
2734437e WC |
191 | #define tc_single_action(_exts) false |
192 | ||
193 | #endif /* CONFIG_NET_CLS_ACT */ | |
194 | ||
5c15257f JP |
195 | int tcf_exts_validate(struct net *net, struct tcf_proto *tp, |
196 | struct nlattr **tb, struct nlattr *rate_tlv, | |
2f7ef2f8 | 197 | struct tcf_exts *exts, bool ovr); |
18d0264f | 198 | void tcf_exts_destroy(struct tcf_exts *exts); |
5c15257f JP |
199 | void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
200 | struct tcf_exts *src); | |
5da57f42 WC |
201 | int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts); |
202 | int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts); | |
7091d8c7 HHZ |
203 | int tcf_exts_get_dev(struct net_device *dev, struct tcf_exts *exts, |
204 | struct net_device **hw_dev); | |
1da177e4 LT |
205 | |
206 | /** | |
207 | * struct tcf_pkt_info - packet information | |
208 | */ | |
fd2c3ef7 | 209 | struct tcf_pkt_info { |
1da177e4 LT |
210 | unsigned char * ptr; |
211 | int nexthdr; | |
212 | }; | |
213 | ||
214 | #ifdef CONFIG_NET_EMATCH | |
215 | ||
216 | struct tcf_ematch_ops; | |
217 | ||
218 | /** | |
219 | * struct tcf_ematch - extended match (ematch) | |
220 | * | |
221 | * @matchid: identifier to allow userspace to reidentify a match | |
222 | * @flags: flags specifying attributes and the relation to other matches | |
223 | * @ops: the operations lookup table of the corresponding ematch module | |
224 | * @datalen: length of the ematch specific configuration data | |
225 | * @data: ematch specific data | |
226 | */ | |
fd2c3ef7 | 227 | struct tcf_ematch { |
1da177e4 LT |
228 | struct tcf_ematch_ops * ops; |
229 | unsigned long data; | |
230 | unsigned int datalen; | |
231 | u16 matchid; | |
232 | u16 flags; | |
82a470f1 | 233 | struct net *net; |
1da177e4 LT |
234 | }; |
235 | ||
236 | static inline int tcf_em_is_container(struct tcf_ematch *em) | |
237 | { | |
238 | return !em->ops; | |
239 | } | |
240 | ||
241 | static inline int tcf_em_is_simple(struct tcf_ematch *em) | |
242 | { | |
243 | return em->flags & TCF_EM_SIMPLE; | |
244 | } | |
245 | ||
246 | static inline int tcf_em_is_inverted(struct tcf_ematch *em) | |
247 | { | |
248 | return em->flags & TCF_EM_INVERT; | |
249 | } | |
250 | ||
251 | static inline int tcf_em_last_match(struct tcf_ematch *em) | |
252 | { | |
253 | return (em->flags & TCF_EM_REL_MASK) == TCF_EM_REL_END; | |
254 | } | |
255 | ||
256 | static inline int tcf_em_early_end(struct tcf_ematch *em, int result) | |
257 | { | |
258 | if (tcf_em_last_match(em)) | |
259 | return 1; | |
260 | ||
261 | if (result == 0 && em->flags & TCF_EM_REL_AND) | |
262 | return 1; | |
263 | ||
264 | if (result != 0 && em->flags & TCF_EM_REL_OR) | |
265 | return 1; | |
266 | ||
267 | return 0; | |
268 | } | |
269 | ||
270 | /** | |
271 | * struct tcf_ematch_tree - ematch tree handle | |
272 | * | |
273 | * @hdr: ematch tree header supplied by userspace | |
274 | * @matches: array of ematches | |
275 | */ | |
fd2c3ef7 | 276 | struct tcf_ematch_tree { |
1da177e4 LT |
277 | struct tcf_ematch_tree_hdr hdr; |
278 | struct tcf_ematch * matches; | |
279 | ||
280 | }; | |
281 | ||
282 | /** | |
283 | * struct tcf_ematch_ops - ematch module operations | |
284 | * | |
285 | * @kind: identifier (kind) of this ematch module | |
286 | * @datalen: length of expected configuration data (optional) | |
287 | * @change: called during validation (optional) | |
288 | * @match: called during ematch tree evaluation, must return 1/0 | |
289 | * @destroy: called during destroyage (optional) | |
290 | * @dump: called during dumping process (optional) | |
291 | * @owner: owner, must be set to THIS_MODULE | |
292 | * @link: link to previous/next ematch module (internal use) | |
293 | */ | |
fd2c3ef7 | 294 | struct tcf_ematch_ops { |
1da177e4 LT |
295 | int kind; |
296 | int datalen; | |
82a470f1 | 297 | int (*change)(struct net *net, void *, |
1da177e4 LT |
298 | int, struct tcf_ematch *); |
299 | int (*match)(struct sk_buff *, struct tcf_ematch *, | |
300 | struct tcf_pkt_info *); | |
82a470f1 | 301 | void (*destroy)(struct tcf_ematch *); |
1da177e4 LT |
302 | int (*dump)(struct sk_buff *, struct tcf_ematch *); |
303 | struct module *owner; | |
304 | struct list_head link; | |
305 | }; | |
306 | ||
5c15257f JP |
307 | int tcf_em_register(struct tcf_ematch_ops *); |
308 | void tcf_em_unregister(struct tcf_ematch_ops *); | |
309 | int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, | |
310 | struct tcf_ematch_tree *); | |
82a470f1 | 311 | void tcf_em_tree_destroy(struct tcf_ematch_tree *); |
5c15257f JP |
312 | int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); |
313 | int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *, | |
314 | struct tcf_pkt_info *); | |
1da177e4 LT |
315 | |
316 | /** | |
317 | * tcf_em_tree_change - replace ematch tree of a running classifier | |
318 | * | |
319 | * @tp: classifier kind handle | |
320 | * @dst: destination ematch tree variable | |
321 | * @src: source ematch tree (temporary tree from tcf_em_tree_validate) | |
322 | * | |
323 | * This functions replaces the ematch tree in @dst with the ematch | |
324 | * tree in @src. The classifier in charge of the ematch tree may be | |
325 | * running. | |
326 | */ | |
327 | static inline void tcf_em_tree_change(struct tcf_proto *tp, | |
328 | struct tcf_ematch_tree *dst, | |
329 | struct tcf_ematch_tree *src) | |
330 | { | |
331 | tcf_tree_lock(tp); | |
332 | memcpy(dst, src, sizeof(*dst)); | |
333 | tcf_tree_unlock(tp); | |
334 | } | |
335 | ||
336 | /** | |
337 | * tcf_em_tree_match - evaulate an ematch tree | |
338 | * | |
339 | * @skb: socket buffer of the packet in question | |
340 | * @tree: ematch tree to be used for evaluation | |
341 | * @info: packet information examined by classifier | |
342 | * | |
343 | * This function matches @skb against the ematch tree in @tree by going | |
344 | * through all ematches respecting their logic relations returning | |
345 | * as soon as the result is obvious. | |
346 | * | |
347 | * Returns 1 if the ematch tree as-one matches, no ematches are configured | |
348 | * or ematch is not enabled in the kernel, otherwise 0 is returned. | |
349 | */ | |
350 | static inline int tcf_em_tree_match(struct sk_buff *skb, | |
351 | struct tcf_ematch_tree *tree, | |
352 | struct tcf_pkt_info *info) | |
353 | { | |
354 | if (tree->hdr.nmatches) | |
355 | return __tcf_em_tree_match(skb, tree, info); | |
356 | else | |
357 | return 1; | |
358 | } | |
359 | ||
db3d99c0 PM |
360 | #define MODULE_ALIAS_TCF_EMATCH(kind) MODULE_ALIAS("ematch-kind-" __stringify(kind)) |
361 | ||
1da177e4 LT |
362 | #else /* CONFIG_NET_EMATCH */ |
363 | ||
fd2c3ef7 | 364 | struct tcf_ematch_tree { |
1da177e4 LT |
365 | }; |
366 | ||
367 | #define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0) | |
82a470f1 | 368 | #define tcf_em_tree_destroy(t) do { (void)(t); } while(0) |
1da177e4 LT |
369 | #define tcf_em_tree_dump(skb, t, tlv) (0) |
370 | #define tcf_em_tree_change(tp, dst, src) do { } while(0) | |
371 | #define tcf_em_tree_match(skb, t, info) ((void)(info), 1) | |
372 | ||
373 | #endif /* CONFIG_NET_EMATCH */ | |
374 | ||
375 | static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer) | |
376 | { | |
377 | switch (layer) { | |
378 | case TCF_LAYER_LINK: | |
379 | return skb->data; | |
380 | case TCF_LAYER_NETWORK: | |
d56f90a7 | 381 | return skb_network_header(skb); |
1da177e4 | 382 | case TCF_LAYER_TRANSPORT: |
9c70220b | 383 | return skb_transport_header(skb); |
1da177e4 LT |
384 | } |
385 | ||
386 | return NULL; | |
387 | } | |
388 | ||
eddc9ec5 ACM |
389 | static inline int tcf_valid_offset(const struct sk_buff *skb, |
390 | const unsigned char *ptr, const int len) | |
1da177e4 | 391 | { |
da521b2c DM |
392 | return likely((ptr + len) <= skb_tail_pointer(skb) && |
393 | ptr >= skb->head && | |
394 | (ptr <= (ptr + len))); | |
1da177e4 LT |
395 | } |
396 | ||
397 | #ifdef CONFIG_NET_CLS_IND | |
0eeb8ffc DL |
398 | #include <net/net_namespace.h> |
399 | ||
1da177e4 | 400 | static inline int |
2519a602 | 401 | tcf_change_indev(struct net *net, struct nlattr *indev_tlv) |
1da177e4 | 402 | { |
2519a602 WC |
403 | char indev[IFNAMSIZ]; |
404 | struct net_device *dev; | |
405 | ||
add93b61 | 406 | if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) |
1da177e4 | 407 | return -EINVAL; |
2519a602 WC |
408 | dev = __dev_get_by_name(net, indev); |
409 | if (!dev) | |
410 | return -ENODEV; | |
411 | return dev->ifindex; | |
1da177e4 LT |
412 | } |
413 | ||
2519a602 WC |
414 | static inline bool |
415 | tcf_match_indev(struct sk_buff *skb, int ifindex) | |
1da177e4 | 416 | { |
2519a602 WC |
417 | if (!ifindex) |
418 | return true; | |
419 | if (!skb->skb_iif) | |
420 | return false; | |
421 | return ifindex == skb->skb_iif; | |
1da177e4 LT |
422 | } |
423 | #endif /* CONFIG_NET_CLS_IND */ | |
424 | ||
a1b7c5fd JF |
425 | struct tc_cls_u32_knode { |
426 | struct tcf_exts *exts; | |
e014860e | 427 | struct tc_u32_sel *sel; |
a1b7c5fd JF |
428 | u32 handle; |
429 | u32 val; | |
430 | u32 mask; | |
431 | u32 link_handle; | |
e014860e | 432 | u8 fshift; |
a1b7c5fd JF |
433 | }; |
434 | ||
435 | struct tc_cls_u32_hnode { | |
436 | u32 handle; | |
437 | u32 prio; | |
438 | unsigned int divisor; | |
439 | }; | |
440 | ||
441 | enum tc_clsu32_command { | |
442 | TC_CLSU32_NEW_KNODE, | |
443 | TC_CLSU32_REPLACE_KNODE, | |
444 | TC_CLSU32_DELETE_KNODE, | |
445 | TC_CLSU32_NEW_HNODE, | |
446 | TC_CLSU32_REPLACE_HNODE, | |
447 | TC_CLSU32_DELETE_HNODE, | |
448 | }; | |
449 | ||
450 | struct tc_cls_u32_offload { | |
451 | /* knode values */ | |
452 | enum tc_clsu32_command command; | |
453 | union { | |
454 | struct tc_cls_u32_knode knode; | |
455 | struct tc_cls_u32_hnode hnode; | |
456 | }; | |
457 | }; | |
458 | ||
55330f05 HHZ |
459 | static inline bool tc_can_offload(const struct net_device *dev, |
460 | const struct tcf_proto *tp) | |
6843e7a2 | 461 | { |
92c075db DB |
462 | const struct Qdisc *sch = tp->q; |
463 | const struct Qdisc_class_ops *cops = sch->ops->cl_ops; | |
464 | ||
2b6ab0d3 JF |
465 | if (!(dev->features & NETIF_F_HW_TC)) |
466 | return false; | |
9e8ce79c JF |
467 | if (!dev->netdev_ops->ndo_setup_tc) |
468 | return false; | |
92c075db DB |
469 | if (cops && cops->tcf_cl_offload) |
470 | return cops->tcf_cl_offload(tp->classid); | |
9e8ce79c JF |
471 | |
472 | return true; | |
6843e7a2 JF |
473 | } |
474 | ||
55330f05 HHZ |
475 | static inline bool tc_skip_hw(u32 flags) |
476 | { | |
477 | return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false; | |
478 | } | |
479 | ||
480 | static inline bool tc_should_offload(const struct net_device *dev, | |
481 | const struct tcf_proto *tp, u32 flags) | |
482 | { | |
483 | if (tc_skip_hw(flags)) | |
484 | return false; | |
485 | return tc_can_offload(dev, tp); | |
486 | } | |
487 | ||
d34e3e18 SS |
488 | static inline bool tc_skip_sw(u32 flags) |
489 | { | |
490 | return (flags & TCA_CLS_FLAGS_SKIP_SW) ? true : false; | |
491 | } | |
492 | ||
493 | /* SKIP_HW and SKIP_SW are mutually exclusive flags. */ | |
494 | static inline bool tc_flags_valid(u32 flags) | |
495 | { | |
496 | if (flags & ~(TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW)) | |
497 | return false; | |
498 | ||
499 | if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW))) | |
500 | return false; | |
501 | ||
502 | return true; | |
503 | } | |
504 | ||
e696028a OG |
505 | static inline bool tc_in_hw(u32 flags) |
506 | { | |
507 | return (flags & TCA_CLS_FLAGS_IN_HW) ? true : false; | |
508 | } | |
509 | ||
5b33f488 AV |
510 | enum tc_fl_command { |
511 | TC_CLSFLOWER_REPLACE, | |
512 | TC_CLSFLOWER_DESTROY, | |
10cbc684 | 513 | TC_CLSFLOWER_STATS, |
5b33f488 AV |
514 | }; |
515 | ||
516 | struct tc_cls_flower_offload { | |
517 | enum tc_fl_command command; | |
69ca05ce | 518 | u32 prio; |
8208d21b | 519 | unsigned long cookie; |
5b33f488 AV |
520 | struct flow_dissector *dissector; |
521 | struct fl_flow_key *mask; | |
522 | struct fl_flow_key *key; | |
523 | struct tcf_exts *exts; | |
524 | }; | |
525 | ||
b87f7936 YG |
526 | enum tc_matchall_command { |
527 | TC_CLSMATCHALL_REPLACE, | |
528 | TC_CLSMATCHALL_DESTROY, | |
529 | }; | |
530 | ||
531 | struct tc_cls_matchall_offload { | |
532 | enum tc_matchall_command command; | |
533 | struct tcf_exts *exts; | |
534 | unsigned long cookie; | |
535 | }; | |
536 | ||
332ae8e2 JK |
537 | enum tc_clsbpf_command { |
538 | TC_CLSBPF_ADD, | |
539 | TC_CLSBPF_REPLACE, | |
540 | TC_CLSBPF_DESTROY, | |
68d64063 | 541 | TC_CLSBPF_STATS, |
332ae8e2 JK |
542 | }; |
543 | ||
544 | struct tc_cls_bpf_offload { | |
545 | enum tc_clsbpf_command command; | |
546 | struct tcf_exts *exts; | |
547 | struct bpf_prog *prog; | |
548 | const char *name; | |
549 | bool exts_integrated; | |
0d01d45f | 550 | u32 gen_flags; |
332ae8e2 JK |
551 | }; |
552 | ||
1045ba77 JHS |
553 | |
554 | /* This structure holds cookie structure that is passed from user | |
555 | * to the kernel for actions and classifiers | |
556 | */ | |
557 | struct tc_cookie { | |
558 | u8 *data; | |
559 | u32 len; | |
560 | }; | |
1da177e4 | 561 | #endif |