Module Name:    src
Committed By:   martin
Date:           Thu Mar 11 16:04:25 UTC 2021

Modified Files:
        src/share/man/man4 [netbsd-8]: ixg.4 ixv.4
        src/sys/dev/pci [netbsd-8]: files.pci
        src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
            ixgbe_netbsd.h ixgbe_vf.c ixgbe_x540.c ixv.c

Log Message:
Pull up the following (all via patch), requested by msaitoh in ticket #1663:

        sys/dev/pci/ixgbe/ixgbe.c                       1.259, 1.278-1.279
        sys/dev/pci/ixgbe/ixgbe.h                       1.75
        sys/dev/pci/ixgbe/ixgbe_netbsd.h                1.12
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.24-1.26
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.17
        sys/dev/pci/ixgbe/ixv.c                         1.155-1.156
        sys/dev/pci/ixgbe/ix_txrx.c                     1.64-67
        sys/dev/pci/files.pci                           1.436
        share/man/man4/ixg.4                            1.13-1.14
        share/man/man4/ixv.4                            1.3, 1.6-1.7

- Fix a problem that the RX path stalled when the mbuf cluster is
  exhausted.
- Modify some parameters to reduce packet dropping. See also the
  manual's OPTIONS section for the detail.
- ixv(4): The max number of queue(pair) is not 7 but 8. Correctly
  reset the hardware.
- Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make
  it more understandable.
- Fix a bug that some advertise speeds can't be set with
  hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error
  message, too.
- Fix typo in comment or debug message.


To generate a diff of this commit:
cvs rdiff -u -r1.10.4.1 -r1.10.4.2 src/share/man/man4/ixg.4
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/share/man/man4/ixv.4
cvs rdiff -u -r1.388.4.4 -r1.388.4.5 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.24.2.20 -r1.24.2.21 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.42 -r1.88.2.43 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.20 -r1.24.6.21 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.7.6.2 -r1.7.6.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.12.8.5 -r1.12.8.6 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.4 -r1.9.6.5 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.30 -r1.56.2.31 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/share/man/man4/ixg.4
diff -u src/share/man/man4/ixg.4:1.10.4.1 src/share/man/man4/ixg.4:1.10.4.2
--- src/share/man/man4/ixg.4:1.10.4.1	Sat May 12 10:35:45 2018
+++ src/share/man/man4/ixg.4	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixg.4,v 1.10.4.1 2018/05/12 10:35:45 martin Exp $
+.\" $NetBSD: ixg.4,v 1.10.4.2 2021/03/11 16:04:25 martin Exp $
 .\"
 .\" Copyright (c) 2001-2008, Intel Corporation
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $
 .\"
-.Dd May 9, 2018
+.Dd March 9, 2021
 .Dt IXG 4
 .Os
 .Sh NAME
@@ -83,6 +83,26 @@ go to the Intel support website at:
 .\" with a supported adapter, email the specific information related to the
 .\" issue to
 .\" .Aq [email protected] .
+.Sh OPTIONS
+The
+.Nm
+driver doesn't use the common
+.Xr MCLGET 9
+interface and use the driver specific cluster allocation mechanism.
+If it's exhausted, the
+.Xr evcnt 9
+counter "ixgX qY Rx no jumbo mbuf" is incremented.
+If this is observed,
+the number can be changed by the following config parameter:
+.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
+.It Dv IXGBE_JCLNUM_MULTI
+The number of RX jumbo buffers (clusters) per queue is calculated by
+.Dv IXGBE_JCLNUM_MULTI
+* (number of rx descriptors).
+The total number of clusters per queue is available via the
+.Li hw.ixgN.num_jcl_per_queue
+.Xr sysctl 7 .
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ixv 4 ,

Index: src/share/man/man4/ixv.4
diff -u src/share/man/man4/ixv.4:1.3.2.3 src/share/man/man4/ixv.4:1.3.2.4
--- src/share/man/man4/ixv.4:1.3.2.3	Thu Sep 26 18:19:27 2019
+++ src/share/man/man4/ixv.4	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ixv.4,v 1.3.2.3 2019/09/26 18:19:27 martin Exp $
+.\"	$NetBSD: ixv.4,v 1.3.2.4 2021/03/11 16:04:25 martin Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,20 +27,42 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 5, 2019
+.Dd March 9, 2021
 .Dt IXV 4
 .Os
 .Sh NAME
 .Nm ixv
-.Nd Intel 10 giabit Ethernet virtual function
+.Nd Intel 10 Gigabit Ethernet virtual function
 .Sh SYNOPSIS
 .Cd "ixv* at pci? dev ? function ?"
 .Sh DESCRIPTION
 The
 .Nm
-driver supports Intel 10 gigabit Ethernet virtual function that 82599 and
+driver supports Intel 10 Gigabit Ethernet virtual function that 82599 and
 newer chips support.
-It can be used on a NetBSD guest that the host supports SR-IOV.
+It can be used on a
+.Nx
+guest that the host supports SR-IOV.
+.Sh OPTIONS
+The
+.Nm
+driver doesn't use the common
+.Xr MCLGET 9
+interface and use the driver specific cluster allocation mechanism.
+If it's exhausted, the
+.Xr evcnt 9
+counter "ixgX qY Rx no jumbo mbuf" is incremented.
+If this is observed,
+the number can be changed by the following config parameter:
+.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
+.It Dv IXGBE_JCLNUM_MULTI
+The number of RX jumbo buffers (clusters) per queue is calculated by
+.Dv IXGBE_JCLNUM_MULTI
+* (number of rx descriptors).
+The total number of clusters per queue is available with the
+.Li hw.ixgN.num_jcl_per_queue
+.Xr sysctl 7 .
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ixg 4 ,

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.388.4.4 src/sys/dev/pci/files.pci:1.388.4.5
--- src/sys/dev/pci/files.pci:1.388.4.4	Fri Dec  7 17:11:37 2018
+++ src/sys/dev/pci/files.pci	Thu Mar 11 16:04:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.388.4.4 2018/12/07 17:11:37 martin Exp $
+#	$NetBSD: files.pci,v 1.388.4.5 2021/03/11 16:04:24 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -687,6 +687,7 @@ file	dev/pci/ixgbe/ixgbe_phy.c	ixg | ixv
 file	dev/pci/ixgbe/ixgbe_vf.c	ixg | ixv
 file	dev/pci/ixgbe/if_bypass.c	ixg | ixv
 file	dev/pci/ixgbe/if_fdir.c		ixg | ixv
+defparam opt_ixgbe.h	IXGBE_JCLNUM_MULTI
 
 # This appears to be the driver for virtual instances of i82599.
 device	ixv: ether, ifnet, arp, mii, mii_phy

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.20 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.21
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.20	Wed Aug  5 15:58:02 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.20 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.21 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
 
@@ -1326,6 +1326,11 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
  *      exhaustion are unnecessary, if an mbuf cannot be obtained
  *      it just returns, keeping its placeholder, thus it can simply
  *      be recalled to try again.
+ *
+ *   XXX NetBSD TODO:
+ *    - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl),
+ *      so the ixgbe_refresh_mbufs() function can be simplified.
+ *
  ************************************************************************/
 static void
 ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
@@ -1515,7 +1520,7 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	 * Assume all of rxr->ptag are the same.
 	 */
 	ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr,
-	    (2 * adapter->num_rx_desc), adapter->rx_mbuf_sz);
+	    adapter->num_jcl, adapter->rx_mbuf_sz);
 
 	IXGBE_RX_LOCK(rxr);
 
@@ -1812,7 +1817,9 @@ ixgbe_rxeof(struct ix_queue *que)
 	struct ixgbe_rx_buf	*rbuf, *nbuf;
 	int			i, nextp, processed = 0;
 	u32			staterr = 0;
-	u32			count = adapter->rx_process_limit;
+	u32			count = 0;
+	u32			limit = adapter->rx_process_limit;
+	bool			discard_multidesc = false;
 #ifdef RSS
 	u16			pkt_info;
 #endif
@@ -1829,8 +1836,16 @@ ixgbe_rxeof(struct ix_queue *que)
 	}
 #endif /* DEV_NETMAP */
 
-	for (i = rxr->next_to_check; count != 0;) {
+	/*
+	 * The max number of loop is rx_process_limit. If discard_multidesc is
+	 * true, continue processing to not to send broken packet to the upper
+	 * layer.
+	 */
+	for (i = rxr->next_to_check;
+	     (count < limit) || (discard_multidesc == true);) {
+
 		struct mbuf *sendmp, *mp;
+		struct mbuf *newmp;
 		u32         rsc, ptype;
 		u16         len;
 		u16         vtag = 0;
@@ -1849,7 +1864,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		if ((staterr & IXGBE_RXD_STAT_DD) == 0)
 			break;
 
-		count--;
+		count++;
 		sendmp = NULL;
 		nbuf = NULL;
 		rsc = 0;
@@ -1870,9 +1885,38 @@ ixgbe_rxeof(struct ix_queue *que)
 #endif
 			rxr->rx_discarded.ev_count++;
 			ixgbe_rx_discard(rxr, i);
+			discard_multidesc = false;
 			goto next_desc;
 		}
 
+		/* pre-alloc new mbuf */
+		if (!discard_multidesc)
+			newmp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, MT_DATA,
+			    M_PKTHDR, rxr->mbuf_sz);
+		else
+			newmp = NULL;
+		if (newmp == NULL) {
+			rxr->no_jmbuf.ev_count++;
+			/*
+			 * Descriptor initialization is already done by the
+			 * above code (cur->wb.upper.status_error = 0).
+			 * So, we can reuse current rbuf->buf for new packet.
+			 *
+			 * Rewrite the buffer addr, see comment in
+			 * ixgbe_rx_discard().
+			 */
+			cur->read.pkt_addr = rbuf->addr;
+			m_freem(rbuf->fmp);
+			rbuf->fmp = NULL;
+			if (!eop) {
+				/* Discard the entire packet. */
+				discard_multidesc = true;
+			} else
+				discard_multidesc = false;
+			goto next_desc;
+		}
+		discard_multidesc = false;
+
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		    rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 
@@ -1921,7 +1965,8 @@ ixgbe_rxeof(struct ix_queue *que)
 		 */
 		sendmp = rbuf->fmp;
 		if (sendmp != NULL) {  /* secondary frag */
-			rbuf->buf = rbuf->fmp = NULL;
+			rbuf->buf = newmp;
+			rbuf->fmp = NULL;
 			mp->m_flags &= ~M_PKTHDR;
 			sendmp->m_pkthdr.len += mp->m_len;
 		} else {
@@ -1940,10 +1985,13 @@ ixgbe_rxeof(struct ix_queue *que)
 					sendmp->m_len = len;
 					rxr->rx_copies.ev_count++;
 					rbuf->flags |= IXGBE_RX_COPY;
+
+					m_freem(newmp);
 				}
 			}
 			if (sendmp == NULL) {
-				rbuf->buf = rbuf->fmp = NULL;
+				rbuf->buf = newmp;
+				rbuf->fmp = NULL;
 				sendmp = mp;
 			}
 

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.42 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.43
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.42	Wed Sep  2 12:27:54 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.42 2020/09/02 12:27:54 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.43 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
 
@@ -67,6 +67,7 @@
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_net_mpsafe.h"
+#include "opt_ixgbe.h"
 #endif
 
 #include "ixgbe.h"
@@ -938,6 +939,8 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_rx_desc = ixgbe_rxd;
 
+	adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI;
+
 	/* Allocate our TX/RX Queues */
 	if (ixgbe_allocate_queues(adapter)) {
 		error = ENOMEM;
@@ -1862,7 +1865,7 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		    NULL, adapter->queues[i].evnamebuf, "TSO");
 		evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC,
 		    NULL, adapter->queues[i].evnamebuf,
-		    "Queue No Descriptor Available");
+		    "TX Queue No Descriptor Available");
 		evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC,
 		    NULL, adapter->queues[i].evnamebuf,
 		    "Queue Packets Transmitted");
@@ -3260,6 +3263,13 @@ ixgbe_add_device_sysctls(struct adapter 
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	if (sysctl_createv(log, 0, &rnode, &cnode,
+	    CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
+	    SYSCTL_DESCR("Number of jumbo buffers per queue"),
+	    NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
+	    CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, &rnode, &cnode,
 	    CTLFLAG_READONLY, CTLTYPE_INT,
 	    "num_queues", SYSCTL_DESCR("Number of queues"),
 	    NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -5341,9 +5351,9 @@ ixgbe_set_advertise(struct adapter *adap
 		return (EINVAL);
 	}
 
-	if (advertise < 0x0 || advertise > 0x2f) {
+	if (advertise < 0x0 || advertise > 0x3f) {
 		device_printf(dev,
-		    "Invalid advertised speed; valid modes are 0x0 through 0x7\n");
+		    "Invalid advertised speed; valid modes are 0x0 through 0x3f\n");
 		return (EINVAL);
 	}
 

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.20 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.21
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.20	Wed Aug  5 15:58:02 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.20 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.21 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -216,7 +216,7 @@
 #define IXGBE_TSO_SIZE                  262140
 #define IXGBE_RX_HDR                    128
 #define IXGBE_VFTA_SIZE                 128
-#define IXGBE_BR_SIZE                   4096
+#define IXGBE_BR_SIZE                   2048
 #define IXGBE_QUEUE_MIN_FREE            32
 #define IXGBE_MAX_TX_BUSY               10
 #define IXGBE_QUEUE_HUNG                0x80000000
@@ -559,6 +559,7 @@ struct adapter {
 	u64			active_queues;
 	u32			num_rx_desc;
 	u32			rx_process_limit;
+	int			num_jcl;
 
 	/* Multicast array memory */
 	struct ixgbe_mc_addr	*mta;

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.7.6.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.7.6.3
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.7.6.2	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixgbe_netbsd.h,v 1.7.6.2 2019/07/22 17:53:35 martin Exp $*/
+/*$NetBSD: ixgbe_netbsd.h,v 1.7.6.3 2021/03/11 16:04:25 martin Exp $*/
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,6 +41,20 @@
 #define	MJUM16BYTES	(16 * 1024)
 #define	MJUMPAGESIZE	PAGE_SIZE
 
+/*
+ * Number of jcl per queue is calculated by
+ * adapter->num_rx_desc * IXGBE_JCLNUM_MULTI. The lower limit is 2.
+ */
+#define	IXGBE_JCLNUM_MULTI_LOWLIM	2
+#define	IXGBE_JCLNUM_MULTI_DEFAULT	3
+#if !defined(IXGBE_JCLNUM_MULTI)
+# define IXGBE_JCLNUM_MULTI IXGBE_JCLNUM_MULTI_DEFAULT
+#else
+# if (IXGBE_JCLNUM_MULTI < IXGBE_JCLNUM_MULTI_LOWLIM)
+#  error IXGBE_JCLNUM_MULTI is too low.
+# endif
+#endif
+
 #define IFCAP_RXCSUM	\
 	(IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\
 	IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx)

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.12.8.5 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.12.8.6
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.12.8.5	Wed Aug  5 15:58:02 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.12.8.5 2020/08/05 15:58:02 martin Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.12.8.6 2021/03/11 16:04:25 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -121,7 +121,8 @@ static void ixgbe_virt_clr_reg(struct ix
 
 	IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
 
-	for (i = 0; i < 7; i++) {
+	KASSERT(IXGBE_VF_MAX_TX_QUEUES == IXGBE_VF_MAX_RX_QUEUES);
+	for (i = 0; i < IXGBE_VF_MAX_TX_QUEUES; i++) {
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0);
@@ -175,7 +176,7 @@ s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw
  *  ixgbe_reset_hw_vf - Performs hardware reset
  *  @hw: pointer to hardware structure
  *
- *  Resets the hardware by reseting the transmit and receive units, masks and
+ *  Resets the hardware by resetting the transmit and receive units, masks and
  *  clears all interrupts.
  **/
 s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
@@ -784,7 +785,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *
 		msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
 		/*
-		 * if we we didn't get an ACK there must have been
+		 * if we didn't get an ACK there must have been
 		 * some sort of mailbox error so we should treat it
 		 * as such
 		 */

Index: src/sys/dev/pci/ixgbe/ixgbe_x540.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.9.6.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.9.6.5
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.9.6.4	Thu Jul 26 23:21:54 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c	Thu Mar 11 16:04:25 2021
@@ -824,7 +824,7 @@ s32 ixgbe_acquire_swfw_sync_X540(struct 
 	 * bits in the SW_FW_SYNC register.
 	 */
 	if (ixgbe_get_swfw_sync_semaphore(hw)) {
-		DEBUGOUT("Failed to get NVM sempahore and register semaphore while forcefully ignoring FW sempahore bit(s) and setting SW semaphore bit(s), returning IXGBE_ERR_SWFW_SYNC\n");
+		DEBUGOUT("Failed to get NVM semaphore and register semaphore while forcefully ignoring FW semaphore bit(s) and setting SW semaphore bit(s), returning IXGBE_ERR_SWFW_SYNC\n");
 		return IXGBE_ERR_SWFW_SYNC;
 	}
 	swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw));

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.30 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.31
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.30	Wed Aug  5 15:58:03 2020
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Mar 11 16:04:25 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.30 2020/08/05 15:58:03 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.31 2021/03/11 16:04:25 martin Exp $*/
 
 /******************************************************************************
 
@@ -38,6 +38,7 @@
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_net_mpsafe.h"
+#include "opt_ixgbe.h"
 #endif
 
 #include "ixgbe.h"
@@ -510,6 +511,8 @@ ixv_attach(device_t parent, device_t dev
 	} else
 		adapter->num_rx_desc = ixv_rxd;
 
+	adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI;
+
 	/* Setup MSI-X */
 	error = ixv_configure_interrupts(adapter);
 	if (error)
@@ -2430,6 +2433,13 @@ ixv_add_device_sysctls(struct adapter *a
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	if (sysctl_createv(log, 0, &rnode, &cnode,
+	    CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
+	    SYSCTL_DESCR("Number of jumbo buffers per queue"),
+	    NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
+	    CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, &rnode, &cnode,
 	    CTLFLAG_READWRITE, CTLTYPE_BOOL,
 	    "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
 	    NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -2529,7 +2539,7 @@ ixv_add_stats_sysctls(struct adapter *ad
 		    NULL, adapter->queues[i].evnamebuf, "TSO");
 		evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC,
 		    NULL, adapter->queues[i].evnamebuf,
-		    "Queue No Descriptor Available");
+		    "TX Queue No Descriptor Available");
 		evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC,
 		    NULL, adapter->queues[i].evnamebuf,
 		    "Queue Packets Transmitted");

Reply via email to