diff options
author | Jakub Kicinski <kuba@kernel.org> | 2020-07-10 02:42:48 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-10 22:54:00 +0200 |
commit | 424be63ad831fbd5fb04eb6576de44f4aa7661e2 (patch) | |
tree | 63b9196a926b35a004ca7caa5577176ca33f277c /drivers/net/netdevsim/netdev.c | |
parent | ethtool: add tunnel info interface (diff) | |
download | linux-424be63ad831fbd5fb04eb6576de44f4aa7661e2.tar.xz linux-424be63ad831fbd5fb04eb6576de44f4aa7661e2.zip |
netdevsim: add UDP tunnel port offload support
Add UDP tunnel port handlers to our fake driver so we can test
the core infra.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
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 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 2908e0a0d6e1..9d0d18026434 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -22,6 +22,7 @@ #include <net/netlink.h> #include <net/pkt_cls.h> #include <net/rtnetlink.h> +#include <net/udp_tunnel.h> #include "netdevsim.h" @@ -257,6 +258,8 @@ static const struct net_device_ops nsim_netdev_ops = { .ndo_setup_tc = nsim_setup_tc, .ndo_set_features = nsim_set_features, .ndo_bpf = nsim_bpf, + .ndo_udp_tunnel_add = udp_tunnel_nic_add_port, + .ndo_udp_tunnel_del = udp_tunnel_nic_del_port, .ndo_get_devlink_port = nsim_get_devlink_port, }; @@ -299,10 +302,14 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) SET_NETDEV_DEV(dev, &ns->nsim_bus_dev->dev); dev->netdev_ops = &nsim_netdev_ops; + err = nsim_udp_tunnels_info_create(nsim_dev, dev); + if (err) + goto err_free_netdev; + rtnl_lock(); err = nsim_bpf_init(ns); if (err) - goto err_free_netdev; + goto err_utn_destroy; nsim_ipsec_init(ns); @@ -317,6 +324,8 @@ err_ipsec_teardown: nsim_ipsec_teardown(ns); nsim_bpf_uninit(ns); rtnl_unlock(); +err_utn_destroy: + nsim_udp_tunnels_info_destroy(dev); err_free_netdev: free_netdev(dev); return ERR_PTR(err); @@ -331,6 +340,7 @@ void nsim_destroy(struct netdevsim *ns) nsim_ipsec_teardown(ns); nsim_bpf_uninit(ns); rtnl_unlock(); + nsim_udp_tunnels_info_destroy(dev); free_netdev(dev); } |