Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci refactor: rearrange interrupt handlers argument
details: https://anonhg.NetBSD.org/src/rev/2604240c016a
branches: trunk
changeset: 340974:2604240c016a
user: knakahara <knakahara%NetBSD.org@localhost>
date: Tue Oct 13 08:29:44 2015 +0000
description:
refactor: rearrange interrupt handlers argument
diffstat:
sys/dev/pci/if_wm.c | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
diffs (91 lines):
diff -r a9e9891aff2d -r 2604240c016a sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Tue Oct 13 08:27:11 2015 +0000
+++ b/sys/dev/pci/if_wm.c Tue Oct 13 08:29:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.362 2015/10/13 08:27:11 knakahara Exp $ */
+/* $NetBSD: if_wm.c,v 1.363 2015/10/13 08:29:44 knakahara Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.362 2015/10/13 08:27:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.363 2015/10/13 08:29:44 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -4064,18 +4064,6 @@
return 0;
}
-struct _msix_matrix {
- const char *intrname;
- int(*func)(void *);
- int intridx;
- int cpuid;
-} msix_matrix[WM_MSIX_NINTR] = {
- { "TX", wm_txintr_msix, WM_MSIX_TXINTR_IDX, WM_MSIX_TXINTR_CPUID },
- { "RX", wm_rxintr_msix, WM_MSIX_RXINTR_IDX, WM_MSIX_RXINTR_CPUID },
- { "LINK", wm_linkintr_msix, WM_MSIX_LINKINTR_IDX,
- WM_MSIX_LINKINTR_CPUID },
-};
-
static int
wm_setup_msix(struct wm_softc *sc)
{
@@ -4087,6 +4075,22 @@
char intrbuf[PCI_INTRSTR_LEN];
char intr_xname[INTRDEVNAMEBUF];
+ struct _msix_matrix {
+ const char *intrname;
+ int(*func)(void *);
+ void *arg;
+ int intridx;
+ int cpuid;
+ } msix_matrix[WM_MSIX_NINTR] = {
+ { "TX", wm_txintr_msix, sc->sc_txq,
+ WM_MSIX_TXINTR_IDX, WM_MSIX_TXINTR_CPUID },
+ { "RX", wm_rxintr_msix, sc->sc_rxq,
+ WM_MSIX_RXINTR_IDX, WM_MSIX_RXINTR_CPUID },
+ { "LINK", wm_linkintr_msix, sc,
+ WM_MSIX_LINKINTR_IDX, WM_MSIX_LINKINTR_CPUID },
+ };
+
+
kcpuset_create(&affinity, false);
for (i = 0; i < WM_MSIX_NINTR; i++) {
@@ -4105,7 +4109,7 @@
sizeof(intr_xname));
vih = pci_intr_establish_xname(pc,
sc->sc_intrs[msix_matrix[i].intridx], IPL_NET,
- msix_matrix[i].func, sc, intr_xname);
+ msix_matrix[i].func, msix_matrix[i].arg, intr_xname);
if (vih == NULL) {
aprint_error_dev(sc->sc_dev,
"unable to establish MSI-X(for %s)%s%s\n",
@@ -7061,8 +7065,8 @@
static int
wm_txintr_msix(void *arg)
{
- struct wm_softc *sc = arg;
- struct wm_txqueue *txq = sc->sc_txq;
+ struct wm_txqueue *txq = arg;
+ struct wm_softc *sc = txq->txq_sc;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
int handled = 0;
@@ -7110,8 +7114,8 @@
static int
wm_rxintr_msix(void *arg)
{
- struct wm_softc *sc = arg;
- struct wm_rxqueue *rxq = sc->sc_rxq;
+ struct wm_rxqueue *rxq = arg;
+ struct wm_softc *sc = rxq->rxq_sc;
DPRINTF(WM_DEBUG_TX,
("%s: RX: got Rx intr\n", device_xname(sc->sc_dev)));
Home |
Main Index |
Thread Index |
Old Index