From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 511B0A0471 for ; Wed, 19 Jun 2019 18:05:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E91E61CFE1; Wed, 19 Jun 2019 17:22:55 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 80FFA1C3A5 for ; Wed, 19 Jun 2019 17:21:40 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 08:21:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="165050609" Received: from lrong-srv-03.sh.intel.com ([10.67.119.177]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2019 08:21:39 -0700 From: Leyi Rong To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Leyi Rong , Vignesh Sridhar , Paul M Stillwell Jr Date: Wed, 19 Jun 2019 23:18:44 +0800 Message-Id: <20190619151846.113820-68-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619151846.113820-1-leyi.rong@intel.com> References: <20190611155221.2703-1-leyi.rong@intel.com> <20190619151846.113820-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v3 67/69] net/ice/base: changes in flow and profile removal 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" - Add function to remove ES profile map as it is now being used in clearing and freeing HW tables. - Locks were initially not used for releasing ES profile maps and flow profiles as the sequence is part of driver unload. Adding calls to acquire and release locks to ensure that any calls made by the VF VSI during VFR or unload do not result in memory access violations. Signed-off-by: Vignesh Sridhar Signed-off-by: Paul M Stillwell Jr Signed-off-by: Leyi Rong --- drivers/net/ice/base/ice_flex_pipe.c | 35 +++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index 5f14d0488..c1f23ec02 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -2988,6 +2988,26 @@ void ice_fill_blk_tbls(struct ice_hw *hw) ice_init_sw_db(hw); } +/** + * ice_free_prof_map - free profile map + * @hw: pointer to the hardware structure + * @blk_idx: HW block index + */ +static void ice_free_prof_map(struct ice_hw *hw, u8 blk_idx) +{ + struct ice_es *es = &hw->blk[blk_idx].es; + struct ice_prof_map *del, *tmp; + + ice_acquire_lock(&es->prof_map_lock); + LIST_FOR_EACH_ENTRY_SAFE(del, tmp, &es->prof_map, + ice_prof_map, list) { + LIST_DEL(&del->list); + ice_free(hw, del); + } + INIT_LIST_HEAD(&es->prof_map); + ice_release_lock(&es->prof_map_lock); +} + /** * ice_free_flow_profs - free flow profile entries * @hw: pointer to the hardware structure @@ -2997,10 +3017,7 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx) { struct ice_flow_prof *p, *tmp; - /* This call is being made as part of resource deallocation - * during unload. Lock acquire and release will not be - * necessary here. - */ + ice_acquire_lock(&hw->fl_profs_locks[blk_idx]); LIST_FOR_EACH_ENTRY_SAFE(p, tmp, &hw->fl_profs[blk_idx], ice_flow_prof, l_entry) { struct ice_flow_entry *e, *t; @@ -3014,6 +3031,7 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx) ice_free(hw, p->acts); ice_free(hw, p); } + ice_release_lock(&hw->fl_profs_locks[blk_idx]); /* if driver is in reset and tables are being cleared * re-initialize the flow profile list heads @@ -3050,17 +3068,12 @@ void ice_free_hw_tbls(struct ice_hw *hw) for (i = 0; i < ICE_BLK_COUNT; i++) { if (hw->blk[i].is_list_init) { struct ice_es *es = &hw->blk[i].es; - struct ice_prof_map *del, *tmp; - - LIST_FOR_EACH_ENTRY_SAFE(del, tmp, &es->prof_map, - ice_prof_map, list) { - LIST_DEL(&del->list); - ice_free(hw, del); - } + ice_free_prof_map(hw, i); ice_destroy_lock(&es->prof_map_lock); ice_free_flow_profs(hw, i); ice_destroy_lock(&hw->fl_profs_locks[i]); + hw->blk[i].is_list_init = false; } ice_free_vsig_tbl(hw, (enum ice_block)i); -- 2.17.1