Merge tag 'chrome-platform-for-linus-4.13' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / include / net / tc_act / tc_pedit.h
bloba46c3f2ace702932dc95c3021e7b13d72a2a4777
1 #ifndef __NET_TC_PED_H
2 #define __NET_TC_PED_H
4 #include <net/act_api.h>
5 #include <linux/tc_act/tc_pedit.h>
7 struct tcf_pedit_key_ex {
8 enum pedit_header_type htype;
9 enum pedit_cmd cmd;
12 struct tcf_pedit {
13 struct tc_action common;
14 unsigned char tcfp_nkeys;
15 unsigned char tcfp_flags;
16 struct tc_pedit_key *tcfp_keys;
17 struct tcf_pedit_key_ex *tcfp_keys_ex;
19 #define to_pedit(a) ((struct tcf_pedit *)a)
21 static inline bool is_tcf_pedit(const struct tc_action *a)
23 #ifdef CONFIG_NET_CLS_ACT
24 if (a->ops && a->ops->type == TCA_ACT_PEDIT)
25 return true;
26 #endif
27 return false;
30 static inline int tcf_pedit_nkeys(const struct tc_action *a)
32 return to_pedit(a)->tcfp_nkeys;
35 static inline u32 tcf_pedit_htype(const struct tc_action *a, int index)
37 if (to_pedit(a)->tcfp_keys_ex)
38 return to_pedit(a)->tcfp_keys_ex[index].htype;
40 return TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
43 static inline u32 tcf_pedit_cmd(const struct tc_action *a, int index)
45 if (to_pedit(a)->tcfp_keys_ex)
46 return to_pedit(a)->tcfp_keys_ex[index].cmd;
48 return __PEDIT_CMD_MAX;
51 static inline u32 tcf_pedit_mask(const struct tc_action *a, int index)
53 return to_pedit(a)->tcfp_keys[index].mask;
56 static inline u32 tcf_pedit_val(const struct tc_action *a, int index)
58 return to_pedit(a)->tcfp_keys[index].val;
61 static inline u32 tcf_pedit_offset(const struct tc_action *a, int index)
63 return to_pedit(a)->tcfp_keys[index].off;
65 #endif /* __NET_TC_PED_H */