[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141113192746.12579.91054.stgit@ahduyck-server>
Date: Thu, 13 Nov 2014 11:27:47 -0800
From: Alexander Duyck <alexander.h.duyck@...hat.com>
To: linux-arch@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: mikey@...ling.org, tony.luck@...el.com,
mathieu.desnoyers@...ymtl.ca, donald.c.skidmore@...el.com,
peterz@...radead.org, benh@...nel.crashing.org,
heiko.carstens@...ibm.com, oleg@...hat.com, will.deacon@....com,
davem@...emloft.net, michael@...erman.id.au,
matthew.vick@...el.com, nic_swsd@...ltek.com, geert@...ux-m68k.org,
jeffrey.t.kirsher@...el.com, fweisbec@...il.com,
schwidefsky@...ibm.com, linux@....linux.org.uk,
paulmck@...ux.vnet.ibm.com, torvalds@...ux-foundation.org,
mingo@...nel.org
Subject: [PATCH 3/3] fm10k/igb/ixgbe: Use load_acquire on Rx descriptor
This change makes it so that load_acquire is used when reading the Rx
descriptor. The advantage of load_acquire is that it allows for a much
lower cost barrier on x86, ia64, powerpc, arm64, and s390 architectures
than a traditional memory barrier when dealing with reads that only have
to synchronize to system memory.
In addition I have updated the code so that it just checks to see if any
bits have been set instead of just the DD bit since the DD bit will always
be set as a part of a descriptor write-back so we just need to check for a
non-zero value being present at that memory location rather than just
checking for any specific bit. This allows the code itself to appear much
cleaner and allows the compiler more room to optimize.
Cc: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Cc: Matthew Vick <matthew.vick@...el.com>
Cc: Don Skidmore <donald.c.skidmore@...el.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@...hat.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_main.c | 8 +++-----
drivers/net/ethernet/intel/igb/igb_main.c | 8 +++-----
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 ++++-------
3 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e645af4..2d4923c 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -620,14 +620,12 @@ static bool fm10k_clean_rx_irq(struct fm10k_q_vector *q_vector,
rx_desc = FM10K_RX_DESC(rx_ring, rx_ring->next_to_clean);
- if (!fm10k_test_staterr(rx_desc, FM10K_RXD_STATUS_DD))
- break;
-
/* This memory barrier is needed to keep us from reading
* any other fields out of the rx_desc until we know the
- * RXD_STATUS_DD bit is set
+ * descriptor has been written back
*/
- rmb();
+ if (!load_acquire(&rx_desc->d.staterr))
+ break;
/* retrieve a buffer from the ring */
skb = fm10k_fetch_rx_buffer(rx_ring, rx_desc, skb);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a2d72a8..a55cd54 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6918,14 +6918,12 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
rx_desc = IGB_RX_DESC(rx_ring, rx_ring->next_to_clean);
- if (!igb_test_staterr(rx_desc, E1000_RXD_STAT_DD))
- break;
-
/* This memory barrier is needed to keep us from reading
* any other fields out of the rx_desc until we know the
- * RXD_STAT_DD bit is set
+ * descriptor has been written back
*/
- rmb();
+ if (!load_acquire(&rx_desc->wb.upper.status_error))
+ break;
/* retrieve a buffer from the ring */
skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d2df4e3..007f174 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2003,15 +2003,12 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
rx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean);
- if (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD))
- break;
-
- /*
- * This memory barrier is needed to keep us from reading
+ /* This memory barrier is needed to keep us from reading
* any other fields out of the rx_desc until we know the
- * RXD_STAT_DD bit is set
+ * descriptor has been written back
*/
- rmb();
+ if (!load_acquire(&rx_desc->wb.upper.status_error))
+ break;
/* retrieve a buffer from the ring */
skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists