Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __NET_TC_IFE_H
0003 #define __NET_TC_IFE_H
0004 
0005 #include <net/act_api.h>
0006 #include <linux/etherdevice.h>
0007 #include <linux/rtnetlink.h>
0008 
0009 struct module;
0010 
0011 struct tcf_ife_params {
0012     u8 eth_dst[ETH_ALEN];
0013     u8 eth_src[ETH_ALEN];
0014     u16 eth_type;
0015     u16 flags;
0016 
0017     struct rcu_head rcu;
0018 };
0019 
0020 struct tcf_ife_info {
0021     struct tc_action common;
0022     struct tcf_ife_params __rcu *params;
0023     /* list of metaids allowed */
0024     struct list_head metalist;
0025 };
0026 #define to_ife(a) ((struct tcf_ife_info *)a)
0027 
0028 struct tcf_meta_info {
0029     const struct tcf_meta_ops *ops;
0030     void *metaval;
0031     u16 metaid;
0032     struct list_head metalist;
0033 };
0034 
0035 struct tcf_meta_ops {
0036     u16 metaid; /*Maintainer provided ID */
0037     u16 metatype; /*netlink attribute type (look at net/netlink.h) */
0038     const char *name;
0039     const char *synopsis;
0040     struct list_head list;
0041     int (*check_presence)(struct sk_buff *, struct tcf_meta_info *);
0042     int (*encode)(struct sk_buff *, void *, struct tcf_meta_info *);
0043     int (*decode)(struct sk_buff *, void *, u16 len);
0044     int (*get)(struct sk_buff *skb, struct tcf_meta_info *mi);
0045     int (*alloc)(struct tcf_meta_info *, void *, gfp_t);
0046     void    (*release)(struct tcf_meta_info *);
0047     int (*validate)(void *val, int len);
0048     struct module   *owner;
0049 };
0050 
0051 #define MODULE_ALIAS_IFE_META(metan)   MODULE_ALIAS("ife-meta-" metan)
0052 
0053 int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);
0054 int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi);
0055 int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval, gfp_t gfp);
0056 int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval, gfp_t gfp);
0057 int ife_check_meta_u32(u32 metaval, struct tcf_meta_info *mi);
0058 int ife_check_meta_u16(u16 metaval, struct tcf_meta_info *mi);
0059 int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi);
0060 int ife_validate_meta_u32(void *val, int len);
0061 int ife_validate_meta_u16(void *val, int len);
0062 int ife_encode_meta_u16(u16 metaval, void *skbdata, struct tcf_meta_info *mi);
0063 void ife_release_meta_gen(struct tcf_meta_info *mi);
0064 int register_ife_op(struct tcf_meta_ops *mops);
0065 int unregister_ife_op(struct tcf_meta_ops *mops);
0066 
0067 #endif /* __NET_TC_IFE_H */