#include "en_accel/tls.h"
 #include "accel/ipsec.h"
 #include "accel/tls.h"
-#include "vxlan.h"
+#include "lib/vxlan.h"
 #include "en/port.h"
 #include "en/xdp.h"
 
                mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
        mutex_unlock(&priv->state_lock);
 
-       if (mlx5_vxlan_allowed(priv->vxlan))
+       if (mlx5_vxlan_allowed(priv->mdev->vxlan))
                udp_tunnel_get_rx_info(netdev);
 
        return err;
        u16 port = vxlan_work->port;
 
        mutex_lock(&priv->state_lock);
-       mlx5_vxlan_add_port(priv->vxlan, port);
+       mlx5_vxlan_add_port(priv->mdev->vxlan, port);
        mutex_unlock(&priv->state_lock);
 
        kfree(vxlan_work);
        u16 port = vxlan_work->port;
 
        mutex_lock(&priv->state_lock);
-       mlx5_vxlan_del_port(priv->vxlan, port);
+       mlx5_vxlan_del_port(priv->mdev->vxlan, port);
        mutex_unlock(&priv->state_lock);
        kfree(vxlan_work);
 }
        if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
                return;
 
-       if (!mlx5_vxlan_allowed(priv->vxlan))
+       if (!mlx5_vxlan_allowed(priv->mdev->vxlan))
                return;
 
        mlx5e_vxlan_queue_work(priv, be16_to_cpu(ti->port), 1);
        if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
                return;
 
-       if (!mlx5_vxlan_allowed(priv->vxlan))
+       if (!mlx5_vxlan_allowed(priv->mdev->vxlan))
                return;
 
        mlx5e_vxlan_queue_work(priv, be16_to_cpu(ti->port), 0);
                port = be16_to_cpu(udph->dest);
 
                /* Verify if UDP port is being offloaded by HW */
-               if (mlx5_vxlan_lookup_port(priv->vxlan, port))
+               if (mlx5_vxlan_lookup_port(priv->mdev->vxlan, port))
                        return features;
        }
 
        netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_FILTER;
        netdev->hw_features      |= NETIF_F_HW_VLAN_STAG_TX;
 
-       if (mlx5_vxlan_allowed(priv->vxlan) || MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
+       if (mlx5_vxlan_allowed(mdev->vxlan) || MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
                netdev->hw_enc_features |= NETIF_F_IP_CSUM;
                netdev->hw_enc_features |= NETIF_F_IPV6_CSUM;
                netdev->hw_enc_features |= NETIF_F_TSO;
                netdev->hw_enc_features |= NETIF_F_GSO_PARTIAL;
        }
 
-       if (mlx5_vxlan_allowed(priv->vxlan)) {
+       if (mlx5_vxlan_allowed(mdev->vxlan)) {
                netdev->hw_features     |= NETIF_F_GSO_UDP_TUNNEL |
                                           NETIF_F_GSO_UDP_TUNNEL_CSUM;
                netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
        struct mlx5e_priv *priv = netdev_priv(netdev);
        int err;
 
-       priv->vxlan = mlx5_vxlan_create(mdev);
-
        mlx5e_build_nic_netdev_priv(mdev, netdev, profile, ppriv);
        err = mlx5e_ipsec_init(priv);
        if (err)
 
 static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
 {
-       mlx5_vxlan_destroy(priv->vxlan);
        mlx5e_tls_cleanup(priv);
        mlx5e_ipsec_cleanup(priv);
 }
 
 #include "en_rep.h"
 #include "en_tc.h"
 #include "eswitch.h"
-#include "vxlan.h"
+#include "lib/vxlan.h"
 #include "fs_core.h"
 #include "en/port.h"
 
                if (memchr_inv(&mask->dst, 0xff, sizeof(mask->dst)))
                        goto vxlan_match_offload_err;
 
-               if (mlx5_vxlan_lookup_port(up_priv->vxlan, be16_to_cpu(key->dst)) &&
+               if (mlx5_vxlan_lookup_port(up_priv->mdev->vxlan, be16_to_cpu(key->dst)) &&
                    MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap))
                        parse_vxlan_attr(spec, f);
                else {
                return -EOPNOTSUPP;
        }
 
-       if (mlx5_vxlan_lookup_port(up_priv->vxlan, be16_to_cpu(key->tp_dst)) &&
+       if (mlx5_vxlan_lookup_port(up_priv->mdev->vxlan, be16_to_cpu(key->tp_dst)) &&
            MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) {
                tunnel_type = MLX5_HEADER_TYPE_VXLAN;
        } else {
 
 #include "accel/ipsec.h"
 #include "accel/tls.h"
 #include "lib/clock.h"
+#include "lib/vxlan.h"
 #include "diag/fw_tracer.h"
 
 MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>");
 
        mlx5_init_clock(dev);
 
+       dev->vxlan = mlx5_vxlan_create(dev);
+
        err = mlx5_init_rl_table(dev);
        if (err) {
                dev_err(&pdev->dev, "Failed to init rate limiting\n");
 err_rl_cleanup:
        mlx5_cleanup_rl_table(dev);
 err_tables_cleanup:
+       mlx5_vxlan_destroy(dev->vxlan);
        mlx5_cleanup_mkey_table(dev);
        mlx5_cleanup_srq_table(dev);
        mlx5_cleanup_qp_table(dev);
        mlx5_eswitch_cleanup(dev->priv.eswitch);
        mlx5_mpfs_cleanup(dev);
        mlx5_cleanup_rl_table(dev);
+       mlx5_vxlan_destroy(dev->vxlan);
        mlx5_cleanup_clock(dev);
        mlx5_cleanup_reserved_gids(dev);
        mlx5_cleanup_mkey_table(dev);