Thu Oct 12 05:50:56 2023 UTC ()
ixg(4): Don't print wrong error message about ixgbe_num_queues.

 Don't override the ixgbe_num_queues global variable. It's the default
value of the number of queues and should not override it because it
will be referenced by later device attach. For example, the number of
MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
to a machine that the number of CPU is 24 and X540 is probed earlier,
ixgbe_num_queues is overridden to 24 and the following error message is
printed when attaching 82599:

	ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
	using reduced amount (17).

Note that the number of queues is in sc->num_queuss and referenced
by hw.ixgN.num_queues sysctl.


(msaitoh)
diff -r1.341 -r1.342 src/sys/dev/pci/ixgbe/ixgbe.c

cvs diff -r1.341 -r1.342 src/sys/dev/pci/ixgbe/ixgbe.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe.c 2023/10/12 03:43:55 1.341
+++ src/sys/dev/pci/ixgbe/ixgbe.c 2023/10/12 05:50:55 1.342
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe.c,v 1.341 2023/10/12 03:43:55 msaitoh Exp $ */ 1/* $NetBSD: ixgbe.c,v 1.342 2023/10/12 05:50:55 msaitoh Exp $ */
2 2
3/****************************************************************************** 3/******************************************************************************
4 4
5 Copyright (c) 2001-2017, Intel Corporation 5 Copyright (c) 2001-2017, Intel Corporation
6 All rights reserved. 6 All rights reserved.
7 7
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met: 9 modification, are permitted provided that the following conditions are met:
10 10
11 1. Redistributions of source code must retain the above copyright notice, 11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer. 12 this list of conditions and the following disclaimer.
13 13
14 2. Redistributions in binary form must reproduce the above copyright 14 2. Redistributions in binary form must reproduce the above copyright
@@ -54,27 +54,27 @@ @@ -54,27 +54,27 @@
54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
63 * POSSIBILITY OF SUCH DAMAGE. 63 * POSSIBILITY OF SUCH DAMAGE.
64 */ 64 */
65 65
66#include <sys/cdefs.h> 66#include <sys/cdefs.h>
67__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.341 2023/10/12 03:43:55 msaitoh Exp $"); 67__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.342 2023/10/12 05:50:55 msaitoh Exp $");
68 68
69#ifdef _KERNEL_OPT 69#ifdef _KERNEL_OPT
70#include "opt_inet.h" 70#include "opt_inet.h"
71#include "opt_inet6.h" 71#include "opt_inet6.h"
72#include "opt_net_mpsafe.h" 72#include "opt_net_mpsafe.h"
73#endif 73#endif
74 74
75#include "ixgbe.h" 75#include "ixgbe.h"
76#include "ixgbe_phy.h" 76#include "ixgbe_phy.h"
77#include "ixgbe_sriov.h" 77#include "ixgbe_sriov.h"
78 78
79#include <sys/cprng.h> 79#include <sys/cprng.h>
80#include <dev/mii/mii.h> 80#include <dev/mii/mii.h>
@@ -7111,29 +7111,26 @@ ixgbe_configure_interrupts(struct ixgbe_ @@ -7111,29 +7111,26 @@ ixgbe_configure_interrupts(struct ixgbe_
7111 if (ixgbe_num_queues > queues) { 7111 if (ixgbe_num_queues > queues) {
7112 aprint_error_dev(sc->dev, 7112 aprint_error_dev(sc->dev,
7113 "ixgbe_num_queues (%d) is too large, " 7113 "ixgbe_num_queues (%d) is too large, "
7114 "using reduced amount (%d).\n", ixgbe_num_queues, queues); 7114 "using reduced amount (%d).\n", ixgbe_num_queues, queues);
7115 ixgbe_num_queues = queues; 7115 ixgbe_num_queues = queues;
7116 } 7116 }
7117 7117
7118 if (ixgbe_num_queues != 0) 7118 if (ixgbe_num_queues != 0)
7119 queues = ixgbe_num_queues; 7119 queues = ixgbe_num_queues;
7120 else 7120 else
7121 queues = uimin(queues, 7121 queues = uimin(queues,
7122 uimin(mac->max_tx_queues, mac->max_rx_queues)); 7122 uimin(mac->max_tx_queues, mac->max_rx_queues));
7123 7123
7124 /* reflect correct sysctl value */ 
7125 ixgbe_num_queues = queues; 
7126 
7127 /* 7124 /*
7128 * Want one vector (RX/TX pair) per queue 7125 * Want one vector (RX/TX pair) per queue
7129 * plus an additional for Link. 7126 * plus an additional for Link.
7130 */ 7127 */
7131 want = queues + 1; 7128 want = queues + 1;
7132 if (msgs >= want) 7129 if (msgs >= want)
7133 msgs = want; 7130 msgs = want;
7134 else { 7131 else {
7135 aprint_error_dev(dev, "MSI-X Configuration Problem, " 7132 aprint_error_dev(dev, "MSI-X Configuration Problem, "
7136 "%d vectors but %d queues wanted!\n", msgs, want); 7133 "%d vectors but %d queues wanted!\n", msgs, want);
7137 goto msi; 7134 goto msi;
7138 } 7135 }
7139 sc->num_queues = queues; 7136 sc->num_queues = queues;