All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH v2 06/11] ixgbe: Use length to determine if descriptor is done
Date: Tue, 17 Jan 2017 08:36:28 -0800	[thread overview]
Message-ID: <20170117163620.5423.4591.stgit@localhost.localdomain> (raw)
In-Reply-To: <20170117163401.5423.37993.stgit@localhost.localdomain>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This change makes it so that we use the length of the packet instead of the
DD status bit to determine if a new descriptor is ready to be processed.
The obvious advantage is that it cuts down on reads as we don't really even
need the DD bit if going from a 0 to a non-zero value on size is enough to
inform us that the packet has been completed.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---

v2: Update ethtool loopback test to use length check instead of DD check

 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index aa80ece9ea96..ab189fc09298 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1909,7 +1909,7 @@ static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring,
 	tx_ntc = tx_ring->next_to_clean;
 	rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc);
 
-	while (ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_DD)) {
+	while (rx_desc->wb.upper.length) {
 		/* check Rx buffer */
 		rx_buffer = &rx_ring->rx_buffer_info[rx_ntc];
 
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 5e210fb71366..c93921256f2e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1653,8 +1653,8 @@ void ixgbe_alloc_rx_buffers(struct ixgbe_ring *rx_ring, u16 cleaned_count)
 			i -= rx_ring->count;
 		}
 
-		/* clear the status bits for the next_to_use descriptor */
-		rx_desc->wb.upper.status_error = 0;
+		/* clear the length for the next_to_use descriptor */
+		rx_desc->wb.upper.length = 0;
 
 		cleaned_count--;
 	} while (cleaned_count);
@@ -2171,7 +2171,7 @@ 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 (!rx_desc->wb.upper.status_error)
+		if (!rx_desc->wb.upper.length)
 			break;
 
 		/* This memory barrier is needed to keep us from reading
@@ -3750,6 +3750,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
 			     struct ixgbe_ring *ring)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
+	union ixgbe_adv_rx_desc *rx_desc;
 	u64 rdba = ring->dma;
 	u32 rxdctl;
 	u8 reg_idx = ring->reg_idx;
@@ -3784,6 +3785,10 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
 		rxdctl |=  0x080420;
 	}
 
+	/* initialize Rx descriptor 0 */
+	rx_desc = IXGBE_RX_DESC(ring, 0);
+	rx_desc->wb.upper.length = 0;
+
 	/* enable receive descriptor ring */
 	rxdctl |= IXGBE_RXDCTL_ENABLE;
 	IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(reg_idx), rxdctl);
@@ -4999,9 +5004,6 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring)
 	size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
 	memset(rx_ring->rx_buffer_info, 0, size);
 
-	/* Zero out the descriptor ring */
-	memset(rx_ring->desc, 0, rx_ring->size);
-
 	rx_ring->next_to_alloc = 0;
 	rx_ring->next_to_clean = 0;
 	rx_ring->next_to_use = 0;


  parent reply	other threads:[~2017-01-17 16:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 16:35 [Intel-wired-lan] [next PATCH v2 00/11] Add support for writable pages and build_skb Alexander Duyck
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 01/11] ixgbe: Add function for checking to see if we can reuse page Alexander Duyck
2017-01-31 17:32   ` Bowers, AndrewX
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 02/11] ixgbe: Only DMA sync frame length Alexander Duyck
2017-01-31 17:33   ` Bowers, AndrewX
2017-01-17 16:35 ` [Intel-wired-lan] [next PATCH v2 03/11] ixgbe: Update driver to make use of DMA attributes in Rx path Alexander Duyck
2017-01-31 17:33   ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 04/11] ixgbe: Update code to better handle incrementing page count Alexander Duyck
2017-01-31 17:34   ` Bowers, AndrewX
2017-02-10 23:04   ` John Fastabend
2017-02-10 23:15     ` Alexander Duyck
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 05/11] ixgbe: Make use of order 1 pages and 3K buffers independent of FCoE Alexander Duyck
2017-01-31 17:34   ` Bowers, AndrewX
2017-01-17 16:36 ` Alexander Duyck [this message]
2017-01-31 17:35   ` [Intel-wired-lan] [next PATCH v2 06/11] ixgbe: Use length to determine if descriptor is done Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 07/11] ixgbe: Break out Rx buffer page management Alexander Duyck
2017-01-31 17:35   ` Bowers, AndrewX
2017-01-17 16:36 ` [Intel-wired-lan] [next PATCH v2 08/11] ixgbe: Add support for padding packet Alexander Duyck
2017-01-31 17:35   ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 09/11] ixgbe: Add private flag to control buffer mode Alexander Duyck
2017-01-31 17:36   ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 10/11] ixgbe: Add support for build_skb Alexander Duyck
2017-01-31 17:36   ` Bowers, AndrewX
2017-01-17 16:37 ` [Intel-wired-lan] [next PATCH v2 11/11] ixgbe: Don't bother clearing buffer memory for descriptor rings Alexander Duyck
2017-01-31 17:36   ` Bowers, AndrewX

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=20170117163620.5423.4591.stgit@localhost.localdomain \
    --to=alexander.duyck@gmail.com \
    --cc=intel-wired-lan@osuosl.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 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.