netdevsim.h (57b54d74dd5c559bd35f2affaf11d8828aaf5733) | netdevsim.h (7699353da875c2ae0d87a4f5a995c144115b31bb) |
---|---|
1/* 2 * Copyright (C) 2017 Netronome Systems, Inc. 3 * 4 * This software is licensed under the GNU General License Version 2, 5 * June 1991 as shown in the file COPYING in the top-level directory of this 6 * source tree. 7 * 8 * THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" --- 15 unchanged lines hidden (view full) --- 24#define NSIM_XDP_MAX_MTU 4000 25 26#define NSIM_EA(extack, msg) NL_SET_ERR_MSG_MOD((extack), msg) 27 28struct bpf_prog; 29struct dentry; 30struct nsim_vf_config; 31 | 1/* 2 * Copyright (C) 2017 Netronome Systems, Inc. 3 * 4 * This software is licensed under the GNU General License Version 2, 5 * June 1991 as shown in the file COPYING in the top-level directory of this 6 * source tree. 7 * 8 * THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" --- 15 unchanged lines hidden (view full) --- 24#define NSIM_XDP_MAX_MTU 4000 25 26#define NSIM_EA(extack, msg) NL_SET_ERR_MSG_MOD((extack), msg) 27 28struct bpf_prog; 29struct dentry; 30struct nsim_vf_config; 31 |
32#define NSIM_IPSEC_MAX_SA_COUNT 33 33#define NSIM_IPSEC_VALID BIT(31) 34 35struct nsim_sa { 36 struct xfrm_state *xs; 37 __be32 ipaddr[4]; 38 u32 key[4]; 39 u32 salt; 40 bool used; 41 bool crypt; 42 bool rx; 43}; 44 45struct nsim_ipsec { 46 struct nsim_sa sa[NSIM_IPSEC_MAX_SA_COUNT]; 47 struct dentry *pfile; 48 u32 count; 49 u32 tx; 50 u32 ok; 51}; 52 |
|
32struct netdevsim { 33 struct net_device *netdev; 34 35 u64 tx_packets; 36 u64 tx_bytes; 37 struct u64_stats_sync syncp; 38 39 struct device dev; --- 22 unchanged lines hidden (view full) --- 62 bool bpf_xdpdrv_accept; 63 bool bpf_xdpoffload_accept; 64 65 bool bpf_map_accept; 66 struct list_head bpf_bound_maps; 67#if IS_ENABLED(CONFIG_NET_DEVLINK) 68 struct devlink *devlink; 69#endif | 53struct netdevsim { 54 struct net_device *netdev; 55 56 u64 tx_packets; 57 u64 tx_bytes; 58 struct u64_stats_sync syncp; 59 60 struct device dev; --- 22 unchanged lines hidden (view full) --- 83 bool bpf_xdpdrv_accept; 84 bool bpf_xdpoffload_accept; 85 86 bool bpf_map_accept; 87 struct list_head bpf_bound_maps; 88#if IS_ENABLED(CONFIG_NET_DEVLINK) 89 struct devlink *devlink; 90#endif |
91 struct nsim_ipsec ipsec; |
|
70}; 71 72extern struct dentry *nsim_ddir; 73 74#ifdef CONFIG_BPF_SYSCALL 75int nsim_bpf_init(struct netdevsim *ns); 76void nsim_bpf_uninit(struct netdevsim *ns); 77int nsim_bpf(struct net_device *dev, struct netdev_bpf *bpf); --- 65 unchanged lines hidden (view full) --- 143 return 0; 144} 145 146static inline void nsim_devlink_exit(void) 147{ 148} 149#endif 150 | 92}; 93 94extern struct dentry *nsim_ddir; 95 96#ifdef CONFIG_BPF_SYSCALL 97int nsim_bpf_init(struct netdevsim *ns); 98void nsim_bpf_uninit(struct netdevsim *ns); 99int nsim_bpf(struct net_device *dev, struct netdev_bpf *bpf); --- 65 unchanged lines hidden (view full) --- 165 return 0; 166} 167 168static inline void nsim_devlink_exit(void) 169{ 170} 171#endif 172 |
173#if IS_ENABLED(CONFIG_XFRM_OFFLOAD) 174void nsim_ipsec_init(struct netdevsim *ns); 175void nsim_ipsec_teardown(struct netdevsim *ns); 176bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb); 177#else 178static inline void nsim_ipsec_init(struct netdevsim *ns) 179{ 180} 181 182static inline void nsim_ipsec_teardown(struct netdevsim *ns) 183{ 184} 185 186static inline bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb) 187{ 188 return true; 189} 190#endif 191 |
|
151static inline struct netdevsim *to_nsim(struct device *ptr) 152{ 153 return container_of(ptr, struct netdevsim, dev); 154} | 192static inline struct netdevsim *to_nsim(struct device *ptr) 193{ 194 return container_of(ptr, struct netdevsim, dev); 195} |