Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci Eliminate IFF_RUNNING checking code from vm...



details:   https://anonhg.NetBSD.org/src/rev/f9e8333c4644
branches:  trunk
changeset: 457739:f9e8333c4644
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue Jul 16 10:01:23 2019 +0000

description:
Eliminate IFF_RUNNING checking code from vmxnet3_init_locked().

Advised by hikaru@n.o, thanks.

diffstat:

 sys/arch/x86/pci/if_vmx.c |  26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diffs (97 lines):

diff -r 9770991103f0 -r f9e8333c4644 sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Tue Jul 16 09:47:41 2019 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Tue Jul 16 10:01:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.30 2019/07/09 08:46:58 msaitoh Exp $      */
+/*     $NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $    */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.30 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.31 2019/07/16 10:01:23 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -1752,14 +1752,12 @@
 vmxnet3_evintr(struct vmxnet3_softc *sc)
 {
        device_t dev;
-       struct ifnet *ifp;
        struct vmxnet3_txq_shared *ts;
        struct vmxnet3_rxq_shared *rs;
        uint32_t event;
        int reset;
 
        dev = sc->vmx_dev;
-       ifp = &sc->vmx_ethercom.ec_if;
        reset = 0;
 
        VMXNET3_CORE_LOCK(sc);
@@ -1791,10 +1789,8 @@
        if (event & VMXNET3_EVENT_DEBUG)
                device_printf(dev, "debug event\n");
 
-       if (reset != 0) {
-               ifp->if_flags &= ~IFF_RUNNING;
+       if (reset != 0)
                vmxnet3_init_locked(sc);
-       }
 
        VMXNET3_CORE_UNLOCK(sc);
 }
@@ -2504,9 +2500,6 @@
        struct ifnet *ifp = &sc->vmx_ethercom.ec_if;
        int error;
 
-       if (ifp->if_flags & IFF_RUNNING)
-               return 0;
-
        vmxnet3_stop_locked(sc);
 
        error = vmxnet3_reinit(sc);
@@ -2886,15 +2879,11 @@
 int
 vmxnet3_change_mtu(struct vmxnet3_softc *sc, int mtu)
 {
-       struct ifnet *ifp = &sc->vmx_ethercom.ec_if;
 
        if (mtu < VMXNET3_MIN_MTU || mtu > VMXNET3_MAX_MTU)
                return EINVAL;
 
-       if (ifp->if_flags & IFF_RUNNING) {
-               ifp->if_flags &= ~IFF_RUNNING;
-               vmxnet3_init_locked(sc);
-       }
+       vmxnet3_init_locked(sc);
 
        return 0;
 }
@@ -3012,11 +3001,9 @@
 vmxnet3_tick(void *xsc)
 {
        struct vmxnet3_softc *sc;
-       struct ifnet *ifp;
        int i, timedout;
 
        sc = xsc;
-       ifp = &sc->vmx_ethercom.ec_if;
        timedout = 0;
 
        VMXNET3_CORE_LOCK(sc);
@@ -3026,10 +3013,9 @@
        for (i = 0; i < sc->vmx_ntxqueues; i++)
                timedout |= vmxnet3_watchdog(&sc->vmx_txq[i]);
 
-       if (timedout != 0) {
-               ifp->if_flags &= ~IFF_RUNNING;
+       if (timedout != 0)
                vmxnet3_init_locked(sc);
-       } else
+       else
                callout_reset(&sc->vmx_tick, hz, vmxnet3_tick, sc);
 
        VMXNET3_CORE_UNLOCK(sc);



Home | Main Index | Thread Index | Old Index