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