From nobody Wed Dec 21 14:36:44 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NcbcF0Kf9z1H4qZ; Wed, 21 Dec 2022 14:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NcbcD6sZjz4K2v; Wed, 21 Dec 2022 14:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671633404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DOjB9IY6jnb2UoU7TqdmX9PFnnNrESPddK9Rnkf2PyM=; b=IVa3VebzYTACgmN9MkSwA3vWXTcdUpfU5pceFe0wnzVievrTCwAc3ed0bm9c/CVviiaqp4 aKWwpG5qU1DMvnBdkd+RU6YYCEKpWnzVo8fWWwXg1NomohgFT9sjWkBbUIPWJAstkehseH JTSlRLtGX3GZgQqYJxj5Acwq4PM+jxIr81ewmA+tWHvuoZW9bRWfSnMvpw0/Z/tbbfvXq1 tH7X5qFen0D5I7rWtjp5svMtxvDsYT0ugk53sKfXIqMWW9i0IIs/cgHFQ2BwxD9yLTf/pR 938plCDBHF+h+ONJu2E6P8iLoi1gvdn9tCKZUYm4sgbnbDNCRHiY8mJv5nZvbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671633404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DOjB9IY6jnb2UoU7TqdmX9PFnnNrESPddK9Rnkf2PyM=; b=wNARoUs/8xP9UBGzRGx0Qt7FUX2Kj6etndVDWo9dxLIebXqUXfZBhzfFL1Z95G6+9PHd6i Crw9warOztXq1wa52+2qJ1y1UFhl5v2uC0lyXyBvLNqc99vgWD9jAlgwy49ebNVjz1gU16 gsgEB71NXNU8F6Xjqb8cKx6B+OVSSmRKAhJImcgWmiDKuAM+7GAKOVGp7RvEFfUFAxXQFb Fa06itS+cSE9tYklxJTP3Fh7obSh+kY6EV91SJvJlObYqffSs3ZciGe0scUpJnfhmK5tM9 0W9fXw9WnEbHYsPKBI8toR3U/leywk0OIG3M8N6vck34R6Hg0F92f3Q9UfOStQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671633404; a=rsa-sha256; cv=none; b=cmFg/Cj8OoVzEXFCbi1LhfUuE2mmLdAt2UY6DW8m6SV1kszx2yfgajLzwkoTch8wKkH0CJ keTesc/qqTPjDyQ1bt+BxjERjs/hviQXY1Yx9aIfXFe7SLeksoY5byQINwuc1jsPMOaPbi od3NWDagehi6dVqpEiNCwCYkmMpIVtxa0VV+dLb5sHFE279gRFMWynXF/3vGb7ebGhU5LL /3F9ev8lhQB/H/Wje2TJZDpthKOXl+sLLna2kTYe4KKSOMb/pBCfOSVTpry7WW8xk3hS6X GBjg/9DAMV7QUFJyy8jEoPvJg9DRocaLT+osBqgEkPseQZJ+n2sf+K3FoI3/AQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NcbcD5rQmzJHs; Wed, 21 Dec 2022 14:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BLEaiJF026193; Wed, 21 Dec 2022 14:36:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BLEaiEA026192; Wed, 21 Dec 2022 14:36:44 GMT (envelope-from git) Date: Wed, 21 Dec 2022 14:36:44 GMT Message-Id: <202212211436.2BLEaiEA026192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 402810d32e5f - main - Convert iflib(4) and iflib-based drivers to the DrvAPI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 402810d32e5f7525c61ef70c6af24817227e1649 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=402810d32e5f7525c61ef70c6af24817227e1649 commit 402810d32e5f7525c61ef70c6af24817227e1649 Author: Justin Hibbits AuthorDate: 2021-10-20 20:49:00 +0000 Commit: Justin Hibbits CommitDate: 2022-12-21 14:20:06 +0000 Convert iflib(4) and iflib-based drivers to the DrvAPI Summary: Convert iflib(4) and the following drivers: * axgbe * em * ice * ixl * vmxnet Sponsored by: Juniper Networks, Inc. Reviewed by: kbowling, #iflib Differential Revision: https://reviews.freebsd.org/D37768 --- sys/dev/axgbe/if_axgbe.c | 44 +++++++++++++++++++------------------- sys/dev/axgbe/if_axgbe_pci.c | 19 ++++++++-------- sys/dev/axgbe/xgbe-dev.c | 2 +- sys/dev/axgbe/xgbe-drv.c | 2 +- sys/dev/axgbe/xgbe-phy-v2.c | 8 +++---- sys/dev/axgbe/xgbe.h | 6 +++--- sys/dev/e1000/if_em.c | 22 +++++++++---------- sys/dev/ice/ice_lib.c | 2 +- sys/dev/ice/ice_rdma.c | 2 +- sys/dev/ice/if_ice_iflib.c | 8 +++---- sys/dev/ixl/if_ixl.c | 12 +++++------ sys/dev/ixl/ixl.h | 2 +- sys/dev/ixl/ixl_iw.c | 2 +- sys/dev/ixl/ixl_pf_iflib.c | 4 ++-- sys/dev/ixl/ixl_pf_main.c | 10 ++++----- sys/dev/vmware/vmxnet3/if_vmx.c | 18 ++++++++-------- sys/dev/vmware/vmxnet3/if_vmxvar.h | 2 +- sys/net/iflib.c | 38 ++++++++++++++++---------------- 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);