From patchwork Wed Apr 14 18:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 421555 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0A04C433ED for ; Wed, 14 Apr 2021 18:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F46E6113B for ; Wed, 14 Apr 2021 18:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352229AbhDNSGy (ORCPT ); Wed, 14 Apr 2021 14:06:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:36618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352037AbhDNSGg (ORCPT ); Wed, 14 Apr 2021 14:06:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBAA061220; Wed, 14 Apr 2021 18:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618423574; bh=fR0Ov1XxJ+iBicVQJwLSNovcfu+cDCusWup//waBNyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pp5y7F/HQawQYDiqxt2U6t03l4kaY6c+Rq5gGEztq+5DtKmaCEkzhVwY1W4wS/lX9 RgveF5aRkBnT9jD2/NdbVmaouI6ZvwSJ7W0lqGGcPJpi6+q1LE/fukQ1LYvYZquzBL QgPVaUq1+I74KKs+xTE53zalzVa5NoADVSLsjApfAGdagQQoRkzZXaXyf1Int0E8jy IY0Z+jXGyLfFFTti4PFayI9bDxoO6/x61gZkhknwhExmnI2HGnMXUcENyT9Wi5+wN9 sCyXqxsNh6qEIPoUVVED/ujUdNe7kyxt0txyj+lw5Q/Nx7X1GAnIdU66N/xgS1gtlx O6Gu5ev6WAv3w== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Tariq Toukan , Parav Pandit , Saeed Mahameed Subject: [net-next V2 04/16] net/mlx5: E-Switch Make cleanup sequence mirror of init Date: Wed, 14 Apr 2021 11:05:53 -0700 Message-Id: <20210414180605.111070-5-saeed@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210414180605.111070-1-saeed@kernel.org> References: <20210414180605.111070-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit Make cleanup sequence mirror of init sequence for cleaning up reps and freeing vports. Also when reps initialization fails, there is no need to perform reps cleanup. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index b3bc82e419b6..9009574372fc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1856,7 +1856,6 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) abort: if (esw->work_queue) destroy_workqueue(esw->work_queue); - esw_offloads_cleanup_reps(esw); kfree(esw->vports); kfree(esw); return err; @@ -1871,7 +1870,6 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) esw->dev->priv.eswitch = NULL; destroy_workqueue(esw->work_queue); - esw_offloads_cleanup_reps(esw); mutex_destroy(&esw->state_lock); WARN_ON(!xa_empty(&esw->offloads.vhca_map)); xa_destroy(&esw->offloads.vhca_map); @@ -1879,6 +1877,7 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) mlx5e_mod_hdr_tbl_destroy(&esw->offloads.mod_hdr); mutex_destroy(&esw->offloads.encap_tbl_lock); mutex_destroy(&esw->offloads.decap_tbl_lock); + esw_offloads_cleanup_reps(esw); kfree(esw->vports); kfree(esw); }