diff --git a/sys/dev/axgbe/if_axgbe.c b/sys/dev/axgbe/if_axgbe.c --- a/sys/dev/axgbe/if_axgbe.c +++ b/sys/dev/axgbe/if_axgbe.c @@ -130,20 +130,20 @@ axgbe_init(void *p) { struct axgbe_softc *sc; - struct ifnet *ifp; + if_t ifp; sc = p; ifp = sc->prv.netdev; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) return; - ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_setdrvflagbits(ifp, IFF_DRV_RUNNING, 0); } static int -axgbe_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) +axgbe_ioctl(if_t ifp, unsigned long command, caddr_t data) { - struct axgbe_softc *sc = ifp->if_softc; + struct axgbe_softc *sc = if_getsoftc(ifp); struct ifreq *ifr = (struct ifreq *)data; int error = 0; @@ -169,19 +169,19 @@ } static void -axgbe_qflush(struct ifnet *ifp) +axgbe_qflush(if_t ifp) { if_qflush(ifp); } static int -axgbe_media_change(struct ifnet *ifp) +axgbe_media_change(if_t ifp) { struct axgbe_softc *sc; int cur_media; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); sx_xlock(&sc->prv.an_mutex); cur_media = sc->media.ifm_cur->ifm_media; @@ -209,11 +209,11 @@ } static void -axgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +axgbe_media_status(if_t ifp, struct ifmediareq *ifmr) { struct axgbe_softc *sc; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); ifmr->ifm_status = IFM_AVALID; if (!sc->prv.phy.link) @@ -241,9 +241,9 @@ } static uint64_t -axgbe_get_counter(struct ifnet *ifp, ift_counter c) +axgbe_get_counter(if_t ifp, ift_counter c) { - struct xgbe_prv_data *pdata = ifp->if_softc; + struct xgbe_prv_data *pdata = if_getsoftc(ifp); struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; DBGPR("-->%s\n", __func__); @@ -305,7 +305,7 @@ axgbe_attach(device_t dev) { struct axgbe_softc *sc; - struct ifnet *ifp; + if_t ifp; pcell_t phy_handle; device_t phydev; phandle_t node, phy_node; @@ -532,18 +532,18 @@ xgbe_init_tx_coalesce(&sc->prv); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_init = axgbe_init; - ifp->if_softc = sc; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_ioctl = axgbe_ioctl; + if_setinitfn(ifp, axgbe_init); + if_setsoftc(ifp, sc); + if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setioctlfn(ifp, axgbe_ioctl); /* TODO - change it to iflib way */ - ifp->if_qflush = axgbe_qflush; - ifp->if_get_counter = axgbe_get_counter; + if_setqflushfn(ifp, axgbe_qflush); + if_setgetcounterfn(ifp, axgbe_get_counter); /* TODO: Support HW offload */ - ifp->if_capabilities = 0; - ifp->if_capenable = 0; - ifp->if_hwassist = 0; + if_setcapabilities(ifp, 0); + if_setcapenable(ifp, 0); + if_sethwassist(ifp, 0); ether_ifattach(ifp, sc->mac_addr); diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -342,14 +342,14 @@ struct axgbe_if_softc *sc = iflib_get_softc(device_get_softc(dev)); struct xgbe_prv_data *pdata = &sc->pdata; struct mii_data *mii = device_get_softc(pdata->axgbe_miibus); - struct ifnet *ifp = pdata->netdev; + if_t ifp = pdata->netdev; int bmsr; axgbe_printf(2, "%s: Link %d/%d\n", __func__, pdata->phy.link, pdata->phy_link); if (mii == NULL || ifp == NULL || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) return; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -1354,7 +1354,7 @@ { struct axgbe_if_softc *sc = iflib_get_softc(ctx); struct xgbe_prv_data *pdata = &sc->pdata; - struct ifnet *ifp = pdata->netdev; + if_t ifp = pdata->netdev; struct xgbe_phy_if *phy_if = &pdata->phy_if; struct xgbe_hw_if *hw_if = &pdata->hw_if; if_softc_ctx_t scctx = sc->scctx; @@ -1467,8 +1467,8 @@ */ set_bit(XGBE_DOWN, &pdata->dev_state); - DBGPR("mtu %d\n", ifp->if_mtu); - scctx->isc_max_frame_size = ifp->if_mtu + 18; + DBGPR("mtu %d\n", if_getmtu(ifp)); + scctx->isc_max_frame_size = if_getmtu(ifp) + 18; scctx->isc_min_frame_size = XGMAC_MIN_PACKET; axgbe_sysctl_init(pdata); @@ -2333,12 +2333,13 @@ { struct axgbe_if_softc *sc = iflib_get_softc(ctx); struct xgbe_prv_data *pdata = &sc->pdata; - struct ifnet *ifp = pdata->netdev; + if_t ifp = pdata->netdev; axgbe_printf(1, "%s: MAC_PFR 0x%x drv_flags 0x%x if_flags 0x%x\n", - __func__, XGMAC_IOREAD(pdata, MAC_PFR), ifp->if_drv_flags, ifp->if_flags); + __func__, XGMAC_IOREAD(pdata, MAC_PFR), if_getdrvflags(ifp), + if_getflags(ifp)); - if (ifp->if_flags & IFF_PPROMISC) { + if (if_getflags(ifp) & IFF_PPROMISC) { axgbe_printf(1, "User requested to enter promisc mode\n"); @@ -2371,7 +2372,7 @@ axgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct axgbe_if_softc *sc = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct xgbe_prv_data *pdata = &sc->pdata; struct xgbe_mmc_stats *pstats = &pdata->mmc_stats; diff --git a/sys/dev/axgbe/xgbe-dev.c b/sys/dev/axgbe/xgbe-dev.c --- a/sys/dev/axgbe/xgbe-dev.c +++ b/sys/dev/axgbe/xgbe-dev.c @@ -2029,7 +2029,7 @@ static void xgbe_config_mac_address(struct xgbe_prv_data *pdata) { - xgbe_set_mac_address(pdata, IF_LLADDR(pdata->netdev)); + xgbe_set_mac_address(pdata, if_getlladdr(pdata->netdev)); /* Filtering is done using perfect filtering and hash filtering */ if (pdata->hw_feat.hash_table_size) { diff --git a/sys/dev/axgbe/xgbe-drv.c b/sys/dev/axgbe/xgbe-drv.c --- a/sys/dev/axgbe/xgbe-drv.c +++ b/sys/dev/axgbe/xgbe-drv.c @@ -118,7 +118,7 @@ #include "xgbe-common.h" int -xgbe_calc_rx_buf_size(struct ifnet *netdev, unsigned int mtu) +xgbe_calc_rx_buf_size(if_t netdev, unsigned int mtu) { unsigned int rx_buf_size; diff --git a/sys/dev/axgbe/xgbe-phy-v2.c b/sys/dev/axgbe/xgbe-phy-v2.c --- a/sys/dev/axgbe/xgbe-phy-v2.c +++ b/sys/dev/axgbe/xgbe-phy-v2.c @@ -3409,13 +3409,13 @@ } static void -axgbe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) +axgbe_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr) { struct axgbe_if_softc *sc; struct xgbe_prv_data *pdata; struct mii_data *mii; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); pdata = &sc->pdata; axgbe_printf(2, "%s: Invoked\n", __func__); @@ -3430,7 +3430,7 @@ } static int -axgbe_ifmedia_upd(struct ifnet *ifp) +axgbe_ifmedia_upd(if_t ifp) { struct xgbe_prv_data *pdata; struct axgbe_if_softc *sc; @@ -3438,7 +3438,7 @@ struct mii_softc *miisc; int ret; - sc = ifp->if_softc; + sc = if_getsoftc(ifp); pdata = &sc->pdata; axgbe_printf(2, "%s: Invoked\n", __func__); diff --git a/sys/dev/axgbe/xgbe.h b/sys/dev/axgbe/xgbe.h --- a/sys/dev/axgbe/xgbe.h +++ b/sys/dev/axgbe/xgbe.h @@ -1010,7 +1010,7 @@ }; struct xgbe_prv_data { - struct ifnet *netdev; + if_t netdev; struct platform_device *pdev; struct acpi_device *adev; @@ -1310,7 +1310,7 @@ if_softc_ctx_t scctx; if_shared_ctx_t sctx; if_ctx_t ctx; - struct ifnet *ifp; + if_t ifp; struct ifmedia *media; unsigned int link_status; }; @@ -1326,7 +1326,7 @@ void xgbe_init_rx_coalesce(struct xgbe_prv_data *); void xgbe_init_tx_coalesce(struct xgbe_prv_data *); -int xgbe_calc_rx_buf_size(struct ifnet *netdev, unsigned int mtu); +int xgbe_calc_rx_buf_size(if_t netdev, unsigned int mtu); void axgbe_sysctl_init(struct xgbe_prv_data *pdata); void axgbe_sysctl_exit(struct xgbe_prv_data *pdata); diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1292,7 +1292,7 @@ { struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct em_tx_queue *tx_que; int i; @@ -1654,7 +1654,7 @@ em_if_set_promisc(if_ctx_t ctx, int flags) { struct e1000_softc *sc = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); u32 reg_rctl; int mcnt = 0; @@ -1711,7 +1711,7 @@ em_if_multi_set(if_ctx_t ctx) { struct e1000_softc *sc = 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; @@ -2471,7 +2471,7 @@ { device_t dev = iflib_get_dev(ctx); struct e1000_softc *sc = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct e1000_hw *hw = &sc->hw; u32 rx_buffer_size; u32 pba; @@ -2568,7 +2568,7 @@ } /* Special needs in case of Jumbo frames */ - if ((hw->mac.type == e1000_82575) && (ifp->if_mtu > ETHERMTU)) { + if ((hw->mac.type == e1000_82575) && (if_getmtu(ifp) > ETHERMTU)) { u32 tx_space, min_tx, min_rx; pba = E1000_READ_REG(hw, E1000_PBA); tx_space = pba >> 16; @@ -2866,7 +2866,7 @@ static int em_setup_interface(if_ctx_t ctx) { - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; @@ -3171,7 +3171,7 @@ { struct e1000_softc *sc = iflib_get_softc(ctx); if_softc_ctx_t scctx = sc->shared; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct e1000_hw *hw = &sc->hw; struct em_rx_queue *que; int i; @@ -3320,7 +3320,7 @@ if (if_getmtu(ifp) > ETHERMTU) { psize = scctx->isc_max_frame_size; /* are we on a vlan? */ - if (ifp->if_vlantrunk != NULL) + if (if_vlantrunkinuse(ifp)) psize += VLAN_TAG_SIZE; if (sc->vf_ifp) @@ -3520,7 +3520,7 @@ { struct e1000_softc *sc = iflib_get_softc(ctx); struct e1000_hw *hw = &sc->hw; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); u32 reg; /* XXXKB: Return early if we are a VF until VF decap and filter management @@ -4155,7 +4155,7 @@ em_if_get_counter(if_ctx_t ctx, ift_counter cnt) { struct e1000_softc *sc = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); switch (cnt) { case IFCOUNTER_COLLISIONS: @@ -4830,7 +4830,7 @@ em_print_debug_info(struct e1000_softc *sc) { device_t dev = iflib_get_dev(sc->ctx); - struct ifnet *ifp = iflib_get_ifp(sc->ctx); + if_t ifp = iflib_get_ifp(sc->ctx); struct tx_ring *txr = &sc->tx_queues->txr; struct rx_ring *rxr = &sc->rx_queues->rxr; diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -6942,7 +6942,7 @@ flowcontrol = ice_flowcontrol_mode(hw->port_info); log(LOG_NOTICE, "%s: Link is up, %s Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg: %s, Flow Control: %s\n", - ifp->if_xname, speed, req_fec, neg_fec, autoneg, flowcontrol); + if_name(ifp), speed, req_fec, neg_fec, autoneg, flowcontrol); } /** diff --git a/sys/dev/ice/ice_rdma.c b/sys/dev/ice/ice_rdma.c --- a/sys/dev/ice/ice_rdma.c +++ b/sys/dev/ice/ice_rdma.c @@ -738,7 +738,7 @@ sx_xlock(&ice_rdma.mtx); /* Update the MTU */ - peer->mtu = sc->ifp->if_mtu; + peer->mtu = if_getmtu(sc->ifp); sc->rdma_entry.initiated = true; if (sc->rdma_entry.attached && ice_rdma.registered) { diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -729,7 +729,7 @@ */ sc->ifp = ifp; - sc->scctx->isc_max_frame_size = ifp->if_mtu + + sc->scctx->isc_max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN; /* @@ -2276,7 +2276,7 @@ if (ice_testandset_state(&sc->state, ICE_STATE_PREPARED_FOR_RESET)) return; - log(LOG_INFO, "%s: preparing to reset device logic\n", sc->ifp->if_xname); + log(LOG_INFO, "%s: preparing to reset device logic\n", if_name(sc->ifp)); /* In recovery mode, hardware is not initialized */ if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE)) @@ -2378,7 +2378,7 @@ /* Now that the rebuild is finished, we're no longer prepared to reset */ ice_clear_state(&sc->state, ICE_STATE_PREPARED_FOR_RESET); - log(LOG_INFO, "%s: device rebuild successful\n", sc->ifp->if_xname); + log(LOG_INFO, "%s: device rebuild successful\n", if_name(sc->ifp)); /* In order to completely restore device functionality, the iflib core * needs to be reset. We need to request an iflib reset. Additionally, @@ -2554,7 +2554,7 @@ /* Now that the rebuild is finished, we're no longer prepared to reset */ ice_clear_state(&sc->state, ICE_STATE_PREPARED_FOR_RESET); - log(LOG_INFO, "%s: device rebuild successful\n", sc->ifp->if_xname); + log(LOG_INFO, "%s: device rebuild successful\n", if_name(sc->ifp)); /* In order to completely restore device functionality, the iflib core * needs to be reset. We need to request an iflib reset. Additionally, diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -905,14 +905,14 @@ static int ixl_if_resume(if_ctx_t ctx) { - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); INIT_DEBUGOUT("ixl_if_resume: begin"); /* Read & clear wake-up registers */ /* Required after D3->D0 transition */ - if (ifp->if_flags & IFF_UP) + if (if_getflags(ifp) & IFF_UP) ixl_if_init(ctx); return (0); @@ -924,7 +924,7 @@ struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = &pf->hw; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); device_t dev = iflib_get_dev(ctx); u8 tmpaddr[ETHER_ADDR_LEN]; int ret; @@ -943,7 +943,7 @@ } /* Get the latest mac address... User might use a LAA */ - bcopy(IF_LLADDR(vsi->ifp), tmpaddr, ETH_ALEN); + bcopy(if_getlladdr(vsi->ifp), tmpaddr, ETH_ALEN); if (!ixl_ether_is_equal(hw->mac.addr, tmpaddr) && (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { ixl_del_all_vlan_filters(vsi, hw->mac.addr); @@ -1013,7 +1013,7 @@ ixl_if_stop(if_ctx_t ctx) { struct ixl_pf *pf = iflib_get_softc(ctx); - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct ixl_vsi *vsi = &pf->vsi; INIT_DEBUGOUT("ixl_if_stop: begin\n"); @@ -1639,7 +1639,7 @@ { struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct i40e_hw *hw = vsi->hw; int err; bool uni = FALSE, multi = FALSE; diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -422,7 +422,7 @@ struct ixl_vsi { if_ctx_t ctx; if_softc_ctx_t shared; - struct ifnet *ifp; + if_t ifp; device_t dev; struct i40e_hw *hw; struct ifmedia *media; diff --git a/sys/dev/ixl/ixl_iw.c b/sys/dev/ixl/ixl_iw.c --- a/sys/dev/ixl/ixl_iw.c +++ b/sys/dev/ixl/ixl_iw.c @@ -165,7 +165,7 @@ pf_info->dev = pf->dev; pf_info->pci_mem = pf->pci_mem; pf_info->pf_id = pf->hw.pf_id; - pf_info->mtu = pf->vsi.ifp->if_mtu; + pf_info->mtu = pf->vsi.if_getmtu(ifp); pf_info->iw_msix.count = IXL_IW_VEC_COUNT(pf); pf_info->iw_msix.base = IXL_IW_VEC_BASE(pf); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -352,14 +352,14 @@ struct ixl_vsi *vsi = &pf->vsi; if_ctx_t ctx = vsi->ctx; struct i40e_hw *hw = &pf->hw; - struct ifnet *ifp = iflib_get_ifp(ctx); + if_t ifp = iflib_get_ifp(ctx); struct i40e_aq_get_phy_abilities_resp abilities; enum i40e_status_code aq_error = 0; INIT_DBG_DEV(dev, "begin"); vsi->shared->isc_max_frame_size = - ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + if_getmtu(ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN; if (IXL_PF_IN_RECOVERY_MODE(pf)) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -530,7 +530,7 @@ void ixl_add_multi(struct ixl_vsi *vsi) { - struct ifnet *ifp = vsi->ifp; + if_t ifp = vsi->ifp; struct i40e_hw *hw = vsi->hw; int mcnt = 0; struct ixl_add_maddr_arg cb_arg; @@ -571,7 +571,7 @@ ixl_del_multi(struct ixl_vsi *vsi, bool all) { struct ixl_ftl_head to_del; - struct ifnet *ifp = vsi->ifp; + if_t ifp = vsi->ifp; struct ixl_mac_filter *f, *fn; int mcnt = 0; @@ -597,7 +597,7 @@ ixl_link_up_msg(struct ixl_pf *pf) { struct i40e_hw *hw = &pf->hw; - struct ifnet *ifp = pf->vsi.ifp; + if_t ifp = pf->vsi.ifp; char *req_fec_string, *neg_fec_string; u8 fec_abilities; @@ -618,7 +618,7 @@ neg_fec_string = ixl_fec_string[2]; log(LOG_NOTICE, "%s: Link is up, %s Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg: %s, Flow Control: %s\n", - ifp->if_xname, + if_name(ifp), ixl_link_speed_string(hw->phy.link_info.link_speed), req_fec_string, neg_fec_string, (hw->phy.link_info.an_info & I40E_AQ_AN_COMPLETED) ? "True" : "False", @@ -1919,7 +1919,7 @@ ixl_handle_empr_reset(struct ixl_pf *pf) { struct ixl_vsi *vsi = &pf->vsi; - bool is_up = !!(vsi->ifp->if_drv_flags & IFF_DRV_RUNNING); + bool is_up = !!(if_getdrvflags(vsi->ifp) & IFF_DRV_RUNNING); ixl_prepare_for_reset(pf, is_up); /* diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -1196,7 +1196,7 @@ static void vmxnet3_reinit_shared_data(struct vmxnet3_softc *sc) { - struct ifnet *ifp; + if_t ifp; struct vmxnet3_driver_shared *ds; if_softc_ctx_t scctx; @@ -1204,16 +1204,16 @@ ds = sc->vmx_ds; scctx = sc->vmx_scctx; - ds->mtu = ifp->if_mtu; + ds->mtu = if_getmtu(ifp); ds->ntxqueue = scctx->isc_ntxqsets; ds->nrxqueue = scctx->isc_nrxqsets; ds->upt_features = 0; - if (ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) + if (if_getcapenable(ifp) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) ds->upt_features |= UPT1_F_CSUM; - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) ds->upt_features |= UPT1_F_VLAN; - if (ifp->if_capenable & IFCAP_LRO) + if (if_getcapenable(ifp) & IFCAP_LRO) ds->upt_features |= UPT1_F_LRO; if (sc->vmx_flags & VMXNET3_FLAG_RSS) { @@ -1923,13 +1923,13 @@ static void vmxnet3_reinit_rxfilters(struct vmxnet3_softc *sc) { - struct ifnet *ifp; + if_t ifp; ifp = sc->vmx_ifp; vmxnet3_set_rxfilter(sc, if_getflags(ifp)); - if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) bcopy(sc->vmx_vlan_filter, sc->vmx_ds->vlan_filter, sizeof(sc->vmx_ds->vlan_filter)); else @@ -1946,7 +1946,7 @@ sc = iflib_get_softc(ctx); /* Use the current MAC address. */ - bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); + bcopy(if_getlladdr(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); vmxnet3_reinit_shared_data(sc); @@ -2115,7 +2115,7 @@ static void vmxnet3_set_rxfilter(struct vmxnet3_softc *sc, int flags) { - struct ifnet *ifp; + if_t ifp; struct vmxnet3_driver_shared *ds; u_int mode; diff --git a/sys/dev/vmware/vmxnet3/if_vmxvar.h b/sys/dev/vmware/vmxnet3/if_vmxvar.h --- a/sys/dev/vmware/vmxnet3/if_vmxvar.h +++ b/sys/dev/vmware/vmxnet3/if_vmxvar.h @@ -114,7 +114,7 @@ if_ctx_t vmx_ctx; if_shared_ctx_t vmx_sctx; if_softc_ctx_t vmx_scctx; - struct ifnet *vmx_ifp; + if_t vmx_ifp; struct vmxnet3_driver_shared *vmx_ds; uint32_t vmx_flags; #define VMXNET3_FLAG_RSS 0x0002 diff --git a/sys/net/iflib.c b/sys/net/iflib.c --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -801,7 +801,7 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) { if_t ifp = na->ifp; - if_ctx_t ctx = ifp->if_softc; + if_ctx_t ctx = if_getsoftc(ifp); int status; CTX_LOCK(ctx); @@ -826,7 +826,7 @@ iflib_init_locked(ctx); IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); // XXX why twice ? - status = ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1; + status = if_getdrvflags(ifp) & IFF_DRV_RUNNING ? 0 : 1; if (status) nm_clear_native_flags(na); CTX_UNLOCK(ctx); @@ -837,7 +837,7 @@ iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) { if_t ifp = na->ifp; - if_ctx_t ctx = ifp->if_softc; + if_ctx_t ctx = if_getsoftc(ifp); iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; iflib_fl_t fl = &rxq->ifr_fl[0]; @@ -1002,7 +1002,7 @@ */ u_int report_frequency = kring->nkr_num_slots >> 1; /* device-specific */ - if_ctx_t ctx = ifp->if_softc; + if_ctx_t ctx = if_getsoftc(ifp); iflib_txq_t txq = &ctx->ifc_txqs[kring->ring_id]; bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, @@ -1174,7 +1174,7 @@ int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; int i = 0, rx_bytes = 0, rx_pkts = 0; - if_ctx_t ctx = ifp->if_softc; + if_ctx_t ctx = if_getsoftc(ifp); if_shared_ctx_t sctx = ctx->ifc_sctx; if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; @@ -1293,7 +1293,7 @@ static void iflib_netmap_intr(struct netmap_adapter *na, int onoff) { - if_ctx_t ctx = na->ifp->if_softc; + if_ctx_t ctx = if_getsoftc(na->ifp); CTX_LOCK(ctx); if (onoff) { @@ -2888,7 +2888,7 @@ static void iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4, bool *v6) { - CURVNET_SET(lc->ifp->if_vnet); + CURVNET_SET(lc->ifp->if_vnet); /* XXX - DRVAPI */ #if defined(INET6) *v6 = V_ip6_forwarding; #endif @@ -2978,7 +2978,7 @@ } /* pfil needs the vnet to be set */ - CURVNET_SET_QUIET(ifp->if_vnet); + CURVNET_SET_QUIET(ifp->if_vnet); /* XXX - DRVAPI */ for (budget_left = budget; budget_left > 0 && avail > 0;) { if (__predict_false(!CTX_ACTIVE(ctx))) { DBG_COUNTER_INC(rx_ctx_inactive); @@ -3051,7 +3051,7 @@ if (!lro_possible) { lro_possible = iflib_check_lro_possible(m, v4_forwarding, v6_forwarding); if (lro_possible && mf != NULL) { - ifp->if_input(ifp, mf); + if_input(ifp, mf); DBG_COUNTER_INC(rx_if_input); mt = mf = NULL; } @@ -3064,7 +3064,7 @@ } #endif if (lro_possible) { - ifp->if_input(ifp, m); + if_input(ifp, m); DBG_COUNTER_INC(rx_if_input); continue; } @@ -3076,7 +3076,7 @@ mt = m; } if (mf != NULL) { - ifp->if_input(ifp, mf); + if_input(ifp, mf); DBG_COUNTER_INC(rx_if_input); } @@ -4015,7 +4015,7 @@ bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); - if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) + if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))) break; ETHER_BPF_MTAP(ifp, m); rang = iflib_txd_db_check(txq, false); @@ -4101,7 +4101,7 @@ goto skip_ifmp; #endif #ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) + if (ALTQ_IS_ENABLED(&ifp->if_snd)) /* XXX - DRVAPI */ iflib_altq_if_start(ifp); #endif if (txq->ift_db_pending) @@ -4283,7 +4283,7 @@ int err, qidx; int abdicate; - if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { + if (__predict_false((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) { DBG_COUNTER_INC(tx_frees); m_freem(m); return (ENETDOWN); @@ -4401,7 +4401,7 @@ static void iflib_altq_if_start(if_t ifp) { - struct ifaltq *ifq = &ifp->if_snd; + struct ifaltq *ifq = &ifp->if_snd; /* XXX - DRVAPI */ struct mbuf *m; IFQ_LOCK(ifq); @@ -4418,8 +4418,8 @@ { int err; - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_ENQUEUE(&ifp->if_snd, m, err); + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { /* XXX - DRVAPI */ + IFQ_ENQUEUE(&ifp->if_snd, m, err); /* XXX - DRVAPI */ if (err == 0) iflib_altq_if_start(ifp); } else @@ -4847,7 +4847,7 @@ pa.pa_version = PFIL_VERSION; pa.pa_flags = PFIL_IN; pa.pa_type = PFIL_TYPE_ETHERNET; - pa.pa_headname = ctx->ifc_ifp->if_xname; + pa.pa_headname = if_name(ctx->ifc_ifp); pfil = pfil_head_register(&pa); for (i = 0, rxq = ctx->ifc_rxqs; i < NRXQSETS(ctx); i++, rxq++) { @@ -5490,7 +5490,7 @@ if_setcapabilities(ifp, scctx->isc_capabilities | IFCAP_HWSTATS | IFCAP_LINKSTATE); if_setcapenable(ifp, scctx->isc_capenable | IFCAP_HWSTATS | IFCAP_LINKSTATE); - ifp->if_flags |= IFF_NOGROUP; + if_setflagbits(ifp, IFF_NOGROUP, 0); if (sctx->isc_flags & IFLIB_PSEUDO) { ifmedia_add(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(ctx->ifc_mediap, IFM_ETHER | IFM_AUTO);