diff options
author | Shannon Nelson <shannon.nelson@oracle.com> | 2018-06-26 10:07:54 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-28 16:10:08 +0900 |
commit | 7699353da875c2ae0d87a4f5a995c144115b31bb (patch) | |
tree | 813c318f6228bde1a400e2b5b2203fd0a3b76611 /drivers/net/netdevsim/netdev.c | |
parent | c3eba0a4ebf0dedabf30804d4cfc31cdd87b5398 (diff) | |
download | lwn-7699353da875c2ae0d87a4f5a995c144115b31bb.tar.gz lwn-7699353da875c2ae0d87a4f5a995c144115b31bb.zip |
netdevsim: add ipsec offload testing
Implement the IPsec/XFRM offload API for testing.
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r-- | drivers/net/netdevsim/netdev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index c9dacc6fcd59..b2f9d0df93b0 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -171,6 +171,8 @@ static int nsim_init(struct net_device *dev) if (err) goto err_unreg_dev; + nsim_ipsec_init(ns); + return 0; err_unreg_dev: @@ -186,6 +188,7 @@ static void nsim_uninit(struct net_device *dev) { struct netdevsim *ns = netdev_priv(dev); + nsim_ipsec_teardown(ns); nsim_devlink_teardown(ns); debugfs_remove_recursive(ns->ddir); nsim_bpf_uninit(ns); @@ -203,11 +206,15 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct netdevsim *ns = netdev_priv(dev); + if (!nsim_ipsec_tx(ns, skb)) + goto out; + u64_stats_update_begin(&ns->syncp); ns->tx_packets++; ns->tx_bytes += skb->len; u64_stats_update_end(&ns->syncp); +out: dev_kfree_skb(skb); return NETDEV_TX_OK; |