From: Joel Stanley <joel@jms.id.au> To: Dylan Hung <dylan_hung@aspeedtech.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: "David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Po-Yu Chuang <ratbert@faraday-tech.com>, linux-aspeed <linux-aspeed@lists.ozlabs.org>, OpenBMC Maillist <openbmc@lists.ozlabs.org>, BMC-SW <BMC-SW@aspeedtech.com> Subject: Re: [PATCH] net: ftgmac100: Fix missing TX-poll issue Date: Mon, 19 Oct 2020 08:57:03 +0000 [thread overview] Message-ID: <CACPK8Xfn+Gn0PHCfhX-vgLTA6e2=RT+D+fnLF67_1j1iwqh7yg@mail.gmail.com> (raw) In-Reply-To: <20201019073908.32262-1-dylan_hung@aspeedtech.com> On Mon, 19 Oct 2020 at 07:39, Dylan Hung <dylan_hung@aspeedtech.com> wrote: > > The cpu accesses the register and the memory via different bus/path on > aspeed soc. So we can not guarantee that the tx-poll command Just the 2600, or other versions too? > (register access) is always behind the tx descriptor (memory). In other > words, the HW may start working even the data is not yet ready. By even if the > adding a dummy read after the last data write, we can ensure the data > are pushed to the memory, then guarantee the processing sequence > > Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com> > --- > drivers/net/ethernet/faraday/ftgmac100.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c > index 00024dd41147..9a99a87f29f3 100644 > --- a/drivers/net/ethernet/faraday/ftgmac100.c > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > @@ -804,7 +804,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); I understand what you're trying to do here, but I'm not sure that this is the correct way to go about it. It does cause the compiler to produce a store and then a load. > > /* Update next TX pointer */ > priv->tx_pointer = pointer; > -- > 2.17.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Joel Stanley <joel@jms.id.au> To: Dylan Hung <dylan_hung@aspeedtech.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: BMC-SW <BMC-SW@aspeedtech.com>, Po-Yu Chuang <ratbert@faraday-tech.com>, linux-aspeed <linux-aspeed@lists.ozlabs.org>, netdev@vger.kernel.org, OpenBMC Maillist <openbmc@lists.ozlabs.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Jakub Kicinski <kuba@kernel.org>, "David S . Miller" <davem@davemloft.net> Subject: Re: [PATCH] net: ftgmac100: Fix missing TX-poll issue Date: Mon, 19 Oct 2020 08:57:03 +0000 [thread overview] Message-ID: <CACPK8Xfn+Gn0PHCfhX-vgLTA6e2=RT+D+fnLF67_1j1iwqh7yg@mail.gmail.com> (raw) In-Reply-To: <20201019073908.32262-1-dylan_hung@aspeedtech.com> On Mon, 19 Oct 2020 at 07:39, Dylan Hung <dylan_hung@aspeedtech.com> wrote: > > The cpu accesses the register and the memory via different bus/path on > aspeed soc. So we can not guarantee that the tx-poll command Just the 2600, or other versions too? > (register access) is always behind the tx descriptor (memory). In other > words, the HW may start working even the data is not yet ready. By even if the > adding a dummy read after the last data write, we can ensure the data > are pushed to the memory, then guarantee the processing sequence > > Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com> > --- > drivers/net/ethernet/faraday/ftgmac100.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c > index 00024dd41147..9a99a87f29f3 100644 > --- a/drivers/net/ethernet/faraday/ftgmac100.c > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > @@ -804,7 +804,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); I understand what you're trying to do here, but I'm not sure that this is the correct way to go about it. It does cause the compiler to produce a store and then a load. > > /* Update next TX pointer */ > priv->tx_pointer = pointer; > -- > 2.17.1 >
next prev parent reply other threads:[~2020-10-19 8:57 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-19 7:39 [PATCH] net: ftgmac100: Fix missing TX-poll issue Dylan Hung 2020-10-19 7:39 ` Dylan Hung 2020-10-19 8:57 ` Joel Stanley [this message] 2020-10-19 8:57 ` Joel Stanley 2020-10-19 9:19 ` Dylan Hung 2020-10-19 9:19 ` Dylan Hung 2020-10-19 19:00 ` Jakub Kicinski 2020-10-19 19:00 ` Jakub Kicinski 2020-10-19 23:23 ` Benjamin Herrenschmidt 2020-10-19 23:23 ` Benjamin Herrenschmidt 2020-10-20 2:57 ` Jakub Kicinski 2020-10-20 2:57 ` Jakub Kicinski 2020-10-20 6:15 ` Benjamin Herrenschmidt 2020-10-20 6:15 ` Benjamin Herrenschmidt 2020-10-20 17:24 ` Jakub Kicinski 2020-10-20 17:24 ` Jakub Kicinski 2020-10-20 6:14 ` Dylan Hung 2020-10-20 6:14 ` Dylan Hung 2020-10-20 13:15 ` David Laight 2020-10-20 13:15 ` David Laight 2020-10-20 22:05 ` Benjamin Herrenschmidt 2020-10-20 22:05 ` Benjamin Herrenschmidt 2020-10-20 19:49 ` Arnd Bergmann 2020-10-20 22:10 ` Benjamin Herrenschmidt 2020-10-20 22:10 ` Benjamin Herrenschmidt 2020-10-20 22:25 ` Andrew Jeffery 2020-10-23 13:08 ` Dylan Hung 2020-10-26 22:21 ` Benjamin Herrenschmidt 2020-10-27 2:18 ` Joel Stanley 2020-10-27 2:18 ` Joel Stanley 2020-10-21 7:16 ` Arnd Bergmann 2020-10-21 12:11 ` Arnd Bergmann 2020-10-21 12:11 ` Arnd Bergmann 2020-10-22 7:40 ` Benjamin Herrenschmidt 2020-10-22 7:40 ` Benjamin Herrenschmidt 2020-10-23 8:39 ` Arnd Bergmann 2020-10-23 8:39 ` Arnd Bergmann
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='CACPK8Xfn+Gn0PHCfhX-vgLTA6e2=RT+D+fnLF67_1j1iwqh7yg@mail.gmail.com' \ --to=joel@jms.id.au \ --cc=BMC-SW@aspeedtech.com \ --cc=benh@kernel.crashing.org \ --cc=davem@davemloft.net \ --cc=dylan_hung@aspeedtech.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.