mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 10:01:02 +01:00
dwc: Move the txstart dma part to dwc1000_dma
This is dma related to move it to the dma file. No functional changes intended.
This commit is contained in:
parent
62519d5a4f
commit
afa0f66e81
@ -60,6 +60,15 @@
|
||||
#include <dev/dwc/dwc1000_reg.h>
|
||||
#include <dev/dwc/dwc1000_dma.h>
|
||||
|
||||
#define WATCHDOG_TIMEOUT_SECS 5
|
||||
|
||||
static inline uint32_t
|
||||
next_txidx(struct dwc_softc *sc, uint32_t curidx)
|
||||
{
|
||||
|
||||
return ((curidx + 1) % TX_DESC_COUNT);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
next_rxidx(struct dwc_softc *sc, uint32_t curidx)
|
||||
{
|
||||
@ -372,6 +381,45 @@ dma1000_txfinish_locked(struct dwc_softc *sc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dma1000_txstart(struct dwc_softc *sc)
|
||||
{
|
||||
int enqueued;
|
||||
struct mbuf *m;
|
||||
|
||||
enqueued = 0;
|
||||
|
||||
for (;;) {
|
||||
if (sc->tx_desccount > (TX_DESC_COUNT - TX_MAP_MAX_SEGS + 1)) {
|
||||
if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sc->tx_mapcount == (TX_MAP_COUNT - 1)) {
|
||||
if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
m = if_dequeue(sc->ifp);
|
||||
if (m == NULL)
|
||||
break;
|
||||
if (dma1000_setup_txbuf(sc, sc->tx_map_head, &m) != 0) {
|
||||
if_sendq_prepend(sc->ifp, m);
|
||||
if_setdrvflagbits(sc->ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
bpf_mtap_if(sc->ifp, m);
|
||||
sc->tx_map_head = next_txidx(sc, sc->tx_map_head);
|
||||
sc->tx_mapcount++;
|
||||
++enqueued;
|
||||
}
|
||||
|
||||
if (enqueued != 0) {
|
||||
WRITE4(sc, TRANSMIT_POLL_DEMAND, 0x1);
|
||||
sc->tx_watchdog_count = WATCHDOG_TIMEOUT_SECS;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dma1000_rxfinish_locked(struct dwc_softc *sc)
|
||||
{
|
||||
|
@ -149,12 +149,6 @@ void dma1000_stop(struct dwc_softc *sc);
|
||||
int dma1000_setup_txbuf(struct dwc_softc *sc, int idx, struct mbuf **mp);
|
||||
void dma1000_txfinish_locked(struct dwc_softc *sc);
|
||||
void dma1000_rxfinish_locked(struct dwc_softc *sc);
|
||||
|
||||
static inline uint32_t
|
||||
next_txidx(struct dwc_softc *sc, uint32_t curidx)
|
||||
{
|
||||
|
||||
return ((curidx + 1) % TX_DESC_COUNT);
|
||||
}
|
||||
void dma1000_txstart(struct dwc_softc *sc);
|
||||
|
||||
#endif /* __DWC1000_DMA_H__ */
|
||||
|
@ -79,7 +79,6 @@
|
||||
#include "miibus_if.h"
|
||||
|
||||
#define MAC_RESET_TIMEOUT 100
|
||||
#define WATCHDOG_TIMEOUT_SECS 5
|
||||
|
||||
static struct resource_spec dwc_spec[] = {
|
||||
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
|
||||
@ -139,8 +138,6 @@ static void
|
||||
dwc_txstart_locked(struct dwc_softc *sc)
|
||||
{
|
||||
if_t ifp;
|
||||
struct mbuf *m;
|
||||
int enqueued;
|
||||
|
||||
DWC_ASSERT_LOCKED(sc);
|
||||
|
||||
@ -152,38 +149,7 @@ dwc_txstart_locked(struct dwc_softc *sc)
|
||||
if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
|
||||
IFF_DRV_RUNNING)
|
||||
return;
|
||||
|
||||
enqueued = 0;
|
||||
|
||||
for (;;) {
|
||||
if (sc->tx_desccount > (TX_DESC_COUNT - TX_MAP_MAX_SEGS + 1)) {
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sc->tx_mapcount == (TX_MAP_COUNT - 1)) {
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
m = if_dequeue(ifp);
|
||||
if (m == NULL)
|
||||
break;
|
||||
if (dma1000_setup_txbuf(sc, sc->tx_map_head, &m) != 0) {
|
||||
if_sendq_prepend(ifp, m);
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
break;
|
||||
}
|
||||
bpf_mtap_if(ifp, m);
|
||||
sc->tx_map_head = next_txidx(sc, sc->tx_map_head);
|
||||
sc->tx_mapcount++;
|
||||
++enqueued;
|
||||
}
|
||||
|
||||
if (enqueued != 0) {
|
||||
WRITE4(sc, TRANSMIT_POLL_DEMAND, 0x1);
|
||||
sc->tx_watchdog_count = WATCHDOG_TIMEOUT_SECS;
|
||||
}
|
||||
dma1000_txstart(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user