Tue Dec 18 18:24:09 2018 UTC ()
Pull up following revision(s) (requested by knakahara in ticket #1138):

	sys/dev/pci/if_wm.c: revision 1.606

Fix txqueue assignment. Pointed out by yamaguchi@n.o, thanks.

E.g. When ncpu is six and nqueue is four, the sequence error occurs.

XXX pullup-8


(martin)
diff -r1.508.4.27 -r1.508.4.28 src/sys/dev/pci/if_wm.c

cvs diff -r1.508.4.27 -r1.508.4.28 src/sys/dev/pci/if_wm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_wm.c 2018/12/04 11:21:32 1.508.4.27
+++ src/sys/dev/pci/if_wm.c 2018/12/18 18:24:09 1.508.4.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_wm.c,v 1.508.4.27 2018/12/04 11:21:32 martin Exp $ */ 1/* $NetBSD: if_wm.c,v 1.508.4.28 2018/12/18 18:24:09 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -73,27 +73,27 @@ @@ -73,27 +73,27 @@
73 * TODO (in order of importance): 73 * TODO (in order of importance):
74 * 74 *
75 * - Check XXX'ed comments 75 * - Check XXX'ed comments
76 * - TX Multi queue improvement (refine queue selection logic) 76 * - TX Multi queue improvement (refine queue selection logic)
77 * - Split header buffer for newer descriptors 77 * - Split header buffer for newer descriptors
78 * - EEE (Energy Efficiency Ethernet) 78 * - EEE (Energy Efficiency Ethernet)
79 * - Virtual Function 79 * - Virtual Function
80 * - Set LED correctly (based on contents in EEPROM) 80 * - Set LED correctly (based on contents in EEPROM)
81 * - Rework how parameters are loaded from the EEPROM. 81 * - Rework how parameters are loaded from the EEPROM.
82 * - Image Unique ID 82 * - Image Unique ID
83 */ 83 */
84 84
85#include <sys/cdefs.h> 85#include <sys/cdefs.h>
86__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.27 2018/12/04 11:21:32 martin Exp $"); 86__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.28 2018/12/18 18:24:09 martin Exp $");
87 87
88#ifdef _KERNEL_OPT 88#ifdef _KERNEL_OPT
89#include "opt_net_mpsafe.h" 89#include "opt_net_mpsafe.h"
90#include "opt_if_wm.h" 90#include "opt_if_wm.h"
91#endif 91#endif
92 92
93#include <sys/param.h> 93#include <sys/param.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/callout.h> 95#include <sys/callout.h>
96#include <sys/mbuf.h> 96#include <sys/mbuf.h>
97#include <sys/malloc.h> 97#include <sys/malloc.h>
98#include <sys/kmem.h> 98#include <sys/kmem.h>
99#include <sys/kernel.h> 99#include <sys/kernel.h>
@@ -7201,27 +7201,27 @@ wm_tx_offload(struct wm_softc *sc, struc @@ -7201,27 +7201,27 @@ wm_tx_offload(struct wm_softc *sc, struc
7201} 7201}
7202 7202
7203static inline int 7203static inline int
7204wm_select_txqueue(struct ifnet *ifp, struct mbuf *m) 7204wm_select_txqueue(struct ifnet *ifp, struct mbuf *m)
7205{ 7205{
7206 struct wm_softc *sc = ifp->if_softc; 7206 struct wm_softc *sc = ifp->if_softc;
7207 u_int cpuid = cpu_index(curcpu()); 7207 u_int cpuid = cpu_index(curcpu());
7208 7208
7209 /* 7209 /*
7210 * Currently, simple distribute strategy. 7210 * Currently, simple distribute strategy.
7211 * TODO: 7211 * TODO:
7212 * distribute by flowid(RSS has value). 7212 * distribute by flowid(RSS has value).
7213 */ 7213 */
7214 return (cpuid + ncpu - sc->sc_affinity_offset) % sc->sc_nqueues; 7214 return ((cpuid + ncpu - sc->sc_affinity_offset) % ncpu) % sc->sc_nqueues;
7215} 7215}
7216 7216
7217/* 7217/*
7218 * wm_start: [ifnet interface function] 7218 * wm_start: [ifnet interface function]
7219 * 7219 *
7220 * Start packet transmission on the interface. 7220 * Start packet transmission on the interface.
7221 */ 7221 */
7222static void 7222static void
7223wm_start(struct ifnet *ifp) 7223wm_start(struct ifnet *ifp)
7224{ 7224{
7225 struct wm_softc *sc = ifp->if_softc; 7225 struct wm_softc *sc = ifp->if_softc;
7226 struct wm_txqueue *txq = &sc->sc_queue[0].wmq_txq; 7226 struct wm_txqueue *txq = &sc->sc_queue[0].wmq_txq;
7227 7227