openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dylan Hung <dylan_hung@aspeedtech.com>
To: <davem@davemloft.net>, <kuba@kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<ratbert@faraday-tech.com>, <linux-aspeed@lists.ozlabs.org>,
	<openbmc@lists.ozlabs.org>
Cc: BMC-SW@aspeedtech.com
Subject: [PATCH 2/4] ftgmac100: Fix missing-poll issue
Date: Mon, 19 Oct 2020 16:57:15 +0800	[thread overview]
Message-ID: <20201019085717.32413-3-dylan_hung@aspeedtech.com> (raw)
In-Reply-To: <20201019085717.32413-1-dylan_hung@aspeedtech.com>

the tx-poll command may advance the tx descriptor due the HW design.
By adding a pseudo read and proper memory barrier, we can ensure all the
data are ready before TX poll command.

Fixes: 52c0cae87465 ("ftgmac100: Remove tx descriptor accessors")
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 7cacbe4aecb7..810bda80f138 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -814,8 +814,8 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
 	 * before setting the OWN bit on the first descriptor.
 	 */
 	dma_wmb();
-	first->txdes0 = cpu_to_le32(f_ctl_stat);
-
+	WRITE_ONCE(first->txdes0, cpu_to_le32(f_ctl_stat));
+	READ_ONCE(first->txdes0);
 	/* Update next TX pointer */
 	priv->tx_pointer = pointer;
 
-- 
2.17.1


  parent reply	other threads:[~2020-10-19  9:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  8:57 [PATCH 0/4] fix ftgmac100 issues on aspeed soc Dylan Hung
2020-10-19  8:57 ` [PATCH 1/4] ftgmac100: Fix race issue on TX descriptor[0] Dylan Hung
2020-10-19 23:19   ` Benjamin Herrenschmidt
2020-10-20  4:13     ` Joel Stanley
2020-10-20  6:23       ` Benjamin Herrenschmidt
2020-10-20  7:13         ` Joel Stanley
2020-10-19  8:57 ` Dylan Hung [this message]
2020-10-19  8:57 ` [PATCH 3/4] ftgmac100: Add a dummy read to ensure running sequence Dylan Hung
2020-10-19 23:25   ` Benjamin Herrenschmidt
2020-10-19  8:57 ` [PATCH 4/4] ftgmac100: Restart MAC HW once Dylan Hung
2020-10-19 23:26   ` Benjamin Herrenschmidt
2020-10-20  4:14   ` Joel Stanley
2021-03-12  0:26     ` Joel Stanley
2021-03-12  0:28       ` 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=20201019085717.32413-3-dylan_hung@aspeedtech.com \
    --to=dylan_hung@aspeedtech.com \
    --cc=BMC-SW@aspeedtech.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=ratbert@faraday-tech.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).