Module Name:    src
Committed By:   msaitoh
Date:           Thu Oct 12 08:06:13 UTC 2023

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

Log Message:
ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable.

 Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all
devices all queues default interrupt rate.


To generate a diff of this commit:
cvs rdiff -u -r1.342 -r1.343 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.190 -r1.191 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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.342 src/sys/dev/pci/ixgbe/ixgbe.c:1.343
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.342	Thu Oct 12 05:50:55 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Oct 12 08:06:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.342 2023/10/12 05:50:55 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.343 2023/10/12 08:06:13 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.342 2023/10/12 05:50:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.343 2023/10/12 08:06:13 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3379,9 +3379,9 @@ ixgbe_sysctl_interrupt_rate_handler(SYSC
 			    && (reg < IXGBE_MIN_RSC_EITR_10G1G))
 				return EINVAL;
 		}
-		ixgbe_max_interrupt_rate = rate;
+		sc->max_interrupt_rate = rate;
 	} else
-		ixgbe_max_interrupt_rate = 0;
+		sc->max_interrupt_rate = 0;
 	ixgbe_eitr_write(sc, que->msix, reg);
 
 	return (0);
@@ -3486,6 +3486,7 @@ ixgbe_add_device_sysctls(struct ixgbe_so
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	sc->enable_aim = ixgbe_enable_aim;
+	sc->max_interrupt_rate = ixgbe_max_interrupt_rate;
 	if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
 	    CTLTYPE_BOOL, "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
 	    NULL, 0, &sc->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -4394,8 +4395,8 @@ ixgbe_configure_ivars(struct ixgbe_softc
 	struct ix_queue *que = sc->queues;
 	u32		newitr;
 
-	if (ixgbe_max_interrupt_rate > 0)
-		newitr = (4000000 / ixgbe_max_interrupt_rate) & 0x0FF8;
+	if (sc->max_interrupt_rate > 0)
+		newitr = (4000000 / sc->max_interrupt_rate) & 0x0FF8;
 	else {
 		/*
 		 * Disable DMA coalescing if interrupt moderation is

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.92 src/sys/dev/pci/ixgbe/ixgbe.h:1.93
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.92	Fri Oct  6 14:48:08 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Oct 12 08:06:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.92 2023/10/06 14:48:08 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.93 2023/10/12 08:06:13 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -499,6 +499,7 @@ struct ixgbe_softc {
 	/* Info about the interface */
 	int			advertise;  /* link speeds */
 	bool			enable_aim; /* adaptive interrupt moderation */
+	int			max_interrupt_rate;
 	int			link_active; /* Use LINK_STATE_* value */
 	u16			max_frame_size;
 	u16			num_segs;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.190 src/sys/dev/pci/ixgbe/ixv.c:1.191
--- src/sys/dev/pci/ixgbe/ixv.c:1.190	Thu Oct 12 03:43:55 2023
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Oct 12 08:06:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.190 2023/10/12 03:43:55 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.191 2023/10/12 08:06:13 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.190 2023/10/12 03:43:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.191 2023/10/12 08:06:13 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -550,6 +550,7 @@ ixv_attach(device_t parent, device_t dev
 
 	/* hw.ix defaults init */
 	sc->enable_aim = ixv_enable_aim;
+	sc->max_interrupt_rate = ixv_max_interrupt_rate;
 
 	sc->txrx_use_workqueue = ixv_txrx_workqueue;
 
@@ -2529,9 +2530,9 @@ ixv_sysctl_interrupt_rate_handler(SYSCTL
 			    && (reg < IXGBE_MIN_RSC_EITR_10G1G))
 				return EINVAL;
 		}
-		ixv_max_interrupt_rate = rate;
+		sc->max_interrupt_rate = rate;
 	} else
-		ixv_max_interrupt_rate = 0;
+		sc->max_interrupt_rate = 0;
 	ixv_eitr_write(sc, que->msix, reg);
 
 	return (0);

Reply via email to