From: Tom Lendacky <thomas.lendacky@amd.com>
To: <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>
Subject: [PATCH net-next v1 1/8] amd-xgbe: Add a read memory barrier to Tx/Rx path
Date: Thu, 20 Nov 2014 11:03:26 -0600 [thread overview]
Message-ID: <20141120170326.15397.96332.stgit@tlendack-t1.amdoffice.net> (raw)
In-Reply-To: <20141120170320.15397.10583.stgit@tlendack-t1.amdoffice.net>
Add a read memory barrier to the Tx and Rx paths where the ownership
bit is checked to be sure that all descriptor fields are read after
having read the ownership bit for the descriptor.
This has not been an issue to date, but it's a good safe-guard to have.
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 3 +++
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index f6014d3..9b1d9fa 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1558,6 +1558,9 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, OWN))
return 1;
+ /* Make sure descriptor fields are read after reading the OWN bit */
+ rmb();
+
#ifdef XGMAC_ENABLE_RX_DESC_DUMP
xgbe_dump_rx_desc(ring, rdesc, ring->cur);
#endif
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 0544931..eebb787 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1791,6 +1791,10 @@ static int xgbe_tx_poll(struct xgbe_channel *channel)
if (!hw_if->tx_complete(rdesc))
break;
+ /* Make sure descriptor fields are read after reading the OWN
+ * bit */
+ rmb();
+
#ifdef XGMAC_ENABLE_TX_DESC_DUMP
xgbe_dump_tx_desc(ring, ring->dirty, 1, 0);
#endif
next prev parent reply other threads:[~2014-11-20 17:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 17:03 [PATCH net-next v1 0/8] amd-xgbe: AMD XGBE driver updates 2014-11-20 Tom Lendacky
2014-11-20 17:03 ` Tom Lendacky [this message]
2014-11-20 17:03 ` [PATCH net-next v1 2/8] amd-xgbe: Tx engine must not be active before stopping it Tom Lendacky
2014-11-20 17:03 ` [PATCH net-next v1 3/8] amd-xgbe: Incorporate Smatch coding suggestion Tom Lendacky
2014-11-20 17:03 ` [PATCH net-next v1 4/8] amd-xgbe: Separate Tx/Rx ring data fields into new structs Tom Lendacky
2014-11-20 17:03 ` [PATCH net-next v1 5/8] amd-xgbe: Add BQL support Tom Lendacky
2014-11-20 17:03 ` [PATCH net-next v1 6/8] amd-xgbe: Remove unused variable Tom Lendacky
2014-11-20 17:04 ` [PATCH net-next v1 7/8] amd-xgbe: Perform Tx coalescing on a packet basis Tom Lendacky
2014-11-20 17:04 ` [PATCH net-next v1 8/8] amd-xgbe: Add support for the skb->xmit_more flag Tom Lendacky
2014-11-21 20:20 ` [PATCH net-next v1 0/8] amd-xgbe: AMD XGBE driver updates 2014-11-20 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=20141120170326.15397.96332.stgit@tlendack-t1.amdoffice.net \
--to=thomas.lendacky@amd.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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