From nobody Thu Oct 05 15:35:04 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S1bGd1Rjwz4vnRD; Thu, 5 Oct 2023 15:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bGd0p7nz4d24; Thu, 5 Oct 2023 15:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JoiVNhogr1kRt+4GqknfHyzYQzzZfm1eZlEFdROa800=; b=fI56wGevz1dOA4aRumsmby/RcqKRPPFKftwN6mQNQ1+hLG4fYOE0oZIufI3PGVBwv9wWUW qEFefmhg1IivbA9k4zSLv54ETK6JdUtap6QAHqVe0iVF0S4Twhnh4fZiiETcucc51MxE84 TMYuN79uiFodHh96psfMsKJq6PH8x79p623vg5O1ejf1I0FuyWBaOums4AEUqyBS8FNSNy e2irdy97QTzLVSCbfdL+FWFU9ryzGdpVHt7Rd0AMPaopEnjH2i5l5G5c2DejoVtqJ0ollR f5yIg273N+xnZPQ/u8GdVyleYHhDZiSZQ+ARp9DJeBpGHqGK9zfl+lBPqGHEzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520105; a=rsa-sha256; cv=none; b=I9mECFEdgBRGDbVU3xtLPnK+ybI0ExaH3kWN6TBUZHttDwxVU5F92Lq4KdJtBC7OX0URmT JZOXYx5uSovbuZ2AH7X6dq48X3mvilF0mcJB8lTh+CADkalE+tN6J1bTRP/GCtVwiVMlNM +TkrqdtY6ysFT0Ew1Av/VsTksm6lp+KPRGhbNdaOFCRPnIP4aECZ/N98V/owar1C0HhRum eS/v/vwuMoG4ipTWWxTp6YXQC/oVZMz9b3G04wlBrBCPVVO1QIEOgpV9TKwF9BJ8IbxHmv gVg8g7rONj1YwJk0R8+c8ECsPr70fcLWHst4uuA1MIUx9z6gus8L+tWAzSZraA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JoiVNhogr1kRt+4GqknfHyzYQzzZfm1eZlEFdROa800=; b=TQxMpr0LaH1gcgo99vKda7HbrOgz+IBQiI301eH7/scqQNDJJ4Zlu/5CN09Bu4cHHZDr56 2a2K2+mlgKGcQbAOJIUZsCKQBqJuMqkY3t880p22+MjxC9lxOPEkGrfe0i7l/qr62OkY5c xa6gJprjA9EnYTFXVBJq0OzFtPNYpD9M10AWn70gr+IhZtvgt0K5P89rCnhoxmZ2856MH0 WS/xFG5iE4ZErpOPyuRt/m2N2WFRv+T1MNtNTZxU41sTQXB0yDDbr2W0jn/7Ey1qSaNJUc wlJVmXvFfQDggpctW/m9+5/L8lEXYZjdjBxCrDk3KCcFlYA4Yw5VDtj2QQJkIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S1bGc6ybCz1PfZ; Thu, 5 Oct 2023 15:35:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FZ4x3012493; Thu, 5 Oct 2023 15:35:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FZ4sO012490; Thu, 5 Oct 2023 15:35:04 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:35:04 GMT Message-Id: <202310051535.395FZ4sO012490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: afa0f66e81cc - main - dwc: Move the txstart dma part to dwc1000_dma List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afa0f66e81ccd6a946133bb9aceaf1fe59370431 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=afa0f66e81ccd6a946133bb9aceaf1fe59370431 commit afa0f66e81ccd6a946133bb9aceaf1fe59370431 Author: Emmanuel Vadot AuthorDate: 2023-09-28 20:34:47 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:39 +0000 dwc: Move the txstart dma part to dwc1000_dma This is dma related to move it to the dma file. No functional changes intended. --- sys/dev/dwc/dwc1000_dma.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/dwc/dwc1000_dma.h | 8 +------- sys/dev/dwc/if_dwc.c | 36 +---------------------------------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/sys/dev/dwc/dwc1000_dma.c b/sys/dev/dwc/dwc1000_dma.c index a04f65de8501..505e3fcaebef 100644 --- a/sys/dev/dwc/dwc1000_dma.c +++ b/sys/dev/dwc/dwc1000_dma.c @@ -60,6 +60,15 @@ #include #include +#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) { diff --git a/sys/dev/dwc/dwc1000_dma.h b/sys/dev/dwc/dwc1000_dma.h index 613faeee91ff..97cebd07f215 100644 --- a/sys/dev/dwc/dwc1000_dma.h +++ b/sys/dev/dwc/dwc1000_dma.h @@ -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__ */ diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 29f78dd94a9a..107158cebf02 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -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