DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, xiaolong.ye@intel.com,
	Qi Zhang <qi.z.zhang@intel.com>,
	Vignesh Sridhar <vignesh.sridhar@intel.com>,
	Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Subject: [dpdk-dev] [PATCH 10/10] net/ice/base: replace RSS profile locks
Date: Thu, 11 Jun 2020 16:43:30 +0800	[thread overview]
Message-ID: <20200611084330.18301-11-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20200611084330.18301-1-qi.z.zhang@intel.com>

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 <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 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


  parent reply	other threads:[~2020-06-11  8:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  8:43 [dpdk-dev] [PATCH 00/10] net/ice: base code update for 20.08 batch 2 Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 01/10] net/ice/base: adjust profile id map locks Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 02/10] net/ice/base: refactor to avoid need to retry Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 03/10] net/ice/base: add FD support for outer IP of GTPU Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 04/10] net/ice/base: add commands for system diagnostic Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 05/10] net/ice/base: rename misleading variable Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 06/10] net/ice/base: add FD support for GTPU with outer IPv6 Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 07/10] net/ice/base: get tunnel type for recipe Qi Zhang
2020-06-19 14:33   ` Ferruh Yigit
2020-06-11  8:43 ` [dpdk-dev] [PATCH 08/10] net/ice/base: choose TCP dummy packet by protocol Qi Zhang
2020-06-11  8:43 ` [dpdk-dev] [PATCH 09/10] net/ice/base: fix the VSI ID mask to be 10 bit Qi Zhang
2020-06-11  8:43 ` Qi Zhang [this message]
2020-06-18  6:04 ` [dpdk-dev] [PATCH 00/10] net/ice: base code update for 20.08 batch 2 Yang, Qiming
2020-06-19  4:24   ` Zhang, Qi Z
2020-06-23 10:15     ` Yang, Qiming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611084330.18301-11-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=paul.m.stillwell.jr@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=vignesh.sridhar@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).