2005-04-17 02:20:36 +04:00
# ifndef __NET_TC_PED_H
# define __NET_TC_PED_H
# include <net/act_api.h>
2017-01-22 21:42:39 +03:00
# include <linux/tc_act/tc_pedit.h>
2005-04-17 02:20:36 +04:00
2017-02-07 10:56:07 +03:00
struct tcf_pedit_key_ex {
enum pedit_header_type htype ;
2017-02-07 10:56:08 +03:00
enum pedit_cmd cmd ;
2017-02-07 10:56:07 +03:00
} ;
2006-08-22 10:54:55 +04:00
struct tcf_pedit {
2016-07-26 02:09:42 +03:00
struct tc_action common ;
2006-08-22 10:54:55 +04:00
unsigned char tcfp_nkeys ;
unsigned char tcfp_flags ;
struct tc_pedit_key * tcfp_keys ;
2017-02-07 10:56:07 +03:00
struct tcf_pedit_key_ex * tcfp_keys_ex ;
2005-04-17 02:20:36 +04:00
} ;
2016-07-26 02:09:41 +03:00
# define to_pedit(a) ((struct tcf_pedit *)a)
2005-04-17 02:20:36 +04:00
2017-01-22 21:42:39 +03:00
static inline bool is_tcf_pedit ( const struct tc_action * a )
{
# ifdef CONFIG_NET_CLS_ACT
if ( a - > ops & & a - > ops - > type = = TCA_ACT_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 ;
}
2006-08-22 10:54:55 +04:00
# endif /* __NET_TC_PED_H */