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