Index: sys/dev/ic/dwc_eqos.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/dwc_eqos.c,v retrieving revision 1.39 diff -u -p -r1.39 dwc_eqos.c --- sys/dev/ic/dwc_eqos.c 14 Sep 2024 07:30:41 -0000 1.39 +++ sys/dev/ic/dwc_eqos.c 26 Sep 2024 08:14:07 -0000 @@ -496,7 +496,7 @@ eqos_setup_rxfilter(struct eqos_softc *s hash[0] = hash[1] = ~0U; ETHER_LOCK(ec); - if (sc->sc_promisc) { + if ((sc->sc_if_flags & IFF_PROMISC) != 0) { ec->ec_flags |= ETHER_F_ALLMULTI; pfil |= GMAC_MAC_PACKET_FILTER_PR | GMAC_MAC_PACKET_FILTER_PCF_ALL; @@ -614,7 +614,7 @@ eqos_init_locked(struct eqos_softc *sc) eqos_init_rings(sc, 0); /* Setup RX filter */ - sc->sc_promisc = ifp->if_flags & IFF_PROMISC; + sc->sc_if_flags = ifp->if_flags; eqos_setup_rxfilter(sc); WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->sc_csr_clock / 1000000) - 1); @@ -701,6 +701,7 @@ eqos_init_locked(struct eqos_softc *sc) sc->sc_running = true; ifp->if_flags |= IFF_RUNNING; + sc->sc_if_flags |= IFF_RUNNING; mii_mediachg(mii); callout_schedule(&sc->sc_stat_ch, hz); @@ -783,6 +784,7 @@ eqos_stop_locked(struct eqos_softc *sc, /* Disable interrupts */ eqos_disable_intr(sc); + sc->sc_if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_RUNNING; } @@ -1234,7 +1236,6 @@ eqos_ioctl(struct ifnet *ifp, u_long cmd error = (*ifp->if_init)(ifp); else if (cmd == SIOCADDMULTI || cmd == SIOCDELMULTI) { EQOS_LOCK(sc); - sc->sc_promisc = ifp->if_flags & IFF_PROMISC; if (sc->sc_running) eqos_setup_rxfilter(sc); EQOS_UNLOCK(sc); @@ -1246,6 +1247,31 @@ eqos_ioctl(struct ifnet *ifp, u_long cmd return error; } +static int +eqos_ifflags_cb(struct ethercom *ec) +{ + struct ifnet * const ifp = &ec->ec_if; + struct eqos_softc * const sc = ifp->if_softc; + int ret = 0; + + KASSERT(IFNET_LOCKED(ifp)); + EQOS_LOCK(sc); + + u_short change = ifp->if_flags ^ sc->sc_if_flags; + sc->sc_if_flags = ifp->if_flags; + + if ((change & ~(IFF_CANTCHANGE | IFF_DEBUG)) != 0) { + ret = ENETRESET; + } else if ((change & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if (sc->sc_running) + eqos_setup_rxfilter(sc); + } + EQOS_UNLOCK(sc); + + return ret; +} + + static void eqos_get_eaddr(struct eqos_softc *sc, uint8_t *eaddr) { @@ -1629,6 +1655,7 @@ eqos_attach(struct eqos_softc *sc) /* Attach ethernet interface */ ether_ifattach(ifp, eaddr); + ether_set_ifflags_cb(&sc->sc_ec, eqos_ifflags_cb); eqos_init_sysctls(sc); Index: sys/dev/ic/dwc_eqos_var.h =================================================================== RCS file: /cvsroot/src/sys/dev/ic/dwc_eqos_var.h,v retrieving revision 1.10 diff -u -p -r1.10 dwc_eqos_var.h --- sys/dev/ic/dwc_eqos_var.h 15 Sep 2024 07:33:33 -0000 1.10 +++ sys/dev/ic/dwc_eqos_var.h 26 Sep 2024 08:14:07 -0000 @@ -70,9 +70,9 @@ struct eqos_softc { callout_t sc_stat_ch; kmutex_t sc_lock; kmutex_t sc_txlock; + bool sc_if_flags; bool sc_running; bool sc_txrunning; - bool sc_promisc; struct eqos_ring sc_tx; struct eqos_ring sc_rx;