1 #ifndef __LINUX_PKT_CLS_H
2 #define __LINUX_PKT_CLS_H
4 #include <linux/types.h>
5 #include <linux/pkt_sched.h>
7 /* I think i could have done better macros ; for now this is stolen from
8 * some arch/mips code - jhs
10 #define _TC_MAKE32(x) ((x))
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))
17 /* verdict bit breakdown
19 bit 0: when set -> this packet has been munged already
21 bit 1: when set -> It is ok to munge this packet
23 bit 2,3,4,5: Reclassify counter - sort of reverse TTL - if exceeded
26 bit 6,7: Where this packet was last seen
27 0: Above the transmit example at the socket level
31 bit 8: when set --> Request not to classify on ingress.
33 bits 9,10,11: redirect counter - redirect TTL. Loop avoidance
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)
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)
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))
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))
58 #define AT_INGRESS 0x1
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)
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))
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))
77 /* Action attributes */
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
99 #define TC_ACT_UNSPEC (-1)
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
109 /* Action type identifiers*/
113 /* other actions go here */
117 #define TCA_ID_MAX __TCA_ID_MAX
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
131 struct tc_ratespec rate
;
132 struct tc_ratespec peakrate
;
164 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
167 #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
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)
194 #define TCA_U32_MAX (__TCA_U32_MAX - 1)
205 unsigned char offshift
;
214 struct tc_u32_key keys
[0];
231 #define TC_U32_TERMINAL 1
232 #define TC_U32_OFFSET 2
233 #define TC_U32_VAROFFSET 4
236 #define TC_U32_MAXDEPTH 8
252 #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 )
260 struct tc_rsvp_pinfo
{
261 struct tc_rsvp_gpi dpi
;
262 struct tc_rsvp_gpi spi
;
282 #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1)
291 TCA_FW_INDEV
, /* used by CONFIG_NET_CLS_IND */
292 TCA_FW_ACT
, /* used by CONFIG_NET_CLS_ACT */
297 #define TCA_FW_MAX (__TCA_FW_MAX - 1)
299 /* TC index filter */
306 TCA_TCINDEX_FALL_THROUGH
,
313 #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1)
329 FLOW_KEY_NFCT_PROTO_SRC
,
330 FLOW_KEY_NFCT_PROTO_DST
,
338 #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1)
362 #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1)
375 #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
378 /* Cgroup classifier */
388 #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
390 /* Extended Matches */
392 struct tcf_ematch_tree_hdr
{
398 TCA_EMATCH_TREE_UNSPEC
,
400 TCA_EMATCH_TREE_LIST
,
401 __TCA_EMATCH_TREE_MAX
403 #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
405 struct tcf_ematch_hdr
{
409 __u16 pad
; /* currently unused */
413 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
414 * +-----------------------+-+-+---+
416 * +-----------------------+-+-+---+
418 * R(2) ::= relation to next ematch
419 * where: 0 0 END (last ematch)
422 * 1 1 Unused (invalid)
423 * I(1) ::= invert result
424 * S(1) ::= simple payload
426 #define TCF_EM_REL_END 0
427 #define TCF_EM_REL_AND (1<<0)
428 #define TCF_EM_REL_OR (1<<1)
429 #define TCF_EM_INVERT (1<<2)
430 #define TCF_EM_SIMPLE (1<<3)
432 #define TCF_EM_REL_MASK 3
433 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
441 #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1)
443 /* Ematch type assignments
444 * 1..32767 Reserved for ematches inside kernel tree
445 * 32768..65535 Free to use, not reliable
447 #define TCF_EM_CONTAINER 0
449 #define TCF_EM_NBYTE 2
451 #define TCF_EM_META 4
452 #define TCF_EM_TEXT 5
453 #define TCF_EM_VLAN 6
This page took 0.03886 seconds and 5 git commands to generate.