From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 368C0A00C5; Thu, 11 Jun 2020 10:41:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AB031BEE0; Thu, 11 Jun 2020 10:39:55 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 065A51BED9 for ; Thu, 11 Jun 2020 10:39:52 +0200 (CEST) IronPort-SDR: kcpbLiVWlUM45CLQITxXUz9b8k+7Vdn/cL4/taQEMTft13rGMogTo+G2qOLeARN2S/UOVIg3CH BxbBG1b3GqUQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 01:39:53 -0700 IronPort-SDR: lN1AVRZM5SdHv1mQpeMYQiEVeKtVxEp2pypgFDGx5QHDxNYy+jHCUbvN/IjqP1XtGJd9KwjGn+ DMuVKdA6TbyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,499,1583222400"; d="scan'208";a="419039215" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by orsmga004.jf.intel.com with ESMTP; 11 Jun 2020 01:39:51 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Vignesh Sridhar , Paul M Stillwell Jr Date: Thu, 11 Jun 2020 16:43:30 +0800 Message-Id: <20200611084330.18301-11-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200611084330.18301-1-qi.z.zhang@intel.com> References: <20200611084330.18301-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 10/10] net/ice/base: replace RSS profile locks 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" Replacing flow profile locks with RSS profile locks in the function to remove all RSS rules for a given VSI. This is to align the locks used for RSS rule addition to VSI and removal during VSI teardown to avoid a race condition owing to several iterations of the above operations. In function to get RSS rules for given VSI and protocol header replacing the pointer reference of the RSS entry with a copy of hash value to ensure thread safety. Signed-off-by: Vignesh Sridhar Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_flow.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index fb0e34e5f..6adcda844 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -3314,7 +3314,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle) if (LIST_EMPTY(&hw->fl_profs[blk])) return ICE_SUCCESS; - ice_acquire_lock(&hw->fl_profs_locks[blk]); + ice_acquire_lock(&hw->rss_locks); LIST_FOR_EACH_ENTRY_SAFE(p, t, &hw->fl_profs[blk], ice_flow_prof, l_entry) if (ice_is_bit_set(p->vsis, vsi_handle)) { @@ -3323,12 +3323,12 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle) break; if (!ice_is_any_bit_set(p->vsis, ICE_MAX_VSI)) { - status = ice_flow_rem_prof_sync(hw, blk, p); + status = ice_flow_rem_prof(hw, blk, p->id); if (status) break; } } - ice_release_lock(&hw->fl_profs_locks[blk]); + ice_release_lock(&hw->rss_locks); return status; } @@ -3820,7 +3820,8 @@ enum ice_status ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle) */ u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs) { - struct ice_rss_cfg *r, *rss_cfg = NULL; + u64 rss_hash = ICE_HASH_INVALID; + struct ice_rss_cfg *r; /* verify if the protocol header is non zero and VSI is valid */ if (hdrs == ICE_FLOW_SEG_HDR_NONE || !ice_is_vsi_valid(hw, vsi_handle)) @@ -3831,10 +3832,10 @@ u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs) ice_rss_cfg, l_entry) if (ice_is_bit_set(r->vsis, vsi_handle) && r->packet_hdr == hdrs) { - rss_cfg = r; + rss_hash = r->hashed_flds; break; } ice_release_lock(&hw->rss_locks); - return rss_cfg ? rss_cfg->hashed_flds : ICE_HASH_INVALID; + return rss_hash; } -- 2.13.6