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
;
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
)
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 */