tc_gact.h 1.2 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4
#ifndef __NET_TC_GACT_H
#define __NET_TC_GACT_H

#include <net/act_api.h>
5
#include <linux/tc_act/tc_gact.h>
L
Linus Torvalds 已提交
6

7
struct tcf_gact {
8
	struct tc_action	common;
L
Linus Torvalds 已提交
9
#ifdef CONFIG_GACT_PROB
10 11 12 13
	u16			tcfg_ptype;
	u16			tcfg_pval;
	int			tcfg_paction;
	atomic_t		packets;
L
Linus Torvalds 已提交
14 15
#endif
};
16
#define to_gact(a) ((struct tcf_gact *)a)
17

18 19
static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
				     bool is_ext)
20
{
21
#ifdef CONFIG_NET_CLS_ACT
22 23 24 25 26
	struct tcf_gact *gact;

	if (a->ops && a->ops->type != TCA_ACT_GACT)
		return false;

27
	gact = to_gact(a);
28 29
	if ((!is_ext && gact->tcf_action == act) ||
	    (is_ext && TC_ACT_EXT_CMP(gact->tcf_action, act)))
30 31
		return true;

32
#endif
33 34
	return false;
}
35 36 37

static inline bool is_tcf_gact_shot(const struct tc_action *a)
{
38
	return __is_tcf_gact_act(a, TC_ACT_SHOT, false);
39 40 41 42
}

static inline bool is_tcf_gact_trap(const struct tc_action *a)
{
43 44 45 46 47 48 49 50 51 52 53
	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;
54 55
}

56
#endif /* __NET_TC_GACT_H */