diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-05-11 15:39:49 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-05-11 16:09:00 +0200 |
commit | a661df04dbc23f2974cd0f4d29036dc661f69881 (patch) | |
tree | 2aef71f17e056e415324463a0dde4bc2abe7524f | |
parent | if_atsam: Support transmit bpf (diff) | |
download | rtems-libbsd-a661df04dbc23f2974cd0f4d29036dc661f69881.tar.bz2 |
if_atsam: Fix interface stop
Close #4651.
-rw-r--r-- | rtemsbsd/sys/dev/atsam/if_atsam.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/rtemsbsd/sys/dev/atsam/if_atsam.c b/rtemsbsd/sys/dev/atsam/if_atsam.c index 2ed17641..f7ab01d4 100644 --- a/rtemsbsd/sys/dev/atsam/if_atsam.c +++ b/rtemsbsd/sys/dev/atsam/if_atsam.c @@ -1046,15 +1046,28 @@ if_atsam_start(void *arg) } static void -if_atsam_stop(struct if_atsam_softc *sc) +if_atsam_stop_locked(struct if_atsam_softc *sc) { struct ifnet *ifp = sc->ifp; Gmac *pHw = sc->Gmac_inst.gGmacd.pHw; + size_t i; ifp->if_drv_flags &= ~IFF_DRV_RUNNING; /* Disable TX/RX */ pHw->GMAC_NCR &= ~(GMAC_NCR_RXEN | GMAC_NCR_TXEN); + + /* Reinitialize the TX descriptors */ + + sc->tx_idx_head = 0; + sc->tx_idx_tail = 0; + + for (i = 0; i < TX_DESC_COUNT; ++i) { + sc->tx->bds[i].addr = 0; + sc->tx->bds[i].status.val = GMAC_TX_USED_BIT | TX_DESC_WRAP(i); + m_freem(sc->tx_mbufs[i]); + sc->tx_mbufs[i] = NULL; + } } @@ -1345,7 +1358,7 @@ if_atsam_ioctl(struct ifnet *ifp, ioctl_command_t command, caddr_t data) } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if_atsam_stop(sc); + if_atsam_stop_locked(sc); } } sc->if_flags = ifp->if_flags; |