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