2005-04-16 15:20:36 -07:00
# ifndef __NET_TC_GACT_H
# define __NET_TC_GACT_H
# include <net/act_api.h>
2016-02-16 21:18:03 -08:00
# include <linux/tc_act/tc_gact.h>
2005-04-16 15:20:36 -07:00
2006-08-21 23:54:55 -07:00
struct tcf_gact {
2016-07-25 16:09:42 -07:00
struct tc_action common ;
2005-04-16 15:20:36 -07:00
# ifdef CONFIG_GACT_PROB
2015-07-06 05:18:06 -07:00
u16 tcfg_ptype ;
u16 tcfg_pval ;
int tcfg_paction ;
atomic_t packets ;
2005-04-16 15:20:36 -07:00
# endif
} ;
2016-07-25 16:09:41 -07:00
# define to_gact(a) ((struct tcf_gact *)a)
2006-08-21 23:54:55 -07:00
2017-08-23 10:08:19 +02:00
static inline bool __is_tcf_gact_act ( const struct tc_action * a , int act ,
bool is_ext )
2016-02-16 21:18:03 -08:00
{
2016-03-08 12:42:31 +02:00
# ifdef CONFIG_NET_CLS_ACT
2016-02-16 21:18:03 -08:00
struct tcf_gact * gact ;
if ( a - > ops & & a - > ops - > type ! = TCA_ACT_GACT )
return false ;
2016-07-25 16:09:41 -07:00
gact = to_gact ( a ) ;
2017-08-23 10:08:19 +02:00
if ( ( ! is_ext & & gact - > tcf_action = = act ) | |
( is_ext & & TC_ACT_EXT_CMP ( gact - > tcf_action , act ) ) )
2016-02-16 21:18:03 -08:00
return true ;
2016-03-08 12:42:31 +02:00
# endif
2016-02-16 21:18:03 -08:00
return false ;
}
2017-06-06 14:12:03 +02:00
static inline bool is_tcf_gact_shot ( const struct tc_action * a )
{
2017-08-23 10:08:19 +02:00
return __is_tcf_gact_act ( a , TC_ACT_SHOT , false ) ;
2017-06-06 14:12:03 +02:00
}
static inline bool is_tcf_gact_trap ( const struct tc_action * a )
{
2017-08-23 10:08:19 +02:00
return __is_tcf_gact_act ( a , TC_ACT_TRAP , false ) ;
}
static inline bool is_tcf_gact_goto_chain ( const struct tc_action * a )
{
return __is_tcf_gact_act ( a , TC_ACT_GOTO_CHAIN , true ) ;
}
static inline u32 tcf_gact_goto_chain_index ( const struct tc_action * a )
{
return a - > goto_chain - > index ;
2017-06-06 14:12:03 +02:00
}
2006-08-21 23:54:55 -07:00
# endif /* __NET_TC_GACT_H */