Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172339879
D59601.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D59601.diff
View Options
diff --git a/sys/dev/aq/aq_irq.c b/sys/dev/aq/aq_irq.c
--- a/sys/dev/aq/aq_irq.c
+++ b/sys/dev/aq/aq_irq.c
@@ -357,7 +357,7 @@
}
/* A stopped or half-initialized interface has no link. */
- running = (if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING) != 0;
+ running = iflib_is_running(ctx);
if (!running || aq_dev->init_failed)
link_speed = 0;
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
@@ -357,7 +357,7 @@
pdata->phy_link);
if (mii == NULL || ifp == NULL ||
- (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+ !iflib_is_running(sc->ctx))
return;
if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
@@ -2357,11 +2357,9 @@
{
struct axgbe_if_softc *sc = iflib_get_softc(ctx);
struct xgbe_prv_data *pdata = &sc->pdata;
- 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), if_getdrvflags(ifp),
- flags);
+ axgbe_printf(1, "%s: MAC_PFR 0x%x if_flags 0x%x\n",
+ __func__, XGMAC_IOREAD(pdata, MAC_PFR), flags);
if (flags & IFF_PROMISC) {
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
--- a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c
@@ -899,7 +899,7 @@
if_t ifp = iflib_get_ifp(ctx);
struct bnxt_softc *softc = iflib_get_softc(ctx);
bool admin_up = !!(if_getflags(ifp) & IFF_UP);
- bool running = !!(if_getdrvflags(ifp) & IFF_DRV_RUNNING);
+ bool running = iflib_is_running(ctx);
if (!admin_up || !running) {
device_printf(softc->dev, "PF is down, rejecting VF creation\n");
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c b/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
--- a/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
@@ -1283,7 +1283,7 @@
p += 2;
}
- if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)
+ if (iflib_is_running(softc->ctx))
bnxt_hwrm_rss_cfg(softc, &softc->vnic_info,
softc->vnic_info.rss_hash_type);
@@ -1338,7 +1338,7 @@
}
if (type != softc->vnic_info.rss_hash_type) {
softc->vnic_info.rss_hash_type = type;
- if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)
+ if (iflib_is_running(softc->ctx))
bnxt_hwrm_rss_cfg(softc, &softc->vnic_info,
softc->vnic_info.rss_hash_type);
}
@@ -1365,7 +1365,7 @@
else
softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_BD_STALL;
- if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)
+ if (iflib_is_running(softc->ctx))
rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info);
return rc;
@@ -1390,7 +1390,7 @@
else
softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_VLAN_STRIP;
- if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)
+ if (iflib_is_running(softc->ctx))
rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info);
return rc;
@@ -1675,7 +1675,7 @@
if (rc || !req->newptr) \
return rc; \
\
- if ((if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)) \
+ if (iflib_is_running(softc->ctx)) \
return EBUSY; \
\
if (!(softc->flags & BNXT_FLAG_TPA)) \
diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re.h b/sys/dev/bnxt/bnxt_re/bnxt_re.h
--- a/sys/dev/bnxt/bnxt_re/bnxt_re.h
+++ b/sys/dev/bnxt/bnxt_re/bnxt_re.h
@@ -933,7 +933,7 @@
static inline enum ib_port_state bnxt_re_get_link_state(struct bnxt_re_dev *rdev)
{
- if (if_getdrvflags(rdev->netdev) & IFF_DRV_RUNNING &&
+ if (iflib_is_running(rdev->en_dev->softc->ctx) &&
if_getlinkstate(rdev->netdev) == LINK_STATE_UP)
return IB_PORT_ACTIVE;
return IB_PORT_DOWN;
diff --git a/sys/dev/bnxt/bnxt_re/main.c b/sys/dev/bnxt/bnxt_re/main.c
--- a/sys/dev/bnxt/bnxt_re/main.c
+++ b/sys/dev/bnxt/bnxt_re/main.c
@@ -66,6 +66,7 @@
MODULE_DEPEND(bnxt_re, linuxkpi, 1, 1, 1);
MODULE_DEPEND(bnxt_re, ibcore, 1, 1, 1);
MODULE_DEPEND(bnxt_re, if_bnxt, 1, 1, 1);
+MODULE_DEPEND(bnxt_re, iflib, 1, 1, 1);
MODULE_VERSION(bnxt_re, 1);
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
@@ -8631,7 +8631,6 @@
em_print_debug_info(struct e1000_softc *sc)
{
device_t dev = iflib_get_dev(sc->ctx);
- if_t ifp = iflib_get_ifp(sc->ctx);
struct tx_ring *txr;
struct rx_ring *rxr;
@@ -8639,15 +8638,8 @@
device_printf(dev, "queue state is unavailable\n");
return;
}
- if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
- printf("Interface is RUNNING ");
- else
- printf("Interface is NOT RUNNING\n");
-
- if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE)
- printf("and INACTIVE\n");
- else
- printf("and ACTIVE\n");
+ device_printf(dev, "iflib software admission: %s\n",
+ iflib_is_running(sc->ctx) ? "open" : "closed");
for (int i = 0; i < sc->tx_num_queues; i++) {
txr = &sc->tx_queues[i].txr;
diff --git a/sys/dev/e1000/if_igbv.c b/sys/dev/e1000/if_igbv.c
--- a/sys/dev/e1000/if_igbv.c
+++ b/sys/dev/e1000/if_igbv.c
@@ -446,7 +446,7 @@
dev = iflib_get_dev(ctx);
KASSERT(sc->vf_ifp, ("%s called for a PF", __func__));
- if ((if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING) == 0 ||
+ if (!iflib_is_running(ctx) ||
!sc->vf_queues_sanitized ||
atomic_load_acq_32(&sc->vf_mbx_ready) == 0) {
if (sc->link_state != EM_LINK_STATE_DOWN) {
@@ -508,9 +508,8 @@
atomic_readandclear_32(&sc->stats_pending) != 0;
if (timer_tick) {
em_update_stats_counters(sc);
- /* iflib clears RUNNING before stop; do not replay after reset. */
- if ((if_getdrvflags(iflib_get_ifp(ctx)) &
- IFF_DRV_RUNNING) != 0)
+ /* iflib closes admission before stop; do not replay after reset. */
+ if (iflib_is_running(ctx))
igbv_vlan_retry_tick(sc);
}
}
diff --git a/sys/dev/enic/if_enic.c b/sys/dev/enic/if_enic.c
--- a/sys/dev/enic/if_enic.c
+++ b/sys/dev/enic/if_enic.c
@@ -877,11 +877,9 @@
enic_rxq_intr(void *rxq)
{
struct vnic_rq *rq;
- if_t ifp;
rq = (struct vnic_rq *)rxq;
- ifp = iflib_get_ifp(rq->vdev->softc->ctx);
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+ if (!iflib_is_running(rq->vdev->softc->ctx))
return (FILTER_HANDLED);
return (FILTER_SCHEDULE_THREAD);
diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c
--- a/sys/dev/iavf/if_iavf_iflib.c
+++ b/sys/dev/iavf/if_iavf_iflib.c
@@ -1558,10 +1558,9 @@
struct iavf_sc *sc = iavf_sc_from_ctx(ctx);
struct iavf_hw *hw = &sc->hw;
struct iavf_vsi *vsi = &sc->vsi;
- if_t ifp = iflib_get_ifp(ctx);
u16 pending = 0;
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 ||
+ if (!iflib_is_running(ctx) ||
atomic_load_acq_32(&sc->mbx_ready) == 0) {
if (vsi->link_active) {
vsi->link_active = false;
@@ -2075,11 +2074,9 @@
iavf_update_link_status(struct iavf_sc *sc)
{
struct iavf_vsi *vsi = &sc->vsi;
- if_t ifp;
u64 baudrate;
- ifp = iflib_get_ifp(vsi->ctx);
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
+ if (!iflib_is_running(vsi->ctx)) {
if (vsi->link_active) {
vsi->link_active = false;
iflib_link_state_change(vsi->ctx, LINK_STATE_DOWN, 0);
@@ -2419,7 +2416,7 @@
}
#ifdef IAVF_DEBUG
-#define CTX_ACTIVE(ctx) ((if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING))
+#define CTX_ACTIVE(ctx) iflib_is_running(ctx)
/**
* iavf_sysctl_vf_reset - Request a VF reset
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
@@ -2610,7 +2610,7 @@
}
/* determine if the iflib context is active */
-#define CTX_ACTIVE(ctx) ((if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING))
+#define CTX_ACTIVE(ctx) iflib_is_running(ctx)
/**
* ice_rebuild_recovery_mode - Rebuild driver state while in recovery mode
diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -3887,17 +3887,9 @@
igc_print_debug_info(struct igc_softc *sc)
{
device_t dev = iflib_get_dev(sc->ctx);
- if_t ifp = iflib_get_ifp(sc->ctx);
- if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
- printf("Interface is RUNNING ");
- else
- printf("Interface is NOT RUNNING\n");
-
- if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE)
- printf("and INACTIVE\n");
- else
- printf("and ACTIVE\n");
+ device_printf(dev, "iflib software admission: %s\n",
+ iflib_is_running(sc->ctx) ? "open" : "closed");
for (int i = 0; i < sc->tx_num_queues; i++) {
device_printf(dev, "TX Queue %d ------\n", i);
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -2973,10 +2973,9 @@
{
struct ix_rx_queue *que = arg;
struct ixgbe_softc *sc = que->sc;
- if_t ifp = iflib_get_ifp(que->sc->ctx);
/* Protect against spurious interrupts */
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+ if (!iflib_is_running(sc->ctx))
return (FILTER_HANDLED);
ixgbe_disable_queue(sc, que->msix);
@@ -5226,7 +5225,7 @@
* MOD and firmware events can produce dependent requests. Fold those
* into the claimed batch so link state is sampled after any link setup.
*/
- if ((if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING) != 0 &&
+ if (iflib_is_running(ctx) &&
(sc->iov_mbx_cleanup_pending || ixgbe_mbx_pending(sc)))
atomic_set_32(&sc->task_requests, IXGBE_REQUEST_TASK_MBX);
for (pass = 0; pass < IXGBE_ADMIN_TASK_BUDGET; pass++) {
@@ -5245,7 +5244,7 @@
ixgbe_handle_msf(ctx);
/* A reset request can re-enable VF traffic; skip it while stopped. */
if ((requests & IXGBE_REQUEST_TASK_MBX) != 0 &&
- (if_getdrvflags(iflib_get_ifp(ctx)) & IFF_DRV_RUNNING) != 0)
+ iflib_is_running(ctx))
ixgbe_handle_mbx(ctx);
if (requests & IXGBE_REQUEST_TASK_FDIR)
ixgbe_reinit_fdir(ctx);
@@ -5683,7 +5682,7 @@
/* Updating SRRCTL on a live queue is itself an MDD violation. */
mdd_active = sc->num_rx_queues > 1 &&
(sc->feat_en & IXGBE_FEATURE_SRIOV) != 0 &&
- (if_getdrvflags(iflib_get_ifp(sc->ctx)) & IFF_DRV_RUNNING) != 0;
+ iflib_is_running(sc->ctx);
if (mdd_active)
ixgbe_disable_mdd(&sc->hw);
if (sc->num_rx_queues > 1) {
@@ -6004,7 +6003,7 @@
}
/* Re-initialize hardware if it's already running */
- if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
+ if (iflib_is_running(sc->ctx))
if_init(ifp, ifp);
return (0);
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -1187,11 +1187,9 @@
ixv_if_promisc_set(if_ctx_t ctx, int flags)
{
struct ixgbe_softc *sc;
- if_t ifp;
sc = iflib_get_softc(ctx);
- ifp = iflib_get_ifp(ctx);
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+ if (!iflib_is_running(ctx))
return (0);
if (ixv_update_xcast_mode(sc, flags) != IXGBE_SUCCESS)
return (EOPNOTSUPP);
@@ -1306,12 +1304,11 @@
{
struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
- if_t ifp = iflib_get_ifp(ctx);
bool check_link, reset_seen;
s32 status;
uint64_t baudrate;
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0 ||
+ if (!iflib_is_running(ctx) ||
atomic_load_acq_32(&sc->vf_mbx_ready) == 0) {
if (sc->link_active) {
sc->link_active = false;
@@ -1391,8 +1388,8 @@
}
}
- /* iflib clears RUNNING before stop; do not replay after VF reset. */
- if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0 &&
+ /* iflib closes admission before stop; do not replay after VF reset. */
+ if (iflib_is_running(ctx) &&
atomic_readandclear_32(&sc->vf_vlan_retry_tick) != 0)
ixv_vlan_retry_tick(sc);
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
@@ -2054,7 +2054,7 @@
ixl_handle_empr_reset(struct ixl_pf *pf)
{
struct ixl_vsi *vsi = &pf->vsi;
- bool is_up = !!(if_getdrvflags(vsi->ifp) & IFF_DRV_RUNNING);
+ bool is_up = iflib_is_running(vsi->ctx);
ixl_prepare_for_reset(pf, is_up);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 18, 8:21 PM (20 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39169697
Default Alt Text
D59601.diff (11 KB)
Attached To
Mode
D59601: iflib: Use the framework run-state accessor in drivers
Attached
Detach File
Event Timeline
Log In to Comment