1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef __LINUX_PKT_CLS_H 13 #define __LINUX_PKT_CLS_H 14 15 #include <linux/types.h> 16 #include <linux/pkt_sched.h> 17 18 #define _TC_MAKE32(x) ((x)) 19 20 #define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) 21 #define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) 22 #define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) 23 #define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) 24 25 #define TC_MUNGED _TC_MAKEMASK1(0) 26 #define SET_TC_MUNGED(v) ( TC_MUNGED | (v & ~TC_MUNGED)) 27 #define CLR_TC_MUNGED(v) ( v & ~TC_MUNGED) 28 29 #define TC_OK2MUNGE _TC_MAKEMASK1(1) 30 #define SET_TC_OK2MUNGE(v) ( TC_OK2MUNGE | (v & ~TC_OK2MUNGE)) 31 #define CLR_TC_OK2MUNGE(v) ( v & ~TC_OK2MUNGE) 32 33 #define S_TC_VERD _TC_MAKE32(2) 34 #define M_TC_VERD _TC_MAKEMASK(4,S_TC_VERD) 35 #define G_TC_VERD(x) _TC_GETVALUE(x,S_TC_VERD,M_TC_VERD) 36 #define V_TC_VERD(x) _TC_MAKEVALUE(x,S_TC_VERD) 37 #define SET_TC_VERD(v,n) ((V_TC_VERD(n)) | (v & ~M_TC_VERD)) 38 39 #define S_TC_FROM _TC_MAKE32(6) 40 #define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) 41 #define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) 42 #define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) 43 #define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) 44 #define AT_STACK 0x0 45 #define AT_INGRESS 0x1 46 #define AT_EGRESS 0x2 47 48 #define TC_NCLS _TC_MAKEMASK1(8) 49 #define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS)) 50 #define CLR_TC_NCLS(v) ( v & ~TC_NCLS) 51 52 #define S_TC_RTTL _TC_MAKE32(9) 53 #define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL) 54 #define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL) 55 #define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL) 56 #define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL)) 57 58 #define S_TC_AT _TC_MAKE32(12) 59 #define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) 60 #define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) 61 #define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) 62 #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) 63 64 enum 65 { 66 TCA_ACT_UNSPEC, 67 TCA_ACT_KIND, 68 TCA_ACT_OPTIONS, 69 TCA_ACT_INDEX, 70 TCA_ACT_STATS, 71 __TCA_ACT_MAX 72 }; 73 74 #define TCA_ACT_MAX __TCA_ACT_MAX 75 #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) 76 #define TCA_ACT_MAX_PRIO 32 77 #define TCA_ACT_BIND 1 78 #define TCA_ACT_NOBIND 0 79 #define TCA_ACT_UNBIND 1 80 #define TCA_ACT_NOUNBIND 0 81 #define TCA_ACT_REPLACE 1 82 #define TCA_ACT_NOREPLACE 0 83 #define MAX_REC_LOOP 4 84 #define MAX_RED_LOOP 4 85 86 #define TC_ACT_UNSPEC (-1) 87 #define TC_ACT_OK 0 88 #define TC_ACT_RECLASSIFY 1 89 #define TC_ACT_SHOT 2 90 #define TC_ACT_PIPE 3 91 #define TC_ACT_STOLEN 4 92 #define TC_ACT_QUEUED 5 93 #define TC_ACT_REPEAT 6 94 #define TC_ACT_JUMP 0x10000000 95 96 enum 97 { 98 TCA_ID_UNSPEC=0, 99 TCA_ID_POLICE=1, 100 101 __TCA_ID_MAX=255 102 }; 103 104 #define TCA_ID_MAX __TCA_ID_MAX 105 106 struct tc_police 107 { 108 __u32 index; 109 int action; 110 #define TC_POLICE_UNSPEC TC_ACT_UNSPEC 111 #define TC_POLICE_OK TC_ACT_OK 112 #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY 113 #define TC_POLICE_SHOT TC_ACT_SHOT 114 #define TC_POLICE_PIPE TC_ACT_PIPE 115 116 __u32 limit; 117 __u32 burst; 118 __u32 mtu; 119 struct tc_ratespec rate; 120 struct tc_ratespec peakrate; 121 int refcnt; 122 int bindcnt; 123 __u32 capab; 124 }; 125 126 struct tcf_t 127 { 128 __u64 install; 129 __u64 lastuse; 130 __u64 expires; 131 }; 132 133 struct tc_cnt 134 { 135 int refcnt; 136 int bindcnt; 137 }; 138 139 #define tc_gen __u32 index; __u32 capab; int action; int refcnt; int bindcnt 140 141 enum 142 { 143 TCA_POLICE_UNSPEC, 144 TCA_POLICE_TBF, 145 TCA_POLICE_RATE, 146 TCA_POLICE_PEAKRATE, 147 TCA_POLICE_AVRATE, 148 TCA_POLICE_RESULT, 149 __TCA_POLICE_MAX 150 #define TCA_POLICE_RESULT TCA_POLICE_RESULT 151 }; 152 153 #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) 154 155 #define TC_U32_HTID(h) ((h)&0xFFF00000) 156 #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) 157 #define TC_U32_HASH(h) (((h)>>12)&0xFF) 158 #define TC_U32_NODE(h) ((h)&0xFFF) 159 #define TC_U32_KEY(h) ((h)&0xFFFFF) 160 #define TC_U32_UNSPEC 0 161 #define TC_U32_ROOT (0xFFF00000) 162 163 enum 164 { 165 TCA_U32_UNSPEC, 166 TCA_U32_CLASSID, 167 TCA_U32_HASH, 168 TCA_U32_LINK, 169 TCA_U32_DIVISOR, 170 TCA_U32_SEL, 171 TCA_U32_POLICE, 172 TCA_U32_ACT, 173 TCA_U32_INDEV, 174 TCA_U32_PCNT, 175 TCA_U32_MARK, 176 __TCA_U32_MAX 177 }; 178 179 #define TCA_U32_MAX (__TCA_U32_MAX - 1) 180 181 struct tc_u32_key 182 { 183 __be32 mask; 184 __be32 val; 185 int off; 186 int offmask; 187 }; 188 189 struct tc_u32_sel 190 { 191 unsigned char flags; 192 unsigned char offshift; 193 unsigned char nkeys; 194 195 __be16 offmask; 196 __u16 off; 197 short offoff; 198 199 short hoff; 200 __be32 hmask; 201 struct tc_u32_key keys[0]; 202 }; 203 204 struct tc_u32_mark 205 { 206 __u32 val; 207 __u32 mask; 208 __u32 success; 209 }; 210 211 struct tc_u32_pcnt 212 { 213 __u64 rcnt; 214 __u64 rhit; 215 __u64 kcnts[0]; 216 }; 217 218 #define TC_U32_TERMINAL 1 219 #define TC_U32_OFFSET 2 220 #define TC_U32_VAROFFSET 4 221 #define TC_U32_EAT 8 222 223 #define TC_U32_MAXDEPTH 8 224 225 enum 226 { 227 TCA_RSVP_UNSPEC, 228 TCA_RSVP_CLASSID, 229 TCA_RSVP_DST, 230 TCA_RSVP_SRC, 231 TCA_RSVP_PINFO, 232 TCA_RSVP_POLICE, 233 TCA_RSVP_ACT, 234 __TCA_RSVP_MAX 235 }; 236 237 #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) 238 239 struct tc_rsvp_gpi 240 { 241 __u32 key; 242 __u32 mask; 243 int offset; 244 }; 245 246 struct tc_rsvp_pinfo 247 { 248 struct tc_rsvp_gpi dpi; 249 struct tc_rsvp_gpi spi; 250 __u8 protocol; 251 __u8 tunnelid; 252 __u8 tunnelhdr; 253 __u8 pad; 254 }; 255 256 enum 257 { 258 TCA_ROUTE4_UNSPEC, 259 TCA_ROUTE4_CLASSID, 260 TCA_ROUTE4_TO, 261 TCA_ROUTE4_FROM, 262 TCA_ROUTE4_IIF, 263 TCA_ROUTE4_POLICE, 264 TCA_ROUTE4_ACT, 265 __TCA_ROUTE4_MAX 266 }; 267 268 #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) 269 270 enum 271 { 272 TCA_FW_UNSPEC, 273 TCA_FW_CLASSID, 274 TCA_FW_POLICE, 275 TCA_FW_INDEV, 276 TCA_FW_ACT, 277 TCA_FW_MASK, 278 __TCA_FW_MAX 279 }; 280 281 #define TCA_FW_MAX (__TCA_FW_MAX - 1) 282 283 enum 284 { 285 TCA_TCINDEX_UNSPEC, 286 TCA_TCINDEX_HASH, 287 TCA_TCINDEX_MASK, 288 TCA_TCINDEX_SHIFT, 289 TCA_TCINDEX_FALL_THROUGH, 290 TCA_TCINDEX_CLASSID, 291 TCA_TCINDEX_POLICE, 292 TCA_TCINDEX_ACT, 293 __TCA_TCINDEX_MAX 294 }; 295 296 #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) 297 298 enum 299 { 300 FLOW_KEY_SRC, 301 FLOW_KEY_DST, 302 FLOW_KEY_PROTO, 303 FLOW_KEY_PROTO_SRC, 304 FLOW_KEY_PROTO_DST, 305 FLOW_KEY_IIF, 306 FLOW_KEY_PRIORITY, 307 FLOW_KEY_MARK, 308 FLOW_KEY_NFCT, 309 FLOW_KEY_NFCT_SRC, 310 FLOW_KEY_NFCT_DST, 311 FLOW_KEY_NFCT_PROTO_SRC, 312 FLOW_KEY_NFCT_PROTO_DST, 313 FLOW_KEY_RTCLASSID, 314 FLOW_KEY_SKUID, 315 FLOW_KEY_SKGID, 316 FLOW_KEY_VLAN_TAG, 317 __FLOW_KEY_MAX, 318 }; 319 320 #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) 321 322 enum 323 { 324 FLOW_MODE_MAP, 325 FLOW_MODE_HASH, 326 }; 327 328 enum 329 { 330 TCA_FLOW_UNSPEC, 331 TCA_FLOW_KEYS, 332 TCA_FLOW_MODE, 333 TCA_FLOW_BASECLASS, 334 TCA_FLOW_RSHIFT, 335 TCA_FLOW_ADDEND, 336 TCA_FLOW_MASK, 337 TCA_FLOW_XOR, 338 TCA_FLOW_DIVISOR, 339 TCA_FLOW_ACT, 340 TCA_FLOW_POLICE, 341 TCA_FLOW_EMATCHES, 342 TCA_FLOW_PERTURB, 343 __TCA_FLOW_MAX 344 }; 345 346 #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) 347 348 enum 349 { 350 TCA_BASIC_UNSPEC, 351 TCA_BASIC_CLASSID, 352 TCA_BASIC_EMATCHES, 353 TCA_BASIC_ACT, 354 TCA_BASIC_POLICE, 355 __TCA_BASIC_MAX 356 }; 357 358 #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) 359 360 enum 361 { 362 TCA_CGROUP_UNSPEC, 363 TCA_CGROUP_ACT, 364 TCA_CGROUP_POLICE, 365 TCA_CGROUP_EMATCHES, 366 __TCA_CGROUP_MAX, 367 }; 368 369 #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) 370 371 struct tcf_ematch_tree_hdr 372 { 373 __u16 nmatches; 374 __u16 progid; 375 }; 376 377 enum 378 { 379 TCA_EMATCH_TREE_UNSPEC, 380 TCA_EMATCH_TREE_HDR, 381 TCA_EMATCH_TREE_LIST, 382 __TCA_EMATCH_TREE_MAX 383 }; 384 #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) 385 386 struct tcf_ematch_hdr 387 { 388 __u16 matchid; 389 __u16 kind; 390 __u16 flags; 391 __u16 pad; 392 }; 393 394 #define TCF_EM_REL_END 0 395 #define TCF_EM_REL_AND (1<<0) 396 #define TCF_EM_REL_OR (1<<1) 397 #define TCF_EM_INVERT (1<<2) 398 #define TCF_EM_SIMPLE (1<<3) 399 400 #define TCF_EM_REL_MASK 3 401 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) 402 403 enum 404 { 405 TCF_LAYER_LINK, 406 TCF_LAYER_NETWORK, 407 TCF_LAYER_TRANSPORT, 408 __TCF_LAYER_MAX 409 }; 410 #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) 411 412 #define TCF_EM_CONTAINER 0 413 #define TCF_EM_CMP 1 414 #define TCF_EM_NBYTE 2 415 #define TCF_EM_U32 3 416 #define TCF_EM_META 4 417 #define TCF_EM_TEXT 5 418 #define TCF_EM_VLAN 6 419 #define TCF_EM_MAX 6 420 421 enum 422 { 423 TCF_EM_PROG_TC 424 }; 425 426 enum 427 { 428 TCF_EM_OPND_EQ, 429 TCF_EM_OPND_GT, 430 TCF_EM_OPND_LT 431 }; 432 433 #endif 434