mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
eddd2cf195
Modify the kernel users of the TCA_ACT_* macros to use TCA_ID_*. For example, use TCA_ID_GACT instead of TCA_ACT_GACT. This will align with TCA_ID_POLICE and also differentiates these identifier, used in struct tc_action_ops type field, from other macros starting with TCA_ACT_. To make things clearer, we name the enum defining the TCA_ID_* identifiers and also change the "type" field of struct tc_action to id. Signed-off-by: Eli Cohen <eli@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NET_TC_PED_H
|
|
#define __NET_TC_PED_H
|
|
|
|
#include <net/act_api.h>
|
|
#include <linux/tc_act/tc_pedit.h>
|
|
|
|
struct tcf_pedit_key_ex {
|
|
enum pedit_header_type htype;
|
|
enum pedit_cmd cmd;
|
|
};
|
|
|
|
struct tcf_pedit {
|
|
struct tc_action common;
|
|
unsigned char tcfp_nkeys;
|
|
unsigned char tcfp_flags;
|
|
struct tc_pedit_key *tcfp_keys;
|
|
struct tcf_pedit_key_ex *tcfp_keys_ex;
|
|
};
|
|
|
|
#define to_pedit(a) ((struct tcf_pedit *)a)
|
|
|
|
static inline bool is_tcf_pedit(const struct tc_action *a)
|
|
{
|
|
#ifdef CONFIG_NET_CLS_ACT
|
|
if (a->ops && a->ops->id == TCA_ID_PEDIT)
|
|
return true;
|
|
#endif
|
|
return false;
|
|
}
|
|
|
|
static inline int tcf_pedit_nkeys(const struct tc_action *a)
|
|
{
|
|
return to_pedit(a)->tcfp_nkeys;
|
|
}
|
|
|
|
static inline u32 tcf_pedit_htype(const struct tc_action *a, int index)
|
|
{
|
|
if (to_pedit(a)->tcfp_keys_ex)
|
|
return to_pedit(a)->tcfp_keys_ex[index].htype;
|
|
|
|
return TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
|
|
}
|
|
|
|
static inline u32 tcf_pedit_cmd(const struct tc_action *a, int index)
|
|
{
|
|
if (to_pedit(a)->tcfp_keys_ex)
|
|
return to_pedit(a)->tcfp_keys_ex[index].cmd;
|
|
|
|
return __PEDIT_CMD_MAX;
|
|
}
|
|
|
|
static inline u32 tcf_pedit_mask(const struct tc_action *a, int index)
|
|
{
|
|
return to_pedit(a)->tcfp_keys[index].mask;
|
|
}
|
|
|
|
static inline u32 tcf_pedit_val(const struct tc_action *a, int index)
|
|
{
|
|
return to_pedit(a)->tcfp_keys[index].val;
|
|
}
|
|
|
|
static inline u32 tcf_pedit_offset(const struct tc_action *a, int index)
|
|
{
|
|
return to_pedit(a)->tcfp_keys[index].off;
|
|
}
|
|
#endif /* __NET_TC_PED_H */
|