From: Saeed Mahameed <saeedm@mellanox.com>
Date: Mon, 7 May 2018 18:06:26 -0700
Subject: net/mlx5e: Vxlan, add direct delete function
Patch-mainline: v4.19-rc1
Git-commit: 0f647bfcd05cb072f952badd7ea4b6b496b64892
References: bsc#1103990 FATE#326006
Add direct vxlan delete function to be called from vxlan_delete_work.
Needed in downstream patch.
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/net/ethernet/mellanox/mlx5/core/vxlan.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
--- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
@@ -158,18 +158,14 @@ static void mlx5e_vxlan_add_work(struct
kfree(vxlan_work);
}
-static void mlx5e_vxlan_del_work(struct work_struct *work)
+static void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port)
{
- struct mlx5e_vxlan_work *vxlan_work =
- container_of(work, struct mlx5e_vxlan_work, work);
- struct mlx5e_priv *priv = vxlan_work->priv;
struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan;
- u16 port = vxlan_work->port;
struct mlx5e_vxlan *vxlan;
bool remove = false;
- mutex_lock(&priv->state_lock);
spin_lock_bh(&vxlan_db->lock);
+
vxlan = mlx5e_vxlan_lookup_port_locked(priv, port);
if (!vxlan)
goto out_unlock;
@@ -187,6 +183,17 @@ out_unlock:
kfree(vxlan);
vxlan_db->num_ports--;
}
+}
+
+static void mlx5e_vxlan_del_work(struct work_struct *work)
+{
+ struct mlx5e_vxlan_work *vxlan_work =
+ container_of(work, struct mlx5e_vxlan_work, work);
+ struct mlx5e_priv *priv = vxlan_work->priv;
+ u16 port = vxlan_work->port;
+
+ mutex_lock(&priv->state_lock);
+ mlx5e_vxlan_del_port(priv, port);
mutex_unlock(&priv->state_lock);
kfree(vxlan_work);
}