xref: /openbmc/linux/include/uapi/linux/pkt_cls.h (revision 8795a739)
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 /* These macros are put here for binary compatibility with userspace apps that
67  * make use of them. For kernel code and new userspace apps, use the TCA_ID_*
68  * versions.
69  */
70 #define TCA_ACT_GACT 5
71 #define TCA_ACT_IPT 6
72 #define TCA_ACT_PEDIT 7
73 #define TCA_ACT_MIRRED 8
74 #define TCA_ACT_NAT 9
75 #define TCA_ACT_XT 10
76 #define TCA_ACT_SKBEDIT 11
77 #define TCA_ACT_VLAN 12
78 #define TCA_ACT_BPF 13
79 #define TCA_ACT_CONNMARK 14
80 #define TCA_ACT_SKBMOD 15
81 #define TCA_ACT_CSUM 16
82 #define TCA_ACT_TUNNEL_KEY 17
83 #define TCA_ACT_SIMP 22
84 #define TCA_ACT_IFE 25
85 #define TCA_ACT_SAMPLE 26
86 
87 /* Action type identifiers*/
88 enum tca_id {
89 	TCA_ID_UNSPEC = 0,
90 	TCA_ID_POLICE = 1,
91 	TCA_ID_GACT = TCA_ACT_GACT,
92 	TCA_ID_IPT = TCA_ACT_IPT,
93 	TCA_ID_PEDIT = TCA_ACT_PEDIT,
94 	TCA_ID_MIRRED = TCA_ACT_MIRRED,
95 	TCA_ID_NAT = TCA_ACT_NAT,
96 	TCA_ID_XT = TCA_ACT_XT,
97 	TCA_ID_SKBEDIT = TCA_ACT_SKBEDIT,
98 	TCA_ID_VLAN = TCA_ACT_VLAN,
99 	TCA_ID_BPF = TCA_ACT_BPF,
100 	TCA_ID_CONNMARK = TCA_ACT_CONNMARK,
101 	TCA_ID_SKBMOD = TCA_ACT_SKBMOD,
102 	TCA_ID_CSUM = TCA_ACT_CSUM,
103 	TCA_ID_TUNNEL_KEY = TCA_ACT_TUNNEL_KEY,
104 	TCA_ID_SIMP = TCA_ACT_SIMP,
105 	TCA_ID_IFE = TCA_ACT_IFE,
106 	TCA_ID_SAMPLE = TCA_ACT_SAMPLE,
107 	TCA_ID_CTINFO,
108 	TCA_ID_MPLS,
109 	TCA_ID_CT,
110 	/* other actions go here */
111 	__TCA_ID_MAX = 255
112 };
113 
114 #define TCA_ID_MAX __TCA_ID_MAX
115 
116 struct tc_police {
117 	__u32			index;
118 	int			action;
119 #define TC_POLICE_UNSPEC	TC_ACT_UNSPEC
120 #define TC_POLICE_OK		TC_ACT_OK
121 #define TC_POLICE_RECLASSIFY	TC_ACT_RECLASSIFY
122 #define TC_POLICE_SHOT		TC_ACT_SHOT
123 #define TC_POLICE_PIPE		TC_ACT_PIPE
124 
125 	__u32			limit;
126 	__u32			burst;
127 	__u32			mtu;
128 	struct tc_ratespec	rate;
129 	struct tc_ratespec	peakrate;
130 	int			refcnt;
131 	int			bindcnt;
132 	__u32			capab;
133 };
134 
135 struct tcf_t {
136 	__u64   install;
137 	__u64   lastuse;
138 	__u64   expires;
139 	__u64   firstuse;
140 };
141 
142 struct tc_cnt {
143 	int                   refcnt;
144 	int                   bindcnt;
145 };
146 
147 #define tc_gen \
148 	__u32                 index; \
149 	__u32                 capab; \
150 	int                   action; \
151 	int                   refcnt; \
152 	int                   bindcnt
153 
154 enum {
155 	TCA_POLICE_UNSPEC,
156 	TCA_POLICE_TBF,
157 	TCA_POLICE_RATE,
158 	TCA_POLICE_PEAKRATE,
159 	TCA_POLICE_AVRATE,
160 	TCA_POLICE_RESULT,
161 	TCA_POLICE_TM,
162 	TCA_POLICE_PAD,
163 	TCA_POLICE_RATE64,
164 	TCA_POLICE_PEAKRATE64,
165 	__TCA_POLICE_MAX
166 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
167 };
168 
169 #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
170 
171 /* tca flags definitions */
172 #define TCA_CLS_FLAGS_SKIP_HW	(1 << 0) /* don't offload filter to HW */
173 #define TCA_CLS_FLAGS_SKIP_SW	(1 << 1) /* don't use filter in SW */
174 #define TCA_CLS_FLAGS_IN_HW	(1 << 2) /* filter is offloaded to HW */
175 #define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */
176 #define TCA_CLS_FLAGS_VERBOSE	(1 << 4) /* verbose logging */
177 
178 /* U32 filters */
179 
180 #define TC_U32_HTID(h) ((h)&0xFFF00000)
181 #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20)
182 #define TC_U32_HASH(h) (((h)>>12)&0xFF)
183 #define TC_U32_NODE(h) ((h)&0xFFF)
184 #define TC_U32_KEY(h) ((h)&0xFFFFF)
185 #define TC_U32_UNSPEC	0
186 #define TC_U32_ROOT	(0xFFF00000)
187 
188 enum {
189 	TCA_U32_UNSPEC,
190 	TCA_U32_CLASSID,
191 	TCA_U32_HASH,
192 	TCA_U32_LINK,
193 	TCA_U32_DIVISOR,
194 	TCA_U32_SEL,
195 	TCA_U32_POLICE,
196 	TCA_U32_ACT,
197 	TCA_U32_INDEV,
198 	TCA_U32_PCNT,
199 	TCA_U32_MARK,
200 	TCA_U32_FLAGS,
201 	TCA_U32_PAD,
202 	__TCA_U32_MAX
203 };
204 
205 #define TCA_U32_MAX (__TCA_U32_MAX - 1)
206 
207 struct tc_u32_key {
208 	__be32		mask;
209 	__be32		val;
210 	int		off;
211 	int		offmask;
212 };
213 
214 struct tc_u32_sel {
215 	unsigned char		flags;
216 	unsigned char		offshift;
217 	unsigned char		nkeys;
218 
219 	__be16			offmask;
220 	__u16			off;
221 	short			offoff;
222 
223 	short			hoff;
224 	__be32			hmask;
225 	struct tc_u32_key	keys[0];
226 };
227 
228 struct tc_u32_mark {
229 	__u32		val;
230 	__u32		mask;
231 	__u32		success;
232 };
233 
234 struct tc_u32_pcnt {
235 	__u64 rcnt;
236 	__u64 rhit;
237 	__u64 kcnts[0];
238 };
239 
240 /* Flags */
241 
242 #define TC_U32_TERMINAL		1
243 #define TC_U32_OFFSET		2
244 #define TC_U32_VAROFFSET	4
245 #define TC_U32_EAT		8
246 
247 #define TC_U32_MAXDEPTH 8
248 
249 
250 /* RSVP filter */
251 
252 enum {
253 	TCA_RSVP_UNSPEC,
254 	TCA_RSVP_CLASSID,
255 	TCA_RSVP_DST,
256 	TCA_RSVP_SRC,
257 	TCA_RSVP_PINFO,
258 	TCA_RSVP_POLICE,
259 	TCA_RSVP_ACT,
260 	__TCA_RSVP_MAX
261 };
262 
263 #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 )
264 
265 struct tc_rsvp_gpi {
266 	__u32	key;
267 	__u32	mask;
268 	int	offset;
269 };
270 
271 struct tc_rsvp_pinfo {
272 	struct tc_rsvp_gpi dpi;
273 	struct tc_rsvp_gpi spi;
274 	__u8	protocol;
275 	__u8	tunnelid;
276 	__u8	tunnelhdr;
277 	__u8	pad;
278 };
279 
280 /* ROUTE filter */
281 
282 enum {
283 	TCA_ROUTE4_UNSPEC,
284 	TCA_ROUTE4_CLASSID,
285 	TCA_ROUTE4_TO,
286 	TCA_ROUTE4_FROM,
287 	TCA_ROUTE4_IIF,
288 	TCA_ROUTE4_POLICE,
289 	TCA_ROUTE4_ACT,
290 	__TCA_ROUTE4_MAX
291 };
292 
293 #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1)
294 
295 
296 /* FW filter */
297 
298 enum {
299 	TCA_FW_UNSPEC,
300 	TCA_FW_CLASSID,
301 	TCA_FW_POLICE,
302 	TCA_FW_INDEV,
303 	TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */
304 	TCA_FW_MASK,
305 	__TCA_FW_MAX
306 };
307 
308 #define TCA_FW_MAX (__TCA_FW_MAX - 1)
309 
310 /* TC index filter */
311 
312 enum {
313 	TCA_TCINDEX_UNSPEC,
314 	TCA_TCINDEX_HASH,
315 	TCA_TCINDEX_MASK,
316 	TCA_TCINDEX_SHIFT,
317 	TCA_TCINDEX_FALL_THROUGH,
318 	TCA_TCINDEX_CLASSID,
319 	TCA_TCINDEX_POLICE,
320 	TCA_TCINDEX_ACT,
321 	__TCA_TCINDEX_MAX
322 };
323 
324 #define TCA_TCINDEX_MAX     (__TCA_TCINDEX_MAX - 1)
325 
326 /* Flow filter */
327 
328 enum {
329 	FLOW_KEY_SRC,
330 	FLOW_KEY_DST,
331 	FLOW_KEY_PROTO,
332 	FLOW_KEY_PROTO_SRC,
333 	FLOW_KEY_PROTO_DST,
334 	FLOW_KEY_IIF,
335 	FLOW_KEY_PRIORITY,
336 	FLOW_KEY_MARK,
337 	FLOW_KEY_NFCT,
338 	FLOW_KEY_NFCT_SRC,
339 	FLOW_KEY_NFCT_DST,
340 	FLOW_KEY_NFCT_PROTO_SRC,
341 	FLOW_KEY_NFCT_PROTO_DST,
342 	FLOW_KEY_RTCLASSID,
343 	FLOW_KEY_SKUID,
344 	FLOW_KEY_SKGID,
345 	FLOW_KEY_VLAN_TAG,
346 	FLOW_KEY_RXHASH,
347 	__FLOW_KEY_MAX,
348 };
349 
350 #define FLOW_KEY_MAX	(__FLOW_KEY_MAX - 1)
351 
352 enum {
353 	FLOW_MODE_MAP,
354 	FLOW_MODE_HASH,
355 };
356 
357 enum {
358 	TCA_FLOW_UNSPEC,
359 	TCA_FLOW_KEYS,
360 	TCA_FLOW_MODE,
361 	TCA_FLOW_BASECLASS,
362 	TCA_FLOW_RSHIFT,
363 	TCA_FLOW_ADDEND,
364 	TCA_FLOW_MASK,
365 	TCA_FLOW_XOR,
366 	TCA_FLOW_DIVISOR,
367 	TCA_FLOW_ACT,
368 	TCA_FLOW_POLICE,
369 	TCA_FLOW_EMATCHES,
370 	TCA_FLOW_PERTURB,
371 	__TCA_FLOW_MAX
372 };
373 
374 #define TCA_FLOW_MAX	(__TCA_FLOW_MAX - 1)
375 
376 /* Basic filter */
377 
378 struct tc_basic_pcnt {
379 	__u64 rcnt;
380 	__u64 rhit;
381 };
382 
383 enum {
384 	TCA_BASIC_UNSPEC,
385 	TCA_BASIC_CLASSID,
386 	TCA_BASIC_EMATCHES,
387 	TCA_BASIC_ACT,
388 	TCA_BASIC_POLICE,
389 	TCA_BASIC_PCNT,
390 	TCA_BASIC_PAD,
391 	__TCA_BASIC_MAX
392 };
393 
394 #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
395 
396 
397 /* Cgroup classifier */
398 
399 enum {
400 	TCA_CGROUP_UNSPEC,
401 	TCA_CGROUP_ACT,
402 	TCA_CGROUP_POLICE,
403 	TCA_CGROUP_EMATCHES,
404 	__TCA_CGROUP_MAX,
405 };
406 
407 #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
408 
409 /* BPF classifier */
410 
411 #define TCA_BPF_FLAG_ACT_DIRECT		(1 << 0)
412 
413 enum {
414 	TCA_BPF_UNSPEC,
415 	TCA_BPF_ACT,
416 	TCA_BPF_POLICE,
417 	TCA_BPF_CLASSID,
418 	TCA_BPF_OPS_LEN,
419 	TCA_BPF_OPS,
420 	TCA_BPF_FD,
421 	TCA_BPF_NAME,
422 	TCA_BPF_FLAGS,
423 	TCA_BPF_FLAGS_GEN,
424 	TCA_BPF_TAG,
425 	TCA_BPF_ID,
426 	__TCA_BPF_MAX,
427 };
428 
429 #define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
430 
431 /* Flower classifier */
432 
433 enum {
434 	TCA_FLOWER_UNSPEC,
435 	TCA_FLOWER_CLASSID,
436 	TCA_FLOWER_INDEV,
437 	TCA_FLOWER_ACT,
438 	TCA_FLOWER_KEY_ETH_DST,		/* ETH_ALEN */
439 	TCA_FLOWER_KEY_ETH_DST_MASK,	/* ETH_ALEN */
440 	TCA_FLOWER_KEY_ETH_SRC,		/* ETH_ALEN */
441 	TCA_FLOWER_KEY_ETH_SRC_MASK,	/* ETH_ALEN */
442 	TCA_FLOWER_KEY_ETH_TYPE,	/* be16 */
443 	TCA_FLOWER_KEY_IP_PROTO,	/* u8 */
444 	TCA_FLOWER_KEY_IPV4_SRC,	/* be32 */
445 	TCA_FLOWER_KEY_IPV4_SRC_MASK,	/* be32 */
446 	TCA_FLOWER_KEY_IPV4_DST,	/* be32 */
447 	TCA_FLOWER_KEY_IPV4_DST_MASK,	/* be32 */
448 	TCA_FLOWER_KEY_IPV6_SRC,	/* struct in6_addr */
449 	TCA_FLOWER_KEY_IPV6_SRC_MASK,	/* struct in6_addr */
450 	TCA_FLOWER_KEY_IPV6_DST,	/* struct in6_addr */
451 	TCA_FLOWER_KEY_IPV6_DST_MASK,	/* struct in6_addr */
452 	TCA_FLOWER_KEY_TCP_SRC,		/* be16 */
453 	TCA_FLOWER_KEY_TCP_DST,		/* be16 */
454 	TCA_FLOWER_KEY_UDP_SRC,		/* be16 */
455 	TCA_FLOWER_KEY_UDP_DST,		/* be16 */
456 
457 	TCA_FLOWER_FLAGS,
458 	TCA_FLOWER_KEY_VLAN_ID,		/* be16 */
459 	TCA_FLOWER_KEY_VLAN_PRIO,	/* u8   */
460 	TCA_FLOWER_KEY_VLAN_ETH_TYPE,	/* be16 */
461 
462 	TCA_FLOWER_KEY_ENC_KEY_ID,	/* be32 */
463 	TCA_FLOWER_KEY_ENC_IPV4_SRC,	/* be32 */
464 	TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */
465 	TCA_FLOWER_KEY_ENC_IPV4_DST,	/* be32 */
466 	TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */
467 	TCA_FLOWER_KEY_ENC_IPV6_SRC,	/* struct in6_addr */
468 	TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */
469 	TCA_FLOWER_KEY_ENC_IPV6_DST,	/* struct in6_addr */
470 	TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */
471 
472 	TCA_FLOWER_KEY_TCP_SRC_MASK,	/* be16 */
473 	TCA_FLOWER_KEY_TCP_DST_MASK,	/* be16 */
474 	TCA_FLOWER_KEY_UDP_SRC_MASK,	/* be16 */
475 	TCA_FLOWER_KEY_UDP_DST_MASK,	/* be16 */
476 	TCA_FLOWER_KEY_SCTP_SRC_MASK,	/* be16 */
477 	TCA_FLOWER_KEY_SCTP_DST_MASK,	/* be16 */
478 
479 	TCA_FLOWER_KEY_SCTP_SRC,	/* be16 */
480 	TCA_FLOWER_KEY_SCTP_DST,	/* be16 */
481 
482 	TCA_FLOWER_KEY_ENC_UDP_SRC_PORT,	/* be16 */
483 	TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK,	/* be16 */
484 	TCA_FLOWER_KEY_ENC_UDP_DST_PORT,	/* be16 */
485 	TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,	/* be16 */
486 
487 	TCA_FLOWER_KEY_FLAGS,		/* be32 */
488 	TCA_FLOWER_KEY_FLAGS_MASK,	/* be32 */
489 
490 	TCA_FLOWER_KEY_ICMPV4_CODE,	/* u8 */
491 	TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */
492 	TCA_FLOWER_KEY_ICMPV4_TYPE,	/* u8 */
493 	TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */
494 	TCA_FLOWER_KEY_ICMPV6_CODE,	/* u8 */
495 	TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */
496 	TCA_FLOWER_KEY_ICMPV6_TYPE,	/* u8 */
497 	TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */
498 
499 	TCA_FLOWER_KEY_ARP_SIP,		/* be32 */
500 	TCA_FLOWER_KEY_ARP_SIP_MASK,	/* be32 */
501 	TCA_FLOWER_KEY_ARP_TIP,		/* be32 */
502 	TCA_FLOWER_KEY_ARP_TIP_MASK,	/* be32 */
503 	TCA_FLOWER_KEY_ARP_OP,		/* u8 */
504 	TCA_FLOWER_KEY_ARP_OP_MASK,	/* u8 */
505 	TCA_FLOWER_KEY_ARP_SHA,		/* ETH_ALEN */
506 	TCA_FLOWER_KEY_ARP_SHA_MASK,	/* ETH_ALEN */
507 	TCA_FLOWER_KEY_ARP_THA,		/* ETH_ALEN */
508 	TCA_FLOWER_KEY_ARP_THA_MASK,	/* ETH_ALEN */
509 
510 	TCA_FLOWER_KEY_MPLS_TTL,	/* u8 - 8 bits */
511 	TCA_FLOWER_KEY_MPLS_BOS,	/* u8 - 1 bit */
512 	TCA_FLOWER_KEY_MPLS_TC,		/* u8 - 3 bits */
513 	TCA_FLOWER_KEY_MPLS_LABEL,	/* be32 - 20 bits */
514 
515 	TCA_FLOWER_KEY_TCP_FLAGS,	/* be16 */
516 	TCA_FLOWER_KEY_TCP_FLAGS_MASK,	/* be16 */
517 
518 	TCA_FLOWER_KEY_IP_TOS,		/* u8 */
519 	TCA_FLOWER_KEY_IP_TOS_MASK,	/* u8 */
520 	TCA_FLOWER_KEY_IP_TTL,		/* u8 */
521 	TCA_FLOWER_KEY_IP_TTL_MASK,	/* u8 */
522 
523 	TCA_FLOWER_KEY_CVLAN_ID,	/* be16 */
524 	TCA_FLOWER_KEY_CVLAN_PRIO,	/* u8   */
525 	TCA_FLOWER_KEY_CVLAN_ETH_TYPE,	/* be16 */
526 
527 	TCA_FLOWER_KEY_ENC_IP_TOS,	/* u8 */
528 	TCA_FLOWER_KEY_ENC_IP_TOS_MASK,	/* u8 */
529 	TCA_FLOWER_KEY_ENC_IP_TTL,	/* u8 */
530 	TCA_FLOWER_KEY_ENC_IP_TTL_MASK,	/* u8 */
531 
532 	TCA_FLOWER_KEY_ENC_OPTS,
533 	TCA_FLOWER_KEY_ENC_OPTS_MASK,
534 
535 	TCA_FLOWER_IN_HW_COUNT,
536 
537 	TCA_FLOWER_KEY_PORT_SRC_MIN,	/* be16 */
538 	TCA_FLOWER_KEY_PORT_SRC_MAX,	/* be16 */
539 	TCA_FLOWER_KEY_PORT_DST_MIN,	/* be16 */
540 	TCA_FLOWER_KEY_PORT_DST_MAX,	/* be16 */
541 
542 	TCA_FLOWER_KEY_CT_STATE,	/* u16 */
543 	TCA_FLOWER_KEY_CT_STATE_MASK,	/* u16 */
544 	TCA_FLOWER_KEY_CT_ZONE,		/* u16 */
545 	TCA_FLOWER_KEY_CT_ZONE_MASK,	/* u16 */
546 	TCA_FLOWER_KEY_CT_MARK,		/* u32 */
547 	TCA_FLOWER_KEY_CT_MARK_MASK,	/* u32 */
548 	TCA_FLOWER_KEY_CT_LABELS,	/* u128 */
549 	TCA_FLOWER_KEY_CT_LABELS_MASK,	/* u128 */
550 
551 	__TCA_FLOWER_MAX,
552 };
553 
554 #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
555 
556 enum {
557 	TCA_FLOWER_KEY_CT_FLAGS_NEW = 1 << 0, /* Beginning of a new connection. */
558 	TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1, /* Part of an existing connection. */
559 	TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */
560 	TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */
561 };
562 
563 enum {
564 	TCA_FLOWER_KEY_ENC_OPTS_UNSPEC,
565 	TCA_FLOWER_KEY_ENC_OPTS_GENEVE, /* Nested
566 					 * TCA_FLOWER_KEY_ENC_OPT_GENEVE_
567 					 * attributes
568 					 */
569 	__TCA_FLOWER_KEY_ENC_OPTS_MAX,
570 };
571 
572 #define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1)
573 
574 enum {
575 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_UNSPEC,
576 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_CLASS,            /* u16 */
577 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_TYPE,             /* u8 */
578 	TCA_FLOWER_KEY_ENC_OPT_GENEVE_DATA,             /* 4 to 128 bytes */
579 
580 	__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX,
581 };
582 
583 #define TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX \
584 		(__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX - 1)
585 
586 enum {
587 	TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
588 	TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
589 };
590 
591 #define TCA_FLOWER_MASK_FLAGS_RANGE	(1 << 0) /* Range-based match */
592 
593 /* Match-all classifier */
594 
595 struct tc_matchall_pcnt {
596 	__u64 rhit;
597 };
598 
599 enum {
600 	TCA_MATCHALL_UNSPEC,
601 	TCA_MATCHALL_CLASSID,
602 	TCA_MATCHALL_ACT,
603 	TCA_MATCHALL_FLAGS,
604 	TCA_MATCHALL_PCNT,
605 	TCA_MATCHALL_PAD,
606 	__TCA_MATCHALL_MAX,
607 };
608 
609 #define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1)
610 
611 /* Extended Matches */
612 
613 struct tcf_ematch_tree_hdr {
614 	__u16		nmatches;
615 	__u16		progid;
616 };
617 
618 enum {
619 	TCA_EMATCH_TREE_UNSPEC,
620 	TCA_EMATCH_TREE_HDR,
621 	TCA_EMATCH_TREE_LIST,
622 	__TCA_EMATCH_TREE_MAX
623 };
624 #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
625 
626 struct tcf_ematch_hdr {
627 	__u16		matchid;
628 	__u16		kind;
629 	__u16		flags;
630 	__u16		pad; /* currently unused */
631 };
632 
633 /*  0                   1
634  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
635  * +-----------------------+-+-+---+
636  * |         Unused        |S|I| R |
637  * +-----------------------+-+-+---+
638  *
639  * R(2) ::= relation to next ematch
640  *          where: 0 0 END (last ematch)
641  *                 0 1 AND
642  *                 1 0 OR
643  *                 1 1 Unused (invalid)
644  * I(1) ::= invert result
645  * S(1) ::= simple payload
646  */
647 #define TCF_EM_REL_END	0
648 #define TCF_EM_REL_AND	(1<<0)
649 #define TCF_EM_REL_OR	(1<<1)
650 #define TCF_EM_INVERT	(1<<2)
651 #define TCF_EM_SIMPLE	(1<<3)
652 
653 #define TCF_EM_REL_MASK	3
654 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
655 
656 enum {
657 	TCF_LAYER_LINK,
658 	TCF_LAYER_NETWORK,
659 	TCF_LAYER_TRANSPORT,
660 	__TCF_LAYER_MAX
661 };
662 #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1)
663 
664 /* Ematch type assignments
665  *   1..32767		Reserved for ematches inside kernel tree
666  *   32768..65535	Free to use, not reliable
667  */
668 #define	TCF_EM_CONTAINER	0
669 #define	TCF_EM_CMP		1
670 #define	TCF_EM_NBYTE		2
671 #define	TCF_EM_U32		3
672 #define	TCF_EM_META		4
673 #define	TCF_EM_TEXT		5
674 #define	TCF_EM_VLAN		6
675 #define	TCF_EM_CANID		7
676 #define	TCF_EM_IPSET		8
677 #define	TCF_EM_IPT		9
678 #define	TCF_EM_MAX		9
679 
680 enum {
681 	TCF_EM_PROG_TC
682 };
683 
684 enum {
685 	TCF_EM_OPND_EQ,
686 	TCF_EM_OPND_GT,
687 	TCF_EM_OPND_LT
688 };
689 
690 #endif
691