From 97ecdc00ac5ac506f4119be9570d13de2d3a003a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Dul=C4=99ba?= Date: Thu, 18 Aug 2022 18:53:14 +0200 Subject: [PATCH] neta: Fix MTU change sequence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IFF_DRV_RUNNING flag is used to see if the interface needs to be temporarily brought down during MTU change sequence. The problem here is that this flag is cleared in mvneta_stop_locked, resulting in the reinitialization logic never being executed after MTU has been changed. Fix that by saving the flag value before the interface is brought down. Reported by: Jérôme Tomczyk Approved by: mw(mentor) Obtained from: Semihalf Sponsored by: Stormshield MFC after: 2 weeks --- sys/dev/neta/if_mvneta.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index c2eb3294771..eb6c9eec74c 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -2054,9 +2054,11 @@ mvneta_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifreq *ifr; int error, mask; uint32_t flags; + bool reinit; int q; error = 0; + reinit = false; sc = ifp->if_softc; ifr = (struct ifreq *)data; switch (cmd) { @@ -2157,8 +2159,10 @@ mvneta_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) * Reinitialize RX queues. * We need to update RX descriptor size. */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + reinit = true; mvneta_stop_locked(sc); + } for (q = 0; q < MVNETA_RX_QNUM_MAX; q++) { mvneta_rx_lockq(sc, q); @@ -2172,7 +2176,7 @@ mvneta_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } mvneta_rx_unlockq(sc, q); } - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (reinit) mvneta_init_locked(sc); mvneta_sc_unlock(sc);