xref: /openbmc/linux/include/uapi/linux/pkt_cls.h (revision cc1e6315)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __LINUX_PKT_CLS_H
3 #define __LINUX_PKT_CLS_H
4 
5 #include <linux/types.h>
6 #include <linux/pkt_sched.h>
7 
8 #define TC_COOKIE_MAX_SIZE 16
9 
10 /* Action attributes */
11 enum {
12 	TCA_ACT_UNSPEC,
13 	TCA_ACT_KIND,
14 	TCA_ACT_OPTIONS,
15 	TCA_ACT_INDEX,
16 	TCA_ACT_STATS,
17 	TCA_ACT_PAD,
18 	TCA_ACT_COOKIE,
19 	__TCA_ACT_MAX
20 };
21 
22 #define TCA_ACT_MAX __TCA_ACT_MAX
23 #define TCA_OLD_COMPAT (TCA_ACT_MAX+1)
24 #define TCA_ACT_MAX_PRIO 32
25 #define TCA_ACT_BIND	1
26 #define TCA_ACT_NOBIND	0
27 #define TCA_ACT_UNBIND	1
28 #define TCA_ACT_NOUNBIND	0
29 #define TCA_ACT_REPLACE		1
30 #define TCA_ACT_NOREPLACE	0
31 
32 #define TC_ACT_UNSPEC	(-1)
33 #define TC_ACT_OK		0
34 #define TC_ACT_RECLASSIFY	1
35 #define TC_ACT_SHOT		2
36 #define TC_ACT_PIPE		3
37 #define TC_ACT_STOLEN		4
38 #define TC_ACT_QUEUED		5
39 #define TC_ACT_REPEAT		6
40 #define TC_ACT_REDIRECT		7
41 #define TC_ACT_TRAP		8 /* For hw path, this means "trap to cpu"
42 				   * and don't further process the frame
43 				   * in hardware. For sw path, this is
44 				   * equivalent of TC_ACT_STOLEN - drop
45 				   * the skb and act like everything
46 				   * is alright.
47 				   */
48 #define TC_ACT_VALUE_MAX	TC_ACT_TRAP
49 
50 /* There is a special kind of actions called "extended actions",
51  * which need a value parameter. These have a local opcode located in
52  * the highest nibble, starting from 1. The rest of the bits
53  * are used to carry the value. These two parts together make
54  * a combined opcode.
55  */
56 #define __TC_ACT_EXT_SHIFT 28
57 #define __TC_ACT_EXT(local) ((local) << __TC_ACT_EXT_SHIFT)
58 #define TC_ACT_EXT_VAL_MASK ((1 << __TC_ACT_EXT_SHIFT) - 1)
59 #define TC_ACT_EXT_OPCODE(combined) ((combined) & (~TC_ACT_EXT_VAL_MASK))
60 #define TC_ACT_EXT_CMP(combined, opcode) (TC_ACT_EXT_OPCODE(combined) == opcode)
61 
62 #define TC_ACT_JUMP __TC_ACT_EXT(1)
63 #define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2)
64 #define TC_ACT_EXT_OPCODE_MAX	TC_ACT_GOTO_CHAIN
65 
66 /* Action type identifiers*/
67 enum {
68 	TCA_ID_UNSPEC=0,
69 	TCA_ID_POLICE=1,
70 	/* other actions go here */
71 	__TCA_ID_MAX=255
72 };
73 
74 #define TCA_ID_MAX __TCA_ID_MAX
75 
76 struct tc_police {
77 	__u32			index;
78 	int			action;
79 #define TC_POLICE_UNSPEC	TC_ACT_UNSPEC
80 #define TC_POLICE_OK		TC_ACT_OK
81 #define TC_POLICE_RECLASSIFY	TC_ACT_RECLASSIFY
82 #define TC_POLICE_SHOT		TC_ACT_SHOT
83 #define TC_POLICE_PIPE		TC_ACT_PIPE
84 
85 	__u32			limit;
86 	__u32			burst;
87 	__u32			mtu;
88 	struct tc_ratespec	rate;
89 	struct tc_ratespec	peakrate;
90 	int			refcnt;
91 	int			bindcnt;
92 	__u32			capab;
93 };
94 
95 struct tcf_t {
96 	__u64   install;
97 	__u64   lastuse;
98 	__u64   expires;
99 	__u64   firstuse;
100 };
101 
102 struct tc_cnt {
103 	int                   refcnt;
104 	int                   bindcnt;
105 };
106 
107 #define tc_gen \
108 	__u32                 index; \
109 	__u32                 capab; \
110 	int                   action; \
111 	int                   refcnt; \
112 	int                   bindcnt
113 
114 enum {
115 	TCA_POLICE_UNSPEC,
116 	TCA_POLICE_TBF,
117 	TCA_POLICE_RATE,
118 	TCA_POLICE_PEAKRATE,
119 	TCA_POLICE_AVRATE,
120 	TCA_POLICE_RESULT,
121 	TCA_POLICE_TM,
122 	TCA_POLICE_PAD,
123 	__TCA_POLICE_MAX
124 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
125 };
126 
127 #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
128 
129 /* tca flags definitions */
130 #define TCA_CLS_FLAGS_SKIP_HW	(1 << 0) /* don't offload filter to HW */
131 #define TCA_CLS_FLAGS_SKIP_SW	(1 << 1) /* don't use filter in SW */
132 #define TCA_CLS_FLAGS_IN_HW	(1 << 2) /* filter is offloaded to HW */
133 #define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */
134 #define TCA_CLS_FLAGS_VERBOSE	(1 << 4) /* verbose logging */
135 
136 /* U32 filters */
137 
138 #define TC_U32_HTID(h) ((h)&0xFFF00000)
139 #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20)
140 #define TC_U32_HASH(h) (((h)>>12)&0xFF)
141 #define TC_U32_NODE(h) ((h)&0xFFF)
142 #define TC_U32_KEY(h) ((h)&0xFFFFF)
143 #define TC_U32_UNSPEC	0
144 #define TC_U32_ROOT	(0xFFF00000)
145 
146 enum {
147 	TCA_U32_UNSPEC,
148 	TCA_U32_CLASSID,
149 	TCA_U32_HASH,
150 	TCA_U32_LINK,
151 	TCA_U32_DIVISOR,
152 	TCA_U32_SEL,
153 	TCA_U32_POLICE,
154 	TCA_U32_ACT,
155 	TCA_U32_INDEV,
156 	TCA_U32_PCNT,
157 	TCA_U32_MARK,
158 	TCA_U32_FLAGS,
159 	TCA_U32_PAD,
160 	__TCA_U32_MAX
161 };
162 
163 #define TCA_U32_MAX (__TCA_U32_MAX - 1)
164 
165 struct tc_u32_key {
166 	__be32		mask;
167 	__be32		val;
168 	int		off;
169 	int		offmask;
170 };
171 
172 struct tc_u32_sel {
173 	unsigned char		flags;
174 	unsigned char		offshift;
175 	unsigned char		nkeys;
176 
177 	__be16			offmask;
178 	__u16			off;
179 	short			offoff;
180 
181 	short			hoff;
182 	__be32			hmask;
183 	struct tc_u32_key	keys[0];
184 };
185 
186 struct tc_u32_mark {
187 	__u32		val;
188 	__u32		mask;
189 	__u32		success;
190 };
191 
192 struct tc_u32_pcnt {
193 	__u64 rcnt;
194 	__u64 rhit;
195 	__u64 kcnts[0];
196 };
197 
198 /* Flags */
199 
200 #define TC_U32_TERMINAL		1
201 #define TC_U32_OFFSET		2
202 #define TC_U32_VAROFFSET	4
203 #define TC_U32_EAT		8
204 
205 #define TC_U32_MAXDEPTH 8
206 
207 
208 /* RSVP filter */
209 
210 enum {
211 	TCA_RSVP_UNSPEC,
212 	TCA_RSVP_CLASSID,
213 	TCA_RSVP_DST,
214 	TCA_RSVP_SRC,
215 	TCA_RSVP_PINFO,
216 	TCA_RSVP_POLICE,
217 	TCA_RSVP_ACT,
218 	__TCA_RSVP_MAX
219 };
220 
221 #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 )
222 
223 struct tc_rsvp_gpi {
224 	__u32	key;
225 	__u32	mask;
226 	int	offset;
227 };
228 
229 struct tc_rsvp_pinfo {
230 	struct tc_rsvp_gpi dpi;
231 	struct tc_rsvp_gpi spi;
232 	__u8	protocol;
233 	__u8	tunnelid;
234 	__u8	tunnelhdr;
235 	__u8	pad;
236 };
237 
238 /* ROUTE filter */
239 
240 enum {
241 	TCA_ROUTE4_UNSPEC,
242 	TCA_ROUTE4_CLASSID,
243 	TCA_ROUTE4_TO,
244 	TCA_ROUTE4_FROM,
245 	TCA_ROUTE4_IIF,
246 	TCA_ROUTE4_POLICE,
247 	TCA_ROUTE4_ACT,
248 	__TCA_ROUTE4_MAX
249 };
250 
251 #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1)
252 
253 
254 /* FW filter */
255 
256 enum {
257 	TCA_FW_UNSPEC,
258 	TCA_FW_CLASSID,
259 	TCA_FW_POLICE,
260 	TCA_FW_INDEV, /*  used by CONFIG_NET_CLS_IND */
261 	TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */
262 	TCA_FW_MASK,
263 	__TCA_FW_MAX
264 };
265 
266 #define TCA_FW_MAX (__TCA_FW_MAX - 1)
267 
268 /* TC index filter */
269 
270 enum {
271 	TCA_TCINDEX_UNSPEC,
272 	TCA_TCINDEX_HASH,
273 	TCA_TCINDEX_MASK,
274 	TCA_TCINDEX_SHIFT,
275 	TCA_TCINDEX_FALL_THROUGH,
276 	TCA_TCINDEX_CLASSID,
277 	TCA_TCINDEX_POLICE,
278 	TCA_TCINDEX_ACT,
279 	__TCA_TCINDEX_MAX
280 };
281 
282 #define TCA_TCINDEX_MAX     (__TCA_TCINDEX_MAX - 1)
283 
284 /* Flow filter */
285 
286 enum {
287 	FLOW_KEY_SRC,
288 	FLOW_KEY_DST,
289 	FLOW_KEY_PROTO,
290 	FLOW_KEY_PROTO_SRC,
291 	FLOW_KEY_PROTO_DST,
292 	FLOW_KEY_IIF,
293 	FLOW_KEY_PRIORITY,
294 	FLOW_KEY_MARK,
295 	FLOW_KEY_NFCT,
296 	FLOW_KEY_NFCT_SRC,
297 	FLOW_KEY_NFCT_DST,
298 	FLOW_KEY_NFCT_PROTO_SRC,
299 	FLOW_KEY_NFCT_PROTO_DST,
300 	FLOW_KEY_RTCLASSID,
301 	FLOW_KEY_SKUID,
302 	FLOW_KEY_SKGID,
303 	FLOW_KEY_VLAN_TAG,
304 	FLOW_KEY_RXHASH,
305 	__FLOW_KEY_MAX,
306 };
307 
308 #define FLOW_KEY_MAX	(__FLOW_KEY_MAX - 1)
309 
310 enum {
311 	FLOW_MODE_MAP,
312 	FLOW_MODE_HASH,
313 };
314 
315 enum {
316 	TCA_FLOW_UNSPEC,
317 	TCA_FLOW_KEYS,
318 	TCA_FLOW_MODE,
319 	TCA_FLOW_BASECLASS,
320 	TCA_FLOW_RSHIFT,
321 	TCA_FLOW_ADDEND,
322 	TCA_FLOW_MASK,
323 	TCA_FLOW_XOR,
324 	TCA_FLOW_DIVISOR,
325 	TCA_FLOW_ACT,
326 	TCA_FLOW_POLICE,
327 	TCA_FLOW_EMATCHES,
328 	TCA_FLOW_PERTURB,
329 	__TCA_FLOW_MAX
330 };
331 
332 #define TCA_FLOW_MAX	(__TCA_FLOW_MAX - 1)
333 
334 /* Basic filter */
335 
336 enum {
337 	TCA_BASIC_UNSPEC,
338 	TCA_BASIC_CLASSID,
339 	TCA_BASIC_EMATCHES,
340 	TCA_BASIC_ACT,
341 	TCA_BASIC_POLICE,
342 	__TCA_BASIC_MAX
343 };
344 
345 #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
346 
347 
348 /* Cgroup classifier */
349 
350 enum {
351 	TCA_CGROUP_UNSPEC,
352 	TCA_CGROUP_ACT,
353 	TCA_CGROUP_POLICE,
354 	TCA_CGROUP_EMATCHES,
355 	__TCA_CGROUP_MAX,
356 };
357 
358 #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
359 
360 /* BPF classifier */
361 
362 #define TCA_BPF_FLAG_ACT_DIRECT		(1 << 0)
363 
364 enum {
365 	TCA_BPF_UNSPEC,
366 	TCA_BPF_ACT,
367 	TCA_BPF_POLICE,
368 	TCA_BPF_CLASSID,
369 	TCA_BPF_OPS_LEN,
370 	TCA_BPF_OPS,
371 	TCA_BPF_FD,
372 	TCA_BPF_NAME,
373 	TCA_BPF_FLAGS,
374 	TCA_BPF_FLAGS_GEN,
375 	TCA_BPF_TAG,
376 	TCA_BPF_ID,
377 	__TCA_BPF_MAX,
378 };
379 
380 #define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
381 
382 /* Flower classifier */
383 
384 enum {
385 	TCA_FLOWER_UNSPEC,
386 	TCA_FLOWER_CLASSID,
387 	TCA_FLOWER_INDEV,
388 	TCA_FLOWER_ACT,
389 	TCA_FLOWER_KEY_ETH_DST,		/* ETH_ALEN */
390 	TCA_FLOWER_KEY_ETH_DST_MASK,	/* ETH_ALEN */
391 	TCA_FLOWER_KEY_ETH_SRC,		/* ETH_ALEN */
392 	TCA_FLOWER_KEY_ETH_SRC_MASK,	/* ETH_ALEN */
393 	TCA_FLOWER_KEY_ETH_TYPE,	/* be16 */
394 	TCA_FLOWER_KEY_IP_PROTO,	/* u8 */
395 	TCA_FLOWER_KEY_IPV4_SRC,	/* be32 */
396 	TCA_FLOWER_KEY_IPV4_SRC_MASK,	/* be32 */
397 	TCA_FLOWER_KEY_IPV4_DST,	/* be32 */
398 	TCA_FLOWER_KEY_IPV4_DST_MASK,	/* be32 */
399 	TCA_FLOWER_KEY_IPV6_SRC,	/* struct in6_addr */
400 	TCA_FLOWER_KEY_IPV6_SRC_MASK,	/* struct in6_addr */
401 	TCA_FLOWER_KEY_IPV6_DST,	/* struct in6_addr */
402 	TCA_FLOWER_KEY_IPV6_DST_MASK,	/* struct in6_addr */
403 	TCA_FLOWER_KEY_TCP_SRC,		/* be16 */
404 	TCA_FLOWER_KEY_TCP_DST,		/* be16 */
405 	TCA_FLOWER_KEY_UDP_SRC,		/* be16 */
406 	TCA_FLOWER_KEY_UDP_DST,		/* be16 */
407 
408 	TCA_FLOWER_FLAGS,
409 	TCA_FLOWER_KEY_VLAN_ID,		/* be16 */
410 	TCA_FLOWER_KEY_VLAN_PRIO,	/* u8   */
411 	TCA_FLOWER_KEY_VLAN_ETH_TYPE,	/* be16 */
412 
413 	TCA_FLOWER_KEY_ENC_KEY_ID,	/* be32 */
414 	TCA_FLOWER_KEY_ENC_IPV4_SRC,	/* be32 */
415 	TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */
416 	TCA_FLOWER_KEY_ENC_IPV4_DST,	/* be32 */
417 	TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */
418 	TCA_FLOWER_KEY_ENC_IPV6_SRC,	/* struct in6_addr */
419 	TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */
420 	TCA_FLOWER_KEY_ENC_IPV6_DST,	/* struct in6_addr */
421 	TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */
422 
423 	TCA_FLOWER_KEY_TCP_SRC_MASK,	/* be16 */
424 	TCA_FLOWER_KEY_TCP_DST_MASK,	/* be16 */
425 	TCA_FLOWER_KEY_UDP_SRC_MASK,	/* be16 */
426 	TCA_FLOWER_KEY_UDP_DST_MASK,	/* be16 */
427 	TCA_FLOWER_KEY_SCTP_SRC_MASK,	/* be16 */
428 	TCA_FLOWER_KEY_SCTP_DST_MASK,	/* be16 */
429 
430 	TCA_FLOWER_KEY_SCTP_SRC,	/* be16 */
431 	TCA_FLOWER_KEY_SCTP_DST,	/* be16 */
432 
433 	TCA_FLOWER_KEY_ENC_UDP_SRC_PORT,	/* be16 */
434 	TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK,	/* be16 */
435 	TCA_FLOWER_KEY_ENC_UDP_DST_PORT,	/* be16 */
436 	TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,	/* be16 */
437 
438 	TCA_FLOWER_KEY_FLAGS,		/* be32 */
439 	TCA_FLOWER_KEY_FLAGS_MASK,	/* be32 */
440 
441 	TCA_FLOWER_KEY_ICMPV4_CODE,	/* u8 */
442 	TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */
443 	TCA_FLOWER_KEY_ICMPV4_TYPE,	/* u8 */
444 	TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */
445 	TCA_FLOWER_KEY_ICMPV6_CODE,	/* u8 */
446 	TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */
447 	TCA_FLOWER_KEY_ICMPV6_TYPE,	/* u8 */
448 	TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */
449 
450 	TCA_FLOWER_KEY_ARP_SIP,		/* be32 */
451 	TCA_FLOWER_KEY_ARP_SIP_MASK,	/* be32 */
452 	TCA_FLOWER_KEY_ARP_TIP,		/* be32 */
453 	TCA_FLOWER_KEY_ARP_TIP_MASK,	/* be32 */
454 	TCA_FLOWER_KEY_ARP_OP,		/* u8 */
455 	TCA_FLOWER_KEY_ARP_OP_MASK,	/* u8 */
456 	TCA_FLOWER_KEY_ARP_SHA,		/* ETH_ALEN */
457 	TCA_FLOWER_KEY_ARP_SHA_MASK,	/* ETH_ALEN */
458 	TCA_FLOWER_KEY_ARP_THA,		/* ETH_ALEN */
459 	TCA_FLOWER_KEY_ARP_THA_MASK,	/* ETH_ALEN */
460 
461 	TCA_FLOWER_KEY_MPLS_TTL,	/* u8 - 8 bits */
462 	TCA_FLOWER_KEY_MPLS_BOS,	/* u8 - 1 bit */
463 	TCA_FLOWER_KEY_MPLS_TC,		/* u8 - 3 bits */
464 	TCA_FLOWER_KEY_MPLS_LABEL,	/* be32 - 20 bits */
465 
466 	TCA_FLOWER_KEY_TCP_FLAGS,	/* be16 */
467 	TCA_FLOWER_KEY_TCP_FLAGS_MASK,	/* be16 */
468 
469 	TCA_FLOWER_KEY_IP_TOS,		/* u8 */
470 	TCA_FLOWER_KEY_IP_TOS_MASK,	/* u8 */
471 	TCA_FLOWER_KEY_IP_TTL,		/* u8 */
472 	TCA_FLOWER_KEY_IP_TTL_MASK,	/* u8 */
473 
474 	TCA_FLOWER_KEY_CVLAN_ID,	/* be16 */
475 	TCA_FLOWER_KEY_CVLAN_PRIO,	/* u8   */
476 	TCA_FLOWER_KEY_CVLAN_ETH_TYPE,	/* be16 */
477 
478 	TCA_FLOWER_KEY_ENC_IP_TOS,	/* u8 */
479 	TCA_FLOWER_KEY_ENC_IP_TOS_MASK,	/* u8 */
480 	TCA_FLOWER_KEY_ENC_IP_TTL,	/* u8 */
481 	TCA_FLOWER_KEY_ENC_IP_TTL_MASK,	/* u8 */
482 
483 	TCA_FLOWER_KEY_ENC_OPTS,
484 	TCA_FLOWER_KEY_ENC_OPTS_MASK,
485 
486 	__TCA_FLOWER_MAX,
487 };
488 
489 #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
490 
491 enum {
492 	TCA_FLOWER_KEY_ENC_OPTS_UNSPEC,
493 	TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested
494 					 * TCA_FLOWER_KEY_ENC_OPT_GENEVE_
495 					 * attributes
496 					 */
497 	__TCA_FLOWER_KEY_ENC_OPTS_MAX,
498 };
499 
500 #define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1)
501 
502 enum {
503 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_UNSPEC,
504 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_CLASS,            /* u16 */
505 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_TYPE,             /* u8 */
506 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_DATA,             /* 4 to 128 bytes */
507 
508 	__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX,
509 };
510 
511 #define TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX \
512 		(__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX - 1)
513 
514 enum {
515 	TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
516 	TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
517 };
518 
519 /* Match-all classifier */
520 
521 enum {
522 	TCA_MATCHALL_UNSPEC,
523 	TCA_MATCHALL_CLASSID,
524 	TCA_MATCHALL_ACT,
525 	TCA_MATCHALL_FLAGS,
526 	__TCA_MATCHALL_MAX,
527 };
528 
529 #define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1)
530 
531 /* Extended Matches */
532 
533 struct tcf_ematch_tree_hdr {
534 	__u16		nmatches;
535 	__u16		progid;
536 };
537 
538 enum {
539 	TCA_EMATCH_TREE_UNSPEC,
540 	TCA_EMATCH_TREE_HDR,
541 	TCA_EMATCH_TREE_LIST,
542 	__TCA_EMATCH_TREE_MAX
543 };
544 #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
545 
546 struct tcf_ematch_hdr {
547 	__u16		matchid;
548 	__u16		kind;
549 	__u16		flags;
550 	__u16		pad; /* currently unused */
551 };
552 
553 /*  0                   1
554  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
555  * +-----------------------+-+-+---+
556  * |         Unused        |S|I| R |
557  * +-----------------------+-+-+---+
558  *
559  * R(2) ::= relation to next ematch
560  *          where: 0 0 END (last ematch)
561  *                 0 1 AND
562  *                 1 0 OR
563  *                 1 1 Unused (invalid)
564  * I(1) ::= invert result
565  * S(1) ::= simple payload
566  */
567 #define TCF_EM_REL_END	0
568 #define TCF_EM_REL_AND	(1<<0)
569 #define TCF_EM_REL_OR	(1<<1)
570 #define TCF_EM_INVERT	(1<<2)
571 #define TCF_EM_SIMPLE	(1<<3)
572 
573 #define TCF_EM_REL_MASK	3
574 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
575 
576 enum {
577 	TCF_LAYER_LINK,
578 	TCF_LAYER_NETWORK,
579 	TCF_LAYER_TRANSPORT,
580 	__TCF_LAYER_MAX
581 };
582 #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1)
583 
584 /* Ematch type assignments
585  *   1..32767		Reserved for ematches inside kernel tree
586  *   32768..65535	Free to use, not reliable
587  */
588 #define	TCF_EM_CONTAINER	0
589 #define	TCF_EM_CMP		1
590 #define	TCF_EM_NBYTE		2
591 #define	TCF_EM_U32		3
592 #define	TCF_EM_META		4
593 #define	TCF_EM_TEXT		5
594 #define	TCF_EM_VLAN		6
595 #define	TCF_EM_CANID		7
596 #define	TCF_EM_IPSET		8
597 #define	TCF_EM_IPT		9
598 #define	TCF_EM_MAX		9
599 
600 enum {
601 	TCF_EM_PROG_TC
602 };
603 
604 enum {
605 	TCF_EM_OPND_EQ,
606 	TCF_EM_OPND_GT,
607 	TCF_EM_OPND_LT
608 };
609 
610 #endif
611