From nobody Tue Feb 07 19:18:09 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 4PBCZp0Nj9z3nbXX; Tue, 7 Feb 2023 19:18:10 +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 4PBCZp00p8z4V8B; Tue, 7 Feb 2023 19:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797490; 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=ATeYu3ls84a/XGYhzUdCBnwjH5i+RGrijzgOKSSdAOk=; b=c048sGKMqm36Ntj+ZgYepOmA2Trzf5AHVZBj/qT1YoMCP4X7XR0taULZAB8nsJL0LoCgtA 08NXDpcqN9gXVrWYPWs0X+wbeNrBcoJWkP3pdnH6FQvyb4r+Trao2JzrMcCrwKXnqzG+nf dx//yaPYgKmo7UKcvdaEMFyn53s0rj7N/CR5+8jn2bm87N3Pl0yqlmeT8SYqRYHarnr4Qp JO1w2YyeVRMrvgg6wY1s2NQByI+DxXZci5qDtkl+CrV7Cy3qWvRvq0okdyBBXmQ+oOqVhW zgraa93QuhOy5ygZhrgYp9unRJ3WZ1JPMtSWrfcp4swJWhZRXN+jHaDK1xbNjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797490; 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=ATeYu3ls84a/XGYhzUdCBnwjH5i+RGrijzgOKSSdAOk=; b=UJdhpMOlWdK8BH5Wju2sHBpoqYPv2PN46HmvpVgnJeo9a2NEO/EFTbi6TlQvbI5ohhjpvJ oAc3G4VmcHgTc5ecDgbLJ3gBrEWvlAt6aLfj1kHw4q3UcfwlEY/4lzkxVvr9I+FI37nP43 zfFeeP7JhoN0Sffy+LHpA5p7QaYXjDrQCxpb9HC6Mn5DRgsKXxQdPctdSynohiXg37jpjc XRZohPc90Qp4EwLlWYzA3YH7SQJJTdbpn9IKxvO8IwUvJl/k3z7pUz4U+emw34skwO1R7z nT/5oKKzB5bJ1j8R+l99LvCPq6XrVUItx+FIxqaGOCMw4NNIA50NFgVXNw4ysg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675797490; a=rsa-sha256; cv=none; b=IkAoWFayf2Z7S/nKmVC6Gmv217ISyZ6lYaH52d4VyHvAvuvcWQjOYU0czosOhidrvnsOAA j/IODnMq9GJ3Cc+B55AFAyy/30oS7qq5C+s3ECTDM/rf18f7Avt48Ex2RtI19eBrSgTEUy TGKO5ZL/J4j32lV212XIDVH1w+PJuVyUab0/G62uXfHAPiKiCrgVRvbTrDGoA70tmW8Miz Kczgt1tAIUP8vlFV6vf9Pd/Yb9YgUv3yBuNYbFAwCXR5PuUOWgRggsa1vSS3h3tVuOaw6T v36Vj1mhl7EDxjFE4ltgWFJCffPs+0l8L41kqsD+D29MBatoKR5RaHgblJ6WDw== 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 4PBCZn6859zSYY; Tue, 7 Feb 2023 19:18:09 +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 317JI9Qq049759; Tue, 7 Feb 2023 19:18:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 317JI9tw049758; Tue, 7 Feb 2023 19:18:09 GMT (envelope-from git) Date: Tue, 7 Feb 2023 19:18:09 GMT Message-Id: <202302071918.317JI9tw049758@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: 04abf87b2a56 - main - Mechanically convert sfxge(4) 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: 04abf87b2a561618d928b4bb13acd2bcd0e8241b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=04abf87b2a561618d928b4bb13acd2bcd0e8241b commit 04abf87b2a561618d928b4bb13acd2bcd0e8241b Author: Justin Hibbits AuthorDate: 2022-08-17 20:15:14 +0000 Commit: Justin Hibbits CommitDate: 2023-02-07 19:15:49 +0000 Mechanically convert sfxge(4) to IfAPI Reviewed by: arybchik, zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37817 --- sys/dev/sfxge/sfxge.c | 95 +++++++++++++++++++++++----------------------- sys/dev/sfxge/sfxge.h | 6 +-- sys/dev/sfxge/sfxge_port.c | 29 +++++++------- sys/dev/sfxge/sfxge_rx.c | 8 ++-- sys/dev/sfxge/sfxge_tx.c | 10 ++--- sys/dev/sfxge/sfxge_tx.h | 4 +- 6 files changed, 75 insertions(+), 77 deletions(-) diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index ad7a2b276fbd..76c0233ad3b6 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -256,8 +256,7 @@ sfxge_start(struct sfxge_softc *sc) sc->init_state = SFXGE_STARTED; /* Tell the stack we're running. */ - sc->ifnet->if_drv_flags |= IFF_DRV_RUNNING; - sc->ifnet->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(sc->ifnet, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); return (0); @@ -321,7 +320,7 @@ sfxge_stop(struct sfxge_softc *sc) efx_nic_fini(sc->enp); - sc->ifnet->if_drv_flags &= ~IFF_DRV_RUNNING; + if_setdrvflagbits(sc->ifnet, 0, IFF_DRV_RUNNING); } static int @@ -384,7 +383,7 @@ sfxge_private_ioctl(struct sfxge_softc *sc, sfxge_ioc_t *ioc) } static int -sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) +sfxge_if_ioctl(if_t ifp, unsigned long command, caddr_t data) { struct sfxge_softc *sc; struct ifreq *ifr; @@ -392,52 +391,52 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) int error; ifr = (struct ifreq *)data; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); error = 0; switch (command) { case SIOCSIFFLAGS: SFXGE_ADAPTER_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)) { sfxge_mac_filter_set(sc); } } else sfxge_start(sc); } else - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) sfxge_stop(sc); - sc->if_flags = ifp->if_flags; + sc->if_flags = if_getflags(ifp); SFXGE_ADAPTER_UNLOCK(sc); break; case SIOCSIFMTU: - if (ifr->ifr_mtu == ifp->if_mtu) { + if (ifr->ifr_mtu == if_getmtu(ifp)) { /* Nothing to do */ error = 0; } else if (ifr->ifr_mtu > SFXGE_MAX_MTU) { error = EINVAL; - } else if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ifp->if_mtu = ifr->ifr_mtu; + } else if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { + if_setmtu(ifp, ifr->ifr_mtu); error = 0; } else { /* Restart required */ SFXGE_ADAPTER_LOCK(sc); sfxge_stop(sc); - ifp->if_mtu = ifr->ifr_mtu; + if_setmtu(ifp, ifr->ifr_mtu); error = sfxge_start(sc); SFXGE_ADAPTER_UNLOCK(sc); if (error != 0) { - ifp->if_flags &= ~IFF_UP; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_setflagbits(ifp, 0, IFF_UP); + if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING); if_down(ifp); } } break; case SIOCADDMULTI: case SIOCDELMULTI: - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) sfxge_mac_filter_set(sc); break; case SIOCSIFCAP: @@ -448,7 +447,7 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) SFXGE_ADAPTER_LOCK(sc); /* Capabilities to be changed in accordance with request */ - capchg_mask = ifp->if_capenable ^ reqcap; + capchg_mask = if_getcapenable(ifp) ^ reqcap; /* * The networking core already rejects attempts to @@ -456,11 +455,11 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) * to reject attempts to disable capabilities that we * can't (yet) disable. */ - KASSERT((reqcap & ~ifp->if_capabilities) == 0, + KASSERT((reqcap & ~if_getcapabilities(ifp)) == 0, ("Unsupported capabilities 0x%x requested 0x%x vs " "supported 0x%x", - reqcap & ~ifp->if_capabilities, - reqcap , ifp->if_capabilities)); + reqcap & ~if_getcapabilities(ifp), + reqcap , if_getcapabilities(ifp))); if (capchg_mask & SFXGE_CAP_FIXED) { error = EINVAL; SFXGE_ADAPTER_UNLOCK(sc); @@ -484,9 +483,9 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) } if (reqcap & IFCAP_TXCSUM) { - ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP); + if_sethwassistbits(ifp, (CSUM_IP | CSUM_TCP | CSUM_UDP), 0); } else { - ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP); + if_sethwassistbits(ifp, 0, (CSUM_IP | CSUM_TCP | CSUM_UDP)); if (reqcap & IFCAP_TSO4) { reqcap &= ~IFCAP_TSO4; if_printf(ifp, @@ -494,9 +493,9 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) } } if (reqcap & IFCAP_TXCSUM_IPV6) { - ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6); + if_sethwassistbits(ifp, (CSUM_TCP_IPV6 | CSUM_UDP_IPV6), 0); } else { - ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6); + if_sethwassistbits(ifp, 0, (CSUM_TCP_IPV6 | CSUM_UDP_IPV6)); if (reqcap & IFCAP_TSO6) { reqcap &= ~IFCAP_TSO6; if_printf(ifp, @@ -512,7 +511,7 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) * but both bits are set in IPv4 and IPv6 mbufs. */ - ifp->if_capenable = reqcap; + if_setcapenable(ifp, reqcap); SFXGE_ADAPTER_UNLOCK(sc); break; @@ -567,9 +566,9 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) } static void -sfxge_ifnet_fini(struct ifnet *ifp) +sfxge_ifnet_fini(if_t ifp) { - struct sfxge_softc *sc = ifp->if_softc; + struct sfxge_softc *sc = if_getsoftc(ifp); SFXGE_ADAPTER_LOCK(sc); sfxge_stop(sc); @@ -581,7 +580,7 @@ sfxge_ifnet_fini(struct ifnet *ifp) } static int -sfxge_ifnet_init(struct ifnet *ifp, struct sfxge_softc *sc) +sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc) { const efx_nic_cfg_t *encp = efx_nic_cfg_get(sc->enp); device_t dev; @@ -591,35 +590,35 @@ sfxge_ifnet_init(struct ifnet *ifp, struct sfxge_softc *sc) sc->ifnet = ifp; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_init = sfxge_if_init; - ifp->if_softc = sc; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_ioctl = sfxge_if_ioctl; + if_setinitfn(ifp, sfxge_if_init); + if_setsoftc(ifp, sc); + if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setioctlfn(ifp, sfxge_if_ioctl); - ifp->if_capabilities = SFXGE_CAP; - ifp->if_capenable = SFXGE_CAP_ENABLE; - ifp->if_hw_tsomax = SFXGE_TSO_MAX_SIZE; - ifp->if_hw_tsomaxsegcount = SFXGE_TX_MAPPING_MAX_SEG; - ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + if_setcapabilities(ifp, SFXGE_CAP); + if_setcapenable(ifp, SFXGE_CAP_ENABLE); + if_sethwtsomax(ifp, SFXGE_TSO_MAX_SIZE); + if_sethwtsomaxsegcount(ifp, SFXGE_TX_MAPPING_MAX_SEG); + if_sethwtsomaxsegsize(ifp, PAGE_SIZE); #ifdef SFXGE_LRO - ifp->if_capabilities |= IFCAP_LRO; - ifp->if_capenable |= IFCAP_LRO; + if_setcapabilitiesbit(ifp, IFCAP_LRO, 0); + if_setcapenablebit(ifp, IFCAP_LRO, 0); #endif if (encp->enc_hw_tx_insert_vlan_enabled) { - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifp->if_capenable |= IFCAP_VLAN_HWTAGGING; + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING, 0); + if_setcapenablebit(ifp, IFCAP_VLAN_HWTAGGING, 0); } - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | - CSUM_TCP_IPV6 | CSUM_UDP_IPV6; + if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | + CSUM_TCP_IPV6 | CSUM_UDP_IPV6, 0); ether_ifattach(ifp, encp->enc_mac_addr); - ifp->if_transmit = sfxge_if_transmit; - ifp->if_qflush = sfxge_if_qflush; + if_settransmitfn(ifp, sfxge_if_transmit); + if_setqflushfn(ifp, sfxge_if_qflush); - ifp->if_get_counter = sfxge_get_counter; + if_setgetcounterfn(ifp, sfxge_get_counter); DBGPRINT(sc->dev, "ifmedia_init"); if ((rc = sfxge_port_ifmedia_init(sc)) != 0) @@ -1076,7 +1075,7 @@ static int sfxge_attach(device_t dev) { struct sfxge_softc *sc; - struct ifnet *ifp; + if_t ifp; int error; sc = device_get_softc(dev); diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h index 07e7ede97309..7e18f4a423f0 100644 --- a/sys/dev/sfxge/sfxge.h +++ b/sys/dev/sfxge/sfxge.h @@ -270,7 +270,7 @@ struct sfxge_softc { struct sx softc_lock; char softc_lock_name[SFXGE_LOCK_NAME_MAX]; enum sfxge_softc_state init_state; - struct ifnet *ifnet; + if_t ifnet; unsigned int if_flags; struct sysctl_oid *stats_node; #if EFSYS_OPT_QSTATS @@ -338,7 +338,7 @@ struct sfxge_softc { #define SFXGE_LINK_UP(sc) \ ((sc)->port.link_mode != EFX_LINK_DOWN && \ (sc)->port.link_mode != EFX_LINK_UNKNOWN) -#define SFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING) +#define SFXGE_RUNNING(sc) (if_getdrvflags((sc)->ifnet) & IFF_DRV_RUNNING) #define SFXGE_PARAM(_name) "hw.sfxge." #_name @@ -404,7 +404,7 @@ extern void sfxge_mac_link_update(struct sfxge_softc *sc, efx_link_mode_t mode); extern int sfxge_mac_filter_set(struct sfxge_softc *sc); extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc); -extern uint64_t sfxge_get_counter(struct ifnet *ifp, ift_counter c); +extern uint64_t sfxge_get_counter(if_t ifp, ift_counter c); #define SFXGE_MAX_MTU (9 * 1024) diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 2100d1d647cd..b186d27c4d2b 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -102,9 +102,9 @@ out: } uint64_t -sfxge_get_counter(struct ifnet *ifp, ift_counter c) +sfxge_get_counter(if_t ifp, ift_counter c) { - struct sfxge_softc *sc = ifp->if_softc; + struct sfxge_softc *sc = if_getsoftc(ifp); uint64_t *mac_stats; uint64_t val; @@ -327,7 +327,7 @@ sfxge_mac_link_update(struct sfxge_softc *sc, efx_link_mode_t mode) /* Push link state update to the OS */ link_state = (SFXGE_LINK_UP(sc) ? LINK_STATE_UP : LINK_STATE_DOWN); - sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode]; + if_setbaudrate(sc->ifnet, sfxge_link_baudrate[port->link_mode]); if_link_state_change(sc->ifnet, link_state); } @@ -373,7 +373,7 @@ sfxge_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) static int sfxge_mac_multicast_list_set(struct sfxge_softc *sc) { - struct ifnet *ifp = sc->ifnet; + if_t ifp = sc->ifnet; struct sfxge_port *port = &sc->port; int rc = 0; @@ -400,21 +400,21 @@ sfxge_mac_multicast_list_set(struct sfxge_softc *sc) static int sfxge_mac_filter_set_locked(struct sfxge_softc *sc) { - struct ifnet *ifp = sc->ifnet; + if_t ifp = sc->ifnet; struct sfxge_port *port = &sc->port; boolean_t all_mulcst; int rc; mtx_assert(&port->lock, MA_OWNED); - all_mulcst = !!(ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)); + all_mulcst = !!(if_getflags(ifp) & (IFF_PROMISC | IFF_ALLMULTI)); rc = sfxge_mac_multicast_list_set(sc); /* Fallback to all multicast if cannot set multicast list */ if (rc != 0) all_mulcst = B_TRUE; - rc = efx_mac_filter_set(sc->enp, !!(ifp->if_flags & IFF_PROMISC), + rc = efx_mac_filter_set(sc->enp, !!(if_getflags(ifp) & IFF_PROMISC), (port->mcast_count > 0), all_mulcst, B_TRUE); return (rc); @@ -483,7 +483,7 @@ sfxge_port_start(struct sfxge_softc *sc) { uint8_t mac_addr[ETHER_ADDR_LEN]; struct epoch_tracker et; - struct ifnet *ifp = sc->ifnet; + if_t ifp = sc->ifnet; struct sfxge_port *port; efx_nic_t *enp; size_t pdu; @@ -507,7 +507,7 @@ sfxge_port_start(struct sfxge_softc *sc) goto fail; /* Set the SDU */ - pdu = EFX_MAC_PDU(ifp->if_mtu); + pdu = EFX_MAC_PDU(if_getmtu(ifp)); if ((rc = efx_mac_pdu_set(enp, pdu)) != 0) goto fail2; @@ -517,8 +517,7 @@ sfxge_port_start(struct sfxge_softc *sc) /* Set the unicast address */ NET_EPOCH_ENTER(et); - bcopy(LLADDR((struct sockaddr_dl *)ifp->if_addr->ifa_addr), - mac_addr, sizeof(mac_addr)); + bcopy(if_getlladdr(ifp), mac_addr, sizeof(mac_addr)); NET_EPOCH_EXIT(et); if ((rc = efx_mac_addr_set(enp, mac_addr)) != 0) goto fail4; @@ -860,13 +859,13 @@ static const int sfxge_link_mode[EFX_PHY_MEDIA_NTYPES][EFX_LINK_NMODES] = { }; static void -sfxge_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +sfxge_media_status(if_t ifp, struct ifmediareq *ifmr) { struct sfxge_softc *sc; efx_phy_media_type_t medium_type; efx_link_mode_t mode; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); SFXGE_ADAPTER_LOCK(sc); ifmr->ifm_status = IFM_AVALID; @@ -976,14 +975,14 @@ sfxge_phy_cap_mask(struct sfxge_softc *sc, int ifmedia, uint32_t *phy_cap_mask) } static int -sfxge_media_change(struct ifnet *ifp) +sfxge_media_change(if_t ifp) { struct sfxge_softc *sc; struct ifmedia_entry *ifm; int rc; uint32_t phy_cap_mask; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); ifm = sc->media.ifm_cur; SFXGE_ADAPTER_LOCK(sc); diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c index 1baab1ac17a6..da75b97ccc7e 100644 --- a/sys/dev/sfxge/sfxge_rx.c +++ b/sys/dev/sfxge/sfxge_rx.c @@ -324,11 +324,11 @@ sfxge_rx_qrefill(struct sfxge_rxq *rxq) static void __sfxge_rx_deliver(struct sfxge_softc *sc, struct mbuf *m) { - struct ifnet *ifp = sc->ifnet; + if_t ifp = sc->ifnet; m->m_pkthdr.rcvif = ifp; m->m_pkthdr.csum_data = 0xffff; - ifp->if_input(ifp, m); + if_input(ifp, m); } static void @@ -812,7 +812,7 @@ void sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) { struct sfxge_softc *sc = rxq->sc; - int if_capenable = sc->ifnet->if_capenable; + int if_capenable = if_getcapenable(sc->ifnet); int lro_enabled = if_capenable & IFCAP_LRO; unsigned int index; struct sfxge_evq *evq __diagused; @@ -1094,7 +1094,7 @@ sfxge_rx_start(struct sfxge_softc *sc) return (rc); encp = efx_nic_cfg_get(sc->enp); - sc->rx_buffer_size = EFX_MAC_PDU(sc->ifnet->if_mtu); + sc->rx_buffer_size = EFX_MAC_PDU(if_getmtu(sc->ifnet)); /* Calculate the receive packet buffer size. */ sc->rx_prefix_size = encp->enc_rx_prefix_size; diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c index f2af6da9fcaf..536f44e9f49e 100644 --- a/sys/dev/sfxge/sfxge_tx.c +++ b/sys/dev/sfxge/sfxge_tx.c @@ -780,12 +780,12 @@ sfxge_tx_qdpl_flush(struct sfxge_txq *txq) } void -sfxge_if_qflush(struct ifnet *ifp) +sfxge_if_qflush(if_t ifp) { struct sfxge_softc *sc; unsigned int i; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); for (i = 0; i < sc->txq_count; i++) sfxge_tx_qdpl_flush(sc->txq[i]); @@ -872,13 +872,13 @@ static void sfxge_parse_tx_packet(struct mbuf *mbuf) * TX start -- called by the stack. */ int -sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m) +sfxge_if_transmit(if_t ifp, struct mbuf *m) { struct sfxge_softc *sc; struct sfxge_txq *txq; int rc; - sc = (struct sfxge_softc *)ifp->if_softc; + sc = (struct sfxge_softc *)if_getsoftc(ifp); /* * Transmit may be called when interface is up from the kernel @@ -888,7 +888,7 @@ sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m) * point of view, but already down from the kernel point of * view. I.e. Rx when interface shutdown is in progress. */ - KASSERT((ifp->if_flags & IFF_UP) || (sc->if_flags & IFF_UP), + KASSERT((if_getflags(ifp) & IFF_UP) || (sc->if_flags & IFF_UP), ("interface not up")); /* Pick the desired transmit queue. */ diff --git a/sys/dev/sfxge/sfxge_tx.h b/sys/dev/sfxge/sfxge_tx.h index 4446eb51a238..1cce72c39c4a 100644 --- a/sys/dev/sfxge/sfxge_tx.h +++ b/sys/dev/sfxge/sfxge_tx.h @@ -244,7 +244,7 @@ extern int sfxge_tx_start(struct sfxge_softc *sc); extern void sfxge_tx_stop(struct sfxge_softc *sc); extern void sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq); extern void sfxge_tx_qflush_done(struct sfxge_txq *txq); -extern void sfxge_if_qflush(struct ifnet *ifp); -extern int sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m); +extern void sfxge_if_qflush(if_t ifp); +extern int sfxge_if_transmit(if_t ifp, struct mbuf *m); #endif