git: 524364126752 - main - Mechanically convert age(4), alc(4), and ale(4) to IfAPI

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Mon, 06 Feb 2023 17:54:26 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=524364126752a6986acdd9f2ecfff4cafd8bb439

commit 524364126752a6986acdd9f2ecfff4cafd8bb439
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2021-11-02 14:17:56 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-02-06 17:32:14 +0000

    Mechanically convert age(4), alc(4), and ale(4) to IfAPI
    
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D37787
---
 sys/dev/age/if_age.c    | 239 +++++++++++++++++++++--------------------
 sys/dev/age/if_agevar.h |   2 +-
 sys/dev/alc/if_alc.c    | 275 ++++++++++++++++++++++++------------------------
 sys/dev/alc/if_alcvar.h |   2 +-
 sys/dev/ale/if_ale.c    | 245 +++++++++++++++++++++---------------------
 sys/dev/ale/if_alevar.h |   2 +-
 6 files changed, 381 insertions(+), 384 deletions(-)

diff --git a/sys/dev/age/if_age.c b/sys/dev/age/if_age.c
index 75d0e5c80952..b712ff141e69 100644
--- a/sys/dev/age/if_age.c
+++ b/sys/dev/age/if_age.c
@@ -104,8 +104,8 @@ static struct age_dev {
 static int age_miibus_readreg(device_t, int, int);
 static int age_miibus_writereg(device_t, int, int, int);
 static void age_miibus_statchg(device_t);
-static void age_mediastatus(struct ifnet *, struct ifmediareq *);
-static int age_mediachange(struct ifnet *);
+static void age_mediastatus(if_t, struct ifmediareq *);
+static int age_mediachange(if_t);
 static int age_probe(device_t);
 static void age_get_macaddr(struct age_softc *);
 static void age_phy_reset(struct age_softc *);
@@ -121,10 +121,10 @@ static void age_setwol(struct age_softc *);
 static int age_suspend(device_t);
 static int age_resume(device_t);
 static int age_encap(struct age_softc *, struct mbuf **);
-static void age_start(struct ifnet *);
-static void age_start_locked(struct ifnet *);
+static void age_start(if_t);
+static void age_start_locked(if_t);
 static void age_watchdog(struct age_softc *);
-static int age_ioctl(struct ifnet *, u_long, caddr_t);
+static int age_ioctl(if_t, u_long, caddr_t);
 static void age_mac_config(struct age_softc *);
 static void age_link_task(void *, int);
 static void age_stats_update(struct age_softc *);
@@ -146,7 +146,7 @@ static void age_init_rr_ring(struct age_softc *);
 static void age_init_cmb_block(struct age_softc *);
 static void age_init_smb_block(struct age_softc *);
 #ifndef __NO_STRICT_ALIGNMENT
-static struct mbuf *age_fixup_rx(struct ifnet *, struct mbuf *);
+static struct mbuf *age_fixup_rx(if_t, struct mbuf *);
 #endif
 static int age_newbuf(struct age_softc *, struct age_rxdesc *);
 static void age_rxvlan(struct age_softc *);
@@ -276,12 +276,12 @@ age_miibus_statchg(device_t dev)
  *	Get the current interface media status.
  */
 static void
-age_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
+age_mediastatus(if_t ifp, struct ifmediareq *ifmr)
 {
 	struct age_softc *sc;
 	struct mii_data *mii;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	AGE_LOCK(sc);
 	mii = device_get_softc(sc->age_miibus);
 
@@ -295,14 +295,14 @@ age_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
  *	Set hardware to newly-selected media.
  */
 static int
-age_mediachange(struct ifnet *ifp)
+age_mediachange(if_t ifp)
 {
 	struct age_softc *sc;
 	struct mii_data *mii;
 	struct mii_softc *miisc;
 	int error;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	AGE_LOCK(sc);
 	mii = device_get_softc(sc->age_miibus);
 	LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
@@ -461,7 +461,7 @@ static int
 age_attach(device_t dev)
 {
 	struct age_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 	uint16_t burst;
 	int error, i, msic, msixc, pmc;
 
@@ -599,22 +599,21 @@ age_attach(device_t dev)
 		goto fail;
 	}
 
-	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_ioctl = age_ioctl;
-	ifp->if_start = age_start;
-	ifp->if_init = age_init;
-	ifp->if_snd.ifq_drv_maxlen = AGE_TX_RING_CNT - 1;
-	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
-	IFQ_SET_READY(&ifp->if_snd);
-	ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4;
-	ifp->if_hwassist = AGE_CSUM_FEATURES | CSUM_TSO;
+	if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+	if_setioctlfn(ifp, age_ioctl);
+	if_setstartfn(ifp, age_start);
+	if_setinitfn(ifp, age_init);
+	if_setsendqlen(ifp, AGE_TX_RING_CNT - 1);
+	if_setsendqready(ifp);
+	if_setcapabilities(ifp, IFCAP_HWCSUM | IFCAP_TSO4);
+	if_sethwassist(ifp, AGE_CSUM_FEATURES | CSUM_TSO);
 	if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) {
 		sc->age_flags |= AGE_FLAG_PMCAP;
-		ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST;
+		if_setcapabilitiesbit(ifp, IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST, 0);
 	}
-	ifp->if_capenable = ifp->if_capabilities;
+	if_setcapenable(ifp, if_getcapabilities(ifp));
 
 	/* Set up MII bus. */
 	error = mii_attach(dev, &sc->age_miibus, ifp, age_mediachange,
@@ -628,12 +627,12 @@ age_attach(device_t dev)
 	ether_ifattach(ifp, sc->age_eaddr);
 
 	/* VLAN capability setup. */
-	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
-	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
-	ifp->if_capenable = ifp->if_capabilities;
+	if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO, 0);
+	if_setcapenable(ifp, if_getcapabilities(ifp));
 
 	/* Tell the upper layer(s) we support long frames. */
-	ifp->if_hdrlen = sizeof(struct ether_vlan_header);
+	if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
 
 	/* Create local taskq. */
 	sc->age_tq = taskqueue_create_fast("age_taskq", M_WAITOK,
@@ -679,7 +678,7 @@ static int
 age_detach(device_t dev)
 {
 	struct age_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 	int i, msic;
 
 	sc = device_get_softc(dev);
@@ -1320,7 +1319,7 @@ age_shutdown(device_t dev)
 static void
 age_setwol(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	struct mii_data *mii;
 	uint32_t reg, pmcs;
 	uint16_t pmstat;
@@ -1347,7 +1346,7 @@ age_setwol(struct age_softc *sc)
 	}
 
 	ifp = sc->age_ifp;
-	if ((ifp->if_capenable & IFCAP_WOL) != 0) {
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0) {
 		/*
 		 * Note, this driver resets the link speed to 10/100Mbps with
 		 * auto-negotiation but we don't know whether that operation
@@ -1420,15 +1419,15 @@ age_setwol(struct age_softc *sc)
 
 got_link:
 	pmcs = 0;
-	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) != 0)
 		pmcs |= WOL_CFG_MAGIC | WOL_CFG_MAGIC_ENB;
 	CSR_WRITE_4(sc, AGE_WOL_CFG, pmcs);
 	reg = CSR_READ_4(sc, AGE_MAC_CFG);
 	reg &= ~(MAC_CFG_DBG | MAC_CFG_PROMISC);
 	reg &= ~(MAC_CFG_ALLMULTI | MAC_CFG_BCAST);
-	if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) != 0)
 		reg |= MAC_CFG_ALLMULTI | MAC_CFG_BCAST;
-	if ((ifp->if_capenable & IFCAP_WOL) != 0) {
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0) {
 		reg |= MAC_CFG_RX_ENB;
 		CSR_WRITE_4(sc, AGE_MAC_CFG, reg);
 	}
@@ -1436,12 +1435,12 @@ got_link:
 	/* Request PME. */
 	pmstat = pci_read_config(sc->age_dev, pmc + PCIR_POWER_STATUS, 2);
 	pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
-	if ((ifp->if_capenable & IFCAP_WOL) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0)
 		pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
 	pci_write_config(sc->age_dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
 #ifdef notyet
 	/* See above for powering down PHY issues. */
-	if ((ifp->if_capenable & IFCAP_WOL) == 0) {
+	if ((if_getcapenable(ifp) & IFCAP_WOL) == 0) {
 		/* No WOL, PHY power down. */
 		age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
 		    MII_BMCR, BMCR_PDOWN);
@@ -1468,14 +1467,14 @@ static int
 age_resume(device_t dev)
 {
 	struct age_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 
 	sc = device_get_softc(dev);
 
 	AGE_LOCK(sc);
 	age_phy_reset(sc);
 	ifp = sc->age_ifp;
-	if ((ifp->if_flags & IFF_UP) != 0)
+	if ((if_getflags(ifp) & IFF_UP) != 0)
 		age_init_locked(sc);
 
 	AGE_UNLOCK(sc);
@@ -1720,33 +1719,33 @@ age_encap(struct age_softc *sc, struct mbuf **m_head)
 }
 
 static void
-age_start(struct ifnet *ifp)
+age_start(if_t ifp)
 {
         struct age_softc *sc;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	AGE_LOCK(sc);
 	age_start_locked(ifp);
 	AGE_UNLOCK(sc);
 }
 
 static void
-age_start_locked(struct ifnet *ifp)
+age_start_locked(if_t ifp)
 {
         struct age_softc *sc;
         struct mbuf *m_head;
 	int enq;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 
 	AGE_LOCK_ASSERT(sc);
 
-	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+	if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
 	    IFF_DRV_RUNNING || (sc->age_flags & AGE_FLAG_LINK) == 0)
 		return;
 
-	for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) {
-		IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
+	for (enq = 0; !if_sendq_empty(ifp); ) {
+		m_head = if_dequeue(ifp);
 		if (m_head == NULL)
 			break;
 		/*
@@ -1757,8 +1756,8 @@ age_start_locked(struct ifnet *ifp)
 		if (age_encap(sc, &m_head)) {
 			if (m_head == NULL)
 				break;
-			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
-			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			if_sendq_prepend(ifp, m_head);
+			if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
 			break;
 		}
 
@@ -1781,7 +1780,7 @@ age_start_locked(struct ifnet *ifp)
 static void
 age_watchdog(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 
 	AGE_LOCK_ASSERT(sc);
 
@@ -1792,27 +1791,27 @@ age_watchdog(struct age_softc *sc)
 	if ((sc->age_flags & AGE_FLAG_LINK) == 0) {
 		if_printf(sc->age_ifp, "watchdog timeout (missed link)\n");
 		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+		if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
 		age_init_locked(sc);
 		return;
 	}
 	if (sc->age_cdata.age_tx_cnt == 0) {
 		if_printf(sc->age_ifp,
 		    "watchdog timeout (missed Tx interrupts) -- recovering\n");
-		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		if (!if_sendq_empty(ifp))
 			age_start_locked(ifp);
 		return;
 	}
 	if_printf(sc->age_ifp, "watchdog timeout\n");
 	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+	if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
 	age_init_locked(sc);
-	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+	if (!if_sendq_empty(ifp))
 		age_start_locked(ifp);
 }
 
 static int
-age_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+age_ioctl(if_t ifp, u_long cmd, caddr_t data)
 {
 	struct age_softc *sc;
 	struct ifreq *ifr;
@@ -1820,18 +1819,18 @@ age_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 	uint32_t reg;
 	int error, mask;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	ifr = (struct ifreq *)data;
 	error = 0;
 	switch (cmd) {
 	case SIOCSIFMTU:
 		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > AGE_JUMBO_MTU)
 			error = EINVAL;
-		else if (ifp->if_mtu != ifr->ifr_mtu) {
+		else if (if_getmtu(ifp) != ifr->ifr_mtu) {
 			AGE_LOCK(sc);
-			ifp->if_mtu = ifr->ifr_mtu;
-			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
-				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			if_setmtu(ifp, ifr->ifr_mtu);
+			if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
+				if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
 				age_init_locked(sc);
 			}
 			AGE_UNLOCK(sc);
@@ -1839,9 +1838,9 @@ age_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		break;
 	case SIOCSIFFLAGS:
 		AGE_LOCK(sc);
-		if ((ifp->if_flags & IFF_UP) != 0) {
-			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
-				if (((ifp->if_flags ^ sc->age_if_flags)
+		if ((if_getflags(ifp) & IFF_UP) != 0) {
+			if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
+				if (((if_getflags(ifp) ^ sc->age_if_flags)
 				    & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
 					age_rxfilter(sc);
 			} else {
@@ -1849,16 +1848,16 @@ age_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 					age_init_locked(sc);
 			}
 		} else {
-			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0)
 				age_stop(sc);
 		}
-		sc->age_if_flags = ifp->if_flags;
+		sc->age_if_flags = if_getflags(ifp);
 		AGE_UNLOCK(sc);
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		AGE_LOCK(sc);
-		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0)
 			age_rxfilter(sc);
 		AGE_UNLOCK(sc);
 		break;
@@ -1869,50 +1868,50 @@ age_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 		break;
 	case SIOCSIFCAP:
 		AGE_LOCK(sc);
-		mask = ifr->ifr_reqcap ^ ifp->if_capenable;
+		mask = ifr->ifr_reqcap ^ if_getcapenable(ifp);
 		if ((mask & IFCAP_TXCSUM) != 0 &&
-		    (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
-			ifp->if_capenable ^= IFCAP_TXCSUM;
-			if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
-				ifp->if_hwassist |= AGE_CSUM_FEATURES;
+		    (if_getcapabilities(ifp) & IFCAP_TXCSUM) != 0) {
+			if_togglecapenable(ifp, IFCAP_TXCSUM);
+			if ((if_getcapenable(ifp) & IFCAP_TXCSUM) != 0)
+				if_sethwassistbits(ifp, AGE_CSUM_FEATURES, 0);
 			else
-				ifp->if_hwassist &= ~AGE_CSUM_FEATURES;
+				if_sethwassistbits(ifp, 0, AGE_CSUM_FEATURES);
 		}
 		if ((mask & IFCAP_RXCSUM) != 0 &&
-		    (ifp->if_capabilities & IFCAP_RXCSUM) != 0) {
-			ifp->if_capenable ^= IFCAP_RXCSUM;
+		    (if_getcapabilities(ifp) & IFCAP_RXCSUM) != 0) {
+			if_togglecapenable(ifp, IFCAP_RXCSUM);
 			reg = CSR_READ_4(sc, AGE_MAC_CFG);
 			reg &= ~MAC_CFG_RXCSUM_ENB;
-			if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
+			if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0)
 				reg |= MAC_CFG_RXCSUM_ENB;
 			CSR_WRITE_4(sc, AGE_MAC_CFG, reg);
 		}
 		if ((mask & IFCAP_TSO4) != 0 &&
-		    (ifp->if_capabilities & IFCAP_TSO4) != 0) {
-			ifp->if_capenable ^= IFCAP_TSO4;
-			if ((ifp->if_capenable & IFCAP_TSO4) != 0)
-				ifp->if_hwassist |= CSUM_TSO;
+		    (if_getcapabilities(ifp) & IFCAP_TSO4) != 0) {
+			if_togglecapenable(ifp, IFCAP_TSO4);
+			if ((if_getcapenable(ifp) & IFCAP_TSO4) != 0)
+				if_sethwassistbits(ifp, CSUM_TSO, 0);
 			else
-				ifp->if_hwassist &= ~CSUM_TSO;
+				if_sethwassistbits(ifp, 0, CSUM_TSO);
 		}
 
 		if ((mask & IFCAP_WOL_MCAST) != 0 &&
-		    (ifp->if_capabilities & IFCAP_WOL_MCAST) != 0)
-			ifp->if_capenable ^= IFCAP_WOL_MCAST;
+		    (if_getcapabilities(ifp) & IFCAP_WOL_MCAST) != 0)
+			if_togglecapenable(ifp, IFCAP_WOL_MCAST);
 		if ((mask & IFCAP_WOL_MAGIC) != 0 &&
-		    (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
-			ifp->if_capenable ^= IFCAP_WOL_MAGIC;
+		    (if_getcapabilities(ifp) & IFCAP_WOL_MAGIC) != 0)
+			if_togglecapenable(ifp, IFCAP_WOL_MAGIC);
 		if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
-		    (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0)
-			ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
+		    (if_getcapabilities(ifp) & IFCAP_VLAN_HWCSUM) != 0)
+			if_togglecapenable(ifp, IFCAP_VLAN_HWCSUM);
 		if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
-		    (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
-			ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
+		    (if_getcapabilities(ifp) & IFCAP_VLAN_HWTSO) != 0)
+			if_togglecapenable(ifp, IFCAP_VLAN_HWTSO);
 		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
-		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
-			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
-			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
-				ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
+		    (if_getcapabilities(ifp) & IFCAP_VLAN_HWTAGGING) != 0) {
+			if_togglecapenable(ifp, IFCAP_VLAN_HWTAGGING);
+			if ((if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) == 0)
+				if_setcapenablebit(ifp, 0, IFCAP_VLAN_HWTSO);
 			age_rxvlan(sc);
 		}
 		AGE_UNLOCK(sc);
@@ -1967,7 +1966,7 @@ age_link_task(void *arg, int pending)
 {
 	struct age_softc *sc;
 	struct mii_data *mii;
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t reg;
 
 	sc = (struct age_softc *)arg;
@@ -1976,7 +1975,7 @@ age_link_task(void *arg, int pending)
 	mii = device_get_softc(sc->age_miibus);
 	ifp = sc->age_ifp;
 	if (mii == NULL || ifp == NULL ||
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+	    (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
 		AGE_UNLOCK(sc);
 		return;
 	}
@@ -2017,7 +2016,7 @@ age_stats_update(struct age_softc *sc)
 {
 	struct age_stats *stat;
 	struct smb *smb;
-	struct ifnet *ifp;
+	if_t ifp;
 
 	AGE_LOCK_ASSERT(sc);
 
@@ -2133,7 +2132,7 @@ static void
 age_int_task(void *arg, int pending)
 {
 	struct age_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 	struct cmb *cmb;
 	uint32_t status;
 
@@ -2162,7 +2161,7 @@ age_int_task(void *arg, int pending)
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	ifp = sc->age_ifp;
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
 		if ((status & INTR_CMB_RX) != 0)
 			sc->age_morework = age_rxintr(sc, sc->age_rr_prod,
 			    sc->age_process_limit);
@@ -2175,10 +2174,10 @@ age_int_task(void *arg, int pending)
 			if ((status & INTR_DMA_WR_TO_RST) != 0)
 				device_printf(sc->age_dev,
 				    "DMA write error! -- resetting\n");
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
 			age_init_locked(sc);
 		}
-		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+		if (!if_sendq_empty(ifp))
 			age_start_locked(ifp);
 		if ((status & INTR_SMB) != 0)
 			age_stats_update(sc);
@@ -2204,7 +2203,7 @@ done:
 static void
 age_txintr(struct age_softc *sc, int tpd_cons)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	struct age_txdesc *txd;
 	int cons, prog;
 
@@ -2225,7 +2224,7 @@ age_txintr(struct age_softc *sc, int tpd_cons)
 		if (sc->age_cdata.age_tx_cnt <= 0)
 			break;
 		prog++;
-		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+		if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
 		sc->age_cdata.age_tx_cnt--;
 		txd = &sc->age_cdata.age_txdesc[cons];
 		/*
@@ -2263,7 +2262,7 @@ age_txintr(struct age_softc *sc, int tpd_cons)
 
 #ifndef __NO_STRICT_ALIGNMENT
 static struct mbuf *
-age_fixup_rx(struct ifnet *ifp, struct mbuf *m)
+age_fixup_rx(if_t ifp, struct mbuf *m)
 {
 	struct mbuf *n;
         int i;
@@ -2304,7 +2303,7 @@ static void
 age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
 {
 	struct age_rxdesc *rxd;
-	struct ifnet *ifp;
+	if_t ifp;
 	struct mbuf *mp, *m;
 	uint32_t status, index, vtag;
 	int count, nsegs;
@@ -2407,7 +2406,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
 			 * assistance due to lack of data sheet. If it is
 			 * proven to work on L1 I'll enable it.
 			 */
-			if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 &&
+			if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0 &&
 			    (status & AGE_RRD_IPV4) != 0) {
 				if ((status & AGE_RRD_IPCSUM_NOK) == 0)
 					m->m_pkthdr.csum_flags |=
@@ -2426,7 +2425,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
 			}
 
 			/* Check for VLAN tagged frames. */
-			if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 &&
+			if ((if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) != 0 &&
 			    (status & AGE_RRD_VLAN) != 0) {
 				vtag = AGE_RX_VLAN(le32toh(rxrd->vtags));
 				m->m_pkthdr.ether_vtag = AGE_RX_VLAN_TAG(vtag);
@@ -2439,7 +2438,7 @@ age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd)
 			{
 			/* Pass it on. */
 			AGE_UNLOCK(sc);
-			(*ifp->if_input)(ifp, m);
+			if_input(ifp, m);
 			AGE_LOCK(sc);
 			}
 		}
@@ -2563,7 +2562,7 @@ age_init(void *xsc)
 static void
 age_init_locked(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	struct mii_data *mii;
 	uint8_t eaddr[ETHER_ADDR_LEN];
 	bus_addr_t paddr;
@@ -2576,7 +2575,7 @@ age_init_locked(struct age_softc *sc)
 	ifp = sc->age_ifp;
 	mii = device_get_softc(sc->age_miibus);
 
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0)
 		return;
 
 	/*
@@ -2602,7 +2601,7 @@ age_init_locked(struct age_softc *sc)
 	age_init_smb_block(sc);
 
 	/* Reprogram the station address. */
-	bcopy(IF_LLADDR(ifp), eaddr, ETHER_ADDR_LEN);
+	bcopy(if_getlladdr(ifp), eaddr, ETHER_ADDR_LEN);
 	CSR_WRITE_4(sc, AGE_PAR0,
 	    eaddr[2] << 24 | eaddr[3] << 16 | eaddr[4] << 8 | eaddr[5]);
 	CSR_WRITE_4(sc, AGE_PAR1, eaddr[0] << 8 | eaddr[1]);
@@ -2678,10 +2677,10 @@ age_init_locked(struct age_softc *sc)
 	CSR_WRITE_2(sc, AGE_INTR_CLR_TIMER, AGE_USECS(1000));
 
 	/* Set Maximum frame size but don't let MTU be lass than ETHER_MTU. */
-	if (ifp->if_mtu < ETHERMTU)
+	if (if_getmtu(ifp) < ETHERMTU)
 		sc->age_max_frame_size = ETHERMTU;
 	else
-		sc->age_max_frame_size = ifp->if_mtu;
+		sc->age_max_frame_size = if_getmtu(ifp);
 	sc->age_max_frame_size += ETHER_HDR_LEN +
 	    sizeof(struct ether_vlan_header) + ETHER_CRC_LEN;
 	CSR_WRITE_4(sc, AGE_FRAME_SIZE, sc->age_max_frame_size);
@@ -2822,7 +2821,7 @@ age_init_locked(struct age_softc *sc)
 	age_rxvlan(sc);
 
 	reg = CSR_READ_4(sc, AGE_MAC_CFG);
-	if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0)
 		reg |= MAC_CFG_RXCSUM_ENB;
 
 	/* Ack all pending interrupts and clear it. */
@@ -2838,14 +2837,14 @@ age_init_locked(struct age_softc *sc)
 
 	callout_reset(&sc->age_tick_ch, hz, age_tick, sc);
 
-	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);
 }
 
 static void
 age_stop(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	struct age_txdesc *txd;
 	struct age_rxdesc *rxd;
 	uint32_t reg;
@@ -2856,7 +2855,7 @@ age_stop(struct age_softc *sc)
 	 * Mark the interface down and cancel the watchdog timer.
 	 */
 	ifp = sc->age_ifp;
-	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+	if_setdrvflagbits(ifp, 0, (IFF_DRV_RUNNING | IFF_DRV_OACTIVE));
 	sc->age_flags &= ~AGE_FLAG_LINK;
 	callout_stop(&sc->age_tick_ch);
 	sc->age_watchdog_timer = 0;
@@ -3123,7 +3122,7 @@ age_newbuf(struct age_softc *sc, struct age_rxdesc *rxd)
 static void
 age_rxvlan(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t reg;
 
 	AGE_LOCK_ASSERT(sc);
@@ -3131,7 +3130,7 @@ age_rxvlan(struct age_softc *sc)
 	ifp = sc->age_ifp;
 	reg = CSR_READ_4(sc, AGE_MAC_CFG);
 	reg &= ~MAC_CFG_VLAN_TAG_STRIP;
-	if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) != 0)
 		reg |= MAC_CFG_VLAN_TAG_STRIP;
 	CSR_WRITE_4(sc, AGE_MAC_CFG, reg);
 }
@@ -3151,7 +3150,7 @@ age_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
 static void
 age_rxfilter(struct age_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t mchash[2];
 	uint32_t rxcfg;
 
@@ -3161,12 +3160,12 @@ age_rxfilter(struct age_softc *sc)
 
 	rxcfg = CSR_READ_4(sc, AGE_MAC_CFG);
 	rxcfg &= ~(MAC_CFG_ALLMULTI | MAC_CFG_BCAST | MAC_CFG_PROMISC);
-	if ((ifp->if_flags & IFF_BROADCAST) != 0)
+	if ((if_getflags(ifp) & IFF_BROADCAST) != 0)
 		rxcfg |= MAC_CFG_BCAST;
-	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
-		if ((ifp->if_flags & IFF_PROMISC) != 0)
+	if ((if_getflags(ifp) & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if ((if_getflags(ifp) & IFF_PROMISC) != 0)
 			rxcfg |= MAC_CFG_PROMISC;
-		if ((ifp->if_flags & IFF_ALLMULTI) != 0)
+		if ((if_getflags(ifp) & IFF_ALLMULTI) != 0)
 			rxcfg |= MAC_CFG_ALLMULTI;
 		CSR_WRITE_4(sc, AGE_MAR0, 0xFFFFFFFF);
 		CSR_WRITE_4(sc, AGE_MAR1, 0xFFFFFFFF);
diff --git a/sys/dev/age/if_agevar.h b/sys/dev/age/if_agevar.h
index 800c33d8e619..82fc91b18723 100644
--- a/sys/dev/age/if_agevar.h
+++ b/sys/dev/age/if_agevar.h
@@ -193,7 +193,7 @@ struct age_stats {
  * Software state per device.
  */
 struct age_softc {
-	struct ifnet 		*age_ifp;
+	if_t	 		age_ifp;
 	device_t		age_dev;
 	device_t		age_miibus;
 	struct resource		*age_res[1];
diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c
index dc1df6753811..6f6d95e266ea 100644
--- a/sys/dev/alc/if_alc.c
+++ b/sys/dev/alc/if_alc.c
@@ -148,7 +148,7 @@ static struct alc_ident *
 		alc_find_ident(device_t);
 #ifndef __NO_STRICT_ALIGNMENT
 static struct mbuf *
-		alc_fixup_rx(struct ifnet *, struct mbuf *);
+		alc_fixup_rx(if_t, struct mbuf *);
 #endif
 static void	alc_get_macaddr(struct alc_softc *);
 static void	alc_get_macaddr_813x(struct alc_softc *);
@@ -163,7 +163,7 @@ static void	alc_init_smb(struct alc_softc *);
 static void	alc_init_tx_ring(struct alc_softc *);
 static void	alc_int_task(void *, int);
 static int	alc_intr(void *);
-static int	alc_ioctl(struct ifnet *, u_long, caddr_t);
+static int	alc_ioctl(if_t, u_long, caddr_t);
 static void	alc_mac_config(struct alc_softc *);
 static uint32_t	alc_mii_readreg_813x(struct alc_softc *, int, int);
 static uint32_t	alc_mii_readreg_816x(struct alc_softc *, int, int);
@@ -176,9 +176,9 @@ static uint32_t	alc_miidbg_readreg(struct alc_softc *, int);
 static uint32_t	alc_miidbg_writereg(struct alc_softc *, int, int);
 static uint32_t	alc_miiext_readreg(struct alc_softc *, int, int);
 static uint32_t	alc_miiext_writereg(struct alc_softc *, int, int, int);
-static int	alc_mediachange(struct ifnet *);
+static int	alc_mediachange(if_t);
 static int	alc_mediachange_locked(struct alc_softc *);
-static void	alc_mediastatus(struct ifnet *, struct ifmediareq *);
+static void	alc_mediastatus(if_t, struct ifmediareq *);
 static int	alc_newbuf(struct alc_softc *, struct alc_rxdesc *);
 static void	alc_osc_reset(struct alc_softc *);
 static void	alc_phy_down(struct alc_softc *);
@@ -197,8 +197,8 @@ static void	alc_setwol(struct alc_softc *);
 static void	alc_setwol_813x(struct alc_softc *);
 static void	alc_setwol_816x(struct alc_softc *);
 static int	alc_shutdown(device_t);
-static void	alc_start(struct ifnet *);
-static void	alc_start_locked(struct ifnet *);
+static void	alc_start(if_t);
+static void	alc_start_locked(if_t);
 static void	alc_start_queue(struct alc_softc *);
 static void	alc_start_tx(struct alc_softc *);
 static void	alc_stats_clear(struct alc_softc *);
@@ -408,7 +408,7 @@ alc_miibus_statchg(device_t dev)
 {
 	struct alc_softc *sc;
 	struct mii_data *mii;
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t reg;
 
 	sc = device_get_softc(dev);
@@ -416,7 +416,7 @@ alc_miibus_statchg(device_t dev)
 	mii = device_get_softc(sc->alc_miibus);
 	ifp = sc->alc_ifp;
 	if (mii == NULL || ifp == NULL ||
-	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+	    (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
 		return;
 
 	sc->alc_flags &= ~ALC_FLAG_LINK;
@@ -603,14 +603,14 @@ alc_dsp_fixup(struct alc_softc *sc, int media)
 }
 
 static void
-alc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
+alc_mediastatus(if_t ifp, struct ifmediareq *ifmr)
 {
 	struct alc_softc *sc;
 	struct mii_data *mii;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	ALC_LOCK(sc);
-	if ((ifp->if_flags & IFF_UP) == 0) {
+	if ((if_getflags(ifp) & IFF_UP) == 0) {
 		ALC_UNLOCK(sc);
 		return;
 	}
@@ -623,12 +623,12 @@ alc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
 }
 
 static int
-alc_mediachange(struct ifnet *ifp)
+alc_mediachange(if_t ifp)
 {
 	struct alc_softc *sc;
 	int error;
 
-	sc = ifp->if_softc;
+	sc = if_getsoftc(ifp);
 	ALC_LOCK(sc);
 	error = alc_mediachange_locked(sc);
 	ALC_UNLOCK(sc);
@@ -1258,7 +1258,7 @@ alc_aspm_816x(struct alc_softc *sc, int init)
 		if (init != 0)
 			pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB |
 			    PM_CFG_MAC_ASPM_CHK;
-		else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		else if ((if_getdrvflags(sc->alc_ifp) & IFF_DRV_RUNNING) != 0)
 			pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK;
 	}
 	CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg);
@@ -1373,7 +1373,7 @@ static int
 alc_attach(device_t dev)
 {
 	struct alc_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 	int base, error, i, msic, msixc;
 	uint16_t burst;
 
@@ -1571,23 +1571,22 @@ alc_attach(device_t dev)
 		goto fail;
 	}
 
-	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_ioctl = alc_ioctl;
-	ifp->if_start = alc_start;
-	ifp->if_init = alc_init;
-	ifp->if_snd.ifq_drv_maxlen = ALC_TX_RING_CNT - 1;
-	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
-	IFQ_SET_READY(&ifp->if_snd);
-	ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4;
-	ifp->if_hwassist = ALC_CSUM_FEATURES | CSUM_TSO;
+	if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+	if_setioctlfn(ifp, alc_ioctl);
+	if_setstartfn(ifp, alc_start);
+	if_setinitfn(ifp, alc_init);
+	if_setsendqlen(ifp, ALC_TX_RING_CNT - 1);
+	if_setsendqready(ifp);
+	if_setcapabilities(ifp, IFCAP_TXCSUM | IFCAP_TSO4);
+	if_sethwassist(ifp, ALC_CSUM_FEATURES | CSUM_TSO);
 	if (pci_find_cap(dev, PCIY_PMG, &base) == 0) {
-		ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST;
+		if_setcapabilitiesbit(ifp, IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST, 0);
 		sc->alc_flags |= ALC_FLAG_PM;
 		sc->alc_pmcap = base;
 	}
-	ifp->if_capenable = ifp->if_capabilities;
+	if_setcapenable(ifp, if_getcapabilities(ifp));
 
 	/* Set up MII bus. */
 	error = mii_attach(dev, &sc->alc_miibus, ifp, alc_mediachange,
@@ -1601,9 +1600,9 @@ alc_attach(device_t dev)
 	ether_ifattach(ifp, sc->alc_eaddr);
 
 	/* VLAN capability setup. */
-	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
-	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO;
-	ifp->if_capenable = ifp->if_capabilities;
+	if_setcapabilitiesbit(ifp, IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
+	    IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO, 0);
+	if_setcapenable(ifp, if_getcapabilities(ifp));
 	/*
 	 * XXX
 	 * It seems enabling Tx checksum offloading makes more trouble.
@@ -1617,12 +1616,12 @@ alc_attach(device_t dev)
 	 * seems to work.
 	 */
 	if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) {
-		ifp->if_capenable &= ~IFCAP_TXCSUM;
-		ifp->if_hwassist &= ~ALC_CSUM_FEATURES;
+		if_setcapenablebit(ifp, 0, IFCAP_TXCSUM);
+		if_sethwassistbits(ifp, 0, ALC_CSUM_FEATURES);
 	}
 
 	/* Tell the upper layer(s) we support long frames. */
-	ifp->if_hdrlen = sizeof(struct ether_vlan_header);
+	if_setifheaderlen(ifp, sizeof(struct ether_vlan_header));
 
 	/* Create local taskq. */
 	sc->alc_tq = taskqueue_create_fast("alc_taskq", M_WAITOK,
@@ -1672,7 +1671,7 @@ static int
 alc_detach(device_t dev)
 {
 	struct alc_softc *sc;
-	struct ifnet *ifp;
+	if_t ifp;
 	int i, msic;
 
 	sc = device_get_softc(dev);
@@ -2526,7 +2525,7 @@ alc_setwol(struct alc_softc *sc)
 static void
 alc_setwol_813x(struct alc_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t reg, pmcs;
 	uint16_t pmstat;
 
@@ -2547,7 +2546,7 @@ alc_setwol_813x(struct alc_softc *sc)
 		return;
 	}
 
-	if ((ifp->if_capenable & IFCAP_WOL) != 0) {
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0) {
 		if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0)
 			alc_setlinkspeed(sc);
 		CSR_WRITE_4(sc, ALC_MASTER_CFG,
@@ -2555,22 +2554,22 @@ alc_setwol_813x(struct alc_softc *sc)
 	}
 
 	pmcs = 0;
-	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) != 0)
 		pmcs |= WOL_CFG_MAGIC | WOL_CFG_MAGIC_ENB;
 	CSR_WRITE_4(sc, ALC_WOL_CFG, pmcs);
 	reg = CSR_READ_4(sc, ALC_MAC_CFG);
 	reg &= ~(MAC_CFG_DBG | MAC_CFG_PROMISC | MAC_CFG_ALLMULTI |
 	    MAC_CFG_BCAST);
-	if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) != 0)
 		reg |= MAC_CFG_ALLMULTI | MAC_CFG_BCAST;
-	if ((ifp->if_capenable & IFCAP_WOL) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0)
 		reg |= MAC_CFG_RX_ENB;
 	CSR_WRITE_4(sc, ALC_MAC_CFG, reg);
 
 	reg = CSR_READ_4(sc, ALC_PCIE_PHYMISC);
 	reg |= PCIE_PHYMISC_FORCE_RCV_DET;
 	CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, reg);
-	if ((ifp->if_capenable & IFCAP_WOL) == 0) {
+	if ((if_getcapenable(ifp) & IFCAP_WOL) == 0) {
 		/* WOL disabled, PHY power down. */
 		alc_phy_down(sc);
 		CSR_WRITE_4(sc, ALC_MASTER_CFG,
@@ -2580,7 +2579,7 @@ alc_setwol_813x(struct alc_softc *sc)
 	pmstat = pci_read_config(sc->alc_dev,
 	    sc->alc_pmcap + PCIR_POWER_STATUS, 2);
 	pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
-	if ((ifp->if_capenable & IFCAP_WOL) != 0)
+	if ((if_getcapenable(ifp) & IFCAP_WOL) != 0)
 		pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
 	pci_write_config(sc->alc_dev,
 	    sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2);
@@ -2589,7 +2588,7 @@ alc_setwol_813x(struct alc_softc *sc)
 static void
 alc_setwol_816x(struct alc_softc *sc)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 	uint32_t gphy, mac, master, pmcs, reg;
 	uint16_t pmstat;
 
@@ -2607,21 +2606,21 @@ alc_setwol_816x(struct alc_softc *sc)
 		gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW;
 		mac = CSR_READ_4(sc, ALC_MAC_CFG);
 	} else {
-		if ((ifp->if_capenable & IFCAP_WOL) != 0) {
+		if ((if_getcapenable(ifp) & IFCAP_WOL) != 0) {
 			gphy |= GPHY_CFG_EXT_RESET;
 			if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0)
 				alc_setlinkspeed(sc);
 		}
 		pmcs = 0;
-		if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
+		if ((if_getcapenable(ifp) & IFCAP_WOL_MAGIC) != 0)
 			pmcs |= WOL_CFG_MAGIC | WOL_CFG_MAGIC_ENB;
 		CSR_WRITE_4(sc, ALC_WOL_CFG, pmcs);
 		mac = CSR_READ_4(sc, ALC_MAC_CFG);
 		mac &= ~(MAC_CFG_DBG | MAC_CFG_PROMISC | MAC_CFG_ALLMULTI |
 		    MAC_CFG_BCAST);
-		if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0)
+		if ((if_getcapenable(ifp) & IFCAP_WOL_MCAST) != 0)
 			mac |= MAC_CFG_ALLMULTI | MAC_CFG_BCAST;
-		if ((ifp->if_capenable & IFCAP_WOL) != 0)
+		if ((if_getcapenable(ifp) & IFCAP_WOL) != 0)
 			mac |= MAC_CFG_RX_ENB;
*** 1233 LINES SKIPPED ***