netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11
@ 2019-09-11 16:49 Jeff Kirsher
  2019-09-11 16:49 ` [net 1/2] ixgbe: Prevent u8 wrapping of ITR value to something less than 10us Jeff Kirsher
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Kirsher @ 2019-09-11 16:49 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann

This series contains fixes to ixgbe.

Alex fixes up the adaptive ITR scheme for ixgbe which could result in a
value that was either 0 or something less than 10 which was causing
issues with hardware features, like RSC, that do not function well with
ITR values that low.

Ilya Maximets fixes the ixgbe driver to limit the number of transmit
descriptors to clean by the number of transmit descriptors used in the
transmit ring, so that the driver does not try to "double" clean the
same descriptors. 

The following are changes since commit f4b752a6b2708bfdf7fbe8a241082c8104f4ce05:
  mlx4: fix spelling mistake "veify" -> "verify"
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue 10GbE

Alexander Duyck (1):
  ixgbe: Prevent u8 wrapping of ITR value to something less than 10us

Ilya Maximets (1):
  ixgbe: fix double clean of Tx descriptors with xdp

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  4 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c  | 29 +++++++------------
 2 files changed, 14 insertions(+), 19 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [net 1/2] ixgbe: Prevent u8 wrapping of ITR value to something less than 10us
  2019-09-11 16:49 [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 Jeff Kirsher
@ 2019-09-11 16:49 ` Jeff Kirsher
  2019-09-11 16:49 ` [net 2/2] ixgbe: fix double clean of Tx descriptors with xdp Jeff Kirsher
  2019-09-11 23:08 ` [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2019-09-11 16:49 UTC (permalink / raw)
  To: davem
  Cc: Alexander Duyck, netdev, nhorman, sassmann, stable,
	Gregg Leventhal, Andrew Bowers, Jeff Kirsher

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

There were a couple cases where the ITR value generated via the adaptive
ITR scheme could exceed 126. This resulted in the value becoming either 0
or something less than 10. Switching back and forth between a value less
than 10 and a value greater than 10 can cause issues as certain hardware
features such as RSC to not function well when the ITR value has dropped
that low.

CC: stable@vger.kernel.org
Fixes: b4ded8327fea ("ixgbe: Update adaptive ITR algorithm")
Reported-by: Gregg Leventhal <gleventhal@janestreet.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 7882148abb43..77ca9005dc41 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2621,7 +2621,7 @@ static void ixgbe_update_itr(struct ixgbe_q_vector *q_vector,
 		/* 16K ints/sec to 9.2K ints/sec */
 		avg_wire_size *= 15;
 		avg_wire_size += 11452;
-	} else if (avg_wire_size <= 1980) {
+	} else if (avg_wire_size < 1968) {
 		/* 9.2K ints/sec to 8K ints/sec */
 		avg_wire_size *= 5;
 		avg_wire_size += 22420;
@@ -2654,6 +2654,8 @@ static void ixgbe_update_itr(struct ixgbe_q_vector *q_vector,
 	case IXGBE_LINK_SPEED_2_5GB_FULL:
 	case IXGBE_LINK_SPEED_1GB_FULL:
 	case IXGBE_LINK_SPEED_10_FULL:
+		if (avg_wire_size > 8064)
+			avg_wire_size = 8064;
 		itr += DIV_ROUND_UP(avg_wire_size,
 				    IXGBE_ITR_ADAPTIVE_MIN_INC * 64) *
 		       IXGBE_ITR_ADAPTIVE_MIN_INC;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net 2/2] ixgbe: fix double clean of Tx descriptors with xdp
  2019-09-11 16:49 [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 Jeff Kirsher
  2019-09-11 16:49 ` [net 1/2] ixgbe: Prevent u8 wrapping of ITR value to something less than 10us Jeff Kirsher
@ 2019-09-11 16:49 ` Jeff Kirsher
  2019-09-11 23:08 ` [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2019-09-11 16:49 UTC (permalink / raw)
  To: davem
  Cc: Ilya Maximets, netdev, nhorman, sassmann, stable, William Tu,
	Eelco Chaudron, Jeff Kirsher

From: Ilya Maximets <i.maximets@samsung.com>

Tx code doesn't clear the descriptors' status after cleaning.
So, if the budget is larger than number of used elems in a ring, some
descriptors will be accounted twice and xsk_umem_complete_tx will move
prod_tail far beyond the prod_head breaking the completion queue ring.

Fix that by limiting the number of descriptors to clean by the number
of used descriptors in the Tx ring.

'ixgbe_clean_xdp_tx_irq()' function refactored to look more like
'ixgbe_xsk_clean_tx_ring()' since we're allowed to directly use
'next_to_clean' and 'next_to_use' indexes.

CC: stable@vger.kernel.org
Fixes: 8221c5eba8c1 ("ixgbe: add AF_XDP zero-copy Tx support")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Tested-by: William Tu <u9012063@gmail.com>
Tested-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 29 ++++++++------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
index 6b609553329f..a3b6d8c89127 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
@@ -633,19 +633,17 @@ static void ixgbe_clean_xdp_tx_buffer(struct ixgbe_ring *tx_ring,
 bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
 			    struct ixgbe_ring *tx_ring, int napi_budget)
 {
+	u16 ntc = tx_ring->next_to_clean, ntu = tx_ring->next_to_use;
 	unsigned int total_packets = 0, total_bytes = 0;
-	u32 i = tx_ring->next_to_clean, xsk_frames = 0;
-	unsigned int budget = q_vector->tx.work_limit;
 	struct xdp_umem *umem = tx_ring->xsk_umem;
 	union ixgbe_adv_tx_desc *tx_desc;
 	struct ixgbe_tx_buffer *tx_bi;
-	bool xmit_done;
+	u32 xsk_frames = 0;
 
-	tx_bi = &tx_ring->tx_buffer_info[i];
-	tx_desc = IXGBE_TX_DESC(tx_ring, i);
-	i -= tx_ring->count;
+	tx_bi = &tx_ring->tx_buffer_info[ntc];
+	tx_desc = IXGBE_TX_DESC(tx_ring, ntc);
 
-	do {
+	while (ntc != ntu) {
 		if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)))
 			break;
 
@@ -661,22 +659,18 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
 
 		tx_bi++;
 		tx_desc++;
-		i++;
-		if (unlikely(!i)) {
-			i -= tx_ring->count;
+		ntc++;
+		if (unlikely(ntc == tx_ring->count)) {
+			ntc = 0;
 			tx_bi = tx_ring->tx_buffer_info;
 			tx_desc = IXGBE_TX_DESC(tx_ring, 0);
 		}
 
 		/* issue prefetch for next Tx descriptor */
 		prefetch(tx_desc);
+	}
 
-		/* update budget accounting */
-		budget--;
-	} while (likely(budget));
-
-	i += tx_ring->count;
-	tx_ring->next_to_clean = i;
+	tx_ring->next_to_clean = ntc;
 
 	u64_stats_update_begin(&tx_ring->syncp);
 	tx_ring->stats.bytes += total_bytes;
@@ -688,8 +682,7 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
 	if (xsk_frames)
 		xsk_umem_complete_tx(umem, xsk_frames);
 
-	xmit_done = ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
-	return budget > 0 && xmit_done;
+	return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);
 }
 
 int ixgbe_xsk_async_xmit(struct net_device *dev, u32 qid)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11
  2019-09-11 16:49 [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 Jeff Kirsher
  2019-09-11 16:49 ` [net 1/2] ixgbe: Prevent u8 wrapping of ITR value to something less than 10us Jeff Kirsher
  2019-09-11 16:49 ` [net 2/2] ixgbe: fix double clean of Tx descriptors with xdp Jeff Kirsher
@ 2019-09-11 23:08 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-09-11 23:08 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 11 Sep 2019 09:49:53 -0700

> This series contains fixes to ixgbe.
> 
> Alex fixes up the adaptive ITR scheme for ixgbe which could result in a
> value that was either 0 or something less than 10 which was causing
> issues with hardware features, like RSC, that do not function well with
> ITR values that low.
> 
> Ilya Maximets fixes the ixgbe driver to limit the number of transmit
> descriptors to clean by the number of transmit descriptors used in the
> transmit ring, so that the driver does not try to "double" clean the
> same descriptors. 

Pulled, thanks Jeff.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-11 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 16:49 [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 Jeff Kirsher
2019-09-11 16:49 ` [net 1/2] ixgbe: Prevent u8 wrapping of ITR value to something less than 10us Jeff Kirsher
2019-09-11 16:49 ` [net 2/2] ixgbe: fix double clean of Tx descriptors with xdp Jeff Kirsher
2019-09-11 23:08 ` [net 0/2][pull request] Intel Wired LAN Driver Updates 2019-09-11 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).