Module Name: src Committed By: knakahara Date: Tue Oct 13 08:29:44 UTC 2015
Modified Files: src/sys/dev/pci: if_wm.c Log Message: refactor: rearrange interrupt handlers argument To generate a diff of this commit: cvs rdiff -u -r1.362 -r1.363 src/sys/dev/pci/if_wm.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/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.362 src/sys/dev/pci/if_wm.c:1.363 --- src/sys/dev/pci/if_wm.c:1.362 Tue Oct 13 08:27:11 2015 +++ src/sys/dev/pci/if_wm.c Tue Oct 13 08:29:44 2015 @@ -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 @@ wm_setup_legacy(struct wm_softc *sc) 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 @@ wm_setup_msix(struct wm_softc *sc) 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 @@ wm_setup_msix(struct wm_softc *sc) 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 @@ wm_intr_legacy(void *arg) 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 @@ out: 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)));