Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci fixed the problem of instability when changing m...



details:   https://anonhg.NetBSD.org/src/rev/d349e4114a6b
branches:  trunk
changeset: 378515:d349e4114a6b
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu Apr 15 09:04:42 2021 +0000

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

diffstat:

 sys/dev/pci/if_aq.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 032d7bddd0a6 -r d349e4114a6b sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Thu Apr 15 09:04:08 2021 +0000
+++ b/sys/dev/pci/if_aq.c       Thu Apr 15 09:04:42 2021 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index