From nobody Tue Mar 07 20:29:09 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 4PWRqn54mwz3wc0q; Tue, 7 Mar 2023 20:29:09 +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 4PWRqn3mS5z3qwr; Tue, 7 Mar 2023 20:29:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678220949; 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=dBulmmc/AnP0kGeCY2JUbDgMMYbgR0v1DR3ofBphkYw=; b=HVMoytUcIq2hkPkf0yhE2qu8AMJGxKe4rvTiQoEdLxPczMZOJ2+SllN/kSM/87HGe8tk7q bo9dK6rMrfmkMQJ138RsAQtJmTh+00uanZ2p32rmirL4ZmIrvPLlbILaR2TI1QcaSsMco7 dGwxM7Q7oLUJatqfeGYdl65PMtVDvaGxQ/SC20CdOOJSNisFRxJMLJgho+sYODNQptTwLU 2MY9TkxJdDU1Kq2NJyowaAKucZirqlyekZN/aZmWF0liK+iaaCkMTQ8P86ygXTtFiLbgd4 wlEz3DoWTZC5KKy8p9C5W+ZoOp9tENUgLk+Mb+YX1dhasJPsVBulQ7tvH81YHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678220949; 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=dBulmmc/AnP0kGeCY2JUbDgMMYbgR0v1DR3ofBphkYw=; b=PfW6q70J0+8VI0NUoG6hchLvkVjmYamJHYeKlpqGobVgRXfM3MPQmJv72oIJ9z1CN3bIA5 pG2eBK9bgOffTQDc77Et9nsnfzQht7GY1+dlulpAkWhI7TeQMQtRiWt/vU8FFQR2nJh6hX MQv8QDFHVQ1FpPzDEJKAj2lcTEqYGptA1wcAVFggnjfbSMbCW5IyOAeRZeY+cWvcungLRF y8rQslhB297GgyFp3lrX/Xmah4hpZzrEs2mYCAqNqGP8/N9s3ODE5W7eQKMvly4D3tbjN4 0zE1VL5HZVFE+/RnkBbeJIgCk9gsMUm2B2+xpYCdLTz6llseaRu3T+Q7HKa6xQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678220949; a=rsa-sha256; cv=none; b=LPi0JATzNCUEdSUhmKbJeYTo7OO9fHTcNDAy6Dj0tWqZMpu0M/rEmIWA8X1GTGYspwdxmF ry+8p+gWOlGTrBy9zmo0GNkO6PZyYuCwXjcMv71dvVtscbPSxWha2pdRHCQzrQ3/d9lHDt OxFSSeEPmog6+uYYkI66cWJOBZ7wQ9aSEbgLNhC6HSH6Jnnust+LqxfWHRaBFXO8itxLjn +cTOjbrSEv83WraO571PxlH3Ja8tn3B2yeBHbxqWdkpE8C9AP+lTQWpwzf5qLa3puHZyeM CerdYBkvjDiIK6XtrL1+EqpcOVYixUAezIyj9W4FPvFOoD1sn3zT8viOkGAExA== 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 4PWRqn2rh2zxnN; Tue, 7 Mar 2023 20:29: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 327KT9Mq069882; Tue, 7 Mar 2023 20:29:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 327KT9Ah069881; Tue, 7 Mar 2023 20:29:09 GMT (envelope-from git) Date: Tue, 7 Mar 2023 20:29:09 GMT Message-Id: <202303072029.327KT9Ah069881@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: 64c618ed7dbb - main - Mechanically convert qlxge(4) 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: 64c618ed7dbbae169ff8284d987e9caf6027f7d2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=64c618ed7dbbae169ff8284d987e9caf6027f7d2 commit 64c618ed7dbbae169ff8284d987e9caf6027f7d2 Author: Justin Hibbits AuthorDate: 2022-08-17 20:26:49 +0000 Commit: Justin Hibbits CommitDate: 2023-03-07 20:31:48 +0000 Mechanically convert qlxge(4) to IfAPI Reviewed by: zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37819 --- sys/dev/qlxge/qls_def.h | 4 +- sys/dev/qlxge/qls_hw.c | 2 +- sys/dev/qlxge/qls_ioctl.c | 2 +- sys/dev/qlxge/qls_isr.c | 4 +- sys/dev/qlxge/qls_os.c | 149 +++++++++++++++++++++++----------------------- 5 files changed, 80 insertions(+), 81 deletions(-) diff --git a/sys/dev/qlxge/qls_def.h b/sys/dev/qlxge/qls_def.h index 47da2403d530..f83fbdbcc27a 100644 --- a/sys/dev/qlxge/qls_def.h +++ b/sys/dev/qlxge/qls_def.h @@ -283,7 +283,7 @@ struct qla_host { bus_dma_tag_t parent_tag; /* interface to o.s */ - struct ifnet *ifp; + if_t ifp; struct ifmedia media; uint16_t max_frame_size; @@ -364,7 +364,7 @@ typedef struct qla_host qla_host_t; #define QL_MIN(x, y) ((x < y) ? x : y) #define QL_RUNNING(ifp) \ - ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \ + ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \ IFF_DRV_RUNNING) /* Return 0, if identical, else 1 */ diff --git a/sys/dev/qlxge/qls_hw.c b/sys/dev/qlxge/qls_hw.c index ab9449089f10..e16b81667863 100644 --- a/sys/dev/qlxge/qls_hw.c +++ b/sys/dev/qlxge/qls_hw.c @@ -1305,7 +1305,7 @@ qls_update_link_state(qla_host_t *ha) uint32_t link_state; uint32_t prev_link_state; - if (!(ha->ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if (!(if_getdrvflags(ha->ifp) & IFF_DRV_RUNNING)) { ha->link_up = 0; return; } diff --git a/sys/dev/qlxge/qls_ioctl.c b/sys/dev/qlxge/qls_ioctl.c index d32ee5e22eb7..e9f8dd387e17 100644 --- a/sys/dev/qlxge/qls_ioctl.c +++ b/sys/dev/qlxge/qls_ioctl.c @@ -55,7 +55,7 @@ int qls_make_cdev(qla_host_t *ha) { ha->ioctl_dev = make_dev(&qla_cdevsw, - ha->ifp->if_dunit, + if_getdunit(ha->ifp), UID_ROOT, GID_WHEEL, 0600, diff --git a/sys/dev/qlxge/qls_isr.c b/sys/dev/qlxge/qls_isr.c index 38da2d2c3408..ed71939d831e 100644 --- a/sys/dev/qlxge/qls_isr.c +++ b/sys/dev/qlxge/qls_isr.c @@ -129,7 +129,7 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e) qla_rx_ring_t *rxr; device_t dev = ha->pci_dev; struct mbuf *mp = NULL; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; #if defined(INET) || defined(INET6) struct lro_ctrl *lro; #endif @@ -210,7 +210,7 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e) } else #endif { - (*ifp->if_input)(ifp, mp); + if_input(ifp, mp); } } } else { diff --git a/sys/dev/qlxge/qls_os.c b/sys/dev/qlxge/qls_os.c index d9404b92dbba..a7e262be015f 100644 --- a/sys/dev/qlxge/qls_os.c +++ b/sys/dev/qlxge/qls_os.c @@ -90,11 +90,11 @@ static int qls_pci_probe (device_t); static int qls_pci_attach (device_t); static int qls_pci_detach (device_t); -static void qls_start(struct ifnet *ifp); +static void qls_start(if_t ifp); static void qls_init(void *arg); -static int qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static int qls_media_change(struct ifnet *ifp); -static void qls_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); +static int qls_ioctl(if_t ifp, u_long cmd, caddr_t data); +static int qls_media_change(if_t ifp); +static void qls_media_status(if_t ifp, struct ifmediareq *ifmr); static device_method_t qla_pci_methods[] = { /* Device interface */ @@ -286,7 +286,7 @@ static void qls_watchdog(void *arg) { qla_host_t *ha = arg; - struct ifnet *ifp; + if_t ifp; ifp = ha->ifp; @@ -303,7 +303,7 @@ qls_watchdog(void *arg) ha->err_inject = 0; taskqueue_enqueue(ha->err_tq, &ha->err_task); - } else if ((ifp->if_snd.ifq_head != NULL) && QL_RUNNING(ifp)) { + } else if (!if_sendq_empty(ifp) && QL_RUNNING(ifp)) { taskqueue_enqueue(ha->tx_tq, &ha->tx_task); } @@ -716,7 +716,7 @@ qls_free_parent_dma_tag(qla_host_t *ha) static void qls_init_ifnet(device_t dev, qla_host_t *ha) { - struct ifnet *ifp; + if_t ifp; QL_DPRINT2((dev, "%s: enter\n", __func__)); @@ -726,18 +726,17 @@ qls_init_ifnet(device_t dev, qla_host_t *ha) panic("%s: cannot if_alloc()\n", device_get_nameunit(dev)); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_baudrate = IF_Gbps(10); - ifp->if_init = qls_init; - ifp->if_softc = ha; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_ioctl = qls_ioctl; - ifp->if_start = qls_start; - - IFQ_SET_MAXLEN(&ifp->if_snd, qls_get_ifq_snd_maxlen(ha)); - ifp->if_snd.ifq_drv_maxlen = qls_get_ifq_snd_maxlen(ha); - IFQ_SET_READY(&ifp->if_snd); - - ha->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + if_setbaudrate(ifp, IF_Gbps(10)); + if_setinitfn(ifp, qls_init); + if_setsoftc(ifp, ha); + if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setioctlfn(ifp, qls_ioctl); + if_setstartfn(ifp, qls_start); + + if_setsendqlen(ifp, qls_get_ifq_snd_maxlen(ha)); + if_setsendqready(ifp); + + ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; if (ha->max_frame_size <= MCLBYTES) { ha->msize = MCLBYTES; } else if (ha->max_frame_size <= MJUMPAGESIZE) { @@ -747,19 +746,19 @@ qls_init_ifnet(device_t dev, qla_host_t *ha) ether_ifattach(ifp, qls_get_mac_addr(ha)); - ifp->if_capabilities = IFCAP_JUMBO_MTU; + if_setcapabilities(ifp, IFCAP_JUMBO_MTU); - ifp->if_capabilities |= IFCAP_HWCSUM; - ifp->if_capabilities |= IFCAP_VLAN_MTU; + if_setcapabilitiesbit(ifp, IFCAP_HWCSUM, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU, 0); - ifp->if_capabilities |= IFCAP_TSO4; - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifp->if_capabilities |= IFCAP_VLAN_HWTSO; - ifp->if_capabilities |= IFCAP_LINKSTATE; + if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING, 0); + if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTSO, 0); + if_setcapabilitiesbit(ifp, IFCAP_LINKSTATE, 0); - ifp->if_capenable = ifp->if_capabilities; + if_setcapenable(ifp, if_getcapabilities(ifp)); - ifp->if_hdrlen = sizeof(struct ether_vlan_header); + if_setifheaderlen(ifp, sizeof(struct ether_vlan_header)); ifmedia_init(&ha->media, IFM_IMASK, qls_media_change, qls_media_status); @@ -777,7 +776,7 @@ qls_init_ifnet(device_t dev, qla_host_t *ha) static void qls_init_locked(qla_host_t *ha) { - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; qls_stop(ha); @@ -789,17 +788,17 @@ qls_init_locked(qla_host_t *ha) if (qls_config_lro(ha)) return; - bcopy(IF_LLADDR(ha->ifp), ha->mac_addr, ETHER_ADDR_LEN); + bcopy(if_getlladdr(ha->ifp), ha->mac_addr, ETHER_ADDR_LEN); - ifp->if_hwassist = CSUM_IP; - ifp->if_hwassist |= CSUM_TCP; - ifp->if_hwassist |= CSUM_UDP; - ifp->if_hwassist |= CSUM_TSO; + if_sethwassist(ifp, CSUM_IP); + if_sethwassistbits(ifp, CSUM_TCP, 0); + if_sethwassistbits(ifp, CSUM_UDP, 0); + if_sethwassistbits(ifp, CSUM_TSO, 0); if (qls_init_hw_if(ha) == 0) { ifp = ha->ifp; - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0); + if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); ha->flags.qla_watchdog_pause = 0; } @@ -839,7 +838,7 @@ static void qls_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; int mcnt; mcnt = if_foreach_llmaddr(ifp, qls_copy_maddr, mta); @@ -853,7 +852,7 @@ qls_set_multi(qla_host_t *ha, uint32_t add_multi) } static int -qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +qls_ioctl(if_t ifp, u_long cmd, caddr_t data) { int ret = 0; struct ifreq *ifr = (struct ifreq *)data; @@ -862,7 +861,7 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif qla_host_t *ha; - ha = (qla_host_t *)ifp->if_softc; + ha = (qla_host_t *)if_getsoftc(ifp); switch (cmd) { case SIOCSIFADDR: @@ -871,8 +870,8 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if_setflagbits(ifp, IFF_UP, 0); + if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { (void)QLA_LOCK(ha, __func__, 0); qls_init_locked(ha); QLA_UNLOCK(ha, __func__); @@ -898,9 +897,9 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } else { (void) QLA_LOCK(ha, __func__, 0); - ifp->if_mtu = ifr->ifr_mtu; + if_setmtu(ifp, ifr->ifr_mtu); ha->max_frame_size = - ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; QLA_UNLOCK(ha, __func__); @@ -916,24 +915,24 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) (void)QLA_LOCK(ha, __func__, 0); - if (ifp->if_flags & IFF_UP) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) { - if ((ifp->if_flags ^ ha->if_flags) & + if (if_getflags(ifp) & IFF_UP) { + if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { + if ((if_getflags(ifp) ^ ha->if_flags) & IFF_PROMISC) { ret = qls_set_promisc(ha); - } else if ((ifp->if_flags ^ ha->if_flags) & + } else if ((if_getflags(ifp) ^ ha->if_flags) & IFF_ALLMULTI) { ret = qls_set_allmulti(ha); } } else { - ha->max_frame_size = ifp->if_mtu + + ha->max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN; qls_init_locked(ha); } } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) qls_stop(ha); - ha->if_flags = ifp->if_flags; + ha->if_flags = if_getflags(ifp); } QLA_UNLOCK(ha, __func__); @@ -943,7 +942,7 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) QL_DPRINT4((ha->pci_dev, "%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd)); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { qls_set_multi(ha, 1); } break; @@ -952,7 +951,7 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) QL_DPRINT4((ha->pci_dev, "%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd)); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) { qls_set_multi(ha, 0); } break; @@ -967,21 +966,21 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: { - int mask = ifr->ifr_reqcap ^ ifp->if_capenable; + int mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); QL_DPRINT4((ha->pci_dev, "%s: SIOCSIFCAP (0x%lx)\n", __func__, cmd)); if (mask & IFCAP_HWCSUM) - ifp->if_capenable ^= IFCAP_HWCSUM; + if_togglecapenable(ifp, IFCAP_HWCSUM); if (mask & IFCAP_TSO4) - ifp->if_capenable ^= IFCAP_TSO4; + if_togglecapenable(ifp, IFCAP_TSO4); if (mask & IFCAP_VLAN_HWTAGGING) - ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if_togglecapenable(ifp, IFCAP_VLAN_HWTAGGING); if (mask & IFCAP_VLAN_HWTSO) - ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + if_togglecapenable(ifp, IFCAP_VLAN_HWTSO); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) qls_init(ha); VLAN_CAPABILITIES(ifp); @@ -999,13 +998,13 @@ qls_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static int -qls_media_change(struct ifnet *ifp) +qls_media_change(if_t ifp) { qla_host_t *ha; struct ifmedia *ifm; int ret = 0; - ha = (qla_host_t *)ifp->if_softc; + ha = (qla_host_t *)if_getsoftc(ifp); QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__)); @@ -1020,11 +1019,11 @@ qls_media_change(struct ifnet *ifp) } static void -qls_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +qls_media_status(if_t ifp, struct ifmediareq *ifmr) { qla_host_t *ha; - ha = (qla_host_t *)ifp->if_softc; + ha = (qla_host_t *)if_getsoftc(ifp); QL_DPRINT2((ha->pci_dev, "%s: enter\n", __func__)); @@ -1044,11 +1043,11 @@ qls_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) } static void -qls_start(struct ifnet *ifp) +qls_start(if_t ifp) { int i, ret = 0; struct mbuf *m_head; - qla_host_t *ha = (qla_host_t *)ifp->if_softc; + qla_host_t *ha = (qla_host_t *)if_getsoftc(ifp); QL_DPRINT8((ha->pci_dev, "%s: enter\n", __func__)); @@ -1058,17 +1057,17 @@ qls_start(struct ifnet *ifp) return; } - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == + if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == IFF_DRV_RUNNING) { for (i = 0; i < ha->num_tx_rings; i++) { ret |= qls_hw_tx_done(ha, i); } if (ret == 0) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE); } - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { QL_DPRINT8((ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__)); QLA_TX_UNLOCK(ha); @@ -1084,8 +1083,8 @@ qls_start(struct ifnet *ifp) } } - while (ifp->if_snd.ifq_head != NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + while (!if_sendq_empty(ifp)) { + m_head = if_dequeue(ifp); if (m_head == NULL) { QL_DPRINT8((ha->pci_dev, "%s: m_head == NULL\n", @@ -1097,8 +1096,8 @@ qls_start(struct ifnet *ifp) if (m_head == NULL) break; QL_DPRINT8((ha->pci_dev, "%s: PREPEND\n", __func__)); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - IF_PREPEND(&ifp->if_snd, m_head); + if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); + if_sendq_prepend(ifp, m_head); break; } /* Send a copy of the frame to the BPF listener */ @@ -1205,9 +1204,9 @@ qls_send(qla_host_t *ha, struct mbuf **m_headp) static void qls_stop(qla_host_t *ha) { - struct ifnet *ifp = ha->ifp; + if_t ifp = ha->ifp; - ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING); + if_setdrvflagbits(ifp, 0, (IFF_DRV_OACTIVE | IFF_DRV_RUNNING)); ha->flags.qla_watchdog_pause = 1; @@ -1433,14 +1432,14 @@ static void qls_tx_done(void *context, int pending) { qla_host_t *ha = context; - struct ifnet *ifp; + if_t ifp; ifp = ha->ifp; if (!ifp) return; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { QL_DPRINT8((ha->pci_dev, "%s: !IFF_DRV_RUNNING\n", __func__)); return; }