mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
netdevsim: add dummy macsec offload
When the kernel is compiled with MACsec support, add the NETIF_F_HW_MACSEC feature to netdevsim devices and implement macsec_ops. To allow easy testing of failure from the device, support is limited to 3 SecY's per netdevsim device, and 1 RXSC per SecY. v2: - nsim_macsec_add_secy, return -ENOSPC if secy_count isn't full but we can't find an empty slot (Simon Horman) - add sci_to_cpu to make sparse happy (Simon Horman) - remove set but not used secy variable (kernel test robot and Simon Horman) Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
633d76ad01
commit
02b34d03a2
@@ -23,6 +23,7 @@
|
||||
#include <net/devlink.h>
|
||||
#include <net/udp_tunnel.h>
|
||||
#include <net/xdp.h>
|
||||
#include <net/macsec.h>
|
||||
|
||||
#define DRV_NAME "netdevsim"
|
||||
|
||||
@@ -52,6 +53,25 @@ struct nsim_ipsec {
|
||||
u32 ok;
|
||||
};
|
||||
|
||||
#define NSIM_MACSEC_MAX_SECY_COUNT 3
|
||||
#define NSIM_MACSEC_MAX_RXSC_COUNT 1
|
||||
struct nsim_rxsc {
|
||||
sci_t sci;
|
||||
bool used;
|
||||
};
|
||||
|
||||
struct nsim_secy {
|
||||
sci_t sci;
|
||||
struct nsim_rxsc nsim_rxsc[NSIM_MACSEC_MAX_RXSC_COUNT];
|
||||
u8 nsim_rxsc_count;
|
||||
bool used;
|
||||
};
|
||||
|
||||
struct nsim_macsec {
|
||||
struct nsim_secy nsim_secy[NSIM_MACSEC_MAX_SECY_COUNT];
|
||||
u8 nsim_secy_count;
|
||||
};
|
||||
|
||||
struct nsim_ethtool_pauseparam {
|
||||
bool rx;
|
||||
bool tx;
|
||||
@@ -93,6 +113,7 @@ struct netdevsim {
|
||||
|
||||
bool bpf_map_accept;
|
||||
struct nsim_ipsec ipsec;
|
||||
struct nsim_macsec macsec;
|
||||
struct {
|
||||
u32 inject_error;
|
||||
u32 sleep;
|
||||
@@ -366,6 +387,19 @@ static inline bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_MACSEC)
|
||||
void nsim_macsec_init(struct netdevsim *ns);
|
||||
void nsim_macsec_teardown(struct netdevsim *ns);
|
||||
#else
|
||||
static inline void nsim_macsec_init(struct netdevsim *ns)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void nsim_macsec_teardown(struct netdevsim *ns)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
struct nsim_bus_dev {
|
||||
struct device dev;
|
||||
struct list_head list;
|
||||
|
||||
Reference in New Issue
Block a user