aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/axgbe/if_axgbe.c44
-rw-r--r--sys/dev/axgbe/if_axgbe_pci.c19
-rw-r--r--sys/dev/axgbe/xgbe-dev.c2
-rw-r--r--sys/dev/axgbe/xgbe-drv.c2
-rw-r--r--sys/dev/axgbe/xgbe-phy-v2.c8
-rw-r--r--sys/dev/axgbe/xgbe.h6
-rw-r--r--sys/dev/e1000/if_em.c22
-rw-r--r--sys/dev/ice/ice_lib.c2
-rw-r--r--sys/dev/ice/ice_rdma.c2
-rw-r--r--sys/dev/ice/if_ice_iflib.c8
-rw-r--r--sys/dev/ixl/if_ixl.c12
-rw-r--r--sys/dev/ixl/ixl.h2
-rw-r--r--sys/dev/ixl/ixl_iw.c2
-rw-r--r--sys/dev/ixl/ixl_pf_iflib.c4
-rw-r--r--sys/dev/ixl/ixl_pf_main.c10
-rw-r--r--sys/dev/vmware/vmxnet3/if_vmx.c18
-rw-r--r--sys/dev/vmware/vmxnet3/if_vmxvar.h2
-rw-r--r--sys/net/iflib.c38
18 files changed, 102 insertions, 101 deletions
diff --git a/sys/dev/axgbe/if_axgbe.c b/sys/dev/axgbe/if_axgbe.c
index 342041c9dec4..ef572bf62aea 100644
--- a/sys/dev/axgbe/if_axgbe.c
+++ b/sys/dev/axgbe/if_axgbe.c
@@ -130,20 +130,20 @@ static void
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 @@ axgbe_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
}
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 @@ axgbe_media_change(struct ifnet *ifp)
}
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 @@ axgbe_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
}
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 @@ static int
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 @@ axgbe_attach(device_t dev)
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
index 4b0bdaa030a6..1bc716d32aea 100644
--- a/sys/dev/axgbe/if_axgbe_pci.c
+++ b/sys/dev/axgbe/if_axgbe_pci.c
@@ -342,14 +342,14 @@ axgbe_miibus_statchg(device_t dev)
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 @@ axgbe_if_attach_post(if_ctx_t ctx)
{
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 @@ axgbe_if_attach_post(if_ctx_t ctx)
*/
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 @@ axgbe_if_promisc_set(if_ctx_t ctx, int flags)
{
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 @@ static uint64_t
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
index 95161802ed8e..5787db4f0441 100644
--- a/sys/dev/axgbe/xgbe-dev.c
+++ b/sys/dev/axgbe/xgbe-dev.c
@@ -2029,7 +2029,7 @@ xgbe_config_queue_mapping(struct xgbe_prv_data *pdata)
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
index 017c3c9bc6ac..6de58ee83621 100644
--- a/sys/dev/axgbe/xgbe-drv.c
+++ b/sys/dev/axgbe/xgbe-drv.c
@@ -118,7 +118,7 @@ __FBSDID("$FreeBSD$");
#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
index df8a75a145b9..6ee673af6e35 100644
--- a/sys/dev/axgbe/xgbe-phy-v2.c
+++ b/sys/dev/axgbe/xgbe-phy-v2.c
@@ -3409,13 +3409,13 @@ xgbe_phy_reset(struct xgbe_prv_data *pdata)
}
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 @@ axgbe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
}
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 @@ axgbe_ifmedia_upd(struct ifnet *ifp)
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
index 85b4c0c5c5d0..32bac28dd093 100644
--- a/sys/dev/axgbe/xgbe.h
+++ b/sys/dev/axgbe/xgbe.h
@@ -1010,7 +1010,7 @@ struct xgbe_version_data {
};
struct xgbe_prv_data {
- struct ifnet *netdev;
+ if_t netdev;
struct platform_device *pdev;
struct acpi_device *adev;
@@ -1310,7 +1310,7 @@ struct axgbe_if_softc {
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_get_all_hw_features(struct xgbe_prv_data *);
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
index b7a9052e0ec1..3be1aaeb362e 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1292,7 +1292,7 @@ em_if_init(if_ctx_t ctx)
{
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 @@ static int
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 @@ static void
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 @@ em_reset(if_ctx_t ctx)
{
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 @@ em_reset(if_ctx_t ctx)
}
/* 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 @@ igb_initialize_rss_mapping(struct e1000_softc *sc)
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 @@ em_initialize_receive_unit(if_ctx_t ctx)
{
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 @@ em_initialize_receive_unit(if_ctx_t ctx)
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 @@ em_setup_vlan_hw_support(if_ctx_t ctx)
{
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 @@ static uint64_t
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 @@ static void
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
index f562b3b55b63..1fec783cd429 100644
--- a/sys/dev/ice/ice_lib.c
+++ b/sys/dev/ice/ice_lib.c
@@ -6942,7 +6942,7 @@ ice_link_up_msg(struct ice_softc *sc)
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
index 5d89deed0f90..0f06cd700663 100644
--- a/sys/dev/ice/ice_rdma.c
+++ b/sys/dev/ice/ice_rdma.c
@@ -738,7 +738,7 @@ ice_rdma_pf_init(struct ice_softc *sc)
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
index 5e5034664251..bc28d7889feb 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -729,7 +729,7 @@ ice_if_attach_post(if_ctx_t ctx)
*/
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 @@ ice_prepare_for_reset(struct ice_softc *sc)
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 @@ ice_rebuild_recovery_mode(struct ice_softc *sc)
/* 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 @@ ice_rebuild(struct ice_softc *sc)
/* 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
index 352a35d95512..9df1d9792e51 100644
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -905,14 +905,14 @@ ixl_if_suspend(if_ctx_t ctx)
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 @@ ixl_if_init(if_ctx_t ctx)
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 @@ ixl_if_init(if_ctx_t ctx)
}
/* 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 @@ void
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 @@ ixl_if_promisc_set(if_ctx_t ctx, int flags)
{
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
index 9828760e4ea6..641ce6b10fcc 100644
--- a/sys/dev/ixl/ixl.h
+++ b/sys/dev/ixl/ixl.h
@@ -422,7 +422,7 @@ LIST_HEAD(ixl_ftl_head, ixl_mac_filter);
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
index 5e2d7cfcb30b..d4129808cc28 100644
--- a/sys/dev/ixl/ixl_iw.c
+++ b/sys/dev/ixl/ixl_iw.c
@@ -165,7 +165,7 @@ ixl_iw_pf_init(struct ixl_pf *pf)
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
index 6ea20389c547..eeb8f28393c2 100644
--- a/sys/dev/ixl/ixl_pf_iflib.c
+++ b/sys/dev/ixl/ixl_pf_iflib.c
@@ -352,14 +352,14 @@ ixl_setup_interface(device_t dev, struct ixl_pf *pf)
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
index 0b1604cc4918..7b1bf78dac09 100644
--- a/sys/dev/ixl/ixl_pf_main.c
+++ b/sys/dev/ixl/ixl_pf_main.c
@@ -530,7 +530,7 @@ ixl_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
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 @@ void
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 @@ void
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 @@ ixl_link_up_msg(struct ixl_pf *pf)
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 @@ void
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
index 6896bd016f00..c28368bc09dc 100644
--- a/sys/dev/vmware/vmxnet3/if_vmx.c
+++ b/sys/dev/vmware/vmxnet3/if_vmx.c
@@ -1196,7 +1196,7 @@ vmxnet3_reinit_rss_shared_data(struct vmxnet3_softc *sc)
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 @@ vmxnet3_reinit_shared_data(struct vmxnet3_softc *sc)
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 @@ vmxnet3_enable_device(struct vmxnet3_softc *sc)
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 @@ vmxnet3_init(if_ctx_t ctx)
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 @@ vmxnet3_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count)
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
index 9811ae42534d..65f876cc21dc 100644
--- a/sys/dev/vmware/vmxnet3/if_vmxvar.h
+++ b/sys/dev/vmware/vmxnet3/if_vmxvar.h
@@ -114,7 +114,7 @@ struct vmxnet3_softc {
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
index b0701c1eb63c..3b743caa34e0 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -801,7 +801,7 @@ static int
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_netmap_register(struct netmap_adapter *na, int onoff)
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 @@ static int
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 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags)
*/
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 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags)
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 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags)
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 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri)
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 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
}
/* 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 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
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 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
}
#endif
if (lro_possible) {
- ifp->if_input(ifp, m);
+ if_input(ifp, m);
DBG_COUNTER_INC(rx_if_input);
continue;
}
@@ -3076,7 +3076,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget)
mt = m;
}
if (mf != NULL) {
- ifp->if_input(ifp, mf);
+ if_input(ifp, mf);
DBG_COUNTER_INC(rx_if_input);
}
@@ -4015,7 +4015,7 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx)
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 @@ _task_fn_tx(void *context)
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 @@ iflib_if_transmit(if_t ifp, struct mbuf *m)
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 @@ iflib_if_transmit(if_t ifp, struct mbuf *m)
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 @@ iflib_altq_if_transmit(if_t ifp, struct mbuf *m)
{
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 @@ iflib_add_pfil(if_ctx_t ctx)
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 @@ iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp,
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);