From 0e23628acec6f06856bb5d70892000009d3ed0ab Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 5 Jan 2013 17:41:50 +0800 Subject: [PATCH] igb: Save TX interrupt CPUID into tx_ring struct This will be used to unify the ifnet.if_cpuid and ifnet.if_npoll_cpuid --- sys/dev/netif/igb/if_igb.c | 12 ++++-------- sys/dev/netif/igb/if_igb.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/dev/netif/igb/if_igb.c b/sys/dev/netif/igb/if_igb.c index 22280d3c64..44fb8cf651 100644 --- a/sys/dev/netif/igb/if_igb.c +++ b/sys/dev/netif/igb/if_igb.c @@ -647,6 +647,8 @@ igb_attach(device_t dev) ether_ifdetach(&sc->arpcom.ac_if); goto failed; } + sc->arpcom.ac_if.if_cpuid = sc->tx_rings[0].tx_intr_cpuid; + return 0; failed: @@ -3758,7 +3760,6 @@ igb_init_unshared_intr(struct igb_softc *sc) static int igb_setup_intr(struct igb_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; int error; if (sc->intr_type == PCI_INTR_TYPE_MSIX) @@ -3771,9 +3772,7 @@ igb_setup_intr(struct igb_softc *sc) device_printf(sc->dev, "Failed to register interrupt handler"); return error; } - - ifp->if_cpuid = rman_get_cpuid(sc->intr_res); - KKASSERT(ifp->if_cpuid >= 0 && ifp->if_cpuid < ncpus); + sc->tx_rings[0].tx_intr_cpuid = rman_get_cpuid(sc->intr_res); return 0; } @@ -4176,7 +4175,7 @@ igb_msix_try_alloc(struct igb_softc *sc) msix->msix_func = igb_msix_tx; msix->msix_arg = txr; msix->msix_cpuid = i + offset; - sc->msix_tx_cpuid = msix->msix_cpuid; /* XXX */ + txr->tx_intr_cpuid = msix->msix_cpuid; KKASSERT(msix->msix_cpuid < ncpus2); ksnprintf(msix->msix_desc, sizeof(msix->msix_desc), "%s tx%d", device_get_nameunit(sc->dev), i); @@ -4275,7 +4274,6 @@ igb_msix_free(struct igb_softc *sc, boolean_t setup) static int igb_msix_setup(struct igb_softc *sc) { - struct ifnet *ifp = &sc->arpcom.ac_if; int i; for (i = 0; i < sc->msix_cnt; ++i) { @@ -4292,8 +4290,6 @@ igb_msix_setup(struct igb_softc *sc) return error; } } - ifp->if_cpuid = sc->msix_tx_cpuid; - return 0; } diff --git a/sys/dev/netif/igb/if_igb.h b/sys/dev/netif/igb/if_igb.h index 792a413657..2864c120dd 100644 --- a/sys/dev/netif/igb/if_igb.h +++ b/sys/dev/netif/igb/if_igb.h @@ -240,6 +240,7 @@ struct igb_tx_ring { bus_dma_tag_t tx_hdr_dtag; bus_dmamap_t tx_hdr_dmap; bus_addr_t tx_hdr_paddr; + int tx_intr_cpuid; } __cachealign; /* @@ -384,7 +385,6 @@ struct igb_softc { void *stats; - int msix_tx_cpuid; int msix_mem_rid; struct resource *msix_mem_res; int msix_cnt; -- 2.41.0