Module Name:    src
Committed By:   msaitoh
Date:           Thu Feb 22 10:02:08 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c

Log Message:
 Fix a potential bug that TX/RX might stall when TX rate limit reached.
This change is almost the same as the RX rate limit bug fix in ixgbe.c
rev. 1.121. I've never got any stall, but this must be a bug.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ixgbe/ixv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.31 src/sys/dev/pci/ixgbe/ix_txrx.c:1.32
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.31	Tue Feb 20 07:30:57 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Feb 22 10:02:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.31 2018/02/20 07:30:57 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.32 2018/02/22 10:02:08 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -993,7 +993,7 @@ ixgbe_tso_setup(struct tx_ring *txr, str
  *   processing the packet then free associated resources. The
  *   tx_buffer is put back on the free queue.
  ************************************************************************/
-void
+bool
 ixgbe_txeof(struct tx_ring *txr)
 {
 	struct adapter		*adapter = txr->adapter;
@@ -1032,13 +1032,13 @@ ixgbe_txeof(struct tx_ring *txr)
 		     txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD)) {
 			netmap_tx_irq(ifp, txr->me);
 		}
-		return;
+		return false;
 	}
 #endif /* DEV_NETMAP */
 
 	if (txr->tx_avail == txr->num_desc) {
 		txr->busy = 0;
-		return;
+		return false;
 	}
 
 	/* Get work starting point */
@@ -1139,7 +1139,7 @@ ixgbe_txeof(struct tx_ring *txr)
 	if (txr->tx_avail == txr->num_desc)
 		txr->busy = 0;
 
-	return;
+	return ((limit > 0) ? false : true);
 } /* ixgbe_txeof */
 
 /************************************************************************

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.125 src/sys/dev/pci/ixgbe/ixgbe.c:1.126
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.125	Tue Feb 20 08:49:23 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Feb 22 10:02:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.125 2018/02/20 08:49:23 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.126 2018/02/22 10:02:08 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -5768,7 +5768,7 @@ ixgbe_handle_que(void *context)
 	if (ifp->if_flags & IFF_RUNNING) {
 		more = ixgbe_rxeof(que);
 		IXGBE_TX_LOCK(txr);
-		ixgbe_txeof(txr);
+		more |= ixgbe_txeof(txr);
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
 			if (!ixgbe_mq_ring_empty(ifp, txr->txr_interq))
 				ixgbe_mq_start_locked(ifp, txr);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.29 src/sys/dev/pci/ixgbe/ixgbe.h:1.30
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.29	Wed Dec  6 04:08:50 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Feb 22 10:02:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.29 2017/12/06 04:08:50 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.30 2018/02/22 10:02:08 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -717,7 +717,7 @@ int  ixgbe_setup_transmit_structures(str
 void ixgbe_free_transmit_structures(struct adapter *);
 int  ixgbe_setup_receive_structures(struct adapter *);
 void ixgbe_free_receive_structures(struct adapter *);
-void ixgbe_txeof(struct tx_ring *);
+bool ixgbe_txeof(struct tx_ring *);
 bool ixgbe_rxeof(struct ix_queue *);
 
 const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.80 src/sys/dev/pci/ixgbe/ixv.c:1.81
--- src/sys/dev/pci/ixgbe/ixv.c:1.80	Thu Feb 22 08:49:42 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Feb 22 10:02:08 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.80 2018/02/22 08:49:42 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.81 2018/02/22 10:02:08 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -2622,7 +2622,7 @@ ixv_handle_que(void *context)
 	if (ifp->if_flags & IFF_RUNNING) {
 		more = ixgbe_rxeof(que);
 		IXGBE_TX_LOCK(txr);
-		ixgbe_txeof(txr);
+		more |= ixgbe_txeof(txr);
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
 			if (!ixgbe_mq_ring_empty(ifp, txr->txr_interq))
 				ixgbe_mq_start_locked(ifp, txr);

Reply via email to