netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sunil.kovvuri@gmail.com
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Sunil Goutham <sgoutham@marvell.com>
Subject: [PATCH 7/7] octeontx2-af: Modify rvu_reg_poll() to check reg atleast twice
Date: Mon,  2 Mar 2020 12:49:28 +0530	[thread overview]
Message-ID: <1583133568-5674-8-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <1583133568-5674-1-git-send-email-sunil.kovvuri@gmail.com>

From: Sunil Goutham <sgoutham@marvell.com>

Currently on the first check if the operation is still not
finished, the poll goes to sleep for 2-5 usecs. But if for
some reason (due to other priority stuff like interrupts etc) by
the time the poll wakes up the 10ms time is expired then we don't
check if operation is finished or not and return failure.

This patch modifies poll logic to check HW operation after sleep so
that the status is checked atleast twice.

Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 3b794df..5ff25bf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -88,13 +88,15 @@ int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
 	u64 reg_val;
 
 	reg = rvu->afreg_base + ((block << 28) | offset);
-	while (time_before(jiffies, timeout)) {
-		reg_val = readq(reg);
-		if (zero && !(reg_val & mask))
-			return 0;
-		if (!zero && (reg_val & mask))
-			return 0;
+again:
+	reg_val = readq(reg);
+	if (zero && !(reg_val & mask))
+		return 0;
+	if (!zero && (reg_val & mask))
+		return 0;
+	if (time_before(jiffies, timeout)) {
 		usleep_range(1, 5);
+		goto again;
 	}
 	return -EBUSY;
 }
-- 
2.7.4


  parent reply	other threads:[~2020-03-02  7:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02  7:19 [PATCH 0/7] octeontx2: Flow control support and other misc changes sunil.kovvuri
2020-03-02  7:19 ` [PATCH 1/7] octeontx2-af: Interface backpressure configuration sunil.kovvuri
2020-03-02  7:19 ` [PATCH 2/7] octeontx2-af: Pause frame configuration at cgx sunil.kovvuri
2020-03-02  7:19 ` [PATCH 3/7] octeontx2-pf: Support to enable/disable pause frames via ethtool sunil.kovvuri
2020-03-02 13:01   ` Andrew Lunn
2020-03-02  7:19 ` [PATCH 4/7] octeontx2-af: Optimize data retrieval from firmware sunil.kovvuri
2020-03-03  1:20   ` kbuild test robot
2020-03-02  7:19 ` [PATCH 5/7] octeontx2-af: Set discovery ID for RVUM block sunil.kovvuri
2020-03-02  7:19 ` [PATCH 6/7] octeontx2-af: Enable PCI master sunil.kovvuri
2020-03-02  7:19 ` sunil.kovvuri [this message]
2020-03-02 19:10 ` [PATCH 0/7] octeontx2: Flow control support and other misc changes 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=1583133568-5674-8-git-send-email-sunil.kovvuri@gmail.com \
    --to=sunil.kovvuri@gmail.com \
    --cc=davem@davemloft.net \
    --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;
as well as URLs for NNTP newsgroup(s).