From patchwork Tue Jan 15 12:56:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 49837 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4819F1B12D; Tue, 15 Jan 2019 13:55:48 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 1BCB81B101 for ; Tue, 15 Jan 2019 13:55:43 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 04:55:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="127889499" Received: from dpdk51.sh.intel.com ([10.67.110.190]) by orsmga001.jf.intel.com with ESMTP; 15 Jan 2019 04:55:42 -0800 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: paul.m.stillwell.jr@intel.com, dev@dpdk.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, Qi Zhang Date: Tue, 15 Jan 2019 20:56:58 +0800 Message-Id: <20190115125658.15421-8-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190115125658.15421-1-qi.z.zhang@intel.com> References: <20190115125658.15421-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 7/7] net/ice/base: free flow profile entries X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Free flow profile entries when free hw tables. Signed-off-by: Qi Zhang Signed-off-by: Paul M Stillwell Jr --- drivers/net/ice/base/ice_flex_pipe.c | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 0b8376d31..479b8bded 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -3034,6 +3034,42 @@ static void ice_fill_blk_tbls(struct ice_hw *hw, enum ice_block block_id) } /** + * ice_free_flow_profs - free flow profile entries + * @hw: pointer to the hardware structure + */ +static void ice_free_flow_profs(struct ice_hw *hw) +{ + u8 i; + + for (i = 0; i < ICE_BLK_COUNT; i++) { + struct ice_flow_prof *p, *tmp; + + if (!&hw->fl_profs[i]) + continue; + + /* This call is being made as part of resource deallocation + * during unload. Lock acquire and release will not be + * necessary here. + */ + LIST_FOR_EACH_ENTRY_SAFE(p, tmp, &hw->fl_profs[i], + ice_flow_prof, l_entry) { + struct ice_flow_entry *e, *t; + + LIST_FOR_EACH_ENTRY_SAFE(e, t, &p->entries, + ice_flow_entry, l_entry) + ice_flow_rem_entry(hw, ICE_FLOW_ENTRY_HNDL(e)); + + LIST_DEL(&p->l_entry); + if (p->acts) + ice_free(hw, p->acts); + ice_free(hw, p); + } + + ice_destroy_lock(&hw->fl_profs_locks[i]); + } +} + +/** * ice_free_prof_map - frees the profile map * @hw: pointer to the hardware structure * @blk: the hw block which contains the profile map to be freed @@ -3096,6 +3132,8 @@ void ice_free_hw_tbls(struct ice_hw *hw) } ice_memset(hw->blk, 0, sizeof(hw->blk), ICE_NONDMA_MEM); + + ice_free_flow_profs(hw); } /**