DPDK patches and discussions
 help / color / mirror / Atom feed
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org
Subject: [PATCH 2/2] event/dlb2: poll HW CQ inflights before mapping queue
Date: Wed, 16 Feb 2022 13:38:27 -0600	[thread overview]
Message-ID: <20220216193827.2908858-2-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <20220216193827.2908858-1-timothy.mcdaniel@intel.com>

When attempting to link a port and queue immediately after unlinking,
the CQ inflights may not all be processed. Poll the h/w register for
outstanding inflights instead of reading once, in case the inflights
are still being processed. Also return EBUSY if the inflight
processing is not completed in a suitable amount of time.

Fixes: 1857f1922ce2 ("event/dlb2: use new implementation of resource file")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/pf/base/dlb2_resource.c | 23 ++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
index 3661b940c3..d4c49c2992 100644
--- a/drivers/event/dlb2/pf/base/dlb2_resource.c
+++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
@@ -2356,16 +2356,26 @@ static bool dlb2_domain_finish_unmap_port(struct dlb2_hw *hw,
 {
 	u32 infl_cnt;
 	int i;
+	const int max_iters = 1000;
+	const int iter_poll_us = 100;
 
 	if (port->num_pending_removals == 0)
 		return false;
 
 	/*
 	 * The unmap requires all the CQ's outstanding inflights to be
-	 * completed.
+	 * completed. Poll up to 100ms.
 	 */
-	infl_cnt = DLB2_CSR_RD(hw, DLB2_LSP_CQ_LDB_INFL_CNT(hw->ver,
+	for (i = 0; i < max_iters; i++) {
+		infl_cnt = DLB2_CSR_RD(hw, DLB2_LSP_CQ_LDB_INFL_CNT(hw->ver,
 						       port->id.phys_id));
+
+		if (DLB2_BITS_GET(infl_cnt,
+				  DLB2_LSP_CQ_LDB_INFL_CNT_COUNT) == 0)
+			break;
+		rte_delay_us_sleep(iter_poll_us);
+	}
+
 	if (DLB2_BITS_GET(infl_cnt, DLB2_LSP_CQ_LDB_INFL_CNT_COUNT) > 0)
 		return false;
 
@@ -5316,6 +5326,7 @@ static void dlb2_log_map_qid(struct dlb2_hw *hw,
  * EINVAL - A requested resource is unavailable, invalid port or queue ID, or
  *	    the domain is not configured.
  * EFAULT - Internal error (resp->status not set).
+ * EBUSY  - The requested port has outstanding detach operations.
  */
 int dlb2_hw_map_qid(struct dlb2_hw *hw,
 		    u32 domain_id,
@@ -5356,8 +5367,12 @@ int dlb2_hw_map_qid(struct dlb2_hw *hw,
 	 * attempt to complete them. This may be necessary to free up a QID
 	 * slot for this requested mapping.
 	 */
-	if (port->num_pending_removals)
-		dlb2_domain_finish_unmap_port(hw, domain, port);
+	if (port->num_pending_removals) {
+		bool bool_ret;
+		bool_ret = dlb2_domain_finish_unmap_port(hw, domain, port);
+		if (!bool_ret)
+			return -EBUSY;
+	}
 
 	ret = dlb2_verify_map_qid_slot_available(port, queue, resp);
 	if (ret)
-- 
2.23.0


  reply	other threads:[~2022-02-16 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 19:38 [PATCH 1/2] event/dlb2: update rolling mask used for dequeue Timothy McDaniel
2022-02-16 19:38 ` Timothy McDaniel [this message]
2022-02-22  5:57 ` Jerin Jacob

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=20220216193827.2908858-2-timothy.mcdaniel@intel.com \
    --to=timothy.mcdaniel@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.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).