Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __LINUX_PKT_CLS_H |
| 2 | #define __LINUX_PKT_CLS_H |
| 3 | |
Jaswinder Singh Rajput | ed30744 | 2009-01-30 22:05:32 +0530 | [diff] [blame] | 4 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/pkt_sched.h> |
| 6 | |
| 7 | /* I think i could have done better macros ; for now this is stolen from |
| 8 | * some arch/mips code - jhs |
| 9 | */ |
| 10 | #define _TC_MAKE32(x) ((x)) |
| 11 | |
| 12 | #define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) |
| 13 | #define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) |
| 14 | #define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) |
| 15 | #define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) |
| 16 | |
| 17 | /* verdict bit breakdown |
| 18 | * |
| 19 | bit 0: when set -> this packet has been munged already |
| 20 | |
| 21 | bit 1: when set -> It is ok to munge this packet |
| 22 | |
| 23 | bit 2,3,4,5: Reclassify counter - sort of reverse TTL - if exceeded |
| 24 | assume loop |
| 25 | |
| 26 | bit 6,7: Where this packet was last seen |
| 27 | 0: Above the transmit example at the socket level |
| 28 | 1: on the Ingress |
| 29 | 2: on the Egress |
| 30 | |
| 31 | bit 8: when set --> Request not to classify on ingress. |
| 32 | |
| 33 | bits 9,10,11: redirect counter - redirect TTL. Loop avoidance |
| 34 | |
| 35 | * |
| 36 | * */ |
| 37 | |
| 38 | #define TC_MUNGED _TC_MAKEMASK1(0) |
| 39 | #define SET_TC_MUNGED(v) ( TC_MUNGED | (v & ~TC_MUNGED)) |
| 40 | #define CLR_TC_MUNGED(v) ( v & ~TC_MUNGED) |
| 41 | |
| 42 | #define TC_OK2MUNGE _TC_MAKEMASK1(1) |
| 43 | #define SET_TC_OK2MUNGE(v) ( TC_OK2MUNGE | (v & ~TC_OK2MUNGE)) |
| 44 | #define CLR_TC_OK2MUNGE(v) ( v & ~TC_OK2MUNGE) |
| 45 | |
| 46 | #define S_TC_VERD _TC_MAKE32(2) |
| 47 | #define M_TC_VERD _TC_MAKEMASK(4,S_TC_VERD) |
| 48 | #define G_TC_VERD(x) _TC_GETVALUE(x,S_TC_VERD,M_TC_VERD) |
| 49 | #define V_TC_VERD(x) _TC_MAKEVALUE(x,S_TC_VERD) |
| 50 | #define SET_TC_VERD(v,n) ((V_TC_VERD(n)) | (v & ~M_TC_VERD)) |
| 51 | |
| 52 | #define S_TC_FROM _TC_MAKE32(6) |
| 53 | #define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) |
| 54 | #define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) |
| 55 | #define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) |
| 56 | #define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) |
| 57 | #define AT_STACK 0x0 |
| 58 | #define AT_INGRESS 0x1 |
| 59 | #define AT_EGRESS 0x2 |
| 60 | |
| 61 | #define TC_NCLS _TC_MAKEMASK1(8) |
| 62 | #define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS)) |
| 63 | #define CLR_TC_NCLS(v) ( v & ~TC_NCLS) |
| 64 | |
| 65 | #define S_TC_RTTL _TC_MAKE32(9) |
| 66 | #define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL) |
| 67 | #define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL) |
| 68 | #define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL) |
| 69 | #define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL)) |
| 70 | |
| 71 | #define S_TC_AT _TC_MAKE32(12) |
| 72 | #define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) |
| 73 | #define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) |
| 74 | #define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) |
| 75 | #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) |
| 76 | |
| 77 | /* Action attributes */ |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 78 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | TCA_ACT_UNSPEC, |
| 80 | TCA_ACT_KIND, |
| 81 | TCA_ACT_OPTIONS, |
| 82 | TCA_ACT_INDEX, |
| 83 | TCA_ACT_STATS, |
| 84 | __TCA_ACT_MAX |
| 85 | }; |
| 86 | |
| 87 | #define TCA_ACT_MAX __TCA_ACT_MAX |
| 88 | #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) |
| 89 | #define TCA_ACT_MAX_PRIO 32 |
| 90 | #define TCA_ACT_BIND 1 |
| 91 | #define TCA_ACT_NOBIND 0 |
| 92 | #define TCA_ACT_UNBIND 1 |
| 93 | #define TCA_ACT_NOUNBIND 0 |
| 94 | #define TCA_ACT_REPLACE 1 |
| 95 | #define TCA_ACT_NOREPLACE 0 |
| 96 | #define MAX_REC_LOOP 4 |
| 97 | #define MAX_RED_LOOP 4 |
| 98 | |
| 99 | #define TC_ACT_UNSPEC (-1) |
| 100 | #define TC_ACT_OK 0 |
| 101 | #define TC_ACT_RECLASSIFY 1 |
| 102 | #define TC_ACT_SHOT 2 |
| 103 | #define TC_ACT_PIPE 3 |
| 104 | #define TC_ACT_STOLEN 4 |
| 105 | #define TC_ACT_QUEUED 5 |
| 106 | #define TC_ACT_REPEAT 6 |
| 107 | #define TC_ACT_JUMP 0x10000000 |
| 108 | |
| 109 | /* Action type identifiers*/ |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 110 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | TCA_ID_UNSPEC=0, |
| 112 | TCA_ID_POLICE=1, |
| 113 | /* other actions go here */ |
| 114 | __TCA_ID_MAX=255 |
| 115 | }; |
| 116 | |
| 117 | #define TCA_ID_MAX __TCA_ID_MAX |
| 118 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 119 | struct tc_police { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | __u32 index; |
| 121 | int action; |
| 122 | #define TC_POLICE_UNSPEC TC_ACT_UNSPEC |
| 123 | #define TC_POLICE_OK TC_ACT_OK |
| 124 | #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY |
| 125 | #define TC_POLICE_SHOT TC_ACT_SHOT |
| 126 | #define TC_POLICE_PIPE TC_ACT_PIPE |
| 127 | |
| 128 | __u32 limit; |
| 129 | __u32 burst; |
| 130 | __u32 mtu; |
| 131 | struct tc_ratespec rate; |
| 132 | struct tc_ratespec peakrate; |
| 133 | int refcnt; |
| 134 | int bindcnt; |
| 135 | __u32 capab; |
| 136 | }; |
| 137 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 138 | struct tcf_t { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | __u64 install; |
| 140 | __u64 lastuse; |
| 141 | __u64 expires; |
| 142 | }; |
| 143 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 144 | struct tc_cnt { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | int refcnt; |
| 146 | int bindcnt; |
| 147 | }; |
| 148 | |
| 149 | #define tc_gen \ |
| 150 | __u32 index; \ |
| 151 | __u32 capab; \ |
| 152 | int action; \ |
| 153 | int refcnt; \ |
| 154 | int bindcnt |
| 155 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 156 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | TCA_POLICE_UNSPEC, |
| 158 | TCA_POLICE_TBF, |
| 159 | TCA_POLICE_RATE, |
| 160 | TCA_POLICE_PEAKRATE, |
| 161 | TCA_POLICE_AVRATE, |
| 162 | TCA_POLICE_RESULT, |
| 163 | __TCA_POLICE_MAX |
| 164 | #define TCA_POLICE_RESULT TCA_POLICE_RESULT |
| 165 | }; |
| 166 | |
| 167 | #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) |
| 168 | |
| 169 | /* U32 filters */ |
| 170 | |
| 171 | #define TC_U32_HTID(h) ((h)&0xFFF00000) |
| 172 | #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) |
| 173 | #define TC_U32_HASH(h) (((h)>>12)&0xFF) |
| 174 | #define TC_U32_NODE(h) ((h)&0xFFF) |
| 175 | #define TC_U32_KEY(h) ((h)&0xFFFFF) |
| 176 | #define TC_U32_UNSPEC 0 |
| 177 | #define TC_U32_ROOT (0xFFF00000) |
| 178 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 179 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | TCA_U32_UNSPEC, |
| 181 | TCA_U32_CLASSID, |
| 182 | TCA_U32_HASH, |
| 183 | TCA_U32_LINK, |
| 184 | TCA_U32_DIVISOR, |
| 185 | TCA_U32_SEL, |
| 186 | TCA_U32_POLICE, |
| 187 | TCA_U32_ACT, |
| 188 | TCA_U32_INDEV, |
| 189 | TCA_U32_PCNT, |
| 190 | TCA_U32_MARK, |
| 191 | __TCA_U32_MAX |
| 192 | }; |
| 193 | |
| 194 | #define TCA_U32_MAX (__TCA_U32_MAX - 1) |
| 195 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 196 | struct tc_u32_key { |
Al Viro | 0382b9c | 2008-03-17 22:46:46 -0700 | [diff] [blame] | 197 | __be32 mask; |
| 198 | __be32 val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | int off; |
| 200 | int offmask; |
| 201 | }; |
| 202 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 203 | struct tc_u32_sel { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | unsigned char flags; |
| 205 | unsigned char offshift; |
| 206 | unsigned char nkeys; |
| 207 | |
Al Viro | 0382b9c | 2008-03-17 22:46:46 -0700 | [diff] [blame] | 208 | __be16 offmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | __u16 off; |
| 210 | short offoff; |
| 211 | |
| 212 | short hoff; |
Al Viro | 0382b9c | 2008-03-17 22:46:46 -0700 | [diff] [blame] | 213 | __be32 hmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | struct tc_u32_key keys[0]; |
| 215 | }; |
| 216 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 217 | struct tc_u32_mark { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | __u32 val; |
| 219 | __u32 mask; |
| 220 | __u32 success; |
| 221 | }; |
| 222 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 223 | struct tc_u32_pcnt { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | __u64 rcnt; |
| 225 | __u64 rhit; |
| 226 | __u64 kcnts[0]; |
| 227 | }; |
| 228 | |
| 229 | /* Flags */ |
| 230 | |
| 231 | #define TC_U32_TERMINAL 1 |
| 232 | #define TC_U32_OFFSET 2 |
| 233 | #define TC_U32_VAROFFSET 4 |
| 234 | #define TC_U32_EAT 8 |
| 235 | |
| 236 | #define TC_U32_MAXDEPTH 8 |
| 237 | |
| 238 | |
| 239 | /* RSVP filter */ |
| 240 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 241 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | TCA_RSVP_UNSPEC, |
| 243 | TCA_RSVP_CLASSID, |
| 244 | TCA_RSVP_DST, |
| 245 | TCA_RSVP_SRC, |
| 246 | TCA_RSVP_PINFO, |
| 247 | TCA_RSVP_POLICE, |
| 248 | TCA_RSVP_ACT, |
| 249 | __TCA_RSVP_MAX |
| 250 | }; |
| 251 | |
| 252 | #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) |
| 253 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 254 | struct tc_rsvp_gpi { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | __u32 key; |
| 256 | __u32 mask; |
| 257 | int offset; |
| 258 | }; |
| 259 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 260 | struct tc_rsvp_pinfo { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | struct tc_rsvp_gpi dpi; |
| 262 | struct tc_rsvp_gpi spi; |
| 263 | __u8 protocol; |
| 264 | __u8 tunnelid; |
| 265 | __u8 tunnelhdr; |
Patrick McHardy | 8a47077 | 2005-06-28 12:56:45 -0700 | [diff] [blame] | 266 | __u8 pad; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | /* ROUTE filter */ |
| 270 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 271 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | TCA_ROUTE4_UNSPEC, |
| 273 | TCA_ROUTE4_CLASSID, |
| 274 | TCA_ROUTE4_TO, |
| 275 | TCA_ROUTE4_FROM, |
| 276 | TCA_ROUTE4_IIF, |
| 277 | TCA_ROUTE4_POLICE, |
| 278 | TCA_ROUTE4_ACT, |
| 279 | __TCA_ROUTE4_MAX |
| 280 | }; |
| 281 | |
| 282 | #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) |
| 283 | |
| 284 | |
| 285 | /* FW filter */ |
| 286 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 287 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | TCA_FW_UNSPEC, |
| 289 | TCA_FW_CLASSID, |
| 290 | TCA_FW_POLICE, |
| 291 | TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ |
| 292 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ |
Patrick McHardy | b4e9b52 | 2006-08-25 16:11:42 -0700 | [diff] [blame] | 293 | TCA_FW_MASK, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | __TCA_FW_MAX |
| 295 | }; |
| 296 | |
| 297 | #define TCA_FW_MAX (__TCA_FW_MAX - 1) |
| 298 | |
| 299 | /* TC index filter */ |
| 300 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 301 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | TCA_TCINDEX_UNSPEC, |
| 303 | TCA_TCINDEX_HASH, |
| 304 | TCA_TCINDEX_MASK, |
| 305 | TCA_TCINDEX_SHIFT, |
| 306 | TCA_TCINDEX_FALL_THROUGH, |
| 307 | TCA_TCINDEX_CLASSID, |
| 308 | TCA_TCINDEX_POLICE, |
| 309 | TCA_TCINDEX_ACT, |
| 310 | __TCA_TCINDEX_MAX |
| 311 | }; |
| 312 | |
| 313 | #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) |
| 314 | |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 315 | /* Flow filter */ |
| 316 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 317 | enum { |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 318 | FLOW_KEY_SRC, |
| 319 | FLOW_KEY_DST, |
| 320 | FLOW_KEY_PROTO, |
| 321 | FLOW_KEY_PROTO_SRC, |
| 322 | FLOW_KEY_PROTO_DST, |
| 323 | FLOW_KEY_IIF, |
| 324 | FLOW_KEY_PRIORITY, |
| 325 | FLOW_KEY_MARK, |
| 326 | FLOW_KEY_NFCT, |
| 327 | FLOW_KEY_NFCT_SRC, |
| 328 | FLOW_KEY_NFCT_DST, |
| 329 | FLOW_KEY_NFCT_PROTO_SRC, |
| 330 | FLOW_KEY_NFCT_PROTO_DST, |
| 331 | FLOW_KEY_RTCLASSID, |
| 332 | FLOW_KEY_SKUID, |
| 333 | FLOW_KEY_SKGID, |
Patrick McHardy | 9ec1381 | 2008-02-05 16:21:04 -0800 | [diff] [blame] | 334 | FLOW_KEY_VLAN_TAG, |
Changli Gao | 739a91e | 2010-08-21 06:23:15 +0000 | [diff] [blame] | 335 | FLOW_KEY_RXHASH, |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 336 | __FLOW_KEY_MAX, |
| 337 | }; |
| 338 | |
| 339 | #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) |
| 340 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 341 | enum { |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 342 | FLOW_MODE_MAP, |
| 343 | FLOW_MODE_HASH, |
| 344 | }; |
| 345 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 346 | enum { |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 347 | TCA_FLOW_UNSPEC, |
| 348 | TCA_FLOW_KEYS, |
| 349 | TCA_FLOW_MODE, |
| 350 | TCA_FLOW_BASECLASS, |
| 351 | TCA_FLOW_RSHIFT, |
| 352 | TCA_FLOW_ADDEND, |
| 353 | TCA_FLOW_MASK, |
| 354 | TCA_FLOW_XOR, |
| 355 | TCA_FLOW_DIVISOR, |
| 356 | TCA_FLOW_ACT, |
| 357 | TCA_FLOW_POLICE, |
| 358 | TCA_FLOW_EMATCHES, |
Patrick McHardy | 72d9794 | 2008-07-14 20:36:32 -0700 | [diff] [blame] | 359 | TCA_FLOW_PERTURB, |
Patrick McHardy | e5dfb81 | 2008-01-31 18:37:42 -0800 | [diff] [blame] | 360 | __TCA_FLOW_MAX |
| 361 | }; |
| 362 | |
| 363 | #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) |
| 364 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | /* Basic filter */ |
| 366 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 367 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | TCA_BASIC_UNSPEC, |
| 369 | TCA_BASIC_CLASSID, |
| 370 | TCA_BASIC_EMATCHES, |
| 371 | TCA_BASIC_ACT, |
| 372 | TCA_BASIC_POLICE, |
| 373 | __TCA_BASIC_MAX |
| 374 | }; |
| 375 | |
| 376 | #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) |
| 377 | |
Thomas Graf | f400923 | 2008-11-07 22:56:00 -0800 | [diff] [blame] | 378 | |
| 379 | /* Cgroup classifier */ |
| 380 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 381 | enum { |
Thomas Graf | f400923 | 2008-11-07 22:56:00 -0800 | [diff] [blame] | 382 | TCA_CGROUP_UNSPEC, |
| 383 | TCA_CGROUP_ACT, |
| 384 | TCA_CGROUP_POLICE, |
| 385 | TCA_CGROUP_EMATCHES, |
| 386 | __TCA_CGROUP_MAX, |
| 387 | }; |
| 388 | |
| 389 | #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) |
| 390 | |
Daniel Borkmann | 7d1d65c | 2013-10-28 16:43:02 +0100 | [diff] [blame] | 391 | /* BPF classifier */ |
| 392 | |
| 393 | enum { |
| 394 | TCA_BPF_UNSPEC, |
| 395 | TCA_BPF_ACT, |
| 396 | TCA_BPF_POLICE, |
| 397 | TCA_BPF_CLASSID, |
| 398 | TCA_BPF_OPS_LEN, |
| 399 | TCA_BPF_OPS, |
| 400 | __TCA_BPF_MAX, |
| 401 | }; |
| 402 | |
| 403 | #define TCA_BPF_MAX (__TCA_BPF_MAX - 1) |
| 404 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | /* Extended Matches */ |
| 406 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 407 | struct tcf_ematch_tree_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | __u16 nmatches; |
| 409 | __u16 progid; |
| 410 | }; |
| 411 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 412 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | TCA_EMATCH_TREE_UNSPEC, |
| 414 | TCA_EMATCH_TREE_HDR, |
| 415 | TCA_EMATCH_TREE_LIST, |
| 416 | __TCA_EMATCH_TREE_MAX |
| 417 | }; |
| 418 | #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) |
| 419 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 420 | struct tcf_ematch_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | __u16 matchid; |
| 422 | __u16 kind; |
| 423 | __u16 flags; |
| 424 | __u16 pad; /* currently unused */ |
| 425 | }; |
| 426 | |
| 427 | /* 0 1 |
| 428 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
| 429 | * +-----------------------+-+-+---+ |
| 430 | * | Unused |S|I| R | |
| 431 | * +-----------------------+-+-+---+ |
| 432 | * |
| 433 | * R(2) ::= relation to next ematch |
| 434 | * where: 0 0 END (last ematch) |
| 435 | * 0 1 AND |
| 436 | * 1 0 OR |
| 437 | * 1 1 Unused (invalid) |
| 438 | * I(1) ::= invert result |
| 439 | * S(1) ::= simple payload |
| 440 | */ |
| 441 | #define TCF_EM_REL_END 0 |
| 442 | #define TCF_EM_REL_AND (1<<0) |
| 443 | #define TCF_EM_REL_OR (1<<1) |
| 444 | #define TCF_EM_INVERT (1<<2) |
| 445 | #define TCF_EM_SIMPLE (1<<3) |
| 446 | |
| 447 | #define TCF_EM_REL_MASK 3 |
| 448 | #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) |
| 449 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 450 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | TCF_LAYER_LINK, |
| 452 | TCF_LAYER_NETWORK, |
| 453 | TCF_LAYER_TRANSPORT, |
| 454 | __TCF_LAYER_MAX |
| 455 | }; |
| 456 | #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) |
| 457 | |
| 458 | /* Ematch type assignments |
| 459 | * 1..32767 Reserved for ematches inside kernel tree |
| 460 | * 32768..65535 Free to use, not reliable |
| 461 | */ |
Patrick McHardy | db3d99c | 2007-07-11 19:46:26 -0700 | [diff] [blame] | 462 | #define TCF_EM_CONTAINER 0 |
| 463 | #define TCF_EM_CMP 1 |
| 464 | #define TCF_EM_NBYTE 2 |
| 465 | #define TCF_EM_U32 3 |
| 466 | #define TCF_EM_META 4 |
| 467 | #define TCF_EM_TEXT 5 |
Rostislav Lisovy | f057bbb | 2012-07-04 05:32:03 +0200 | [diff] [blame] | 468 | #define TCF_EM_VLAN 6 |
| 469 | #define TCF_EM_CANID 7 |
Florian Westphal | 6d4fa85 | 2012-07-11 10:56:57 +0000 | [diff] [blame] | 470 | #define TCF_EM_IPSET 8 |
| 471 | #define TCF_EM_MAX 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 473 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | TCF_EM_PROG_TC |
| 475 | }; |
| 476 | |
Eric Dumazet | d94d9fe | 2009-11-04 09:50:58 -0800 | [diff] [blame] | 477 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | TCF_EM_OPND_EQ, |
| 479 | TCF_EM_OPND_GT, |
| 480 | TCF_EM_OPND_LT |
| 481 | }; |
| 482 | |
| 483 | #endif |