From nobody Tue Feb 07 19:18:05 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 4PBCZj5kxmz3nbFl; Tue, 7 Feb 2023 19:18: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 4PBCZj42X9z4V60; Tue, 7 Feb 2023 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797485; 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=szNSe1wEZTaJIVwSHm5e2Yy6C/P2LaTS/opO+Pd6QVk=; b=r7f9SDoVWp2RyZF+f2z+kuMDVOllO5EwMUp4airfWuR+dXosIQUDiKupkdISt3K02Q7dv9 bm3ltWNYJMtp9ucHVgnU78prbCrtuDt3nP2bF2ddzQS2GbbZYk6Xl/DJOF1Db8Te767np7 5+NIaACWE/Fe5yHE80dlBM3A+smB/UhhZfbWTiCcqiyfGN/qqxNdZCRZMBKlIid1dXYrcR Z7H1MmBEO7/ljmeV4kPCq9KQ+KAEzrfgKAcpsCZyT5CyDb96xkMickyMw36e2Y3iB/X/j7 /0dtMiG98XzuNixlgzozeJLFTPVbj5OlPAVLxCvgNSHsEiV5oVLEUc8HN42HIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797485; 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=szNSe1wEZTaJIVwSHm5e2Yy6C/P2LaTS/opO+Pd6QVk=; b=fYqKr1i49LQdwQNPQeg0a4uusM+0VMkr7i8Bg00AyFx0R8WfPHgMtDywM8eGFy6mZd6K7/ 4iRU0PQjl44ei80mZvdbuDsXxxXnErpqXN3gKTWiksC/p1pNe8DEItRPe1bb1CsiW0eFKh xEd5qM3eOTvL+th/a3CW+1qxB/HHyaAfKJquE8AxbE1FFMLq19tOcExsmzeUuimOYI3KUf upkRp3DHg26cg44iGVxHnLjBRW1Jik0HJMu6v2oH83Ih2Milj0wZXR07CfSnostOcbXqz9 eIOMv1V62ON84uwiCL8+8T+qB0SO5iCjwSN2vr8CrvTQ0EKD/CP6R3dZU4aRAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675797485; a=rsa-sha256; cv=none; b=HXrH0ZQsN7MBPtzRx2rgih6WfLiuPZeS85g4Rpw3m2T+HY2htd2bCSTT2a8/8IPBJyEFcn xEX78dnDP396E7HUCFGwxZFw/nf/xe9EMdyqWsB/SPU/Eip4Yunu7DJ8DXBJXmqKQkQP98 0AecRNR1VAZlPvFHDS565s46egz4aiMJYhIBmfcr78C1dDKEvBK2LoobRGvIVCQ2NZb2a6 FfkuAazHeTMG696pFGL4aHvfbuRVGotT6G6VCKhKJDiYSPxqSuT3h8Cm/3LRft8XpzJliT 23sP2LMTV4S/WHkWgoGsT24vNmrSqp4Zi35nLeAGRj10fw5zUG6V0LfsNcitvA== 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 4PBCZj36pGzS7h; Tue, 7 Feb 2023 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 317JI5cU049662; Tue, 7 Feb 2023 19:18:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 317JI5p1049661; Tue, 7 Feb 2023 19:18:05 GMT (envelope-from git) Date: Tue, 7 Feb 2023 19:18:05 GMT Message-Id: <202302071918.317JI5p1049661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: dba12f75604f - main - Mechanically convert if_xae to IfAPI 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dba12f75604f3d361f2610d3cab85f9eaca6eea4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=dba12f75604f3d361f2610d3cab85f9eaca6eea4 commit dba12f75604f3d361f2610d3cab85f9eaca6eea4 Author: Justin Hibbits AuthorDate: 2022-03-01 17:00:21 +0000 Commit: Justin Hibbits CommitDate: 2023-02-07 19:15:04 +0000 Mechanically convert if_xae to IfAPI Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37797 --- sys/dev/xilinx/if_xae.c | 93 +++++++++++++++++++++++----------------------- sys/dev/xilinx/if_xaevar.h | 2 +- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/sys/dev/xilinx/if_xae.c b/sys/dev/xilinx/if_xae.c index 5b61d19b6f0a..414d45f37514 100644 --- a/sys/dev/xilinx/if_xae.c +++ b/sys/dev/xilinx/if_xae.c @@ -177,7 +177,7 @@ xae_xdma_tx_intr(void *arg, xdma_transfer_status_t *status) { xdma_transfer_status_t st; struct xae_softc *sc; - struct ifnet *ifp; + if_t ifp; struct mbuf *m; int err; @@ -200,7 +200,7 @@ xae_xdma_tx_intr(void *arg, xdma_transfer_status_t *status) m_freem(m); } - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); XAE_UNLOCK(sc); @@ -212,7 +212,7 @@ xae_xdma_rx_intr(void *arg, xdma_transfer_status_t *status) { xdma_transfer_status_t st; struct xae_softc *sc; - struct ifnet *ifp; + if_t ifp; struct mbuf *m; int err; uint32_t cnt_processed; @@ -242,7 +242,7 @@ xae_xdma_rx_intr(void *arg, xdma_transfer_status_t *status) m->m_pkthdr.len = m->m_len = st.transferred; m->m_pkthdr.rcvif = ifp; XAE_UNLOCK(sc); - (*ifp->if_input)(ifp, m); + if_input(ifp, m); XAE_LOCK(sc); } @@ -254,12 +254,12 @@ xae_xdma_rx_intr(void *arg, xdma_transfer_status_t *status) } static void -xae_qflush(struct ifnet *ifp) +xae_qflush(if_t ifp) { } static int -xae_transmit_locked(struct ifnet *ifp) +xae_transmit_locked(if_t ifp) { struct xae_softc *sc; struct mbuf *m; @@ -269,7 +269,7 @@ xae_transmit_locked(struct ifnet *ifp) dprintf("%s\n", __func__); - sc = ifp->if_softc; + sc = if_getsoftc(ifp); br = sc->br; enq = 0; @@ -298,14 +298,14 @@ xae_transmit_locked(struct ifnet *ifp) } static int -xae_transmit(struct ifnet *ifp, struct mbuf *m) +xae_transmit(if_t ifp, struct mbuf *m) { struct xae_softc *sc; int error; dprintf("%s\n", __func__); - sc = ifp->if_softc; + sc = if_getsoftc(ifp); XAE_LOCK(sc); @@ -315,7 +315,7 @@ xae_transmit(struct ifnet *ifp, struct mbuf *m) return (error); } - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { XAE_UNLOCK(sc); return (0); @@ -336,13 +336,13 @@ xae_transmit(struct ifnet *ifp, struct mbuf *m) static void xae_stop_locked(struct xae_softc *sc) { - struct ifnet *ifp; + if_t ifp; uint32_t reg; XAE_ASSERT_LOCKED(sc); ifp = sc->ifp; - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)); callout_stop(&sc->xae_callout); @@ -381,7 +381,7 @@ xae_stat(struct xae_softc *sc, int counter_id) static void xae_harvest_stats(struct xae_softc *sc) { - struct ifnet *ifp; + if_t ifp; ifp = sc->ifp; @@ -409,7 +409,7 @@ static void xae_tick(void *arg) { struct xae_softc *sc; - struct ifnet *ifp; + if_t ifp; int link_was_up; sc = arg; @@ -418,7 +418,7 @@ xae_tick(void *arg) ifp = sc->ifp; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) return; /* Gather stats from hardware counters. */ @@ -437,15 +437,15 @@ xae_tick(void *arg) static void xae_init_locked(struct xae_softc *sc) { - struct ifnet *ifp; + if_t ifp; XAE_ASSERT_LOCKED(sc); ifp = sc->ifp; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) return; - ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0); xae_setup_rxfilter(sc); @@ -476,12 +476,12 @@ xae_init(void *arg) } static void -xae_media_status(struct ifnet * ifp, struct ifmediareq *ifmr) +xae_media_status(if_t ifp, struct ifmediareq *ifmr) { struct xae_softc *sc; struct mii_data *mii; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); mii = sc->mii_softc; XAE_LOCK(sc); @@ -499,12 +499,12 @@ xae_media_change_locked(struct xae_softc *sc) } static int -xae_media_change(struct ifnet * ifp) +xae_media_change(if_t ifp) { struct xae_softc *sc; int error; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); XAE_LOCK(sc); error = xae_media_change_locked(sc); @@ -545,7 +545,7 @@ xae_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) static void xae_setup_rxfilter(struct xae_softc *sc) { - struct ifnet *ifp; + if_t ifp; uint32_t reg; XAE_ASSERT_LOCKED(sc); @@ -555,7 +555,7 @@ xae_setup_rxfilter(struct xae_softc *sc) /* * Set the multicast (group) filter hash. */ - if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { + if ((if_getflags(ifp) & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { reg = READ4(sc, XAE_FFC); reg |= FFC_PM; WRITE4(sc, XAE_FFC, reg); @@ -582,23 +582,23 @@ xae_setup_rxfilter(struct xae_softc *sc) } static int -xae_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +xae_ioctl(if_t ifp, u_long cmd, caddr_t data) { struct xae_softc *sc; struct mii_data *mii; struct ifreq *ifr; int mask, error; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); ifr = (struct ifreq *)data; error = 0; switch (cmd) { case SIOCSIFFLAGS: XAE_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if ((ifp->if_flags ^ sc->if_flags) & + if (if_getflags(ifp) & IFF_UP) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { + if ((if_getflags(ifp) ^ sc->if_flags) & (IFF_PROMISC | IFF_ALLMULTI)) xae_setup_rxfilter(sc); } else { @@ -606,15 +606,15 @@ xae_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) xae_init_locked(sc); } } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) xae_stop_locked(sc); } - sc->if_flags = ifp->if_flags; + sc->if_flags = if_getflags(ifp); XAE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { XAE_LOCK(sc); xae_setup_rxfilter(sc); XAE_UNLOCK(sc); @@ -626,10 +626,10 @@ xae_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; case SIOCSIFCAP: - mask = ifp->if_capenable ^ ifr->ifr_reqcap; + mask = if_getcapenable(ifp) ^ ifr->ifr_reqcap; if (mask & IFCAP_VLAN_MTU) { /* No work to do except acknowledge the change took */ - ifp->if_capenable ^= IFCAP_VLAN_MTU; + if_togglecapenable(ifp, IFCAP_VLAN_MTU); } break; @@ -934,7 +934,7 @@ static int xae_attach(device_t dev) { struct xae_softc *sc; - struct ifnet *ifp; + if_t ifp; phandle_t node; uint32_t reg; int error; @@ -998,18 +998,17 @@ xae_attach(device_t dev) return (ENXIO); } - ifp->if_softc = sc; + if_setsoftc(ifp, sc); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_capabilities = IFCAP_VLAN_MTU; - ifp->if_capenable = ifp->if_capabilities; - ifp->if_transmit = xae_transmit; - ifp->if_qflush = xae_qflush; - ifp->if_ioctl = xae_ioctl; - ifp->if_init = xae_init; - IFQ_SET_MAXLEN(&ifp->if_snd, TX_DESC_COUNT - 1); - ifp->if_snd.ifq_drv_maxlen = TX_DESC_COUNT - 1; - IFQ_SET_READY(&ifp->if_snd); + if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setcapabilities(ifp, IFCAP_VLAN_MTU); + if_setcapenable(ifp, if_getcapabilities(ifp)); + if_settransmitfn(ifp, xae_transmit); + if_setqflushfn(ifp, xae_qflush); + if_setioctlfn(ifp, xae_ioctl); + if_setinitfn(ifp, xae_init); + if_setsendqlen(ifp, TX_DESC_COUNT - 1); + if_setsendqready(ifp); if (xae_get_phyaddr(node, &sc->phy_addr) != 0) return (ENXIO); @@ -1043,7 +1042,7 @@ static int xae_detach(device_t dev) { struct xae_softc *sc; - struct ifnet *ifp; + if_t ifp; sc = device_get_softc(dev); diff --git a/sys/dev/xilinx/if_xaevar.h b/sys/dev/xilinx/if_xaevar.h index 3039653780e9..fab0850989be 100644 --- a/sys/dev/xilinx/if_xaevar.h +++ b/sys/dev/xilinx/if_xaevar.h @@ -51,7 +51,7 @@ struct xae_softc { uint8_t macaddr[ETHER_ADDR_LEN]; device_t miibus; struct mii_data * mii_softc; - struct ifnet *ifp; + if_t ifp; int if_flags; struct mtx mtx; void * intr_cookie;