tc_ife.h 2.01 KB
Newer Older
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
1
2
3
4
5
6
7
8
9
10
#ifndef __NET_TC_IFE_H
#define __NET_TC_IFE_H

#include <net/act_api.h>
#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <linux/module.h>

#define IFE_METAHDRLEN 2
struct tcf_ife_info {
11
	struct tc_action common;
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
12
13
14
15
16
17
18
	u8 eth_dst[ETH_ALEN];
	u8 eth_src[ETH_ALEN];
	u16 eth_type;
	u16 flags;
	/* list of metaids allowed */
	struct list_head metalist;
};
19
#define to_ife(a) ((struct tcf_ife_info *)a)
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

struct tcf_meta_info {
	const struct tcf_meta_ops *ops;
	void *metaval;
	u16 metaid;
	struct list_head metalist;
};

struct tcf_meta_ops {
	u16 metaid; /*Maintainer provided ID */
	u16 metatype; /*netlink attribute type (look at net/netlink.h) */
	const char *name;
	const char *synopsis;
	struct list_head list;
	int	(*check_presence)(struct sk_buff *, struct tcf_meta_info *);
	int	(*encode)(struct sk_buff *, void *, struct tcf_meta_info *);
	int	(*decode)(struct sk_buff *, void *, u16 len);
	int	(*get)(struct sk_buff *skb, struct tcf_meta_info *mi);
38
	int	(*alloc)(struct tcf_meta_info *, void *, gfp_t);
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
39
40
41
42
43
44
45
46
47
	void	(*release)(struct tcf_meta_info *);
	int	(*validate)(void *val, int len);
	struct module	*owner;
};

#define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ifemeta" __stringify_1(metan))

int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);
int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi);
48
49
int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval, gfp_t gfp);
int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval, gfp_t gfp);
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
50
int ife_check_meta_u32(u32 metaval, struct tcf_meta_info *mi);
51
int ife_check_meta_u16(u16 metaval, struct tcf_meta_info *mi);
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
52
53
54
int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi);
int ife_validate_meta_u32(void *val, int len);
int ife_validate_meta_u16(void *val, int len);
55
int ife_encode_meta_u16(u16 metaval, void *skbdata, struct tcf_meta_info *mi);
Jamal Hadi Salim's avatar
Jamal Hadi Salim committed
56
57
58
59
60
void ife_release_meta_gen(struct tcf_meta_info *mi);
int register_ife_op(struct tcf_meta_ops *mops);
int unregister_ife_op(struct tcf_meta_ops *mops);

#endif /* __NET_TC_IFE_H */