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