From patchwork Fri May 6 09:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radu Nicolau X-Patchwork-Id: 110771 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04294A0503; Fri, 6 May 2022 11:45:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6B5340395; Fri, 6 May 2022 11:45:39 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 267684014F; Fri, 6 May 2022 11:45:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651830338; x=1683366338; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BOlR2zJKRStzG92/eXY4uW6Iwi2XKHArXBtMDOAO5hI=; b=QnEtxueuNy5nDjNGHiyrsG8rwoiW2VBoOxyxwARsbuIlcCVaXCrVTMv5 OSrfb7KjBJ9v0eQlQNa2/8rOHbT+6Dt+0/OfRjCyf21PHPCGxjBFOiN1e itjefLEdWP/g/HScwTzZwULhbtmJIq6NiLEYcxREYviStbHXjDn96m4+8 pMteFYwhrY60BJY4BWjro02YVPeSfbalD7fhDU1k3h31YUF7FPpqa9Ray WqjAA/8FnFN9dDhb8hPe8codch23p4G0i1xEYiDbTu4X6e/V15QQjomNm CaUWXggXr6PzPYhoz9dbOl9pU2lp/KgwHx+9Mft5fhRsqts3sXN5/C6FR g==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="248952134" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="248952134" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 02:45:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="517953415" Received: from silpixa00400884.ir.intel.com ([10.243.22.82]) by orsmga003.jf.intel.com with ESMTP; 06 May 2022 02:45:33 -0700 From: Radu Nicolau To: Jingjing Wu , Beilei Xing Cc: dev@dpdk.org, daniel.m.buckley@intel.com, qi.z.zhang@intel.com, Radu Nicolau , stable@dpdk.org Subject: [PATCH] net/iavf: fix device stop Date: Fri, 6 May 2022 10:45:31 +0100 Message-Id: <20220506094531.3485109-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Move security context destroy from device stop to device close function. Deleting the context on device stop can prevent the application from properly cleaning and releasing resources. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau --- drivers/net/iavf/iavf_ethdev.c | 6 +++--- drivers/net/iavf/iavf_ipsec_crypto.c | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7d093bdc24..839831882d 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1035,9 +1035,6 @@ iavf_dev_stop(struct rte_eth_dev *dev) iavf_add_del_mc_addr_list(adapter, vf->mc_addrs, vf->mc_addrs_num, false); - /* free iAVF security device context all related resources */ - iavf_security_ctx_destroy(adapter); - adapter->stopped = 1; dev->data->dev_started = 0; @@ -2625,6 +2622,9 @@ iavf_dev_close(struct rte_eth_dev *dev) ret = iavf_dev_stop(dev); + /* free iAVF security device context all related resources */ + iavf_security_ctx_destroy(adapter); + iavf_flow_flush(dev, NULL); iavf_flow_uninit(adapter); diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index b1949cee91..6faebf3270 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -1551,8 +1551,6 @@ iavf_security_ctx_destroy(struct iavf_adapter *adapter) if (iavf_sctx == NULL) return -ENODEV; - /* TODO: Add resources cleanup */ - /* free and reset security data structures */ rte_free(iavf_sctx); rte_free(sctx);