linux/include/uapi/linux/pkt_cls.h
<<
>>
Prefs
   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 */
  11enum {
  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*/
  93enum 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
 121struct 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
 140struct tcf_t {
 141        __u64   install;
 142        __u64   lastuse;
 143        __u64   expires;
 144        __u64   firstuse;
 145};
 146
 147struct 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
 159enum {
 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
 193enum {
 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
 212struct tc_u32_key {
 213        __be32          mask;
 214        __be32          val;
 215        int             off;
 216        int             offmask;
 217};
 218
 219struct 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
 233struct tc_u32_mark {
 234        __u32           val;
 235        __u32           mask;
 236        __u32           success;
 237};
 238
 239struct 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
 257enum {
 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
 270struct tc_rsvp_gpi {
 271        __u32   key;
 272        __u32   mask;
 273        int     offset;
 274};
 275
 276struct 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
 287enum {
 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
 303enum {
 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
 317enum {
 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
 333enum {
 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
 357enum {
 358        FLOW_MODE_MAP,
 359        FLOW_MODE_HASH,
 360};
 361
 362enum {
 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
 383struct tc_basic_pcnt {
 384        __u64 rcnt;
 385        __u64 rhit;
 386};
 387
 388enum {
 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
 404enum {
 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
 418enum {
 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
 438enum {
 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
 561enum {
 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
 568enum {
 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_MAX,
 575};
 576
 577#define TCA_FLOWER_KEY_ENC_OPTS_MAX (__TCA_FLOWER_KEY_ENC_OPTS_MAX - 1)
 578
 579enum {
 580        TCA_FLOWER_KEY_ENC_OPT_GENEVE_UNSPEC,
 581        TCA_FLOWER_KEY_ENC_OPT_GENEVE_CLASS,            /* u16 */
 582        TCA_FLOWER_KEY_ENC_OPT_GENEVE_TYPE,             /* u8 */
 583        TCA_FLOWER_KEY_ENC_OPT_GENEVE_DATA,             /* 4 to 128 bytes */
 584
 585        __TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX,
 586};
 587
 588#define TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX \
 589                (__TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX - 1)
 590
 591enum {
 592        TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
 593        TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
 594};
 595
 596#define TCA_FLOWER_MASK_FLAGS_RANGE     (1 << 0) /* Range-based match */
 597
 598/* Match-all classifier */
 599
 600struct tc_matchall_pcnt {
 601        __u64 rhit;
 602};
 603
 604enum {
 605        TCA_MATCHALL_UNSPEC,
 606        TCA_MATCHALL_CLASSID,
 607        TCA_MATCHALL_ACT,
 608        TCA_MATCHALL_FLAGS,
 609        TCA_MATCHALL_PCNT,
 610        TCA_MATCHALL_PAD,
 611        __TCA_MATCHALL_MAX,
 612};
 613
 614#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1)
 615
 616/* Extended Matches */
 617
 618struct tcf_ematch_tree_hdr {
 619        __u16           nmatches;
 620        __u16           progid;
 621};
 622
 623enum {
 624        TCA_EMATCH_TREE_UNSPEC,
 625        TCA_EMATCH_TREE_HDR,
 626        TCA_EMATCH_TREE_LIST,
 627        __TCA_EMATCH_TREE_MAX
 628};
 629#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
 630
 631struct tcf_ematch_hdr {
 632        __u16           matchid;
 633        __u16           kind;
 634        __u16           flags;
 635        __u16           pad; /* currently unused */
 636};
 637
 638/*  0                   1
 639 *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 
 640 * +-----------------------+-+-+---+
 641 * |         Unused        |S|I| R |
 642 * +-----------------------+-+-+---+
 643 *
 644 * R(2) ::= relation to next ematch
 645 *          where: 0 0 END (last ematch)
 646 *                 0 1 AND
 647 *                 1 0 OR
 648 *                 1 1 Unused (invalid)
 649 * I(1) ::= invert result
 650 * S(1) ::= simple payload
 651 */
 652#define TCF_EM_REL_END  0
 653#define TCF_EM_REL_AND  (1<<0)
 654#define TCF_EM_REL_OR   (1<<1)
 655#define TCF_EM_INVERT   (1<<2)
 656#define TCF_EM_SIMPLE   (1<<3)
 657
 658#define TCF_EM_REL_MASK 3
 659#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
 660
 661enum {
 662        TCF_LAYER_LINK,
 663        TCF_LAYER_NETWORK,
 664        TCF_LAYER_TRANSPORT,
 665        __TCF_LAYER_MAX
 666};
 667#define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1)
 668
 669/* Ematch type assignments
 670 *   1..32767           Reserved for ematches inside kernel tree
 671 *   32768..65535       Free to use, not reliable
 672 */
 673#define TCF_EM_CONTAINER        0
 674#define TCF_EM_CMP              1
 675#define TCF_EM_NBYTE            2
 676#define TCF_EM_U32              3
 677#define TCF_EM_META             4
 678#define TCF_EM_TEXT             5
 679#define TCF_EM_VLAN             6
 680#define TCF_EM_CANID            7
 681#define TCF_EM_IPSET            8
 682#define TCF_EM_IPT              9
 683#define TCF_EM_MAX              9
 684
 685enum {
 686        TCF_EM_PROG_TC
 687};
 688
 689enum {
 690        TCF_EM_OPND_EQ,
 691        TCF_EM_OPND_GT,
 692        TCF_EM_OPND_LT
 693};
 694
 695#endif
 696