Module Name:    src
Committed By:   ryo
Date:           Thu Apr 15 09:04:42 UTC 2021

Modified Files:
        src/sys/dev/pci: if_aq.c

Log Message:
fixed the problem of instability when changing mtu in IFF_UP state


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_aq.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_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.21 src/sys/dev/pci/if_aq.c:1.22
--- src/sys/dev/pci/if_aq.c:1.21	Thu Apr 15 09:04:08 2021
+++ src/sys/dev/pci/if_aq.c	Thu Apr 15 09:04:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4487,6 +4487,8 @@ aq_init(struct ifnet *ifp)
 	struct aq_softc *sc = ifp->if_softc;
 	int i, error = 0;
 
+	aq_stop(ifp, false);
+
 	AQ_LOCK(sc);
 
 	aq_set_vlan_filters(sc);
@@ -4659,6 +4661,9 @@ aq_stop(struct ifnet *ifp, int disable)
 
 	ifp->if_timer = 0;
 
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		goto already_stopped;
+
 	/* disable tx/rx interrupts */
 	aq_enable_intr(sc, true, false);
 
@@ -4679,6 +4684,7 @@ aq_stop(struct ifnet *ifp, int disable)
 
 	ifp->if_timer = 0;
 
+ already_stopped:
 	if (!disable) {
 		/* when pmf stop, disable link status intr and callout */
 		aq_enable_intr(sc, false, false);

Reply via email to