DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Boyer <aboyer@pensando.io>
To: dev@dpdk.org
Cc: cardigliano@ntop.org, Andrew Boyer <aboyer@pensando.io>,
	Neel Patel <neel@pensando.io>
Subject: [dpdk-dev] [PATCH 4/8] ionic: check for devcmd/admincmd completion more frequently
Date: Mon,  2 Nov 2020 10:35:23 -0800
Message-ID: <20201102183527.69209-5-aboyer@pensando.io> (raw)
In-Reply-To: <20201102183527.69209-1-aboyer@pensando.io>

This reduces the startup time by a few seconds.

Signed-off-by: Neel Patel <neel@pensando.io>
Signed-off-by: Andrew Boyer <aboyer@pensando.io>
---
 drivers/net/ionic/ionic_dev.h   |  4 +++-
 drivers/net/ionic/ionic_main.c  | 36 ++++++++++++++++-----------------
 drivers/net/ionic/ionic_osdep.h | 10 ---------
 3 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h
index 532255a60..dc64a6d28 100644
--- a/drivers/net/ionic/ionic_dev.h
+++ b/drivers/net/ionic/ionic_dev.h
@@ -20,7 +20,9 @@
 
 #define IONIC_LIFS_MAX			1024
 
-#define IONIC_DEVCMD_TIMEOUT	30 /* devcmd_timeout */
+#define IONIC_DEVCMD_TIMEOUT		5	/* devcmd_timeout */
+#define IONIC_DEVCMD_CHECK_PERIOD_US	10	/* devcmd status chk period */
+
 #define	IONIC_ALIGN             4096
 
 struct ionic_adapter;
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index 2ade213d2..f77bddaa4 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -144,12 +144,12 @@ static int
 ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq,
 		struct ionic_admin_ctx *ctx, unsigned long max_wait)
 {
-	unsigned long step_msec = 1;
-	unsigned int max_wait_msec = max_wait * 1000;
-	unsigned long elapsed_msec = 0;
+	unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US;
+	unsigned long max_wait_usec = max_wait * 1000000L;
+	unsigned long elapsed_usec = 0;
 	int budget = 8;
 
-	while (ctx->pending_work && elapsed_msec < max_wait_msec) {
+	while (ctx->pending_work && elapsed_usec < max_wait_usec) {
 		/*
 		 * Locking here as adminq is served inline (this could be called
 		 * from multiple places)
@@ -160,8 +160,8 @@ ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq,
 
 		rte_spinlock_unlock(&lif->adminq_service_lock);
 
-		msec_delay(step_msec);
-		elapsed_msec += step_msec;
+		rte_delay_us_block(step_usec);
+		elapsed_usec += step_usec;
 	}
 
 	return (!ctx->pending_work);
@@ -195,9 +195,9 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)
 static int
 ionic_dev_cmd_wait(struct ionic_dev *idev, unsigned long max_wait)
 {
-	unsigned long step_msec = 100;
-	unsigned int max_wait_msec = max_wait * 1000;
-	unsigned long elapsed_msec = 0;
+	unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US;
+	unsigned long max_wait_usec = max_wait * 1000000L;
+	unsigned long elapsed_usec = 0;
 	int done;
 
 	/* Wait for dev cmd to complete.. but no more than max_wait sec */
@@ -205,20 +205,20 @@ ionic_dev_cmd_wait(struct ionic_dev *idev, unsigned long max_wait)
 	do {
 		done = ionic_dev_cmd_done(idev);
 		if (done) {
-			IONIC_PRINT(DEBUG, "DEVCMD %d done took %ld msecs",
-				idev->dev_cmd->cmd.cmd.opcode,
-				elapsed_msec);
+			IONIC_PRINT(DEBUG, "DEVCMD %d done took %ld usecs",
+				ioread8(&idev->dev_cmd->cmd.cmd.opcode),
+				elapsed_usec);
 			return 0;
 		}
 
-		msec_delay(step_msec);
+		rte_delay_us_block(step_usec);
 
-		elapsed_msec += step_msec;
-	} while (elapsed_msec < max_wait_msec);
+		elapsed_usec += step_usec;
+	} while (elapsed_usec < max_wait_usec);
 
-	IONIC_PRINT(DEBUG, "DEVCMD %d timeout after %ld msecs",
-		idev->dev_cmd->cmd.cmd.opcode,
-		elapsed_msec);
+	IONIC_PRINT(ERR, "DEVCMD %d timeout after %ld usecs",
+		ioread8(&idev->dev_cmd->cmd.cmd.opcode),
+		elapsed_usec);
 
 	return -ETIMEDOUT;
 }
diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
index e04bb8f65..a55d59918 100644
--- a/drivers/net/ionic/ionic_osdep.h
+++ b/drivers/net/ionic/ionic_osdep.h
@@ -20,13 +20,8 @@
 
 #include "ionic_logs.h"
 
-#define DELAY(x) rte_delay_us(x)
-#define usec_delay(x) DELAY(x)
-#define msec_delay(x) DELAY(1000 * (x))
-
 #define BIT(nr)            (1UL << (nr))
 #define BIT_ULL(nr)        (1ULL << (nr))
-#define BITS_TO_LONGS(nr)  div_round_up(nr, 8 * sizeof(long))
 
 #ifndef PAGE_SHIFT
 #define PAGE_SHIFT      12
@@ -44,11 +39,6 @@ typedef uint16_t __le16;
 typedef uint32_t __le32;
 typedef uint64_t __le64;
 
-static inline uint32_t div_round_up(uint32_t n, uint32_t d)
-{
-	return (n + d - 1) / d;
-}
-
 #define ioread8(reg)		rte_read8(reg)
 #define ioread32(reg)		rte_read32(reg)
 #define iowrite8(value, reg)	rte_write8(value, reg)
-- 
2.17.1


  parent reply	other threads:[~2020-11-02 18:37 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 18:35 [dpdk-dev] [PATCH 0/8] net/ionic: minor updates and documentation Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 1/8] ionic: update documentation and MAINTAINERS Andrew Boyer
2020-11-03 12:35   ` Ferruh Yigit
2020-11-03 14:43     ` Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 2/8] ionic: connect to the meson build system Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 3/8] ionic: update ionic_if.h to the latest version Andrew Boyer
2020-11-03 12:44   ` Ferruh Yigit
2020-11-03 14:36     ` Andrew Boyer
2020-11-03 15:55       ` Ferruh Yigit
2020-11-02 18:35 ` Andrew Boyer [this message]
2020-11-02 18:35 ` [dpdk-dev] [PATCH 5/8] ionic: remove some unused fields Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 6/8] ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-11-02 18:35 ` [dpdk-dev] [PATCH 7/8] ionic: warn if RTE tries to enable loopback mode Andrew Boyer
2020-11-03 12:52   ` Ferruh Yigit
2020-11-02 18:35 ` [dpdk-dev] [PATCH 8/8] ionic: nits - whitespace, logging, helper variables Andrew Boyer
2020-11-03 13:06   ` Ferruh Yigit
2020-11-03 14:00     ` Andrew Boyer
2020-11-03 14:02       ` Ferruh Yigit
2020-11-03 13:11 ` [dpdk-dev] [PATCH 0/8] net/ionic: minor updates and documentation Ferruh Yigit
2020-11-03 14:45   ` Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 0/9] " Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 " Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 " Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 " Andrew Boyer
2020-12-10 12:31         ` Ferruh Yigit
2020-12-10 14:44           ` [dpdk-dev] Patchworks " Andrew Boyer
2020-12-10 15:06             ` Ferruh Yigit
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-10 12:01         ` Ferruh Yigit
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-10  2:57       ` [dpdk-dev] [PATCH v5 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-10  2:07     ` [dpdk-dev] [PATCH v4 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-09 12:03     ` Ferruh Yigit
2020-12-09 14:36       ` Andrew Boyer
2020-12-09 15:24         ` Ferruh Yigit
2020-12-09 16:24           ` Andrew Boyer
2020-12-09 17:15             ` Ferruh Yigit
2020-12-09 19:05               ` Andrew Boyer
2020-12-10  9:23                 ` Ferruh Yigit
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-09 13:04     ` Ferruh Yigit
2020-12-09 14:39       ` Andrew Boyer
2020-12-09 15:25         ` Ferruh Yigit
2020-12-04 20:16   ` [dpdk-dev] [PATCH v3 9/9] net/ionic: minor logging fixups Andrew Boyer
2020-12-09 13:47     ` Ferruh Yigit
2020-12-09 14:45       ` Andrew Boyer
2020-12-09 15:42         ` Ferruh Yigit
2020-12-09 19:26           ` Andrew Boyer
2020-12-10  9:58             ` Ferruh Yigit
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 1/9] net/ionic: connect ionic to the build system Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 2/9] net/ionic: update interface file to the latest version Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 3/9] net/ionic: update documentation and MAINTAINERS Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 4/9] net/ionic: check for cmd completion more frequently Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 5/9] net/ionic: remove some unused fields Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 6/9] net/ionic: convert 'deferred' boolean to a flag bit Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 7/9] net/ionic: warn if loopback mode is requested Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 8/9] net/ionic: minor refactorings and helper variables Andrew Boyer
2020-12-03 20:34 ` [dpdk-dev] [PATCH v2 9/9] net/ionic: minor logging fixups Andrew Boyer

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=20201102183527.69209-5-aboyer@pensando.io \
    --to=aboyer@pensando.io \
    --cc=cardigliano@ntop.org \
    --cc=dev@dpdk.org \
    --cc=neel@pensando.io \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git