staging: rtl8188eu: rename HalSetBrateCfg() - style
[linux/fpc-iii.git] / include / net / tc_act / tc_pedit.h
blobfac3ad4a86de96ed1acb1b2747f043471b5f4fd3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NET_TC_PED_H
3 #define __NET_TC_PED_H
5 #include <net/act_api.h>
6 #include <linux/tc_act/tc_pedit.h>
8 struct tcf_pedit_key_ex {
9 enum pedit_header_type htype;
10 enum pedit_cmd cmd;
13 struct tcf_pedit {
14 struct tc_action common;
15 unsigned char tcfp_nkeys;
16 unsigned char tcfp_flags;
17 struct tc_pedit_key *tcfp_keys;
18 struct tcf_pedit_key_ex *tcfp_keys_ex;
21 #define to_pedit(a) ((struct tcf_pedit *)a)
23 static inline bool is_tcf_pedit(const struct tc_action *a)
25 #ifdef CONFIG_NET_CLS_ACT
26 if (a->ops && a->ops->type == TCA_ACT_PEDIT)
27 return true;
28 #endif
29 return false;
32 static inline int tcf_pedit_nkeys(const struct tc_action *a)
34 return to_pedit(a)->tcfp_nkeys;
37 static inline u32 tcf_pedit_htype(const struct tc_action *a, int index)
39 if (to_pedit(a)->tcfp_keys_ex)
40 return to_pedit(a)->tcfp_keys_ex[index].htype;
42 return TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
45 static inline u32 tcf_pedit_cmd(const struct tc_action *a, int index)
47 if (to_pedit(a)->tcfp_keys_ex)
48 return to_pedit(a)->tcfp_keys_ex[index].cmd;
50 return __PEDIT_CMD_MAX;
53 static inline u32 tcf_pedit_mask(const struct tc_action *a, int index)
55 return to_pedit(a)->tcfp_keys[index].mask;
58 static inline u32 tcf_pedit_val(const struct tc_action *a, int index)
60 return to_pedit(a)->tcfp_keys[index].val;
63 static inline u32 tcf_pedit_offset(const struct tc_action *a, int index)
65 return to_pedit(a)->tcfp_keys[index].off;
67 #endif /* __NET_TC_PED_H */