From nobody Sat Mar 11 16:43:24 2023 X-Original-To: dev-commits-src-main@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 4PYpdS6yxsz3xqJN; Sat, 11 Mar 2023 16:43:24 +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 4PYpdS655tz3Qy9; Sat, 11 Mar 2023 16:43:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678553004; 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=YEbtBrz6EfdHqy9PLH4fC2iyRlf0yELaPkBsMJIDDIc=; b=DyGFzg0VlWC87yARf7fkvc4g43qbSYGUxlHvhX4UkdH0Eo7FNlOdP5Mk96X5dAD8vqeHU/ JHEqUrwwQJ6Ufy/WwiQibToimvX7759BG/Rhix+OBwsq+4mrRTOMly5oZ0DseNLrnSmSje 8D4y50LaUldSTcB35oJ0d0sBq+yUh26HoiV3QX3RrCoVEYyWv9kP0pNzW1eCUUz3ftRETv eESSeLIGsJZv9q1ORCWBv+I+7xrSidr1zrO5F8n0g2QZSNRas9nsz3KM53QYzHdXeXZsTu G0WIGq0GPER9shQGkCYffMLNW6Nbv3WA0tWsmpEVwE2exAji+qDq0NtwrgZoug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678553004; 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=YEbtBrz6EfdHqy9PLH4fC2iyRlf0yELaPkBsMJIDDIc=; b=ltuk/Trv5nOcVSmLDowJgTI5qJHqMAAYd3xq9fR5IW9nU5QVD44TANcOrVW2gkHYL80XyD 1Tpidoz4vSvGGv5jdnXo3hHU4JR8mu4UYsol8tYcXr3mL12ZAI1ssjX0Ib83k/Bh4L7YJZ 9zwGk8eVtGIyDjau2VpbfU/FwKQMRyN6ZNkg740YGzwND1wkq8fNb9vcM3y2q1aLIYZb+X Rg6ITUD/jT+yBsAaLm1aj1HQlYgwU0VPUfVaQU8MSh6twMe5KCJSPUtTtXxHt6Vn1ax9IP mJ6kcCYgxKDr1/dp/v23x2m55Y+0Bjr84hr/bf+iHiV4CW3PnqtzYdFPCFEGUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678553004; a=rsa-sha256; cv=none; b=QHaqNqdoRBDKIUrbSTZLN57OAiIZIT49zmypXPr6juMnRdd+Aqi3p7m7JcMqSLxkHarrYz QLeR5qlFjkwLCx+HRVnLb9qFjg+52marBzF6iMKQhqTINYVqdOp6BVBWl47NZJaROVJOIe Vb0jywvJYRwr9R/K2/yFOz5tyXp91bEySX8DRf4JOOrg4Fd1dhzXeIZeG/0paOC5M/gVxQ 40oJWGY0tIgJKkFMn+EYO7mtvQ8aVPEScDSdbrA8gr+cG8gbeK08CUmpIWRLDRvcQE/0ut 2VbCabLJa4jaA67wNE4lSaPP0ehB9IhF7jZx+tMlbhHea65IAfl9k27vn25z3Q== 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 4PYpdS578Qzcvt; Sat, 11 Mar 2023 16:43:24 +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 32BGhOOk087305; Sat, 11 Mar 2023 16:43:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32BGhOlv087304; Sat, 11 Mar 2023 16:43:24 GMT (envelope-from git) Date: Sat, 11 Mar 2023 16:43:24 GMT Message-Id: <202303111643.32BGhOlv087304@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: 3caaaa56bbba - main - phyp_llan: Mechanically convert to IfAPI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 3caaaa56bbbafbf74b1a65acdd2c71ab1178cd95 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=3caaaa56bbbafbf74b1a65acdd2c71ab1178cd95 commit 3caaaa56bbbafbf74b1a65acdd2c71ab1178cd95 Author: Justin Hibbits AuthorDate: 2023-03-11 16:25:25 +0000 Commit: Justin Hibbits CommitDate: 2023-03-11 16:35:27 +0000 phyp_llan: Mechanically convert to IfAPI Sponsored by: Juniper Networks, Inc. --- sys/powerpc/pseries/phyp_llan.c | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/sys/powerpc/pseries/phyp_llan.c b/sys/powerpc/pseries/phyp_llan.c index accb8406f043..c1acca603d1a 100644 --- a/sys/powerpc/pseries/phyp_llan.c +++ b/sys/powerpc/pseries/phyp_llan.c @@ -224,26 +224,25 @@ llan_attach(device_t dev) /* Attach to network stack */ sc->ifp = if_alloc(IFT_ETHER); - sc->ifp->if_softc = sc; + if_setsoftc(sc->ifp, sc); if_initname(sc->ifp, device_get_name(dev), device_get_unit(dev)); - sc->ifp->if_mtu = ETHERMTU; /* XXX max-frame-size from OF? */ - sc->ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - sc->ifp->if_hwassist = 0; /* XXX: ibm,illan-options */ - sc->ifp->if_capabilities = 0; - sc->ifp->if_capenable = 0; - sc->ifp->if_start = llan_start; - sc->ifp->if_ioctl = llan_ioctl; - sc->ifp->if_init = llan_init; + if_setmtu(sc->ifp, ETHERMTU); /* XXX max-frame-size from OF? */ + if_setflags(sc->ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_sethwassist(sc->ifp, 0); /* XXX: ibm,illan-options */ + if_setcapabilities(sc->ifp, 0); + if_setcapenable(sc->ifp, 0); + if_setstartfn(sc->ifp, llan_start); + if_setioctlfn(sc->ifp, llan_ioctl); + if_setinitfn(sc->ifp, llan_init); ifmedia_init(&sc->media, IFM_IMASK, llan_media_change, llan_media_status); ifmedia_add(&sc->media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&sc->media, IFM_ETHER | IFM_AUTO); - IFQ_SET_MAXLEN(&sc->ifp->if_snd, LLAN_MAX_TX_PACKETS); - sc->ifp->if_snd.ifq_drv_maxlen = LLAN_MAX_TX_PACKETS; - IFQ_SET_READY(&sc->ifp->if_snd); + if_setsendqlen(sc->ifp, LLAN_MAX_RX_PACKETS); + if_setsendqready(sc->ifp); ether_ifattach(sc->ifp, &sc->mac_address[2]); @@ -256,7 +255,7 @@ llan_attach(device_t dev) static int llan_media_change(struct ifnet *ifp) { - struct llan_softc *sc = ifp->if_softc; + struct llan_softc *sc = if_getsoftc(ifp); if (IFM_TYPE(sc->media.ifm_media) != IFM_ETHER) return (EINVAL); @@ -315,8 +314,7 @@ llan_init(void *xsc) phyp_hcall(H_VIO_SIGNAL, sc->unit, 1); /* Enable interrupts */ /* Tell stack we're up */ - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; - sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(sc->ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); mtx_unlock(&sc->io_lock); @@ -412,7 +410,7 @@ restart: } mtx_unlock(&sc->io_lock); - (*sc->ifp->if_input)(sc->ifp, m); + if_input(sc->ifp, m); mtx_lock(&sc->io_lock); } @@ -462,18 +460,18 @@ llan_send_packet(void *xsc, bus_dma_segment_t *segs, int nsegs, static void llan_start_locked(struct ifnet *ifp) { - struct llan_softc *sc = ifp->if_softc; + struct llan_softc *sc = if_getsoftc(ifp); int nsegs; struct mbuf *mb_head, *m; mtx_assert(&sc->io_lock, MA_OWNED); - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, mb_head); + while (!if_sendq_empty(ifp)) { + mb_head = if_dequeue(ifp); if (mb_head == NULL) break; @@ -500,7 +498,7 @@ llan_start_locked(struct ifnet *ifp) static void llan_start(struct ifnet *ifp) { - struct llan_softc *sc = ifp->if_softc; + struct llan_softc *sc = if_getsoftc(ifp); mtx_lock(&sc->io_lock); llan_start_locked(ifp); @@ -537,13 +535,13 @@ static int llan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { int err = 0; - struct llan_softc *sc = ifp->if_softc; + struct llan_softc *sc = if_getsoftc(ifp); switch (cmd) { case SIOCADDMULTI: case SIOCDELMULTI: mtx_lock(&sc->io_lock); - if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) != 0) llan_set_multicast(sc); mtx_unlock(&sc->io_lock); break;