From c0e7885f2030217f1290fea38c900b1f69e654f9 Mon Sep 17 00:00:00 2001 From: ozaki-r Date: Thu, 8 Dec 2016 01:12:00 +0000 Subject: [PATCH] Apply deferred if_start framework if_schedule_deferred_start checks if the if_snd queue contains packets, so drivers don't need to check it by themselves. --- sys/arch/arm/omap/if_cpsw.c | 7 +-- sys/arch/emips/ebus/if_le_ebus.c | 9 ++-- sys/arch/macppc/dev/if_bm.c | 7 +-- sys/arch/macppc/dev/if_gm.c | 7 +-- sys/arch/mips/adm5120/dev/if_admsw.c | 7 +-- sys/arch/mips/alchemy/dev/if_aumac.c | 7 +-- sys/arch/mips/atheros/dev/if_ae.c | 7 +-- sys/arch/playstation2/dev/if_smap.c | 8 +-- sys/arch/powerpc/ibm4xx/dev/if_emac.c | 7 +-- sys/arch/sgimips/hpc/if_sq.c | 7 +-- sys/arch/sgimips/mace/if_mec.c | 9 ++-- sys/arch/sun2/dev/if_ec.c | 15 ++---- sys/arch/x86/pci/if_vmx.c | 7 +-- sys/dev/marvell/if_mvgbe.c | 8 +-- sys/dev/marvell/if_mvxpe.c | 8 +-- sys/dev/pci/if_age.c | 7 +-- sys/dev/pci/if_alc.c | 6 +-- sys/dev/pci/if_bce.c | 7 +-- sys/dev/pci/if_bge.c | 9 ++-- sys/dev/pci/if_bnx.c | 8 +-- sys/dev/pci/if_cas.c | 7 +-- sys/dev/pci/if_de.c | 7 +-- sys/dev/pci/if_dge.c | 7 +-- sys/dev/pci/if_et.c | 7 +-- sys/dev/pci/if_ipw.c | 7 +-- sys/dev/pci/if_iwi.c | 7 +-- sys/dev/pci/if_iwm.c | 9 ++-- sys/dev/pci/if_iwn.c | 7 +-- sys/dev/pci/if_lii.c | 7 +-- sys/dev/pci/if_msk.c | 13 ++--- sys/dev/pci/if_nfe.c | 9 ++-- sys/dev/pci/if_pcn.c | 7 +-- sys/dev/pci/if_rtwn.c | 9 ++-- sys/dev/pci/if_sip.c | 7 +-- sys/dev/pci/if_sk.c | 13 ++--- sys/dev/pci/if_ste.c | 7 +-- sys/dev/pci/if_stge.c | 7 +-- sys/dev/pci/if_ti.c | 10 ++-- sys/dev/pci/if_txp.c | 7 +-- sys/dev/pci/if_vge.c | 9 ++-- sys/dev/pci/if_vioif.c | 7 +-- sys/dev/pci/if_vr.c | 7 +-- sys/dev/pci/if_wm.c | 72 +++++++++++++++++++++++---- sys/dev/pci/if_wpi.c | 7 +-- sys/dev/pci/if_xge.c | 7 +-- sys/dev/pcmcia/if_cnw.c | 7 +-- sys/dev/pcmcia/if_malo_pcmcia.c | 7 +-- sys/dev/pcmcia/if_xi.c | 8 +-- 48 files changed, 264 insertions(+), 178 deletions(-) diff --git a/sys/arch/arm/omap/if_cpsw.c b/sys/arch/arm/omap/if_cpsw.c index e377dd0ede41..df9ec4814cdf 100644 --- a/sys/arch/arm/omap/if_cpsw.c +++ b/sys/arch/arm/omap/if_cpsw.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cpsw.c,v 1.16 2016/08/04 14:08:23 kiyohara Exp $ */ +/* $NetBSD: if_cpsw.c,v 1.17 2016/12/08 01:12:00 ozaki-r Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.16 2016/08/04 14:08:23 kiyohara Exp $"); +__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.17 2016/12/08 01:12:00 ozaki-r Exp $"); #include #include @@ -572,6 +572,7 @@ cpsw_attach(device_t parent, device_t self, void *aux) } if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); /* The attach is successful. */ @@ -1303,7 +1304,7 @@ next: ifp->if_timer = 0; if (handled) - cpsw_start(ifp); + if_schedule_deferred_start(ifp); return handled; } diff --git a/sys/arch/emips/ebus/if_le_ebus.c b/sys/arch/emips/ebus/if_le_ebus.c index 85ede581829a..c9067e3a562a 100644 --- a/sys/arch/emips/ebus/if_le_ebus.c +++ b/sys/arch/emips/ebus/if_le_ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ebus.c,v 1.11 2016/10/03 17:35:38 maya Exp $ */ +/* $NetBSD: if_le_ebus.c,v 1.12 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.11 2016/10/03 17:35:38 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.12 2016/12/08 01:12:00 ozaki-r Exp $"); #include "opt_inet.h" @@ -216,6 +216,7 @@ enic_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); sc->sc_sh = shutdownhook_establish(enic_shutdown, ifp); @@ -540,7 +541,7 @@ enic_init(struct ifnet *ifp) printf("enic_init <- %x\n",ctl); #endif - enic_start(ifp); + if_schedule_deferred_start(ifp); return 0; } @@ -819,7 +820,7 @@ void enic_tint(struct enic_softc *sc, uint32_t saf, paddr_t phys) ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; - enic_start(ifp); + if_schedule_deferred_start(ifp); #if DEBUG sc->it = 1; #endif diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index 1c845a14e268..2da74757ba3f 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bm.c,v 1.51 2016/10/03 01:23:55 ozaki-r Exp $ */ +/* $NetBSD: if_bm.c,v 1.52 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.51 2016/10/03 01:23:55 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.52 2016/12/08 01:12:00 ozaki-r Exp $"); #include "opt_inet.h" @@ -260,6 +260,7 @@ bmac_attach(device_t parent, device_t self, void *aux) bmac_reset_chip(sc); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); } @@ -441,7 +442,7 @@ bmac_intr(void *v) sc->sc_if.if_flags &= ~IFF_OACTIVE; sc->sc_if.if_timer = 0; sc->sc_if.if_opackets++; - bmac_start(&sc->sc_if); + if_schedule_deferred_start(&sc->sc_if); } /* XXX should do more! */ diff --git a/sys/arch/macppc/dev/if_gm.c b/sys/arch/macppc/dev/if_gm.c index 95518cca937a..12e54116bd3b 100644 --- a/sys/arch/macppc/dev/if_gm.c +++ b/sys/arch/macppc/dev/if_gm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gm.c,v 1.47 2016/06/10 13:27:11 ozaki-r Exp $ */ +/* $NetBSD: if_gm.c,v 1.48 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.47 2016/06/10 13:27:11 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.48 2016/12/08 01:12:00 ozaki-r Exp $"); #include "opt_inet.h" @@ -247,6 +247,7 @@ gmac_attach(device_t parent, device_t self, void *aux) ifmedia_set(&mii->mii_media, IFM_ETHER|IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, laddr); rnd_attach_source(&sc->sc_rnd_source, xname, RND_TYPE_NET, RND_FLAG_DEFAULT); @@ -343,7 +344,7 @@ gmac_tint(struct gmac_softc *sc) ifp->if_flags &= ~IFF_OACTIVE; ifp->if_timer = 0; - gmac_start(ifp); + if_schedule_deferred_start(ifp); } void diff --git a/sys/arch/mips/adm5120/dev/if_admsw.c b/sys/arch/mips/adm5120/dev/if_admsw.c index 0fac2e66d3ed..144842e7a5d6 100644 --- a/sys/arch/mips/adm5120/dev/if_admsw.c +++ b/sys/arch/mips/adm5120/dev/if_admsw.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_admsw.c,v 1.14 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $NetBSD: if_admsw.c,v 1.15 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.14 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.15 2016/12/08 01:12:00 ozaki-r Exp $"); #include @@ -480,6 +480,7 @@ admsw_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); enaddr[5]++; } @@ -886,7 +887,7 @@ admsw_txintr(struct admsw_softc *sc, int prio) ifp = &sc->sc_ethercom[0].ec_if; /* Try to queue more packets. */ - admsw_start(ifp); + if_schedule_deferred_start(ifp); /* * If there are no more pending transmissions, diff --git a/sys/arch/mips/alchemy/dev/if_aumac.c b/sys/arch/mips/alchemy/dev/if_aumac.c index 8be623477b7b..cdd3a0f4ef0b 100644 --- a/sys/arch/mips/alchemy/dev/if_aumac.c +++ b/sys/arch/mips/alchemy/dev/if_aumac.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_aumac.c,v 1.41 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $NetBSD: if_aumac.c,v 1.42 2016/12/08 01:12:00 ozaki-r Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.41 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.42 2016/12/08 01:12:00 ozaki-r Exp $"); @@ -338,6 +338,7 @@ aumac_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); rnd_attach_source(&sc->rnd_source, device_xname(self), @@ -578,7 +579,7 @@ aumac_txintr(struct aumac_softc *sc) ifp->if_flags &= ~IFF_OACTIVE; /* Try to queue more packets. */ - aumac_start(ifp); + if_schedule_deferred_start(ifp); } if (pkts) diff --git a/sys/arch/mips/atheros/dev/if_ae.c b/sys/arch/mips/atheros/dev/if_ae.c index c55b13b703b6..938eb4b8f4bc 100644 --- a/sys/arch/mips/atheros/dev/if_ae.c +++ b/sys/arch/mips/atheros/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $Id: if_ae.c,v 1.28 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $Id: if_ae.c,v 1.29 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. * Copyright (c) 2006 Garrett D'Amore. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.28 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.29 2016/12/08 01:12:00 ozaki-r Exp $"); #include @@ -383,6 +383,7 @@ ae_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, ae_ifflags_cb); @@ -993,7 +994,7 @@ ae_intr(void *arg) } /* Try to get more packets going. */ - ae_start(ifp); + if_schedule_deferred_start(ifp); if (handled) rnd_add_uint32(&sc->sc_rnd_source, status); diff --git a/sys/arch/playstation2/dev/if_smap.c b/sys/arch/playstation2/dev/if_smap.c index f7084544e54c..72c8d527d52e 100644 --- a/sys/arch/playstation2/dev/if_smap.c +++ b/sys/arch/playstation2/dev/if_smap.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_smap.c,v 1.21 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $NetBSD: if_smap.c,v 1.22 2016/12/08 01:12:00 ozaki-r Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.21 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.22 2016/12/08 01:12:00 ozaki-r Exp $"); #include "debug_playstation2.h" @@ -246,6 +246,7 @@ smap_attach(struct device *parent, struct device *self, void *aux) } if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, emac3->eaddr); spd_intr_establish(SPD_NIC, smap_intr, sc); @@ -321,8 +322,7 @@ smap_intr(void *arg) /* if transmission is pending, start here */ ifp = &sc->ethercom.ec_if; - if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) - smap_start(ifp); + if_schedule_deferred_start(ifp); rnd_add_uint32(&sc->rnd_source, cause | sc->tx_fifo_ptr << 16); return (1); diff --git a/sys/arch/powerpc/ibm4xx/dev/if_emac.c b/sys/arch/powerpc/ibm4xx/dev/if_emac.c index d33a1d39129d..d98c937ac65c 100644 --- a/sys/arch/powerpc/ibm4xx/dev/if_emac.c +++ b/sys/arch/powerpc/ibm4xx/dev/if_emac.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_emac.c,v 1.45 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $NetBSD: if_emac.c,v 1.46 2016/12/08 01:12:00 ozaki-r Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.45 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.46 2016/12/08 01:12:00 ozaki-r Exp $"); #include "opt_emac.h" @@ -550,6 +550,7 @@ emac_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); #ifdef EMAC_EVENT_COUNTERS @@ -1559,7 +1560,7 @@ emac_txeob_intr(void *arg) handled |= emac_txreap(sc); /* try to get more packets going */ - emac_start(&sc->sc_ethercom.ec_if); + if_schedule_deferred_start(&sc->sc_ethercom.ec_if); return handled; } diff --git a/sys/arch/sgimips/hpc/if_sq.c b/sys/arch/sgimips/hpc/if_sq.c index 14afb1b60c3e..3139510ebb11 100644 --- a/sys/arch/sgimips/hpc/if_sq.c +++ b/sys/arch/sgimips/hpc/if_sq.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sq.c,v 1.46 2016/06/10 13:27:12 ozaki-r Exp $ */ +/* $NetBSD: if_sq.c,v 1.47 2016/12/08 01:12:00 ozaki-r Exp $ */ /* * Copyright (c) 2001 Rafal K. Boni @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.46 2016/06/10 13:27:12 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.47 2016/12/08 01:12:00 ozaki-r Exp $"); #include @@ -324,6 +324,7 @@ sq_attach(device_t parent, device_t self, void *aux) IFQ_SET_READY(&ifp->if_snd); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); memset(&sc->sq_trace, 0, sizeof(sc->sq_trace)); @@ -1110,7 +1111,7 @@ sq_txintr(struct sq_softc *sc) ifp->if_timer = 0; SQ_TRACE(SQ_TXINTR_EXIT, sc, sc->sc_prevtx, status); - sq_start(ifp); + if_schedule_deferred_start(ifp); return 1; } diff --git a/sys/arch/sgimips/mace/if_mec.c b/sys/arch/sgimips/mace/if_mec.c index d35cb72c251f..e56fac3d278e 100644 --- a/sys/arch/sgimips/mace/if_mec.c +++ b/sys/arch/sgimips/mace/if_mec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_mec.c,v 1.53 2016/06/10 13:27:13 ozaki-r Exp $ */ +/* $NetBSD: if_mec.c,v 1.54 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.53 2016/06/10 13:27:13 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.54 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_ddb.h" @@ -614,6 +614,7 @@ mec_attach(device_t parent, device_t self, void *aux) /* attach the interface */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); /* establish interrupt */ @@ -1607,9 +1608,9 @@ mec_intr(void *arg) } } - if (sent && !IFQ_IS_EMPTY(&ifp->if_snd)) { + if (sent) { /* try to get more packets going */ - mec_start(ifp); + if_schedule_deferred_start(ifp); } if (handled) diff --git a/sys/arch/sun2/dev/if_ec.c b/sys/arch/sun2/dev/if_ec.c index 9b6b6c2176f0..849a23e26221 100644 --- a/sys/arch/sun2/dev/if_ec.c +++ b/sys/arch/sun2/dev/if_ec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ec.c,v 1.25 2016/06/10 13:27:13 ozaki-r Exp $ */ +/* $NetBSD: if_ec.c,v 1.26 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.25 2016/06/10 13:27:13 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.26 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_ns.h" @@ -232,6 +232,7 @@ ec_attach(device_t parent, device_t self, void *aux) /* Now we can attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); idprom_etheraddr(myaddr); ether_ifattach(ifp, myaddr); aprint_normal_dev(self, "address %s\n", ether_sprintf(myaddr)); @@ -352,7 +353,6 @@ ec_intr(void *arg) int recv_first; int recv_second; int retval; - struct mbuf *m0; retval = 0; @@ -434,9 +434,7 @@ ec_intr(void *arg) sc->sc_ethercom.ec_if.if_opackets++; sc->sc_jammed = 0; ifp->if_flags &= ~IFF_OACTIVE; - IFQ_POLL(&ifp->if_snd, m0); - if (m0 != NULL) - ec_start(ifp); + if_schedule_deferred_start(ifp); } } else { @@ -646,7 +644,6 @@ ec_coll(struct ec_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; u_short jams; - struct mbuf *m0; if ((++sc->sc_colliding) >= EC_COLLISIONS_JAMMED) { sc->sc_ethercom.ec_if.if_oerrors++; @@ -656,9 +653,7 @@ ec_coll(struct ec_softc *sc) sc->sc_jammed = 1; sc->sc_colliding = 0; ifp->if_flags &= ~IFF_OACTIVE; - IFQ_POLL(&ifp->if_snd, m0); - if (m0 != NULL) - ec_start(ifp); + if_schedule_deferred_start(ifp); } else { jams = MAX(sc->sc_colliding, EC_BACKOFF_PRNG_COLL_MAX); sc->sc_backoff_seed = diff --git a/sys/arch/x86/pci/if_vmx.c b/sys/arch/x86/pci/if_vmx.c index b89f9ca140c1..71579f1fe473 100644 --- a/sys/arch/x86/pci/if_vmx.c +++ b/sys/arch/x86/pci/if_vmx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.11 2016/11/29 22:27:09 dholland Exp $ */ +/* $NetBSD: if_vmx.c,v 1.12 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.11 2016/11/29 22:27:09 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.12 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -1717,6 +1717,7 @@ vmxnet3_setup_interface(struct vmxnet3_softc *sc) ifmedia_set(&sc->vmx_media, IFM_ETHER|IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->vmx_lladdr); ether_set_ifflags_cb(&sc->vmx_ethercom, vmxnet3_ifflags_cb); vmxnet3_link_status(sc); @@ -1747,7 +1748,7 @@ vmxnet3_evintr(struct vmxnet3_softc *sc) if (event & VMXNET3_EVENT_LINK) { vmxnet3_link_status(sc); if (sc->vmx_link_active != 0) - vmxnet3_start(&sc->vmx_ethercom.ec_if); + if_schedule_deferred_start(&sc->vmx_ethercom.ec_if); } if (event & (VMXNET3_EVENT_TQERROR | VMXNET3_EVENT_RQERROR)) { diff --git a/sys/dev/marvell/if_mvgbe.c b/sys/dev/marvell/if_mvgbe.c index 77b45f0b6d65..01f946a39bbd 100644 --- a/sys/dev/marvell/if_mvgbe.c +++ b/sys/dev/marvell/if_mvgbe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.45 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.45 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_multiprocessor.h" @@ -909,6 +909,7 @@ mvgbe_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, mvgbe_ifflags_cb); @@ -1050,8 +1051,7 @@ mvgbe_intr(void *arg) mvgbe_txeof(sc); } - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - mvgbe_start(ifp); + if_schedule_deferred_start(ifp); rnd_add_uint32(&sc->sc_rnd_source, datum); diff --git a/sys/dev/marvell/if_mvxpe.c b/sys/dev/marvell/if_mvxpe.c index 5ce019dfe0ce..f0e5687e2c88 100644 --- a/sys/dev/marvell/if_mvxpe.c +++ b/sys/dev/marvell/if_mvxpe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.15 2016/10/20 09:53:08 skrll Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.16 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.15 2016/10/20 09:53:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.16 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_multiprocessor.h" @@ -503,6 +503,7 @@ mvxpe_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, mvxpe_ifflags_cb); @@ -1479,8 +1480,7 @@ mvxpe_rxtxth_intr(void *arg) } mvxpe_sc_unlock(sc); - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - mvxpe_start(ifp); + if_schedule_deferred_start(ifp); rnd_add_uint32(&sc->sc_rnd_source, datum); diff --git a/sys/dev/pci/if_age.c b/sys/dev/pci/if_age.c index 5a24574d53d1..866f69eb1014 100644 --- a/sys/dev/pci/if_age.c +++ b/sys/dev/pci/if_age.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_age.c,v 1.48 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_age.c,v 1.49 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */ /*- @@ -31,7 +31,7 @@ /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.48 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.49 2016/12/08 01:12:01 ozaki-r Exp $"); #include "vlan.h" @@ -285,6 +285,7 @@ age_attach(device_t parent, device_t self, void *aux) ifmedia_set(&sc->sc_miibus.mii_media, IFM_ETHER | IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); if (pmf_device_register1(self, NULL, age_resume, age_shutdown)) @@ -535,7 +536,7 @@ age_intr(void *arg) age_init(ifp); } - age_start(ifp); + if_schedule_deferred_start(ifp); if (status & INTR_SMB) age_stats_update(sc); diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index d0be34b3225b..3ae091ddf657 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_alc.c,v 1.21 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_alc.c,v 1.22 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon @@ -1466,6 +1466,7 @@ alc_attach(device_t parent, device_t self, void *aux) ifmedia_set(&sc->sc_miibus.mii_media, IFM_ETHER | IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->alc_eaddr); if (!pmf_device_register(self, NULL, NULL)) @@ -2300,8 +2301,7 @@ alc_intr(void *arg) } alc_txeof(sc); - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - alc_start(ifp); + if_schedule_deferred_start(ifp); } /* Re-enable interrupts. */ diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index 252d7683adc1..f20e91df2b2f 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bce.c,v 1.42 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_bce.c,v 1.43 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2003 Clifford Wright. All rights reserved. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.42 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.43 2016/12/08 01:12:01 ozaki-r Exp $"); #include "vlan.h" @@ -445,6 +445,7 @@ bce_attach(device_t parent, device_t self, void *aux) /* Attach the interface */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); sc->enaddr[0] = bus_space_read_1(sc->bce_btag, sc->bce_bhandle, BCE_MAGIC_ENET0); sc->enaddr[1] = bus_space_read_1(sc->bce_btag, sc->bce_bhandle, @@ -713,7 +714,7 @@ bce_intr(void *xsc) bce_init(ifp); rnd_add_uint32(&sc->rnd_source, intstatus); /* Try to get more packets going. */ - bce_start(ifp); + if_schedule_deferred_start(ifp); } return (handled); } diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index d07a5fdf0699..5d99b109436e 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bge.c,v 1.298 2016/07/11 06:14:51 knakahara Exp $ */ +/* $NetBSD: if_bge.c,v 1.299 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.298 2016/07/11 06:14:51 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.299 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -4061,6 +4061,7 @@ alloc_retry: */ DPRINTFN(5, ("if_attach\n")); if_attach(ifp); + if_deferred_start_init(ifp, NULL); DPRINTFN(5, ("ether_ifattach\n")); ether_ifattach(ifp, eaddr); ether_set_ifflags_cb(&sc->ethercom, bge_ifflags_cb); @@ -4788,8 +4789,8 @@ bge_intr(void *xsc) /* Re-enable interrupts. */ bge_writembx_flush(sc, BGE_MBX_IRQ0_LO, statustag); - if (ifp->if_flags & IFF_RUNNING && !IFQ_IS_EMPTY(&ifp->if_snd)) - bge_start(ifp); + if (ifp->if_flags & IFF_RUNNING) + if_schedule_deferred_start(ifp); return 1; } diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index a51490c4e06d..d222cfb4c366 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bnx.c,v 1.59 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_bnx.c,v 1.60 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */ /*- @@ -35,7 +35,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.59 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.60 2016/12/08 01:12:01 ozaki-r Exp $"); /* * The following controllers are supported by this driver: @@ -846,6 +846,7 @@ bnx_attach(device_t parent, device_t self, void *aux) /* Attach to the Ethernet interface list. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp,sc->eaddr); callout_init(&sc->bnx_timeout, 0); @@ -5384,8 +5385,7 @@ bnx_intr(void *xsc) BNX_PCICFG_INT_ACK_CMD_INDEX_VALID | sc->last_status_idx); /* Handle any frames that arrived while handling the interrupt. */ - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - bnx_start(ifp); + if_schedule_deferred_start(ifp); return 1; } diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index de3b20b07497..d42493db8614 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cas.c,v 1.24 2016/02/09 08:32:11 ozaki-r Exp $ */ +/* $NetBSD: if_cas.c,v 1.25 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ /* @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.24 2016/02/09 08:32:11 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.25 2016/12/08 01:12:01 ozaki-r Exp $"); #ifndef _MODULE #include "opt_inet.h" @@ -609,6 +609,7 @@ cas_config(struct cas_softc *sc, const uint8_t *enaddr) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), @@ -2016,7 +2017,7 @@ cas_tint(struct cas_softc *sc, u_int32_t status) if (sc->sc_tx_cnt == 0) ifp->if_timer = 0; - cas_start(ifp); + if_schedule_deferred_start(ifp); return (1); } diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index eb8ef36e48de..b0429314932b 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.147 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_de.c,v 1.148 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -37,7 +37,7 @@ * board which support 21040, 21041, or 21140 (mostly). */ #include -__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.147 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.148 2016/12/08 01:12:01 ozaki-r Exp $"); #define TULIP_HDR_DATA @@ -4111,7 +4111,7 @@ tulip_intr_handler( if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_TXPROBE_ACTIVE|TULIP_DOINGSETUP|TULIP_PROMISC)) { tulip_tx_intr(sc); if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) - tulip_ifstart(&sc->tulip_if); + if_schedule_deferred_start(&sc->tulip_if); } } if (sc->tulip_flags & TULIP_NEEDRESET) { @@ -5136,6 +5136,7 @@ tulip_attach( TULIP_ETHER_IFATTACH(sc); #else if_attach(ifp); + if_deferred_start_init(ifp, NULL); #if defined(__NetBSD__) || (defined(__FreeBSD__) && BSD >= 199506) TULIP_ETHER_IFATTACH(sc); #endif diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c index b39a27b08c6a..2cc173de22de 100644 --- a/sys/dev/pci/if_dge.c +++ b/sys/dev/pci/if_dge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_dge.c,v 1.45 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: if_dge.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.45 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $"); @@ -943,6 +943,7 @@ dge_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, RND_FLAG_DEFAULT); @@ -1578,7 +1579,7 @@ dge_intr(void *arg) dge_init(ifp); /* Try to get more packets going. */ - dge_start(ifp); + if_schedule_deferred_start(ifp); } return (handled); diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index a9ff3e85633a..305e8a4d98b2 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_et.c,v 1.12 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_et.c,v 1.13 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.12 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.13 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" #include "vlan.h" @@ -284,6 +284,7 @@ et_attach(device_t parent, device_t self, void *aux) ifmedia_set(&sc->sc_miibus.mii_media, IFM_ETHER | IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); callout_init(&sc->sc_tick, 0); @@ -1971,7 +1972,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE <= ET_TX_NDESC) ifp->if_flags &= ~IFF_OACTIVE; - et_start(ifp); + if_schedule_deferred_start(ifp); } void diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 72d526b71f09..a1d200051273 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ipw.c,v 1.60 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_ipw.c,v 1.61 2016/12/08 01:12:01 ozaki-r Exp $ */ /* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */ /*- @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.60 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.61 2016/12/08 01:12:01 ozaki-r Exp $"); /*- * Intel(R) PRO/Wireless 2100 MiniPCI driver @@ -297,6 +297,7 @@ ipw_attach(device_t parent, device_t self, void *aux) ether_sprintf(ic->ic_myaddr)); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ieee80211_ifattach(ic); /* override state transition machine */ @@ -1215,7 +1216,7 @@ ipw_tx_intr(struct ipw_softc *sc) /* Call start() since some buffer descriptors have been released */ ifp->if_flags &= ~IFF_OACTIVE; - (*ifp->if_start)(ifp); + if_schedule_deferred_start(ifp); } static int diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 7576f0ace2de..d87b38d44d61 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwi.c,v 1.100 2016/08/03 19:59:57 mlelstv Exp $ */ +/* $NetBSD: if_iwi.c,v 1.101 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */ /*- @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.100 2016/08/03 19:59:57 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.101 2016/12/08 01:12:01 ozaki-r Exp $"); /*- * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver @@ -355,6 +355,7 @@ iwi_attach(device_t parent, device_t self, void *aux) memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ieee80211_ifattach(ic); /* override default methods */ ic->ic_node_alloc = iwi_node_alloc; @@ -1444,7 +1445,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct iwi_tx_ring *txq) ifp->if_flags &= ~IFF_OACTIVE; /* Call start() since some buffer descriptors have been released */ - (*ifp->if_start)(ifp); + if_schedule_deferred_start(ifp); } static int diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index ac404f399d88..c9cd4078422e 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwm.c,v 1.43 2016/09/23 19:53:52 maya Exp $ */ +/* $NetBSD: if_iwm.c,v 1.44 2016/12/08 01:12:01 ozaki-r Exp $ */ /* OpenBSD: if_iwm.c,v 1.41 2015/05/22 06:50:54 kettenis Exp */ /* @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.43 2016/09/23 19:53:52 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.44 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -3330,7 +3330,7 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, * I guess net80211 does all sorts of stunts in * interrupt context, so maybe this is no biggie. */ - (*ifp->if_start)(ifp); + if_schedule_deferred_start(ifp); } } } @@ -6831,9 +6831,10 @@ iwm_attach(device_t parent, device_t self, void *aux) #else ether_ifattach(ifp, ic->ic_myaddr); /* XXX */ #endif - if_register(ifp); /* Use common softint-based if_input */ ifp->if_percpuq = if_percpuq_create(ifp); + if_deferred_start_init(ifp, NULL); + if_register(ifp); callout_init(&sc->sc_calib_to, 0); callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc); diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index 3d20ba9a8737..7d7a1afcab36 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwn.c,v 1.80 2016/11/24 12:32:47 hkenken Exp $ */ +/* $NetBSD: if_iwn.c,v 1.81 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $ */ /*- @@ -22,7 +22,7 @@ * adapters. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.80 2016/11/24 12:32:47 hkenken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.81 2016/12/08 01:12:01 ozaki-r Exp $"); #define IWN_USE_RBUF /* Use local storage for RX */ #undef IWN_HWCRYPTO /* XXX does not even compile yet */ @@ -593,6 +593,7 @@ iwn_attach(device_t parent __unused, device_t self, void *aux) memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ieee80211_ifattach(ic); ic->ic_node_alloc = iwn_node_alloc; ic->ic_newassoc = iwn_newassoc; @@ -2341,7 +2342,7 @@ iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt, sc->qfullmsk &= ~(1 << ring->qid); if (sc->qfullmsk == 0 && (ifp->if_flags & IFF_OACTIVE)) { ifp->if_flags &= ~IFF_OACTIVE; - (*ifp->if_start)(ifp); + if_schedule_deferred_start(ifp); } } } diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c index b4e3f76b1954..d96a228c851c 100644 --- a/sys/dev/pci/if_lii.c +++ b/sys/dev/pci/if_lii.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_lii.c,v 1.15 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_lii.c,v 1.16 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.15 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.16 2016/12/08 01:12:01 ozaki-r Exp $"); #include @@ -336,6 +336,7 @@ lii_attach(device_t parent, device_t self, void *aux) sc->sc_ec.ec_capabilities = ETHERCAP_VLAN_MTU; if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, eaddr); if (pmf_device_register(self, NULL, NULL)) @@ -1048,7 +1049,7 @@ lii_txintr(struct lii_softc *sc) } if (sc->sc_free_tx_slots) - lii_start(ifp); + if_schedule_deferred_start(ifp); } static int diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 309eceac881d..818d0b6e8e6f 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_msk.c,v 1.52 2016/11/06 21:51:31 christos Exp $ */ +/* $NetBSD: if_msk.c,v 1.53 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */ /* @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.52 2016/11/06 21:51:31 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.53 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -1135,6 +1135,7 @@ msk_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc_if->sk_enaddr); if (pmf_device_register(self, NULL, msk_resume)) @@ -1972,10 +1973,10 @@ msk_intr(void *xsc) CSR_WRITE_4(sc, SK_Y2_ICR, 2); - if (ifp0 != NULL && !IFQ_IS_EMPTY(&ifp0->if_snd)) - msk_start(ifp0); - if (ifp1 != NULL && !IFQ_IS_EMPTY(&ifp1->if_snd)) - msk_start(ifp1); + if (ifp0 != NULL) + if_schedule_deferred_start(ifp0); + if (ifp1 != NULL) + if_schedule_deferred_start(ifp1); rnd_add_uint32(&sc->rnd_source, status); diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index d7c1ca6573dc..82bff7f6b572 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_nfe.c,v 1.61 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_nfe.c,v 1.62 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $ */ /*- @@ -21,7 +21,7 @@ /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */ #include -__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.61 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.62 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" #include "vlan.h" @@ -409,6 +409,7 @@ nfe_attach(device_t parent, device_t self, void *aux) ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, nfe_ifflags_cb); @@ -631,8 +632,8 @@ nfe_intr(void *arg) } } - if (handled && !IF_IS_EMPTY(&ifp->if_snd)) - nfe_start(ifp); + if (handled) + if_schedule_deferred_start(ifp); return handled; } diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 7a8499f230bc..7f13e8e839f0 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_pcn.c,v 1.62 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_pcn.c,v 1.63 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.62 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.63 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -812,6 +812,7 @@ pcn_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, RND_FLAG_DEFAULT); @@ -1288,7 +1289,7 @@ pcn_intr(void *arg) pcn_init(ifp); /* Try to get more packets going. */ - pcn_start(ifp); + if_schedule_deferred_start(ifp); } return (handled); diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index f6d00d7e7264..b227d1e43d4e 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_rtwn.c,v 1.8 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_rtwn.c,v 1.9 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $ */ #define IEEE80211_NO_HT /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.8 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.9 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -357,9 +357,10 @@ rtwn_attach(device_t parent, device_t self, void *aux) if_initialize(ifp); ieee80211_ifattach(ic); - if_register(ifp); /* Use common softint-based if_input */ ifp->if_percpuq = if_percpuq_create(ifp); + if_deferred_start_init(ifp, NULL); + if_register(ifp); /* override default methods */ ic->ic_newassoc = rtwn_newassoc; @@ -3519,7 +3520,7 @@ rtwn_intr(void *xsc) if ((status & RTWN_INT_ENABLE_TX) && sc->qfullmsk == 0) { struct ifnet *ifp = GET_IFP(sc); ifp->if_flags &= ~IFF_OACTIVE; - rtwn_start(ifp); + if_schedule_deferred_start(ifp); } /* Enable interrupts. */ diff --git a/sys/dev/pci/if_sip.c b/sys/dev/pci/if_sip.c index d587ad748219..a57a009ed586 100644 --- a/sys/dev/pci/if_sip.c +++ b/sys/dev/pci/if_sip.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sip.c,v 1.163 2016/07/14 10:19:06 msaitoh Exp $ */ +/* $NetBSD: if_sip.c,v 1.164 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.163 2016/07/14 10:19:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.164 2016/12/08 01:12:01 ozaki-r Exp $"); @@ -1283,6 +1283,7 @@ sipcom_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, sip_ifflags_cb); sc->sc_prev.ec_capenable = sc->sc_ethercom.ec_capenable; @@ -1952,7 +1953,7 @@ sipcom_intr(void *arg) bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_IER, IER_IE); /* Try to get more packets going. */ - sipcom_start(ifp); + if_schedule_deferred_start(ifp); return (handled); } diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index cc4388990f4e..4715b42fd753 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sk.c,v 1.82 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_sk.c,v 1.83 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -115,7 +115,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.82 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.83 2016/12/08 01:12:01 ozaki-r Exp $"); #include #include @@ -1458,6 +1458,7 @@ sk_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc_if->sk_enaddr); @@ -2397,10 +2398,10 @@ sk_intr(void *xsc) CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask); - if (ifp0 != NULL && !IFQ_IS_EMPTY(&ifp0->if_snd)) - sk_start(ifp0); - if (ifp1 != NULL && !IFQ_IS_EMPTY(&ifp1->if_snd)) - sk_start(ifp1); + if (ifp0 != NULL) + if_schedule_deferred_start(ifp0); + if (ifp1 != NULL) + if_schedule_deferred_start(ifp1); rnd_add_uint32(&sc->rnd_source, status); diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index 1159fe6114ed..b6b71feedc16 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ste.c,v 1.48 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: if_ste.c,v 1.49 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.48 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.49 2016/12/08 01:12:01 ozaki-r Exp $"); #include @@ -505,6 +505,7 @@ ste_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); /* @@ -912,7 +913,7 @@ ste_intr(void *arg) sc->sc_IntEnable); /* Try to get more packets going. */ - ste_start(ifp); + if_schedule_deferred_start(ifp); return (1); } diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 4f5d1899f373..1af1441ca170 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_stge.c,v 1.60 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: if_stge.c,v 1.61 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.60 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.61 2016/12/08 01:12:01 ozaki-r Exp $"); #include @@ -658,6 +658,7 @@ stge_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); #ifdef STGE_EVENT_COUNTERS @@ -1141,7 +1142,7 @@ stge_intr(void *arg) sc->sc_IntEnable); /* Try to get more packets going. */ - stge_start(ifp); + if_schedule_deferred_start(ifp); return (1); } diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index 317ed3cbc865..28cf409310a4 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ti.c,v 1.99 2016/07/14 04:15:27 msaitoh Exp $ */ +/* $NetBSD: if_ti.c,v 1.100 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.99 2016/07/14 04:15:27 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.100 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" @@ -1866,6 +1866,7 @@ ti_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, eaddr); /* @@ -2180,9 +2181,8 @@ ti_intr(void *xsc) /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - if ((ifp->if_flags & IFF_RUNNING) != 0 && - IFQ_IS_EMPTY(&ifp->if_snd) == 0) - ti_start(ifp); + if ((ifp->if_flags & IFF_RUNNING) != 0) + if_schedule_deferred_start(ifp); return (1); } diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index b74c1085de1f..66b359937efa 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_txp.c,v 1.45 2016/07/14 10:19:06 msaitoh Exp $ */ +/* $NetBSD: if_txp.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2001 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.45 2016/07/14 10:19:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.46 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" @@ -343,6 +343,7 @@ txp_attach(device_t parent, device_t self, void *aux) * Attach us everywhere */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); if (pmf_device_register1(self, NULL, NULL, txp_shutdown)) @@ -652,7 +653,7 @@ txp_intr(void *vsc) /* unmask all interrupts */ WRITE_REG(sc, TXP_IMR, TXP_INT_A2H_3); - txp_start(&sc->sc_arpcom.ec_if); + if_schedule_deferred_start(&sc->sc_arpcom.ec_if); return (claimed); } diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 206ac683f878..3ad5c2315dcb 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vge.c,v 1.58 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_vge.c,v 1.59 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.58 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.59 2016/12/08 01:12:01 ozaki-r Exp $"); /* * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. @@ -1067,6 +1067,7 @@ vge_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, eaddr); ether_set_ifflags_cb(&sc->sc_ethercom, vge_ifflags_cb); @@ -1529,8 +1530,8 @@ vge_intr(void *arg) /* Re-enable interrupts */ CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); - if (claim && !IFQ_IS_EMPTY(&ifp->if_snd)) - vge_start(ifp); + if (claim) + if_schedule_deferred_start(ifp); return claim; } diff --git a/sys/dev/pci/if_vioif.c b/sys/dev/pci/if_vioif.c index ed89412db8cd..330cf1c3a9a0 100644 --- a/sys/dev/pci/if_vioif.c +++ b/sys/dev/pci/if_vioif.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.27 2016/11/29 21:54:11 uwe Exp $ */ +/* $NetBSD: if_vioif.c,v 1.28 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.27 2016/11/29 21:54:11 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.28 2016/12/08 01:12:01 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -672,6 +672,7 @@ skip: sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU; if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_mac); return; @@ -1130,7 +1131,7 @@ vioif_tx_vq_done(struct virtqueue *vq) out: VIOIF_TX_UNLOCK(sc); if (r) - vioif_start(ifp); + if_schedule_deferred_start(ifp); return r; } diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 331f28b0d26d..9ceb433e6694 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vr.c,v 1.119 2016/07/14 04:00:46 msaitoh Exp $ */ +/* $NetBSD: if_vr.c,v 1.120 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.119 2016/07/14 04:00:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.120 2016/12/08 01:12:01 ozaki-r Exp $"); @@ -987,7 +987,7 @@ vr_intr(void *arg) CSR_WRITE_2(sc, VR_IMR, VR_INTRS); if (dotx) - vr_start(ifp); + if_schedule_deferred_start(ifp); return (handled); } @@ -1745,6 +1745,7 @@ vr_attach(device_t parent, device_t self, void *aux) * Call MI attach routines. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->vr_enaddr); rnd_attach_source(&sc->rnd_source, device_xname(self), diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index 1fdc9aef9165..9d7496261de7 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.455 2016/12/02 01:48:44 knakahara Exp $ */ +/* $NetBSD: if_wm.c,v 1.456 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -84,7 +84,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.455 2016/12/02 01:48:44 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.456 2016/12/08 01:12:01 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -696,6 +696,7 @@ static void wm_nq_start_locked(struct ifnet *); static int wm_nq_transmit(struct ifnet *, struct mbuf *); static void wm_nq_transmit_locked(struct ifnet *, struct wm_txqueue *); static void wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *, bool); +static void wm_deferred_start(struct ifnet *); /* Interrupt */ static int wm_txeof(struct wm_softc *, struct wm_txqueue *); static void wm_rxeof(struct wm_rxqueue *); @@ -1612,6 +1613,7 @@ wm_attach(device_t parent, device_t self, void *aux) bool force_clear_smbi; uint32_t link_mode; uint32_t reg; + void (*deferred_start_func)(struct ifnet *) = NULL; sc->sc_dev = self; callout_init(&sc->sc_tick_ch, CALLOUT_FLAGS); @@ -2514,12 +2516,16 @@ alloc_retry: ifp->if_ioctl = wm_ioctl; if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) { ifp->if_start = wm_nq_start; - if (sc->sc_nqueues > 1) + if (sc->sc_nqueues > 1) { ifp->if_transmit = wm_nq_transmit; + deferred_start_func = wm_deferred_start; + } } else { ifp->if_start = wm_start; - if (sc->sc_nqueues > 1) + if (sc->sc_nqueues > 1) { ifp->if_transmit = wm_transmit; + deferred_start_func = wm_deferred_start; + } } ifp->if_watchdog = wm_watchdog; ifp->if_init = wm_init; @@ -2620,6 +2626,7 @@ alloc_retry: /* Attach the interface. */ if_initialize(ifp); sc->sc_ipq = if_percpuq_create(&sc->sc_ethercom.ec_if); + if_deferred_start_init(ifp, deferred_start_func); ether_ifattach(ifp, enaddr); if_register(ifp); ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb); @@ -7245,6 +7252,53 @@ wm_nq_send_common_locked(struct ifnet *ifp, struct wm_txqueue *txq, } } +static void +wm_deferred_start(struct ifnet *ifp) +{ + struct wm_softc *sc = ifp->if_softc; + int qid = 0; + + /* + * Try to transmit on all Tx queues. Passing a txq somehow and + * transmitting only on the txq may be better. + */ +restart: + WM_CORE_LOCK(sc); + if (sc->sc_core_stopping) + goto out; + + for (; qid < sc->sc_nqueues; qid++) { + struct wm_txqueue *txq = &sc->sc_queue[qid].wmq_txq; + + if (!mutex_tryenter(txq->txq_lock)) + continue; + + if (txq->txq_stopping) { + mutex_exit(txq->txq_lock); + continue; + } + WM_CORE_UNLOCK(sc); + + if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) { + /* XXX need for ALTQ */ + if (qid == 0) + wm_nq_start_locked(ifp); + wm_nq_transmit_locked(ifp, txq); + } else { + /* XXX need for ALTQ */ + if (qid == 0) + wm_start_locked(ifp); + wm_transmit_locked(ifp, txq); + } + mutex_exit(txq->txq_lock); + + qid++; + goto restart; + } +out: + WM_CORE_UNLOCK(sc); +} + /* Interrupt */ /* @@ -7926,7 +7980,7 @@ wm_intr_legacy(void *arg) if (handled) { /* Try to get more packets going. */ - ifp->if_start(ifp); + if_schedule_deferred_start(ifp); } return handled; @@ -7965,15 +8019,13 @@ wm_txrxintr_msix(void *arg) /* Try to get more packets going. */ if (pcq_peek(txq->txq_interq) != NULL) - wm_nq_transmit_locked(ifp, txq); + if_schedule_deferred_start(ifp); /* * There are still some upper layer processing which call * ifp->if_start(). e.g. ALTQ */ - if (wmq->wmq_id == 0) { - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - wm_nq_start_locked(ifp); - } + if (wmq->wmq_id == 0) + if_schedule_deferred_start(ifp); mutex_exit(txq->txq_lock); diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index cabe7bfab1ab..a90cc546244b 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpi.c,v 1.74 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_wpi.c,v 1.75 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.74 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.75 2016/12/08 01:12:01 ozaki-r Exp $"); /* * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. @@ -359,6 +359,7 @@ wpi_attach(device_t parent __unused, device_t self, void *aux) memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ieee80211_ifattach(ic); /* override default methods */ ic->ic_node_alloc = wpi_node_alloc; @@ -1630,7 +1631,7 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) sc->sc_tx_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; - wpi_start(ifp); + if_schedule_deferred_start(ifp); } static void diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 27acb76a2676..fb698e6e7362 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xge.c,v 1.23 2016/07/14 04:00:46 msaitoh Exp $ */ +/* $NetBSD: if_xge.c,v 1.24 2016/12/08 01:12:01 ozaki-r Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.23 2016/07/14 04:00:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.24 2016/12/08 01:12:01 ozaki-r Exp $"); #include @@ -553,6 +553,7 @@ xge_attach(device_t parent, device_t self, void *aux) * Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); /* @@ -750,7 +751,7 @@ xge_intr(void *pv) if (sc->sc_lasttx != lasttx) ifp->if_flags &= ~IFF_OACTIVE; - xge_start(ifp); /* Try to get more packets on the wire */ + if_schedule_deferred_start(ifp); /* Try to get more packets on the wire */ if ((val = PIF_RCSR(RX_TRAFFIC_INT))) { XGE_EVCNT_INCR(&sc->sc_rxintr); diff --git a/sys/dev/pcmcia/if_cnw.c b/sys/dev/pcmcia/if_cnw.c index 355a2f01b150..f16e27073458 100644 --- a/sys/dev/pcmcia/if_cnw.c +++ b/sys/dev/pcmcia/if_cnw.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cnw.c,v 1.59 2016/10/02 14:16:03 christos Exp $ */ +/* $NetBSD: if_cnw.c,v 1.60 2016/12/08 01:12:01 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.59 2016/10/02 14:16:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.60 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" @@ -558,6 +558,7 @@ cnw_attach(device_t parent, device_t self, void *aux) /* Attach the interface */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, macaddr); sc->sc_resource |= CNW_RES_NET; @@ -975,7 +976,7 @@ cnw_intr(void *arg) ifp->if_flags &= ~IFF_OACTIVE; /* Continue to send packets from the queue */ - cnw_start(&sc->sc_ethercom.ec_if); + if_schedule_deferred_start(&sc->sc_ethercom.ec_if); } } diff --git a/sys/dev/pcmcia/if_malo_pcmcia.c b/sys/dev/pcmcia/if_malo_pcmcia.c index b0d2b77681db..de8d0d3c58f5 100644 --- a/sys/dev/pcmcia/if_malo_pcmcia.c +++ b/sys/dev/pcmcia/if_malo_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_malo_pcmcia.c,v 1.10 2016/03/11 22:09:54 macallan Exp $ */ +/* $NetBSD: if_malo_pcmcia.c,v 1.11 2016/12/08 01:12:01 ozaki-r Exp $ */ /* $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.10 2016/03/11 22:09:54 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.11 2016/12/08 01:12:01 ozaki-r Exp $"); #ifdef _MODULE #include @@ -356,6 +356,7 @@ cmalo_attach(void *arg) /* attach interface */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ieee80211_ifattach(ic); sc->sc_newstate = ic->ic_newstate; @@ -1070,7 +1071,7 @@ cmalo_tx_done(struct malo_softc *sc) ifp->if_opackets++; ifp->if_flags &= ~IFF_OACTIVE; ifp->if_timer = 0; - cmalo_start(ifp); + if_schedule_deferred_start(ifp); } static void diff --git a/sys/dev/pcmcia/if_xi.c b/sys/dev/pcmcia/if_xi.c index d3b177a8d092..e4d7232b355a 100644 --- a/sys/dev/pcmcia/if_xi.c +++ b/sys/dev/pcmcia/if_xi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xi.c,v 1.78 2016/10/02 14:16:03 christos Exp $ */ +/* $NetBSD: if_xi.c,v 1.79 2016/12/08 01:12:01 ozaki-r Exp $ */ /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ /* @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.78 2016/10/02 14:16:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.79 2016/12/08 01:12:01 ozaki-r Exp $"); #include "opt_inet.h" @@ -219,6 +219,7 @@ xi_attach(struct xi_softc *sc, u_int8_t *myea) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, myea); /* @@ -360,8 +361,7 @@ xi_intr(void *arg) } /* Try to start more packets transmitting. */ - if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) - xi_start(ifp); + if_schedule_deferred_start(ifp); /* Detected excessive collisions? */ if ((tx_status & EXCESSIVE_COLL) && ifp->if_opackets > 0) {