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