Module Name:    src
Committed By:   knakahara
Date:           Tue Jul 16 10:01:24 UTC 2019

Modified Files:
        src/sys/arch/x86/pci: if_vmx.c

Log Message:
Eliminate IFF_RUNNING checking code from vmxnet3_init_locked().

Advised by hikaru@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/pci/if_vmx.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/arch/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.30 src/sys/arch/x86/pci/if_vmx.c:1.31
--- src/sys/arch/x86/pci/if_vmx.c:1.30	Tue Jul  9 08:46:58 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Tue Jul 16 10:01:23 2019
@@ -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 @@ void
 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 @@ vmxnet3_evintr(struct vmxnet3_softc *sc)
 	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 @@ vmxnet3_init_locked(struct vmxnet3_softc
 	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 @@ setit:
 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 @@ void
 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 @@ vmxnet3_tick(void *xsc)
 	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);

Reply via email to