Module Name:    src
Committed By:   msaitoh
Date:           Wed May 23 10:11:08 UTC 2018

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

Log Message:
 Add "bool txr_no_space" for TX descriptor shortage. Use it like IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.99 -r1.100 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.46 src/sys/dev/pci/ixgbe/ix_txrx.c:1.47
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.46	Wed May 23 04:45:24 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.46 2018/05/23 04:45:24 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.47 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -146,7 +146,9 @@ ixgbe_legacy_start_locked(struct ifnet *
 	}
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return (ENETDOWN);
-
+	if (txr->txr_no_space)
+		return (ENETDOWN);
+	
 	while (!IFQ_IS_EMPTY(&ifp->if_snd)) {
 		if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
 			break;
@@ -291,6 +293,8 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 	}
 	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return (ENETDOWN);
+	if (txr->txr_no_space)
+		return (ENETDOWN);
 
 	/* Process the queue */
 	while ((next = pcq_get(txr->txr_interq)) != NULL) {
@@ -461,6 +465,7 @@ retry:
 
 	/* Make certain there are enough descriptors */
 	if (txr->tx_avail < (map->dm_nsegs + 2)) {
+		txr->txr_no_space = true;
 		txr->no_desc_avail.ev_count++;
 		ixgbe_dmamap_unload(txr->txtag, txbuf->map);
 		return EAGAIN;
@@ -1159,6 +1164,7 @@ ixgbe_txeof(struct tx_ring *txr)
 			buf->m_head = NULL;
 		}
 		buf->eop = NULL;
+		txr->txr_no_space = false;
 		++txr->tx_avail;
 
 		/* We clean the range if multi segment */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.154 src/sys/dev/pci/ixgbe/ixgbe.c:1.155
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.154	Wed May 23 04:37:13 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.154 2018/05/23 04:37:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.155 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -703,6 +703,8 @@ ixgbe_initialize_transmit_units(struct a
 		/* Cache the tail address */
 		txr->tail = IXGBE_TDT(j);
 
+		txr->txr_no_space = false;
+
 		/* Disable Head Writeback */
 		/*
 		 * Note: for X550 series devices, these registers are actually

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.48 src/sys/dev/pci/ixgbe/ixgbe.h:1.49
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.48	Fri May 18 10:09:02 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.48 2018/05/18 10:09:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.49 2018/05/23 10:11:07 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -368,6 +368,7 @@ struct tx_ring {
 	pcq_t			*txr_interq;
 	struct work		wq_cookie;
 	void			*txr_si;
+	bool			txr_no_space; /* Like IFF_OACTIVE */
 
 	/* Flow Director */
 	u16			atr_sample;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.99 src/sys/dev/pci/ixgbe/ixv.c:1.100
--- src/sys/dev/pci/ixgbe/ixv.c:1.99	Wed May 23 04:37:13 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed May 23 10:11:07 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.99 2018/05/23 04:37:13 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.100 2018/05/23 10:11:07 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -1589,6 +1589,8 @@ ixv_initialize_transmit_units(struct ada
 		/* Set Tx Tail register */
 		txr->tail = IXGBE_VFTDT(j);
 
+		txr->txr_no_space = false;
+
 		/* Set Ring parameters */
 		IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(j),
 		    (tdba & 0x00000000ffffffffULL));

Reply via email to