From mboxrd@z Thu Jan 1 00:00:00 1970 From: Saeed Mahameed Subject: [net-next V2 05/12] net/mlx5e: Vxlan, add direct delete function Date: Fri, 27 Jul 2018 17:06:15 -0700 Message-ID: <20180728000622.4123-6-saeedm@mellanox.com> References: <20180728000622.4123-1-saeedm@mellanox.com> Cc: netdev@vger.kernel.org, Saeed Mahameed To: "David S. Miller" Return-path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:34613 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389204AbeG1BlB (ORCPT ); Fri, 27 Jul 2018 21:41:01 -0400 In-Reply-To: <20180728000622.4123-1-saeedm@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: Add direct vxlan delete function to be called from vxlan_delete_work. Needed in downstream patch. Signed-off-by: Saeed Mahameed Reviewed-by: Or Gerlitz --- .../net/ethernet/mellanox/mlx5/core/vxlan.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.c index 4b9190d677fc..baeac5922e8c 100644 --- 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 work_struct *work) 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 @@ static void mlx5e_vxlan_del_work(struct work_struct *work) 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); } -- 2.17.0