From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 843B9A00BE; Mon, 23 May 2022 14:04:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C63D4014F; Mon, 23 May 2022 14:04:44 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 5AAC140141; Mon, 23 May 2022 14:04:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653307482; x=1684843482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BFO8GCCgpmYjJXsAHxRxtk1Si83GjpeWG62BLQWv0tI=; b=jUVviP9PTC2SqQXe3w+jMgVLZ8P9hhRl1ytV/P2v4akiloTh7HW7SZkB nj3ubdF8/a0cBrYZpgMKsZITu8eyTVjyl1KFYxC3RlDTFWMVj8Upfm1bY N/J8L9QsXSUxCMKDl6ULsBpL2GkQuvnUVZXFtfMVCNjAlCX+Fdgmx2Rnz nImp4HUU5d6bciUNfpdOUrlxy2MEj+OnLTFHi9TucaHlS0frn0b3HCUHi PPg+EAiQtFSa/+9HU+ueIEen5nXAT0Z0g85oqwi6pe4C6bFAlxK5FgqqA bFk9K4SY1/Hn2vbc+0BoP/YpsVxS1FqTvTs+XCUDUl5SwvcWbbsrKaiiU g==; X-IronPort-AV: E=McAfee;i="6400,9594,10355"; a="253701557" X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="253701557" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2022 05:04:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="558614871" Received: from silpixa00400884.ir.intel.com ([10.243.22.82]) by orsmga002.jf.intel.com with ESMTP; 23 May 2022 05:04:39 -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 v2] net/iavf: fix device stop Date: Mon, 23 May 2022 13:04:36 +0100 Message-Id: <20220523120436.4042421-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220506094531.3485109-1-radu.nicolau@intel.com> References: <20220506094531.3485109-1-radu.nicolau@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- v2: rebased to next-net-intel 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 7a3b37d5e3..e85ae0ed0e 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1088,9 +1088,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; @@ -2713,6 +2710,9 @@ iavf_dev_close(struct rte_eth_dev *dev) ret = iavf_dev_stop(dev); adapter->closed = true; + /* 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 72ce39a052..fa1cecc1e1 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); -- 2.25.1