The branch main has been updated by jhibbits:

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

commit ec22a3a259193685afaea1667a39266264c65fd3
Author:     Justin Hibbits <[email protected]>
AuthorDate: 2022-08-19 19:48:39 +0000
Commit:     Justin Hibbits <[email protected]>
CommitDate: 2022-12-21 20:36:59 +0000

    DrvAPI: Trivial mechanical conversions for various drivers
    
    Mechanically convert the following drivers, with trivial changes:
    * ipw(4)
    * igc(4)
    * enetc(4)
    * malo(4)
    * nfe(4)
    * bxe(4)
    * awg(4)
    * otus(4)
    * rtwn(4)
    * bnxt(4)
    * ath(4)
    
    Sponsored by:   Juniper Networks, Inc.
---
 sys/arm/allwinner/if_awg.c               |  2 +-
 sys/dev/ath/if_ath_ioctl.c               |  2 +-
 sys/dev/ath/if_ath_led.c                 |  1 +
 sys/dev/ath/if_ath_misc.h                |  2 +-
 sys/dev/ath/if_ath_tdma.c                |  2 +-
 sys/dev/bnxt/bnxt_mgmt.c                 |  2 +-
 sys/dev/bnxt/if_bnxt.c                   |  6 +++---
 sys/dev/bxe/bxe.c                        | 20 ++++++++++----------
 sys/dev/enetc/if_enetc.c                 | 14 +++++++-------
 sys/dev/igc/if_igc.c                     | 16 ++++++++--------
 sys/dev/igc/if_igc.h                     |  2 +-
 sys/dev/ipw/if_ipw.c                     |  6 +++---
 sys/dev/malo/if_malo.c                   |  2 +-
 sys/dev/nfe/if_nfevar.h                  |  2 +-
 sys/dev/otus/if_otus.c                   |  2 +-
 sys/dev/rtwn/rtl8812a/r12a_caps.c        |  8 ++++----
 sys/dev/rtwn/rtl8812a/usb/r12au_attach.c |  8 ++++----
 17 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/sys/arm/allwinner/if_awg.c b/sys/arm/allwinner/if_awg.c
index 7236bd94335d..7f94b88e7035 100644
--- a/sys/arm/allwinner/if_awg.c
+++ b/sys/arm/allwinner/if_awg.c
@@ -442,7 +442,7 @@ awg_setup_rxfilter(struct awg_softc *sc)
                val |= HASH_MULTICAST;
 
        /* Write our unicast address */
-       eaddr = IF_LLADDR(ifp);
+       eaddr = if_getlladdr(ifp);
        machi = (eaddr[5] << 8) | eaddr[4];
        maclo = (eaddr[3] << 24) | (eaddr[2] << 16) | (eaddr[1] << 8) |
           (eaddr[0] << 0);
diff --git a/sys/dev/ath/if_ath_ioctl.c b/sys/dev/ath/if_ath_ioctl.c
index f58742d6e5fb..cec769d615d7 100644
--- a/sys/dev/ath/if_ath_ioctl.c
+++ b/sys/dev/ath/if_ath_ioctl.c
@@ -242,7 +242,7 @@ ath_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
        switch (cmd) {
        case SIOCGATHSTATS: {
                struct ieee80211vap *vap;
-               struct ifnet *ifp;
+               if_t ifp;
                const HAL_RATE_TABLE *rt;
 
                /* NB: embed these numbers to get a consistent view */
diff --git a/sys/dev/ath/if_ath_led.c b/sys/dev/ath/if_ath_led.c
index 8b4ac821f2be..e8da930f7217 100644
--- a/sys/dev/ath/if_ath_led.c
+++ b/sys/dev/ath/if_ath_led.c
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_arp.h>
 #include <net/ethernet.h>
 #include <net/if_llc.h>
+#include <net/if_var.h>
 
 #include <net80211/ieee80211_var.h>
 #include <net80211/ieee80211_regdomain.h>
diff --git a/sys/dev/ath/if_ath_misc.h b/sys/dev/ath/if_ath_misc.h
index b108c29bab4b..c19e028e64bd 100644
--- a/sys/dev/ath/if_ath_misc.h
+++ b/sys/dev/ath/if_ath_misc.h
@@ -105,7 +105,7 @@ extern      void ath_tx_update_tim(struct ath_softc *sc,
  * if_ath.c and do the ath_start() call there.  Once that's done,
  * we can kill this.
  */
-extern void ath_start(struct ifnet *ifp);
+extern void ath_start(if_t ifp);
 extern void ath_start_task(void *arg, int npending);
 
 extern void ath_tx_dump(struct ath_softc *sc, struct ath_txq *txq);
diff --git a/sys/dev/ath/if_ath_tdma.c b/sys/dev/ath/if_ath_tdma.c
index f0900435c6d6..420b4a2b6d68 100644
--- a/sys/dev/ath/if_ath_tdma.c
+++ b/sys/dev/ath/if_ath_tdma.c
@@ -290,7 +290,7 @@ ath_tdma_config(struct ath_softc *sc, struct ieee80211vap 
*vap)
                /* XXX short preamble assumed */
                /* XXX non-11n rate assumed */
                sc->sc_tdmaguard = ath_hal_computetxtime(ah, sc->sc_currates,
-                   vap->iv_ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE,
+                   if_getmtu(vap->iv_ifp) + IEEE80211_MAXOVERHEAD, rix, 
AH_TRUE,
                    AH_TRUE);
        }
 
diff --git a/sys/dev/bnxt/bnxt_mgmt.c b/sys/dev/bnxt/bnxt_mgmt.c
index d54d7a2a2fe1..7185fa2f5c0a 100644
--- a/sys/dev/bnxt/bnxt_mgmt.c
+++ b/sys/dev/bnxt/bnxt_mgmt.c
@@ -309,7 +309,7 @@ bnxt_mgmt_get_dev_info(struct cdev *dev, u_long cmd, 
caddr_t data,
        }
        
        if_t ifp = iflib_get_ifp(softc->ctx);
-       dev_info.nic_info.mtu = ifp->if_mtu;
+       dev_info.nic_info.mtu = if_getmtu(ifp);
        memcpy(dev_info.nic_info.mac, softc->func.mac_addr, ETHER_ADDR_LEN);
        
        if (pci_find_cap(softc->dev, PCIY_EXPRESS, &capreg)) {
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index d6cb4d613c96..6f45c0963d1d 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -1597,7 +1597,7 @@ bnxt_attach_post(if_ctx_t ctx)
        bnxt_add_media_types(softc);
        ifmedia_set(softc->media, IFM_ETHER | IFM_AUTO);
 
-       softc->scctx->isc_max_frame_size = ifp->if_mtu + ETHER_HDR_LEN +
+       softc->scctx->isc_max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN +
            ETHER_CRC_LEN;
 
        softc->rx_buf_size = min(softc->scctx->isc_max_frame_size, 
BNXT_PAGE_SIZE);
@@ -2156,7 +2156,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags)
        if_t ifp = iflib_get_ifp(ctx);
        int rc;
 
-       if (ifp->if_flags & IFF_ALLMULTI ||
+       if (if_getflags(ifp) & IFF_ALLMULTI ||
            if_llmaddr_count(ifp) > BNXT_MAX_MC_ADDRS)
                softc->vnic_info.rx_mask |=
                    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
@@ -2164,7 +2164,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags)
                softc->vnic_info.rx_mask &=
                    ~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
 
-       if (ifp->if_flags & IFF_PROMISC)
+       if (if_getflags(ifp) & IFF_PROMISC)
                softc->vnic_info.rx_mask |=
                    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS |
                    HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN;
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index 83b2aa588006..aa417ae6b95b 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -4392,7 +4392,7 @@ bxe_nic_unload(struct bxe_softc *sc,
  * the user runs "ifconfig bxe media ..." or "ifconfig bxe mediaopt ...".
  */
 static int
-bxe_ifmedia_update(struct ifnet  *ifp)
+bxe_ifmedia_update(if_t ifp)
 {
     struct bxe_softc *sc = (struct bxe_softc *)if_getsoftc(ifp);
     struct ifmedia *ifm;
@@ -4425,7 +4425,7 @@ bxe_ifmedia_update(struct ifnet  *ifp)
  * Called by the OS to get the current media status (i.e. link, speed, etc.).
  */
 static void
-bxe_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
+bxe_ifmedia_status(if_t ifp, struct ifmediareq *ifmr)
 {
     struct bxe_softc *sc = if_getsoftc(ifp);
 
@@ -4441,7 +4441,7 @@ bxe_ifmedia_status(struct ifnet *ifp, struct ifmediareq 
*ifmr)
     ifmr->ifm_active = IFM_ETHER;
 
     /* Report link down if the driver isn't running. */
-    if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+    if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
         ifmr->ifm_active |= IFM_NONE;
         BLOGD(sc, DBG_PHY, "in %s : nic still not loaded fully\n", __func__);
         BLOGD(sc, DBG_PHY, "in %s : link_up (1) : %d\n",
@@ -5753,7 +5753,7 @@ bxe_tx_mq_start_deferred(void *arg,
 
 /* Multiqueue (TSS) dispatch routine. */
 static int
-bxe_tx_mq_start(struct ifnet *ifp,
+bxe_tx_mq_start(if_t ifp,
                 struct mbuf  *m)
 {
     struct bxe_softc *sc = if_getsoftc(ifp);
@@ -5786,7 +5786,7 @@ bxe_tx_mq_start(struct ifnet *ifp,
 }
 
 static void
-bxe_mq_flush(struct ifnet *ifp)
+bxe_mq_flush(if_t ifp)
 {
     struct bxe_softc *sc = if_getsoftc(ifp);
     struct bxe_fastpath *fp;
@@ -19099,7 +19099,7 @@ bxe_add_cdev(struct bxe_softc *sc)
     }
 
     sc->ioctl_dev = make_dev(&bxe_cdevsw,
-                            sc->ifp->if_dunit,
+                            if_getdunit(sc->ifp),
                             UID_ROOT,
                             GID_WHEEL,
                             0600,
@@ -19421,7 +19421,7 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, 
int fflag,
 
 #ifdef DEBUGNET
 static void
-bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
+bxe_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
 {
        struct bxe_softc *sc;
 
@@ -19434,12 +19434,12 @@ bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int 
*ncl, int *clsize)
 }
 
 static void
-bxe_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused)
+bxe_debugnet_event(if_t ifp __unused, enum debugnet_ev event __unused)
 {
 }
 
 static int
-bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
+bxe_debugnet_transmit(if_t ifp, struct mbuf *m)
 {
        struct bxe_softc *sc;
        int error;
@@ -19456,7 +19456,7 @@ bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
 }
 
 static int
-bxe_debugnet_poll(struct ifnet *ifp, int count)
+bxe_debugnet_poll(if_t ifp, int count)
 {
        struct bxe_softc *sc;
        int i;
diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c
index d691f7ccbf01..60d1c9f96d45 100644
--- a/sys/dev/enetc/if_enetc.c
+++ b/sys/dev/enetc/if_enetc.c
@@ -581,7 +581,7 @@ enetc_get_hwaddr(struct enetc_softc *sc)
 static void
 enetc_set_hwaddr(struct enetc_softc *sc)
 {
-       struct ifnet *ifp;
+       if_t ifp;
        uint16_t high;
        uint32_t low;
        uint8_t *hwaddr;
@@ -823,7 +823,7 @@ static void
 enetc_setup_multicast(if_ctx_t ctx)
 {
        struct enetc_softc *sc;
-       struct ifnet *ifp;
+       if_t ifp;
        uint64_t bitmap = 0;
        uint8_t revid;
 
@@ -905,7 +905,7 @@ enetc_init(if_ctx_t ctx)
 {
        struct enetc_softc *sc;
        struct mii_data *miid;
-       struct ifnet *ifp;
+       if_t ifp;
        uint16_t max_frame_length;
        int baudrate;
 
@@ -1335,7 +1335,7 @@ static uint64_t
 enetc_get_counter(if_ctx_t ctx, ift_counter cnt)
 {
        struct enetc_softc *sc;
-       struct ifnet *ifp;
+       if_t ifp;
 
        sc = iflib_get_softc(ctx);
        ifp = iflib_get_ifp(ctx);
@@ -1481,7 +1481,7 @@ enetc_media_change(if_t ifp)
        struct enetc_softc *sc;
        struct mii_data *miid;
 
-       sc = iflib_get_softc(ifp->if_softc);
+       sc = iflib_get_softc(if_getsoftc(ifp));
        miid = device_get_softc(sc->miibus);
 
        mii_mediachg(miid);
@@ -1494,7 +1494,7 @@ enetc_media_status(if_t ifp, struct ifmediareq* ifmr)
        struct enetc_softc *sc;
        struct mii_data *miid;
 
-       sc = iflib_get_softc(ifp->if_softc);
+       sc = iflib_get_softc(if_getsoftc(ifp));
        miid = device_get_softc(sc->miibus);
 
        mii_pollstat(miid);
@@ -1515,7 +1515,7 @@ enetc_fixed_media_status(if_t ifp, struct ifmediareq* 
ifmr)
 {
        struct enetc_softc *sc;
 
-       sc = iflib_get_softc(ifp->if_softc);
+       sc = iflib_get_softc(if_getsoftc(ifp));
 
        ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
        ifmr->ifm_active = sc->fixed_ifmedia.ifm_cur->ifm_media;
diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index a98f0a78f474..60f796010232 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -797,7 +797,7 @@ igc_if_init(if_ctx_t ctx)
 {
        struct igc_adapter *adapter = iflib_get_softc(ctx);
        if_softc_ctx_t scctx = adapter->shared;
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
        struct igc_tx_queue *tx_que;
        int i;
 
@@ -1079,7 +1079,7 @@ static int
 igc_if_set_promisc(if_ctx_t ctx, int flags)
 {
        struct igc_adapter *adapter = iflib_get_softc(ctx);
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
        u32 reg_rctl;
        int mcnt = 0;
 
@@ -1133,7 +1133,7 @@ static void
 igc_if_multi_set(if_ctx_t ctx)
 {
        struct igc_adapter *adapter = iflib_get_softc(ctx);
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
        u8  *mta; /* Multicast array memory */
        u32 reg_rctl = 0;
        int mcnt = 0;
@@ -1762,7 +1762,7 @@ igc_initialize_rss_mapping(struct igc_adapter *adapter)
 static int
 igc_setup_interface(if_ctx_t ctx)
 {
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
        struct igc_adapter *adapter = iflib_get_softc(ctx);
        if_softc_ctx_t scctx = adapter->shared;
 
@@ -1991,7 +1991,7 @@ igc_initialize_receive_unit(if_ctx_t ctx)
 {
        struct igc_adapter *adapter = iflib_get_softc(ctx);
        if_softc_ctx_t scctx = adapter->shared;
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
        struct igc_hw   *hw = &adapter->hw;
        struct igc_rx_queue *que;
        int i;
@@ -2060,7 +2060,7 @@ igc_initialize_receive_unit(if_ctx_t ctx)
                }
                psize = scctx->isc_max_frame_size;
                /* are we on a vlan? */
-               if (ifp->if_vlantrunk != NULL)
+               if (if_vlantrunkinuse(ifp))
                        psize += VLAN_TAG_SIZE;
                IGC_WRITE_REG(&adapter->hw, IGC_RLPML, psize);
        } else {
@@ -2386,7 +2386,7 @@ static uint64_t
 igc_if_get_counter(if_ctx_t ctx, ift_counter cnt)
 {
        struct igc_adapter *adapter = iflib_get_softc(ctx);
-       struct ifnet *ifp = iflib_get_ifp(ctx);
+       if_t ifp = iflib_get_ifp(ctx);
 
        switch (cnt) {
        case IFCOUNTER_COLLISIONS:
@@ -2903,7 +2903,7 @@ static void
 igc_print_debug_info(struct igc_adapter *adapter)
 {
        device_t dev = iflib_get_dev(adapter->ctx);
-       struct ifnet *ifp = iflib_get_ifp(adapter->ctx);
+       if_t ifp = iflib_get_ifp(adapter->ctx);
        struct tx_ring *txr = &adapter->tx_queues->txr;
        struct rx_ring *rxr = &adapter->rx_queues->rxr;
 
diff --git a/sys/dev/igc/if_igc.h b/sys/dev/igc/if_igc.h
index 86a02266a81c..545005f55f4c 100644
--- a/sys/dev/igc/if_igc.h
+++ b/sys/dev/igc/if_igc.h
@@ -336,7 +336,7 @@ struct igc_rx_queue {
 
 /* Our adapter structure */
 struct igc_adapter {
-       struct ifnet    *ifp;
+       if_t            ifp;
        struct igc_hw   hw;
 
         if_softc_ctx_t shared;
diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c
index c64a0c74ea8a..2c08077a2dea 100644
--- a/sys/dev/ipw/if_ipw.c
+++ b/sys/dev/ipw/if_ipw.c
@@ -115,7 +115,7 @@ static struct ieee80211vap *ipw_vap_create(struct 
ieee80211com *,
 static void    ipw_vap_delete(struct ieee80211vap *);
 static int     ipw_dma_alloc(struct ipw_softc *);
 static void    ipw_release(struct ipw_softc *);
-static void    ipw_media_status(struct ifnet *, struct ifmediareq *);
+static void    ipw_media_status(if_t, struct ifmediareq *);
 static int     ipw_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static uint16_t        ipw_read_prom_word(struct ipw_softc *, uint8_t);
 static uint16_t        ipw_read_chanmask(struct ipw_softc *);
@@ -833,9 +833,9 @@ ipw_cvtrate(int ipwrate)
  * value here.
  */
 static void
-ipw_media_status(struct ifnet *ifp, struct ifmediareq *imr)
+ipw_media_status(if_t ifp, struct ifmediareq *imr)
 {
-       struct ieee80211vap *vap = ifp->if_softc;
+       struct ieee80211vap *vap = if_getsoftc(ifp);
        struct ieee80211com *ic = vap->iv_ic;
        struct ipw_softc *sc = ic->ic_softc;
 
diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c
index d9220eaee0f9..71da0832d29e 100644
--- a/sys/dev/malo/if_malo.c
+++ b/sys/dev/malo/if_malo.c
@@ -1743,7 +1743,7 @@ malo_newstate(struct ieee80211vap *vap, enum 
ieee80211_state nstate, int arg)
                DPRINTF(sc, MALO_DEBUG_STATE,
                    "%s: %s(RUN): iv_flags 0x%08x bintvl %d bssid %s "
                    "capinfo 0x%04x chan %d associd 0x%x mode %d rate %d\n",
-                   vap->iv_ifp->if_xname, __func__, vap->iv_flags,
+                   if_name(vap->iv_ifp), __func__, vap->iv_flags,
                    ni->ni_intval, ether_sprintf(ni->ni_bssid), ni->ni_capinfo,
                    ieee80211_chan2ieee(ic, ic->ic_curchan),
                    ni->ni_associd, mode, tp->ucastrate);
diff --git a/sys/dev/nfe/if_nfevar.h b/sys/dev/nfe/if_nfevar.h
index c2e34f1687f7..3e814ce01404 100644
--- a/sys/dev/nfe/if_nfevar.h
+++ b/sys/dev/nfe/if_nfevar.h
@@ -104,7 +104,7 @@ struct nfe_hw_stats {
 };
 
 struct nfe_softc {
-       struct ifnet            *nfe_ifp;
+       if_t                    nfe_ifp;
        device_t                nfe_dev;
        uint16_t                nfe_devid;
        uint16_t                nfe_revid;
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
index d0c8fc93ef92..76f71604567b 100644
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -174,7 +174,7 @@ void                otus_sub_rxeof(struct otus_softc *, 
uint8_t *, int,
 static int     otus_tx(struct otus_softc *, struct ieee80211_node *,
                    struct mbuf *, struct otus_data *,
                    const struct ieee80211_bpf_params *);
-int            otus_ioctl(struct ifnet *, u_long, caddr_t);
+int            otus_ioctl(if_t, u_long, caddr_t);
 int            otus_set_multi(struct otus_softc *);
 static int     otus_updateedca(struct ieee80211com *);
 static void    otus_updateedca_locked(struct otus_softc *);
diff --git a/sys/dev/rtwn/rtl8812a/r12a_caps.c 
b/sys/dev/rtwn/rtl8812a/r12a_caps.c
index ab175b41ec70..dfe18deb504f 100644
--- a/sys/dev/rtwn/rtl8812a/r12a_caps.c
+++ b/sys/dev/rtwn/rtl8812a/r12a_caps.c
@@ -101,11 +101,11 @@ r12a_ioctl_net(struct ieee80211com *ic, u_long cmd, void 
*data)
 
                IEEE80211_LOCK(ic);     /* XXX */
                TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
-                       struct ifnet *ifp = vap->iv_ifp;
+                       if_t ifp = vap->iv_ifp;
 
-                       ifp->if_capenable &=
-                           ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
-                       ifp->if_capenable |= rxmask;
+                       if_setcapenablebit(ifp, 0,
+                           IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
+                       if_setcapenablebit(ifp, rxmask, 0);
                }
                IEEE80211_UNLOCK(ic);
                break;
diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c 
b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
index dd5223ce969b..abb786132fb7 100644
--- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
+++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c
@@ -111,14 +111,14 @@ void
 r12a_vap_preattach(struct rtwn_softc *sc, struct ieee80211vap *vap)
 {
        struct r12a_softc *rs = sc->sc_priv;
-       struct ifnet *ifp = vap->iv_ifp;
+       if_t ifp = vap->iv_ifp;
 
-       ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6;
+       if_setcapabilities(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
        RTWN_LOCK(sc);
        if (rs->rs_flags & R12A_RXCKSUM_EN)
-               ifp->if_capenable |= IFCAP_RXCSUM;
+               if_setcapenablebit(ifp, IFCAP_RXCSUM, 0);
        if (rs->rs_flags & R12A_RXCKSUM6_EN)
-               ifp->if_capenable |= IFCAP_RXCSUM_IPV6;
+               if_setcapenablebit(ifp, IFCAP_RXCSUM_IPV6, 0);
        RTWN_UNLOCK(sc);
 }
 

Reply via email to