netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net
Cc: Vignesh Sridhar <vignesh.sridhar@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jeffrey.t.kirsher@intel.com, anthony.l.nguyen@intel.com,
	Andrew Bowers <andrewx.bowers@intel.com>
Subject: [net-next 04/14] ice: Fix RSS profile locks
Date: Sat,  1 Aug 2020 09:17:52 -0700	[thread overview]
Message-ID: <20200801161802.867645-5-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20200801161802.867645-1-anthony.l.nguyen@intel.com>

From: Vignesh Sridhar <vignesh.sridhar@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>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_flow.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c b/drivers/net/ethernet/intel/ice/ice_flow.c
index d74e5290677f..fe677621dd51 100644
--- a/drivers/net/ethernet/intel/ice/ice_flow.c
+++ b/drivers/net/ethernet/intel/ice/ice_flow.c
@@ -1187,7 +1187,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 	if (list_empty(&hw->fl_profs[blk]))
 		return 0;
 
-	mutex_lock(&hw->fl_profs_locks[blk]);
+	mutex_lock(&hw->rss_locks);
 	list_for_each_entry_safe(p, t, &hw->fl_profs[blk], l_entry)
 		if (test_bit(vsi_handle, p->vsis)) {
 			status = ice_flow_disassoc_prof(hw, blk, p, vsi_handle);
@@ -1195,12 +1195,12 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)
 				break;
 
 			if (bitmap_empty(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;
 			}
 		}
-	mutex_unlock(&hw->fl_profs_locks[blk]);
+	mutex_unlock(&hw->rss_locks);
 
 	return status;
 }
@@ -1597,7 +1597,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))
@@ -1607,10 +1608,10 @@ u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs)
 	list_for_each_entry(r, &hw->rss_list_head, l_entry)
 		if (test_bit(vsi_handle, r->vsis) &&
 		    r->packet_hdr == hdrs) {
-			rss_cfg = r;
+			rss_hash = r->hashed_flds;
 			break;
 		}
 	mutex_unlock(&hw->rss_locks);
 
-	return rss_cfg ? rss_cfg->hashed_flds : ICE_HASH_INVALID;
+	return rss_hash;
 }
-- 
2.26.2


  parent reply	other threads:[~2020-08-01 16:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-01 16:17 [net-next 00/14][pull request] 100GbE Intel Wired LAN Driver Updates 2020-08-01 Tony Nguyen
2020-08-01 16:17 ` [net-next 01/14] ice: mark PM functions as __maybe_unused Tony Nguyen
2020-08-01 16:17 ` [net-next 02/14] ice: rename misleading grst_delay variable Tony Nguyen
2020-08-01 16:17 ` [net-next 03/14] ice: fix the vsi_id mask to be 10 bit for set_rss_lut Tony Nguyen
2020-08-01 16:17 ` Tony Nguyen [this message]
2020-08-01 16:17 ` [net-next 05/14] ice: remove page_reuse statistic Tony Nguyen
2020-08-01 16:17 ` [net-next 06/14] ice: add useful statistics Tony Nguyen
2020-08-01 16:17 ` [net-next 07/14] ice: Clear and free XLT entries on reset Tony Nguyen
2020-08-01 16:17 ` [net-next 08/14] ice: Allow 2 queue pairs per VF on SR-IOV initialization Tony Nguyen
2020-08-01 16:17 ` [net-next 09/14] ice: port fix for chk_linearlize Tony Nguyen
2020-08-01 16:17 ` [net-next 10/14] ice: Graceful error handling in HW table calloc failure Tony Nguyen
2020-08-01 16:17 ` [net-next 11/14] ice: Disable VLAN pruning in promiscuous mode Tony Nguyen
2020-08-01 16:18 ` [net-next 12/14] ice: update PTYPE lookup table Tony Nguyen
2020-08-01 16:18 ` [net-next 13/14] ice: adjust profile ID map locks Tony Nguyen
2020-08-01 16:18 ` [net-next 14/14] ice: Misc minor fixes Tony Nguyen
2020-08-03 22:44 ` [net-next 00/14][pull request] 100GbE Intel Wired LAN Driver Updates 2020-08-01 David Miller

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=20200801161802.867645-5-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    --cc=vignesh.sridhar@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).