Netdev List
 help / color / mirror / Atom feed
From: sunil.kovvuri@gmail.com
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: arnd@arndb.de, linux-soc@vger.kernel.org,
	Sunil Goutham <sgoutham@marvell.com>
Subject: [PATCH 01/16] octeontx2-af: Improve register polling loop
Date: Tue, 16 Oct 2018 16:57:05 +0530	[thread overview]
Message-ID: <1539689240-11526-2-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <1539689240-11526-1-git-send-email-sunil.kovvuri@gmail.com>

From: Sunil Goutham <sgoutham@marvell.com>

Instead of looping on a integer timeout, use time_before(jiffies),
so that maximum poll time is capped.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 2033f42..7cf5865 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -47,18 +47,18 @@ MODULE_DEVICE_TABLE(pci, rvu_id_table);
  */
 int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
 {
+	unsigned long timeout = jiffies + usecs_to_jiffies(100);
 	void __iomem *reg;
-	int timeout = 100;
 	u64 reg_val;
 
 	reg = rvu->afreg_base + ((block << 28) | offset);
-	while (timeout) {
+	while (time_before(jiffies, timeout)) {
 		reg_val = readq(reg);
 		if (zero && !(reg_val & mask))
 			return 0;
 		if (!zero && (reg_val & mask))
 			return 0;
-		usleep_range(1, 2);
+		usleep_range(1, 5);
 		timeout--;
 	}
 	return -EBUSY;
-- 
2.7.4

  reply	other threads:[~2018-10-16 19:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 11:27 [PATCH 00/16] octeontx2-af: NPA and NIX blocks initialization sunil.kovvuri
2018-10-16 11:27 ` sunil.kovvuri [this message]
2018-10-16 11:27 ` [PATCH 02/16] octeontx2-af: CGX Rx/Tx enable/disable mbox handlers sunil.kovvuri
2018-10-16 11:27 ` [PATCH 03/16] octeontx2-af: Support to retrieve CGX LMAC stats sunil.kovvuri
2018-10-16 11:27 ` [PATCH 04/16] octeontx2-af: Support for MAC address filters in CGX sunil.kovvuri
2018-10-16 11:27 ` [PATCH 05/16] octeontx2-af: Forward CGX link notifications to PFs sunil.kovvuri
2018-10-16 11:27 ` [PATCH 06/16] octeontx2-af: Enable or disable CGX internal loopback sunil.kovvuri
2018-10-16 11:27 ` [PATCH 07/16] octeontx2-af: NPA block admin queue init sunil.kovvuri
2018-10-16 11:27 ` [PATCH 08/16] octeontx2-af: NPA block LF initialization sunil.kovvuri
2018-10-16 11:27 ` [PATCH 09/16] octeontx2-af: NPA AQ instruction enqueue support sunil.kovvuri
2018-10-16 11:27 ` [PATCH 10/16] octeontx2-af: Support for disabling NPA Aura/Pool contexts sunil.kovvuri
2018-10-16 11:27 ` [PATCH 11/16] octeontx2-af: NIX block admin queue init sunil.kovvuri
2018-10-16 11:27 ` [PATCH 12/16] octeontx2-af: NIX block LF initialization sunil.kovvuri
2018-10-16 11:27 ` [PATCH 13/16] octeontx2-af: NIX LSO config for TSOv4/v6 offload sunil.kovvuri
2018-10-16 11:27 ` [PATCH 14/16] octeontx2-af: Alloc bitmaps for NIX Tx scheduler queues sunil.kovvuri
2018-10-16 11:27 ` [PATCH 15/16] octeontx2-af: NIX AQ instruction enqueue support sunil.kovvuri
2018-10-16 11:27 ` [PATCH 16/16] octeontx2-af: Support for disabling NIX RQ/SQ/CQ contexts sunil.kovvuri
2018-10-18  4:34 ` [PATCH 00/16] octeontx2-af: NPA and NIX blocks initialization 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=1539689240-11526-2-git-send-email-sunil.kovvuri@gmail.com \
    --to=sunil.kovvuri@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgoutham@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