summaryrefslogtreecommitdiff
path: root/drivers/net/netdevsim/netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r--drivers/net/netdevsim/netdev.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 23950e7a0f81..97cfb015a50b 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_rtnl_unlock;
+ goto err_utn_destroy;
nsim_ipsec_init(ns);
@@ -316,8 +323,10 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
err_ipsec_teardown:
nsim_ipsec_teardown(ns);
nsim_bpf_uninit(ns);
-err_rtnl_unlock:
+err_utn_destroy:
rtnl_unlock();
+ 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);
}