DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rmody@marvell.com>
To: <dev@dpdk.org>, <jerinj@marvell.com>, <ferruh.yigit@intel.com>
Cc: Rasesh Mody <rmody@marvell.com>, <GR-Everest-DPDK-Dev@marvell.com>
Subject: [dpdk-dev] [PATCH v2 3/9] net/qede/base: lock entire QM reconfiguration flow
Date: Sun, 6 Oct 2019 13:14:03 -0700	[thread overview]
Message-ID: <20191006201409.8770-4-rmody@marvell.com> (raw)
In-Reply-To: <20190930024921.21818-1-rmody@marvell.com>

Multiple flows can issue QM reconfiguration, hence hold the lock longer
to account for entire duration of reconfiguration flow.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
---
 drivers/net/qede/base/ecore_dev.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index d7e1d7b32..b183519b5 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -2291,18 +2291,21 @@ enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
 {
 	struct ecore_qm_info *qm_info = &p_hwfn->qm_info;
 	bool b_rc;
-	enum _ecore_status_t rc;
+	enum _ecore_status_t rc = ECORE_SUCCESS;
+
+	/* multiple flows can issue qm reconf. Need to lock */
+	OSAL_SPIN_LOCK(&qm_lock);
 
 	/* initialize ecore's qm data structure */
 	ecore_init_qm_info(p_hwfn);
 
 	/* stop PF's qm queues */
-	OSAL_SPIN_LOCK(&qm_lock);
 	b_rc = ecore_send_qm_stop_cmd(p_hwfn, p_ptt, false, true,
 				      qm_info->start_pq, qm_info->num_pqs);
-	OSAL_SPIN_UNLOCK(&qm_lock);
-	if (!b_rc)
-		return ECORE_INVAL;
+	if (!b_rc) {
+		rc = ECORE_INVAL;
+		goto unlock;
+	}
 
 	/* clear the QM_PF runtime phase leftovers from previous init */
 	ecore_init_clear_rt_data(p_hwfn);
@@ -2313,18 +2316,17 @@ enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
 	/* activate init tool on runtime array */
 	rc = ecore_init_run(p_hwfn, p_ptt, PHASE_QM_PF, p_hwfn->rel_pf_id,
 			    p_hwfn->hw_info.hw_mode);
-	if (rc != ECORE_SUCCESS)
-		return rc;
 
 	/* start PF's qm queues */
-	OSAL_SPIN_LOCK(&qm_lock);
 	b_rc = ecore_send_qm_stop_cmd(p_hwfn, p_ptt, true, true,
 				      qm_info->start_pq, qm_info->num_pqs);
-	OSAL_SPIN_UNLOCK(&qm_lock);
 	if (!b_rc)
-		return ECORE_INVAL;
+		rc = ECORE_INVAL;
 
-	return ECORE_SUCCESS;
+unlock:
+	OSAL_SPIN_UNLOCK(&qm_lock);
+
+	return rc;
 }
 
 static enum _ecore_status_t ecore_alloc_qm_data(struct ecore_hwfn *p_hwfn)
-- 
2.18.0


  parent reply	other threads:[~2019-10-06 20:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-30  2:49 [dpdk-dev] [PATCH 0/9] net/qede/base: update FW to 8.40.25.0 Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 1/9] net/qede/base: calculate right page index for PBL chains Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 2/9] net/qede/base: change MFW mailbox command log verbosity Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 3/9] net/qede/base: lock entire QM reconfiguration flow Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 4/9] net/qede/base: rename HSI datatypes and funcs Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 5/9] net/qede/base: update rt defs NVM cfg and mcp code Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 6/9] net/qede/base: move dmae code to HSI Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 7/9] net/qede/base: update HSI code Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 8/9] net/qede/base: update the FW to 8.40.25.0 Rasesh Mody
2019-09-30  2:49 ` [dpdk-dev] [PATCH 9/9] net/qede: print adapter info during init failure Rasesh Mody
2019-10-03  5:06 ` [dpdk-dev] [PATCH 0/9] net/qede/base: update FW to 8.40.25.0 Jerin Jacob
2019-10-03  5:59   ` Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 " Rasesh Mody
2019-10-11  7:57   ` Jerin Jacob
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 1/9] net/qede/base: calculate right page index for PBL chains Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 2/9] net/qede/base: change MFW mailbox command log verbosity Rasesh Mody
2019-10-06 20:14 ` Rasesh Mody [this message]
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 4/9] net/qede/base: rename HSI datatypes and funcs Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 5/9] net/qede/base: update rt defs NVM cfg and mcp code Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 6/9] net/qede/base: move dmae code to HSI Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 7/9] net/qede/base: update HSI code Rasesh Mody
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 8/9] net/qede/base: update the FW to 8.40.25.0 Rasesh Mody
2019-10-11 16:13   ` Ferruh Yigit
2019-10-06 20:14 ` [dpdk-dev] [PATCH v2 9/9] net/qede: print adapter info during init failure Rasesh Mody

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=20191006201409.8770-4-rmody@marvell.com \
    --to=rmody@marvell.com \
    --cc=GR-Everest-DPDK-Dev@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.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).