Module Name: src Committed By: thorpej Date: Sun Sep 18 13:53:06 UTC 2022
Modified Files: src/sys/arch/arm/imx: if_enet.c if_enetvar.h Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/arm/imx/if_enet.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/if_enetvar.h 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/arm/imx/if_enet.c diff -u src/sys/arch/arm/imx/if_enet.c:1.35 src/sys/arch/arm/imx/if_enet.c:1.36 --- src/sys/arch/arm/imx/if_enet.c:1.35 Mon Jan 24 09:14:37 2022 +++ src/sys/arch/arm/imx/if_enet.c Sun Sep 18 13:53:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $ */ +/* $NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $ */ /* * Copyright (c) 2014 Ryo Shimizu <r...@nerv.org> @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $"); #include "vlan.h" @@ -498,7 +498,7 @@ enet_tx_intr(void *arg) sc->sc_tx_considx = idx; if (sc->sc_tx_free > 0) - ifp->if_flags &= ~IFF_OACTIVE; + sc->sc_txbusy = false; /* * No more pending TX descriptor, @@ -823,7 +823,7 @@ enet_init(struct ifnet *ifp) /* update if_flags */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + sc->sc_txbusy = false; /* update local copy of if_flags */ sc->sc_if_flags = ifp->if_flags; @@ -850,18 +850,18 @@ enet_start(struct ifnet *ifp) struct mbuf *m; int npkt; - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0) return; sc = ifp->if_softc; - for (npkt = 0; ; npkt++) { + for (npkt = 0; !sc->sc_txbusy; npkt++) { IFQ_POLL(&ifp->if_snd, m); if (m == NULL) break; if (sc->sc_tx_free <= 0) { /* no tx descriptor now... */ - ifp->if_flags |= IFF_OACTIVE; + sc->sc_txbusy = true; DEVICE_DPRINTF("TX descriptor is full\n"); break; } @@ -870,7 +870,7 @@ enet_start(struct ifnet *ifp) if (enet_encap_txring(sc, &m) != 0) { /* too many mbuf chains? */ - ifp->if_flags |= IFF_OACTIVE; + sc->sc_txbusy = true; DEVICE_DPRINTF( "TX descriptor is full. dropping packet\n"); m_freem(m); @@ -909,8 +909,9 @@ enet_stop(struct ifnet *ifp, int disable ENET_REG_WRITE(sc, ENET_ECR, v & ~ENET_ECR_ETHEREN); /* Mark the interface as down and cancel the watchdog timer. */ - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; ifp->if_timer = 0; + sc->sc_txbusy = false; if (disable) { enet_drain_txbuf(sc); Index: src/sys/arch/arm/imx/if_enetvar.h diff -u src/sys/arch/arm/imx/if_enetvar.h:1.7 src/sys/arch/arm/imx/if_enetvar.h:1.8 --- src/sys/arch/arm/imx/if_enetvar.h:1.7 Wed Jan 15 01:09:56 2020 +++ src/sys/arch/arm/imx/if_enetvar.h Sun Sep 18 13:53:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_enetvar.h,v 1.7 2020/01/15 01:09:56 jmcneill Exp $ */ +/* $NetBSD: if_enetvar.h,v 1.8 2022/09/18 13:53:06 thorpej Exp $ */ /* * Copyright (c) 2014 Ryo Shimizu <r...@nerv.org> @@ -81,6 +81,7 @@ struct enet_softc { int sc_tx_considx; int sc_tx_prodidx; int sc_tx_free; + bool sc_txbusy; /* RX */ struct enet_rxsoft sc_rxsoft[ENET_RX_RING_CNT];