aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@redhat.com>2014-12-11 18:02:28 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-11 21:15:06 -0500
commit124b74c18e0e31b24638d256afee7122a994e1b3 (patch)
treea4962667802529c26231f4768c0233a15f9e9e4c /drivers/net/ethernet/intel
parenta0750138704a63834bac065c24d227c08768a019 (diff)
fm10k/igb/ixgbe: Use dma_rmb on Rx descriptor reads
This change makes it so that dma_rmb is used when reading the Rx descriptor. The advantage of dma_rmb is that it allows for a much lower cost barrier on x86, powerpc, arm, and arm64 architectures than a traditional memory barrier when dealing with reads that only have to synchronize to coherent 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: Matthew Vick <matthew.vick@intel.com> Cc: Don Skidmore <donald.c.skidmore@intel.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/fm10k/fm10k_main.c6
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c6
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c9
3 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index ee1ecb146df7..eb088b129bc7 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -615,14 +615,14 @@ static bool fm10k_clean_rx_irq(struct fm10k_q_vector *q_vector,
615 615
616 rx_desc = FM10K_RX_DESC(rx_ring, rx_ring->next_to_clean); 616 rx_desc = FM10K_RX_DESC(rx_ring, rx_ring->next_to_clean);
617 617
618 if (!fm10k_test_staterr(rx_desc, FM10K_RXD_STATUS_DD)) 618 if (!rx_desc->d.staterr)
619 break; 619 break;
620 620
621 /* This memory barrier is needed to keep us from reading 621 /* This memory barrier is needed to keep us from reading
622 * any other fields out of the rx_desc until we know the 622 * any other fields out of the rx_desc until we know the
623 * RXD_STATUS_DD bit is set 623 * descriptor has been written back
624 */ 624 */
625 rmb(); 625 dma_rmb();
626 626
627 /* retrieve a buffer from the ring */ 627 /* retrieve a buffer from the ring */
628 skb = fm10k_fetch_rx_buffer(rx_ring, rx_desc, skb); 628 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 2e526d4904a6..ff59897a9463 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6910,14 +6910,14 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
6910 6910
6911 rx_desc = IGB_RX_DESC(rx_ring, rx_ring->next_to_clean); 6911 rx_desc = IGB_RX_DESC(rx_ring, rx_ring->next_to_clean);
6912 6912
6913 if (!igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) 6913 if (!rx_desc->wb.upper.status_error)
6914 break; 6914 break;
6915 6915
6916 /* This memory barrier is needed to keep us from reading 6916 /* This memory barrier is needed to keep us from reading
6917 * any other fields out of the rx_desc until we know the 6917 * any other fields out of the rx_desc until we know the
6918 * RXD_STAT_DD bit is set 6918 * descriptor has been written back
6919 */ 6919 */
6920 rmb(); 6920 dma_rmb();
6921 6921
6922 /* retrieve a buffer from the ring */ 6922 /* retrieve a buffer from the ring */
6923 skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb); 6923 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 798b05556e1b..2ed2c7de2304 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2009,15 +2009,14 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
2009 2009
2010 rx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean); 2010 rx_desc = IXGBE_RX_DESC(rx_ring, rx_ring->next_to_clean);
2011 2011
2012 if (!ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD)) 2012 if (!rx_desc->wb.upper.status_error)
2013 break; 2013 break;
2014 2014
2015 /* 2015 /* This memory barrier is needed to keep us from reading
2016 * This memory barrier is needed to keep us from reading
2017 * any other fields out of the rx_desc until we know the 2016 * any other fields out of the rx_desc until we know the
2018 * RXD_STAT_DD bit is set 2017 * descriptor has been written back
2019 */ 2018 */
2020 rmb(); 2019 dma_rmb();
2021 2020
2022 /* retrieve a buffer from the ring */ 2021 /* retrieve a buffer from the ring */
2023 skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc); 2022 skb = ixgbe_fetch_rx_buffer(rx_ring, rx_desc);