aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2021-09-25 23:12:23 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-09-26 18:18:07 +0000
commitb1d5caf3c7504a1ece0498ec3f7360ac760577f7 (patch)
tree89563bb8a3639ebce08513fccf1acbd4ece33da9
parent21ab8c75c940dd15343b4af28b18a66f377e670a (diff)
downloadsrc-b1d5caf3c7504a1ece0498ec3f7360ac760577f7.tar.gz
src-b1d5caf3c7504a1ece0498ec3f7360ac760577f7.zip
ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'
Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type ambiguity in things like kgdb. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32131
-rw-r--r--sys/dev/ixgbe/if_bypass.c186
-rw-r--r--sys/dev/ixgbe/if_fdir.c26
-rw-r--r--sys/dev/ixgbe/if_ix.c1263
-rw-r--r--sys/dev/ixgbe/if_ixv.c602
-rw-r--r--sys/dev/ixgbe/if_sriov.c296
-rw-r--r--sys/dev/ixgbe/ix_txrx.c47
-rw-r--r--sys/dev/ixgbe/ixgbe.h22
-rw-r--r--sys/dev/ixgbe/ixgbe_bypass.h2
-rw-r--r--sys/dev/ixgbe/ixgbe_fdir.h2
-rw-r--r--sys/dev/ixgbe/ixgbe_osdep.c20
-rw-r--r--sys/dev/ixgbe/ixgbe_sriov.h8
11 files changed, 1232 insertions, 1242 deletions
diff --git a/sys/dev/ixgbe/if_bypass.c b/sys/dev/ixgbe/if_bypass.c
index 41669e29d475..7e8848512e05 100644
--- a/sys/dev/ixgbe/if_bypass.c
+++ b/sys/dev/ixgbe/if_bypass.c
@@ -43,11 +43,11 @@
* over other threads.
************************************************************************/
static void
-ixgbe_bypass_mutex_enter(struct adapter *adapter)
+ixgbe_bypass_mutex_enter(struct ixgbe_softc *sc)
{
- while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0)
+ while (atomic_cmpset_int(&sc->bypass.low, 0, 1) == 0)
usec_delay(3000);
- while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
+ while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0)
usec_delay(3000);
return;
} /* ixgbe_bypass_mutex_enter */
@@ -56,11 +56,11 @@ ixgbe_bypass_mutex_enter(struct adapter *adapter)
* ixgbe_bypass_mutex_clear
************************************************************************/
static void
-ixgbe_bypass_mutex_clear(struct adapter *adapter)
+ixgbe_bypass_mutex_clear(struct ixgbe_softc *sc)
{
- while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
+ while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0)
usec_delay(6000);
- while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0)
+ while (atomic_cmpset_int(&sc->bypass.low, 1, 0) == 0)
usec_delay(6000);
return;
} /* ixgbe_bypass_mutex_clear */
@@ -71,9 +71,9 @@ ixgbe_bypass_mutex_clear(struct adapter *adapter)
* Watchdog entry is allowed to simply grab the high priority
************************************************************************/
static void
-ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
+ixgbe_bypass_wd_mutex_enter(struct ixgbe_softc *sc)
{
- while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
+ while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0)
usec_delay(3000);
return;
} /* ixgbe_bypass_wd_mutex_enter */
@@ -82,9 +82,9 @@ ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
* ixgbe_bypass_wd_mutex_clear
************************************************************************/
static void
-ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
+ixgbe_bypass_wd_mutex_clear(struct ixgbe_softc *sc)
{
- while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
+ while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0)
usec_delay(6000);
return;
} /* ixgbe_bypass_wd_mutex_clear */
@@ -115,13 +115,13 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec)
static int
ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int version = 0;
u32 cmd;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) &
BYPASS_CTL2_OFFSET_M;
@@ -131,12 +131,12 @@ ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
cmd &= ~BYPASS_WE;
if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
goto err;
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
version &= BYPASS_CTL2_DATA_M;
error = sysctl_handle_int(oidp, &version, 0, req);
return (error);
err:
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
return (error);
} /* ixgbe_bp_version */
@@ -155,16 +155,16 @@ err:
static int
ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int state = 0;
/* Get the current state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw,
BYPASS_PAGE_CTL0, &state);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error != 0)
return (error);
state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
@@ -182,7 +182,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
default:
return (EINVAL);
}
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_MODE_OFF_M, state) != 0))
goto out;
@@ -190,7 +190,7 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_MODE_OFF_M, BYPASS_AUTO);
out:
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_set_state */
@@ -217,15 +217,15 @@ out:
static int
ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int timeout = 0;
/* Get the current value */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
@@ -246,10 +246,10 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
}
/* Set the new state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_timeout */
@@ -260,15 +260,15 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int main_on = 0;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3;
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
@@ -288,10 +288,10 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
}
/* Set the new state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_main_on */
@@ -302,14 +302,14 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int main_off = 0;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3;
@@ -330,10 +330,10 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
}
/* Set the new state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_main_off */
@@ -344,14 +344,14 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int aux_on = 0;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3;
@@ -372,10 +372,10 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
}
/* Set the new state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_aux_on */
@@ -386,14 +386,14 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int aux_off = 0;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3;
@@ -414,10 +414,10 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
}
/* Set the new state */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
usec_delay(6000);
return (error);
} /* ixgbe_bp_aux_off */
@@ -433,16 +433,16 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int error, tmp;
static int timeout = 0;
u32 mask, arg;
/* Get the current hardware value */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (error);
/*
@@ -489,9 +489,9 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
}
/* Set the new watchdog */
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
return (error);
} /* ixgbe_bp_wd_set */
@@ -504,8 +504,8 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
u32 sec, year;
int cmd, count = 0, error = 0;
int reset_wd = 0;
@@ -522,7 +522,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID;
cmd |= BYPASS_CTL1_OFFTRST;
- ixgbe_bypass_wd_mutex_enter(adapter);
+ ixgbe_bypass_wd_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd);
/* Read until it matches what we wrote, or we time out */
@@ -539,7 +539,7 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
} while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd));
reset_wd = 0;
- ixgbe_bypass_wd_mutex_clear(adapter);
+ ixgbe_bypass_wd_mutex_clear(sc);
return (error);
} /* ixgbe_bp_wd_reset */
@@ -551,8 +551,8 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *) arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
+ struct ixgbe_hw *hw = &sc->hw;
u32 cmd, base, head;
u32 log_off, count = 0;
static int status = 0;
@@ -565,10 +565,10 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
return (error);
/* Keep the log display single-threaded */
- while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0)
+ while (atomic_cmpset_int(&sc->bypass.log, 0, 1) == 0)
usec_delay(3000);
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
/* Find Current head of the log eeprom offset */
cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
@@ -586,7 +586,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
if (error)
goto unlock_err;
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
base = status & BYPASS_CTL2_DATA_M;
head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT;
@@ -601,19 +601,19 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
/* Log 5 bytes store in on u32 and a u8 */
for (i = 0; i < 4; i++) {
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rd_eep(hw, log_off + i,
&data);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (EINVAL);
eeprom[count].logs += data << (8 * i);
}
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rd_eep(hw,
log_off + i, &eeprom[count].actions);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (EINVAL);
@@ -668,7 +668,7 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
time %= (60 * 60);
min = time / 60;
sec = time % 60;
- device_printf(adapter->dev,
+ device_printf(sc->dev,
"UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n",
mon, days, hours, min, sec, event_str[event],
action_str[action]);
@@ -677,14 +677,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
<< BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M;
cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24);
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, cmd, &status);
/* wait for the write to stick */
msec_delay(100);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
if (error)
return (EINVAL);
@@ -692,14 +692,14 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
status = 0; /* reset */
/* Another log command can now run */
- while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0)
+ while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0)
usec_delay(3000);
return (error);
unlock_err:
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
status = 0; /* reset */
- while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0)
+ while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0)
usec_delay(3000);
return (EINVAL);
} /* ixgbe_bp_log */
@@ -711,15 +711,15 @@ unlock_err:
* only enabled for the first port of a bypass adapter.
************************************************************************/
void
-ixgbe_bypass_init(struct adapter *adapter)
+ixgbe_bypass_init(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
- device_t dev = adapter->dev;
+ struct ixgbe_hw *hw = &sc->hw;
+ device_t dev = sc->dev;
struct sysctl_oid *bp_node;
struct sysctl_oid_list *bp_list;
u32 mask, value, sec, year;
- if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS))
+ if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS))
return;
/* First set up time for the hardware */
@@ -733,9 +733,9 @@ ixgbe_bypass_init(struct adapter *adapter)
| BYPASS_CTL1_VALID
| BYPASS_CTL1_OFFTRST;
- ixgbe_bypass_mutex_enter(adapter);
+ ixgbe_bypass_mutex_enter(sc);
hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value);
- ixgbe_bypass_mutex_clear(adapter);
+ ixgbe_bypass_mutex_clear(sc);
/* Now set up the SYSCTL infrastructure */
@@ -748,7 +748,7 @@ ixgbe_bypass_init(struct adapter *adapter)
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "bypass_log",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_log, "I", "Bypass Log");
+ sc, 0, ixgbe_bp_log, "I", "Bypass Log");
/* All other setting are hung from the 'bypass' node */
bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev),
@@ -759,40 +759,40 @@ ixgbe_bypass_init(struct adapter *adapter)
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_version, "I", "Bypass Version");
+ sc, 0, ixgbe_bp_version, "I", "Bypass Version");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_set_state, "I", "Bypass State");
+ sc, 0, ixgbe_bp_set_state, "I", "Bypass State");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout");
+ sc, 0, ixgbe_bp_timeout, "I", "Bypass Timeout");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On");
+ sc, 0, ixgbe_bp_main_on, "I", "Bypass Main On");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off");
+ sc, 0, ixgbe_bp_main_off, "I", "Bypass Main Off");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On");
+ sc, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off");
+ sc, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog");
+ sc, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset");
+ sc, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset");
- adapter->feat_en |= IXGBE_FEATURE_BYPASS;
+ sc->feat_en |= IXGBE_FEATURE_BYPASS;
} /* ixgbe_bypass_init */
diff --git a/sys/dev/ixgbe/if_fdir.c b/sys/dev/ixgbe/if_fdir.c
index 09a5b70464ae..22b71f2bdf09 100644
--- a/sys/dev/ixgbe/if_fdir.c
+++ b/sys/dev/ixgbe/if_fdir.c
@@ -37,33 +37,33 @@
#ifdef IXGBE_FDIR
void
-ixgbe_init_fdir(struct adapter *adapter)
+ixgbe_init_fdir(struct ixgbe_softc *sc)
{
u32 hdrm = 32 << fdir_pballoc;
- if (!(adapter->feat_en & IXGBE_FEATURE_FDIR))
+ if (!(sc->feat_en & IXGBE_FEATURE_FDIR))
return;
- adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm,
+ sc->hw.mac.ops.setup_rxpba(&sc->hw, 0, hdrm,
PBA_STRATEGY_EQUAL);
- ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc);
+ ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc);
} /* ixgbe_init_fdir */
void
ixgbe_reinit_fdir(void *context)
{
if_ctx_t ctx = context;
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
- if (!(adapter->feat_en & IXGBE_FEATURE_FDIR))
+ if (!(sc->feat_en & IXGBE_FEATURE_FDIR))
return;
- if (adapter->fdir_reinit != 1) /* Shouldn't happen */
+ if (sc->fdir_reinit != 1) /* Shouldn't happen */
return;
- ixgbe_reinit_fdir_tables_82599(&adapter->hw);
- adapter->fdir_reinit = 0;
+ ixgbe_reinit_fdir_tables_82599(&sc->hw);
+ sc->fdir_reinit = 0;
/* re-enable flow director interrupts */
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR);
/* Restart the interface */
ifp->if_drv_flags |= IFF_DRV_RUNNING;
} /* ixgbe_reinit_fdir */
@@ -80,7 +80,7 @@ ixgbe_reinit_fdir(void *context)
void
ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
{
- struct adapter *adapter = txr->adapter;
+ struct ixgbe_softc *sc = txr->sc;
struct ix_queue *que;
struct ip *ip;
struct tcphdr *th;
@@ -134,12 +134,12 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
common.flex_bytes ^= etype;
common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr;
- que = &adapter->queues[txr->me];
+ que = &sc->queues[txr->me];
/*
* This assumes the Rx queue and Tx
* queue are bound to the same CPU
*/
- ixgbe_fdir_add_signature_filter_82599(&adapter->hw,
+ ixgbe_fdir_add_signature_filter_82599(&sc->hw,
input, common, que->msix);
} /* ixgbe_atr */
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 42523f82cc01..b3960a129c29 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -109,87 +109,82 @@ static pci_vendor_info_t ixgbe_vendor_info_array[] =
PVID_END
};
-static void *ixgbe_register(device_t dev);
-static int ixgbe_if_attach_pre(if_ctx_t ctx);
-static int ixgbe_if_attach_post(if_ctx_t ctx);
-static int ixgbe_if_detach(if_ctx_t ctx);
-static int ixgbe_if_shutdown(if_ctx_t ctx);
-static int ixgbe_if_suspend(if_ctx_t ctx);
-static int ixgbe_if_resume(if_ctx_t ctx);
-
-static void ixgbe_if_stop(if_ctx_t ctx);
-void ixgbe_if_enable_intr(if_ctx_t ctx);
-static void ixgbe_if_disable_intr(if_ctx_t ctx);
-static void ixgbe_link_intr_enable(if_ctx_t ctx);
-static int ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid);
-static void ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr);
-static int ixgbe_if_media_change(if_ctx_t ctx);
+static void *ixgbe_register(device_t);
+static int ixgbe_if_attach_pre(if_ctx_t);
+static int ixgbe_if_attach_post(if_ctx_t);
+static int ixgbe_if_detach(if_ctx_t);
+static int ixgbe_if_shutdown(if_ctx_t);
+static int ixgbe_if_suspend(if_ctx_t);
+static int ixgbe_if_resume(if_ctx_t);
+
+static void ixgbe_if_stop(if_ctx_t);
+void ixgbe_if_enable_intr(if_ctx_t);
+static void ixgbe_if_disable_intr(if_ctx_t);
+static void ixgbe_link_intr_enable(if_ctx_t);
+static int ixgbe_if_rx_queue_intr_enable(if_ctx_t, uint16_t);
+static void ixgbe_if_media_status(if_ctx_t, struct ifmediareq *);
+static int ixgbe_if_media_change(if_ctx_t);
static int ixgbe_if_msix_intr_assign(if_ctx_t, int);
-static int ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu);
-static void ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int strip);
-static void ixgbe_if_multi_set(if_ctx_t ctx);
-static int ixgbe_if_promisc_set(if_ctx_t ctx, int flags);
-static int ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
- uint64_t *paddrs, int nrxqs, int nrxqsets);
-static int ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
- uint64_t *paddrs, int nrxqs, int nrxqsets);
-static void ixgbe_if_queues_free(if_ctx_t ctx);
-static void ixgbe_if_timer(if_ctx_t ctx, uint16_t);
-static void ixgbe_if_update_admin_status(if_ctx_t ctx);
-static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag);
-static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
-static int ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req);
-static bool ixgbe_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event);
-int ixgbe_intr(void *arg);
+static int ixgbe_if_mtu_set(if_ctx_t, uint32_t);
+static void ixgbe_if_crcstrip_set(if_ctx_t, int, int);
+static void ixgbe_if_multi_set(if_ctx_t);
+static int ixgbe_if_promisc_set(if_ctx_t, int);
+static int ixgbe_if_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int);
+static int ixgbe_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int);
+static void ixgbe_if_queues_free(if_ctx_t);
+static void ixgbe_if_timer(if_ctx_t, uint16_t);
+static void ixgbe_if_update_admin_status(if_ctx_t);
+static void ixgbe_if_vlan_register(if_ctx_t, u16);
+static void ixgbe_if_vlan_unregister(if_ctx_t, u16);
+static int ixgbe_if_i2c_req(if_ctx_t, struct ifi2creq *);
+static bool ixgbe_if_needs_restart(if_ctx_t, enum iflib_restart_event);
+int ixgbe_intr(void *);
/************************************************************************
* Function prototypes
************************************************************************/
-#if __FreeBSD_version >= 1100036
static uint64_t ixgbe_if_get_counter(if_ctx_t, ift_counter);
-#endif
-static void ixgbe_enable_queue(struct adapter *adapter, u32 vector);
-static void ixgbe_disable_queue(struct adapter *adapter, u32 vector);
-static void ixgbe_add_device_sysctls(if_ctx_t ctx);
-static int ixgbe_allocate_pci_resources(if_ctx_t ctx);
-static int ixgbe_setup_low_power_mode(if_ctx_t ctx);
+static void ixgbe_enable_queue(struct ixgbe_softc *, u32);
+static void ixgbe_disable_queue(struct ixgbe_softc *, u32);
+static void ixgbe_add_device_sysctls(if_ctx_t);
+static int ixgbe_allocate_pci_resources(if_ctx_t);
+static int ixgbe_setup_low_power_mode(if_ctx_t);
-static void ixgbe_config_dmac(struct adapter *adapter);
-static void ixgbe_configure_ivars(struct adapter *adapter);
-static void ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector,
- s8 type);
+static void ixgbe_config_dmac(struct ixgbe_softc *);
+static void ixgbe_configure_ivars(struct ixgbe_softc *);
+static void ixgbe_set_ivar(struct ixgbe_softc *, u8, u8, s8);
static u8 *ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
-static bool ixgbe_sfp_probe(if_ctx_t ctx);
+static bool ixgbe_sfp_probe(if_ctx_t);
-static void ixgbe_free_pci_resources(if_ctx_t ctx);
+static void ixgbe_free_pci_resources(if_ctx_t);
-static int ixgbe_msix_link(void *arg);
-static int ixgbe_msix_que(void *arg);
-static void ixgbe_initialize_rss_mapping(struct adapter *adapter);
-static void ixgbe_initialize_receive_units(if_ctx_t ctx);
-static void ixgbe_initialize_transmit_units(if_ctx_t ctx);
+static int ixgbe_msix_link(void *);
+static int ixgbe_msix_que(void *);
+static void ixgbe_initialize_rss_mapping(struct ixgbe_softc *);
+static void ixgbe_initialize_receive_units(if_ctx_t);
+static void ixgbe_initialize_transmit_units(if_ctx_t);
-static int ixgbe_setup_interface(if_ctx_t ctx);
-static void ixgbe_init_device_features(struct adapter *adapter);
-static void ixgbe_check_fan_failure(struct adapter *, u32, bool);
+static int ixgbe_setup_interface(if_ctx_t);
+static void ixgbe_init_device_features(struct ixgbe_softc *);
+static void ixgbe_check_fan_failure(struct ixgbe_softc *, u32, bool);
static void ixgbe_sbuf_fw_version(struct ixgbe_hw *, struct sbuf *);
-static void ixgbe_print_fw_version(if_ctx_t ctx);
-static void ixgbe_add_media_types(if_ctx_t ctx);
-static void ixgbe_update_stats_counters(struct adapter *adapter);
-static void ixgbe_config_link(if_ctx_t ctx);
-static void ixgbe_get_slot_info(struct adapter *);
-static void ixgbe_check_wol_support(struct adapter *adapter);
-static void ixgbe_enable_rx_drop(struct adapter *);
-static void ixgbe_disable_rx_drop(struct adapter *);
-
-static void ixgbe_add_hw_stats(struct adapter *adapter);
-static int ixgbe_set_flowcntl(struct adapter *, int);
-static int ixgbe_set_advertise(struct adapter *, int);
-static int ixgbe_get_advertise(struct adapter *);
-static void ixgbe_setup_vlan_hw_support(if_ctx_t ctx);
-static void ixgbe_config_gpie(struct adapter *adapter);
-static void ixgbe_config_delay_values(struct adapter *adapter);
+static void ixgbe_print_fw_version(if_ctx_t);
+static void ixgbe_add_media_types(if_ctx_t);
+static void ixgbe_update_stats_counters(struct ixgbe_softc *);
+static void ixgbe_config_link(if_ctx_t);
+static void ixgbe_get_slot_info(struct ixgbe_softc *);
+static void ixgbe_check_wol_support(struct ixgbe_softc *);
+static void ixgbe_enable_rx_drop(struct ixgbe_softc *);
+static void ixgbe_disable_rx_drop(struct ixgbe_softc *);
+
+static void ixgbe_add_hw_stats(struct ixgbe_softc *);
+static int ixgbe_set_flowcntl(struct ixgbe_softc *, int);
+static int ixgbe_set_advertise(struct ixgbe_softc *, int);
+static int ixgbe_get_advertise(struct ixgbe_softc *);
+static void ixgbe_setup_vlan_hw_support(if_ctx_t);
+static void ixgbe_config_gpie(struct ixgbe_softc *);
+static void ixgbe_config_delay_values(struct ixgbe_softc *);
/* Sysctl handlers */
static int ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS);
@@ -237,7 +232,7 @@ static device_method_t ix_methods[] = {
};
static driver_t ix_driver = {
- "ix", ix_methods, sizeof(struct adapter),
+ "ix", ix_methods, sizeof(struct ixgbe_softc),
};
devclass_t ix_devclass;
@@ -293,7 +288,7 @@ static device_method_t ixgbe_if_methods[] = {
static SYSCTL_NODE(_hw, OID_AUTO, ix, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
"IXGBE driver parameters");
static driver_t ixgbe_if_driver = {
- "ixgbe_if", ixgbe_if_methods, sizeof(struct adapter)
+ "ixgbe_if", ixgbe_if_methods, sizeof(struct ixgbe_softc)
};
static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY);
@@ -412,33 +407,33 @@ static int
ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
int ntxqs, int ntxqsets)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- if_softc_ctx_t scctx = adapter->shared;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ if_softc_ctx_t scctx = sc->shared;
struct ix_tx_queue *que;
int i, j, error;
- MPASS(adapter->num_tx_queues > 0);
- MPASS(adapter->num_tx_queues == ntxqsets);
+ MPASS(sc->num_tx_queues > 0);
+ MPASS(sc->num_tx_queues == ntxqsets);
MPASS(ntxqs == 1);
/* Allocate queue structure memory */
- adapter->tx_queues =
+ sc->tx_queues =
(struct ix_tx_queue *)malloc(sizeof(struct ix_tx_queue) * ntxqsets,
M_IXGBE, M_NOWAIT | M_ZERO);
- if (!adapter->tx_queues) {
+ if (!sc->tx_queues) {
device_printf(iflib_get_dev(ctx),
"Unable to allocate TX ring memory\n");
return (ENOMEM);
}
- for (i = 0, que = adapter->tx_queues; i < ntxqsets; i++, que++) {
+ for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) {
struct tx_ring *txr = &que->txr;
/* In case SR-IOV is enabled, align the index properly */
- txr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool,
+ txr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool,
i);
- txr->adapter = que->adapter = adapter;
+ txr->sc = que->sc = sc;
/* Allocate report status array */
txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_IXGBE, M_NOWAIT | M_ZERO);
@@ -457,13 +452,13 @@ ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
txr->total_packets = 0;
/* Set the rate at which we sample packets */
- if (adapter->feat_en & IXGBE_FEATURE_FDIR)
+ if (sc->feat_en & IXGBE_FEATURE_FDIR)
txr->atr_sample = atr_sample_rate;
}
device_printf(iflib_get_dev(ctx), "allocated for %d queues\n",
- adapter->num_tx_queues);
+ sc->num_tx_queues);
return (0);
@@ -480,32 +475,32 @@ static int
ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
int nrxqs, int nrxqsets)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ix_rx_queue *que;
int i;
- MPASS(adapter->num_rx_queues > 0);
- MPASS(adapter->num_rx_queues == nrxqsets);
+ MPASS(sc->num_rx_queues > 0);
+ MPASS(sc->num_rx_queues == nrxqsets);
MPASS(nrxqs == 1);
/* Allocate queue structure memory */
- adapter->rx_queues =
+ sc->rx_queues =
(struct ix_rx_queue *)malloc(sizeof(struct ix_rx_queue)*nrxqsets,
M_IXGBE, M_NOWAIT | M_ZERO);
- if (!adapter->rx_queues) {
+ if (!sc->rx_queues) {
device_printf(iflib_get_dev(ctx),
"Unable to allocate TX ring memory\n");
return (ENOMEM);
}
- for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) {
+ for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) {
struct rx_ring *rxr = &que->rxr;
/* In case SR-IOV is enabled, align the index properly */
- rxr->me = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool,
+ rxr->me = ixgbe_vf_que_index(sc->iov_mode, sc->pool,
i);
- rxr->adapter = que->adapter = adapter;
+ rxr->sc = que->sc = sc;
/* get the virtual and physical address of the hw queues */
rxr->tail = IXGBE_RDT(rxr->me);
@@ -516,7 +511,7 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
}
device_printf(iflib_get_dev(ctx), "allocated for %d rx queues\n",
- adapter->num_rx_queues);
+ sc->num_rx_queues);
return (0);
} /* ixgbe_if_rx_queues_alloc */
@@ -527,13 +522,13 @@ ixgbe_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
static void
ixgbe_if_queues_free(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_tx_queue *tx_que = adapter->tx_queues;
- struct ix_rx_queue *rx_que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_tx_queue *tx_que = sc->tx_queues;
+ struct ix_rx_queue *rx_que = sc->rx_queues;
int i;
if (tx_que != NULL) {
- for (i = 0; i < adapter->num_tx_queues; i++, tx_que++) {
+ for (i = 0; i < sc->num_tx_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
if (txr->tx_rsq == NULL)
break;
@@ -542,12 +537,12 @@ ixgbe_if_queues_free(if_ctx_t ctx)
txr->tx_rsq = NULL;
}
- free(adapter->tx_queues, M_IXGBE);
- adapter->tx_queues = NULL;
+ free(sc->tx_queues, M_IXGBE);
+ sc->tx_queues = NULL;
}
if (rx_que != NULL) {
- free(adapter->rx_queues, M_IXGBE);
- adapter->rx_queues = NULL;
+ free(sc->rx_queues, M_IXGBE);
+ sc->rx_queues = NULL;
}
} /* ixgbe_if_queues_free */
@@ -555,15 +550,15 @@ ixgbe_if_queues_free(if_ctx_t ctx)
* ixgbe_initialize_rss_mapping
************************************************************************/
static void
-ixgbe_initialize_rss_mapping(struct adapter *adapter)
+ixgbe_initialize_rss_mapping(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 reta = 0, mrqc, rss_key[10];
int queue_id, table_size, index_mult;
int i, j;
u32 rss_hash_config;
- if (adapter->feat_en & IXGBE_FEATURE_RSS) {
+ if (sc->feat_en & IXGBE_FEATURE_RSS) {
/* Fetch the configured RSS key */
rss_getkey((uint8_t *)&rss_key);
} else {
@@ -574,7 +569,7 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter)
/* Set multiplier for RETA setup and table size based on MAC */
index_mult = 0x1;
table_size = 128;
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_82598EB:
index_mult = 0x11;
break;
@@ -589,17 +584,17 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter)
/* Set up the redirection table */
for (i = 0, j = 0; i < table_size; i++, j++) {
- if (j == adapter->num_rx_queues)
+ if (j == sc->num_rx_queues)
j = 0;
- if (adapter->feat_en & IXGBE_FEATURE_RSS) {
+ if (sc->feat_en & IXGBE_FEATURE_RSS) {
/*
* Fetch the RSS bucket id for the given indirection
* entry. Cap it at the number of configured buckets
* (which is num_rx_queues.)
*/
queue_id = rss_get_indirection_to_bucket(i);
- queue_id = queue_id % adapter->num_rx_queues;
+ queue_id = queue_id % sc->num_rx_queues;
} else
queue_id = (j * index_mult);
@@ -624,7 +619,7 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter)
IXGBE_WRITE_REG(hw, IXGBE_RSSRK(i), rss_key[i]);
/* Perform hash on these packet types */
- if (adapter->feat_en & IXGBE_FEATURE_RSS)
+ if (sc->feat_en & IXGBE_FEATURE_RSS)
rss_hash_config = rss_gethashconfig();
else {
/*
@@ -659,7 +654,7 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter)
mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP;
if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6_EX)
mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_EX_UDP;
- mrqc |= ixgbe_get_mrqc(adapter->iov_mode);
+ mrqc |= ixgbe_get_mrqc(sc->iov_mode);
IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
} /* ixgbe_initialize_rss_mapping */
@@ -671,9 +666,9 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter)
static void
ixgbe_initialize_receive_units(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- if_softc_ctx_t scctx = adapter->shared;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ if_softc_ctx_t scctx = sc->shared;
+ struct ixgbe_hw *hw = &sc->hw;
struct ifnet *ifp = iflib_get_ifp(ctx);
struct ix_rx_queue *que;
int i, j;
@@ -689,7 +684,7 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
/* Enable broadcasts */
fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
fctrl |= IXGBE_FCTRL_BAM;
- if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
+ if (sc->hw.mac.type == ixgbe_mac_82598EB) {
fctrl |= IXGBE_FCTRL_DPF;
fctrl |= IXGBE_FCTRL_PMCF;
}
@@ -703,11 +698,11 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
hlreg &= ~IXGBE_HLREG0_JUMBOEN;
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg);
- bufsz = (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >>
+ bufsz = (sc->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >>
IXGBE_SRRCTL_BSIZEPKT_SHIFT;
/* Setup the Base and Length of the Rx Descriptor Ring */
- for (i = 0, que = adapter->rx_queues; i < adapter->num_rx_queues; i++, que++) {
+ for (i = 0, que = sc->rx_queues; i < sc->num_rx_queues; i++, que++) {
struct rx_ring *rxr = &que->rxr;
u64 rdba = rxr->rx_paddr;
@@ -733,8 +728,8 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
* so we do not need to clear the bit, but do it just in case
* this code is moved elsewhere.
*/
- if (adapter->num_rx_queues > 1 &&
- adapter->hw.fc.requested_mode == ixgbe_fc_none) {
+ if (sc->num_rx_queues > 1 &&
+ sc->hw.fc.requested_mode == ixgbe_fc_none) {
srrctl |= IXGBE_SRRCTL_DROP_EN;
} else {
srrctl &= ~IXGBE_SRRCTL_DROP_EN;
@@ -750,7 +745,7 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
rxr->tail = IXGBE_RDT(rxr->me);
}
- if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
+ if (sc->hw.mac.type != ixgbe_mac_82598EB) {
u32 psrtype = IXGBE_PSRTYPE_TCPHDR
| IXGBE_PSRTYPE_UDPHDR
| IXGBE_PSRTYPE_IPV4HDR
@@ -760,9 +755,9 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM);
- ixgbe_initialize_rss_mapping(adapter);
+ ixgbe_initialize_rss_mapping(sc);
- if (adapter->num_rx_queues > 1) {
+ if (sc->num_rx_queues > 1) {
/* RSS and RX IPP Checksum are mutually exclusive */
rxcsum |= IXGBE_RXCSUM_PCSD;
}
@@ -784,14 +779,14 @@ ixgbe_initialize_receive_units(if_ctx_t ctx)
static void
ixgbe_initialize_transmit_units(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
- if_softc_ctx_t scctx = adapter->shared;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
+ if_softc_ctx_t scctx = sc->shared;
struct ix_tx_queue *que;
int i;
/* Setup the Base and Length of the Tx Descriptor Ring */
- for (i = 0, que = adapter->tx_queues; i < adapter->num_tx_queues;
+ for (i = 0, que = sc->tx_queues; i < sc->num_tx_queues;
i++, que++) {
struct tx_ring *txr = &que->txr;
u64 tdba = txr->tx_paddr;
@@ -853,7 +848,7 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx)
rttdcs |= IXGBE_RTTDCS_ARBDIS;
IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
IXGBE_WRITE_REG(hw, IXGBE_MTQC,
- ixgbe_get_mtqc(adapter->iov_mode));
+ ixgbe_get_mtqc(sc->iov_mode));
rttdcs &= ~IXGBE_RTTDCS_ARBDIS;
IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
}
@@ -881,7 +876,7 @@ ixgbe_register(device_t dev)
static int
ixgbe_if_attach_pre(if_ctx_t ctx)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
device_t dev;
if_softc_ctx_t scctx;
struct ixgbe_hw *hw;
@@ -892,13 +887,13 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
/* Allocate, clear, and link in our adapter structure */
dev = iflib_get_dev(ctx);
- adapter = iflib_get_softc(ctx);
- adapter->hw.back = adapter;
- adapter->ctx = ctx;
- adapter->dev = dev;
- scctx = adapter->shared = iflib_get_softc_ctx(ctx);
- adapter->media = iflib_get_media(ctx);
- hw = &adapter->hw;
+ sc = iflib_get_softc(ctx);
+ sc->hw.back = sc;
+ sc->ctx = ctx;
+ sc->dev = dev;
+ scctx = sc->shared = iflib_get_softc_ctx(ctx);
+ sc->media = iflib_get_media(ctx);
+ hw = &sc->hw;
/* Determine hardware revision */
hw->vendor_id = pci_get_vendor(dev);
@@ -935,15 +930,15 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
if (hw->mac.type != ixgbe_mac_82598EB)
hw->phy.smart_speed = ixgbe_smart_speed;
- ixgbe_init_device_features(adapter);
+ ixgbe_init_device_features(sc);
/* Enable WoL (if supported) */
- ixgbe_check_wol_support(adapter);
+ ixgbe_check_wol_support(sc);
/* Verify adapter fan is still functional (if applicable) */
- if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) {
+ if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) {
u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP);
- ixgbe_check_fan_failure(adapter, esdp, false);
+ ixgbe_check_fan_failure(sc, esdp, false);
}
/* Ensure SW/FW semaphore is free */
@@ -961,7 +956,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
* so the timer routine will probe
* for later insertion.
*/
- adapter->sfp_probe = true;
+ sc->sfp_probe = true;
error = 0;
} else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev, "Unsupported SFP+ module detected!\n");
@@ -974,7 +969,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
}
/* Make sure we have a good EEPROM before we read from it */
- if (ixgbe_validate_eeprom_checksum(&adapter->hw, NULL) < 0) {
+ if (ixgbe_validate_eeprom_checksum(&sc->hw, NULL) < 0) {
device_printf(dev, "The EEPROM Checksum Is Not Valid\n");
error = EIO;
goto err_pci;
@@ -999,7 +994,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
/* Most of the iflib initialization... */
iflib_set_mac(ctx, hw->mac.addr);
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_X550:
case ixgbe_mac_X550EM_x:
case ixgbe_mac_X550EM_a:
@@ -1024,7 +1019,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
/* XXX */
scctx->isc_tx_csum_flags = CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_TSO |
CSUM_IP6_TCP | CSUM_IP6_UDP | CSUM_IP6_TSO;
- if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
+ if (sc->hw.mac.type == ixgbe_mac_82598EB) {
scctx->isc_tx_nsegments = IXGBE_82598_SCATTER;
} else {
scctx->isc_tx_csum_flags |= CSUM_SCTP |CSUM_IP6_SCTP;
@@ -1044,9 +1039,9 @@ ixgbe_if_attach_pre(if_ctx_t ctx)
return (0);
err_pci:
- ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT);
+ ctrl_ext = IXGBE_READ_REG(&sc->hw, IXGBE_CTRL_EXT);
ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD;
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_CTRL_EXT, ctrl_ext);
ixgbe_free_pci_resources(ctx);
return (error);
@@ -1065,33 +1060,33 @@ static int
ixgbe_if_attach_post(if_ctx_t ctx)
{
device_t dev;
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
struct ixgbe_hw *hw;
int error = 0;
dev = iflib_get_dev(ctx);
- adapter = iflib_get_softc(ctx);
- hw = &adapter->hw;
+ sc = iflib_get_softc(ctx);
+ hw = &sc->hw;
- if (adapter->intr_type == IFLIB_INTR_LEGACY &&
- (adapter->feat_cap & IXGBE_FEATURE_LEGACY_IRQ) == 0) {
+ if (sc->intr_type == IFLIB_INTR_LEGACY &&
+ (sc->feat_cap & IXGBE_FEATURE_LEGACY_IRQ) == 0) {
device_printf(dev, "Device does not support legacy interrupts");
error = ENXIO;
goto err;
}
/* Allocate multicast array memory. */
- adapter->mta = malloc(sizeof(*adapter->mta) *
+ sc->mta = malloc(sizeof(*sc->mta) *
MAX_NUM_MULTICAST_ADDRESSES, M_IXGBE, M_NOWAIT);
- if (adapter->mta == NULL) {
+ if (sc->mta == NULL) {
device_printf(dev, "Can not allocate multicast setup array\n");
error = ENOMEM;
goto err;
}
/* hw.ix defaults init */
- ixgbe_set_advertise(adapter, ixgbe_advertise_speed);
+ ixgbe_set_advertise(sc, ixgbe_advertise_speed);
/* Enable the optics for 82599 SFP+ fiber */
ixgbe_enable_tx_laser(hw);
@@ -1099,7 +1094,7 @@ ixgbe_if_attach_post(if_ctx_t ctx)
/* Enable power to the phy. */
ixgbe_set_phy_power(hw, true);
- ixgbe_initialize_iov(adapter);
+ ixgbe_initialize_iov(sc);
error = ixgbe_setup_interface(ctx);
if (error) {
@@ -1110,27 +1105,27 @@ ixgbe_if_attach_post(if_ctx_t ctx)
ixgbe_if_update_admin_status(ctx);
/* Initialize statistics */
- ixgbe_update_stats_counters(adapter);
- ixgbe_add_hw_stats(adapter);
+ ixgbe_update_stats_counters(sc);
+ ixgbe_add_hw_stats(sc);
/* Check PCIE slot type/speed/width */
- ixgbe_get_slot_info(adapter);
+ ixgbe_get_slot_info(sc);
/*
* Do time init and sysctl init here, but
- * only on the first port of a bypass adapter.
+ * only on the first port of a bypass sc.
*/
- ixgbe_bypass_init(adapter);
+ ixgbe_bypass_init(sc);
/* Display NVM and Option ROM versions */
ixgbe_print_fw_version(ctx);
/* Set an initial dmac value */
- adapter->dmac = 0;
+ sc->dmac = 0;
/* Set initial advertised speeds (if applicable) */
- adapter->advertise = ixgbe_get_advertise(adapter);
+ sc->advertise = ixgbe_get_advertise(sc);
- if (adapter->feat_cap & IXGBE_FEATURE_SRIOV)
+ if (sc->feat_cap & IXGBE_FEATURE_SRIOV)
ixgbe_define_iov_schemas(dev, &error);
/* Add sysctls */
@@ -1151,21 +1146,21 @@ err:
* on the value read here.
************************************************************************/
static void
-ixgbe_check_wol_support(struct adapter *adapter)
+ixgbe_check_wol_support(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u16 dev_caps = 0;
/* Find out WoL support for port */
- adapter->wol_support = hw->wol_enabled = 0;
+ sc->wol_support = hw->wol_enabled = 0;
ixgbe_get_device_caps(hw, &dev_caps);
if ((dev_caps & IXGBE_DEVICE_CAPS_WOL_PORT0_1) ||
((dev_caps & IXGBE_DEVICE_CAPS_WOL_PORT0) &&
hw->bus.func == 0))
- adapter->wol_support = hw->wol_enabled = 1;
+ sc->wol_support = hw->wol_enabled = 1;
/* Save initial wake up filter configuration */
- adapter->wufc = IXGBE_READ_REG(hw, IXGBE_WUFC);
+ sc->wufc = IXGBE_READ_REG(hw, IXGBE_WUFC);
return;
} /* ixgbe_check_wol_support */
@@ -1179,20 +1174,20 @@ static int
ixgbe_setup_interface(if_ctx_t ctx)
{
struct ifnet *ifp = iflib_get_ifp(ctx);
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
INIT_DEBUGOUT("ixgbe_setup_interface: begin");
if_setbaudrate(ifp, IF_Gbps(10));
- adapter->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+ sc->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
- adapter->phy_layer = ixgbe_get_supported_physical_layer(&adapter->hw);
+ sc->phy_layer = ixgbe_get_supported_physical_layer(&sc->hw);
ixgbe_add_media_types(ctx);
/* Autoselect media by default */
- ifmedia_set(adapter->media, IFM_ETHER | IFM_AUTO);
+ ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO);
return (0);
} /* ixgbe_setup_interface */
@@ -1203,30 +1198,30 @@ ixgbe_setup_interface(if_ctx_t ctx)
static uint64_t
ixgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
if_t ifp = iflib_get_ifp(ctx);
switch (cnt) {
case IFCOUNTER_IPACKETS:
- return (adapter->ipackets);
+ return (sc->ipackets);
case IFCOUNTER_OPACKETS:
- return (adapter->opackets);
+ return (sc->opackets);
case IFCOUNTER_IBYTES:
- return (adapter->ibytes);
+ return (sc->ibytes);
case IFCOUNTER_OBYTES:
- return (adapter->obytes);
+ return (sc->obytes);
case IFCOUNTER_IMCASTS:
- return (adapter->imcasts);
+ return (sc->imcasts);
case IFCOUNTER_OMCASTS:
- return (adapter->omcasts);
+ return (sc->omcasts);
case IFCOUNTER_COLLISIONS:
return (0);
case IFCOUNTER_IQDROPS:
- return (adapter->iqdrops);
+ return (sc->iqdrops);
case IFCOUNTER_OQDROPS:
return (0);
case IFCOUNTER_IERRORS:
- return (adapter->ierrors);
+ return (sc->ierrors);
default:
return (if_get_counter_default(ifp, cnt));
}
@@ -1238,8 +1233,8 @@ ixgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt)
static int
ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
int i;
@@ -1276,85 +1271,85 @@ ixgbe_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
static void
ixgbe_add_media_types(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
device_t dev = iflib_get_dev(ctx);
u64 layer;
- layer = adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
+ layer = sc->phy_layer = ixgbe_get_supported_physical_layer(hw);
/* Media types with matching FreeBSD media defines */
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_T, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_T, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_T, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_100BASE_TX)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_100_TX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_100_TX, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_10BASE_T)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10_T, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10_T, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ||
layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_TWINAX, 0,
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_TWINAX, 0,
NULL);
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR) {
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_LR, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_LR, 0, NULL);
if (hw->phy.multispeed_fiber)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_LX, 0,
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_LX, 0,
NULL);
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) {
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_SR, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_SR, 0, NULL);
if (hw->phy.multispeed_fiber)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_SX, 0,
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SX, 0,
NULL);
} else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_SX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_SX, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_CX4, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_CX4, 0, NULL);
#ifdef IFM_ETH_XTYPE
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_KR, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_KR, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4)
- ifmedia_add( adapter->media, IFM_ETHER | IFM_10G_KX4, 0, NULL);
+ ifmedia_add( sc->media, IFM_ETHER | IFM_10G_KX4, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_KX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_KX, 0, NULL);
if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX)
- ifmedia_add(adapter->media, IFM_ETHER | IFM_2500_KX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_2500_KX, 0, NULL);
#else
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
device_printf(dev, "Media supported: 10GbaseKR\n");
device_printf(dev, "10GbaseKR mapped to 10GbaseSR\n");
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_SR, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_SR, 0, NULL);
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
device_printf(dev, "Media supported: 10GbaseKX4\n");
device_printf(dev, "10GbaseKX4 mapped to 10GbaseCX4\n");
- ifmedia_add(adapter->media, IFM_ETHER | IFM_10G_CX4, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_10G_CX4, 0, NULL);
}
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) {
device_printf(dev, "Media supported: 1000baseKX\n");
device_printf(dev, "1000baseKX mapped to 1000baseCX\n");
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_CX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_CX, 0, NULL);
}
if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) {
device_printf(dev, "Media supported: 2500baseKX\n");
device_printf(dev, "2500baseKX mapped to 2500baseSX\n");
- ifmedia_add(adapter->media, IFM_ETHER | IFM_2500_SX, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_2500_SX, 0, NULL);
}
#endif
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
device_printf(dev, "Media supported: 1000baseBX\n");
if (hw->device_id == IXGBE_DEV_ID_82598AT) {
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_T | IFM_FDX,
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T | IFM_FDX,
0, NULL);
- ifmedia_add(adapter->media, IFM_ETHER | IFM_1000_T, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_1000_T, 0, NULL);
}
- ifmedia_add(adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+ ifmedia_add(sc->media, IFM_ETHER | IFM_AUTO, 0, NULL);
} /* ixgbe_add_media_types */
/************************************************************************
@@ -1392,20 +1387,20 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
static void
ixgbe_config_link(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
u32 autoneg, err = 0;
bool sfp, negotiate;
sfp = ixgbe_is_sfp(hw);
if (sfp) {
- adapter->task_requests |= IXGBE_REQUEST_TASK_MOD;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MOD;
iflib_admin_intr_deferred(ctx);
} else {
if (hw->mac.ops.check_link)
- err = ixgbe_check_link(hw, &adapter->link_speed,
- &adapter->link_up, false);
+ err = ixgbe_check_link(hw, &sc->link_speed,
+ &sc->link_up, false);
if (err)
return;
autoneg = hw->phy.autoneg_advertised;
@@ -1416,7 +1411,7 @@ ixgbe_config_link(if_ctx_t ctx)
return;
if (hw->mac.ops.setup_link)
err = hw->mac.ops.setup_link(hw, autoneg,
- adapter->link_up);
+ sc->link_up);
}
} /* ixgbe_config_link */
@@ -1424,10 +1419,10 @@ ixgbe_config_link(if_ctx_t ctx)
* ixgbe_update_stats_counters - Update board statistics counters.
************************************************************************/
static void
-ixgbe_update_stats_counters(struct adapter *adapter)
+ixgbe_update_stats_counters(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
- struct ixgbe_hw_stats *stats = &adapter->stats.pf;
+ struct ixgbe_hw *hw = &sc->hw;
+ struct ixgbe_hw_stats *stats = &sc->stats.pf;
u32 missed_rx = 0, bprc, lxon, lxoff, total;
u32 lxoffrxc;
u64 total_missed_rx = 0;
@@ -1476,7 +1471,7 @@ ixgbe_update_stats_counters(struct adapter *adapter)
* during the last interval, so capture that here.
*/
if (lxoffrxc)
- adapter->shared->isc_pause_frames = 1;
+ sc->shared->isc_pause_frames = 1;
/*
* Workaround: mprc hardware is incorrectly counting
@@ -1537,14 +1532,14 @@ ixgbe_update_stats_counters(struct adapter *adapter)
}
/* Fill out the OS statistics structure */
- IXGBE_SET_IPACKETS(adapter, stats->gprc);
- IXGBE_SET_OPACKETS(adapter, stats->gptc);
- IXGBE_SET_IBYTES(adapter, stats->gorc);
- IXGBE_SET_OBYTES(adapter, stats->gotc);
- IXGBE_SET_IMCASTS(adapter, stats->mprc);
- IXGBE_SET_OMCASTS(adapter, stats->mptc);
- IXGBE_SET_COLLISIONS(adapter, 0);
- IXGBE_SET_IQDROPS(adapter, total_missed_rx);
+ IXGBE_SET_IPACKETS(sc, stats->gprc);
+ IXGBE_SET_OPACKETS(sc, stats->gptc);
+ IXGBE_SET_IBYTES(sc, stats->gorc);
+ IXGBE_SET_OBYTES(sc, stats->gotc);
+ IXGBE_SET_IMCASTS(sc, stats->mprc);
+ IXGBE_SET_OMCASTS(sc, stats->mptc);
+ IXGBE_SET_COLLISIONS(sc, 0);
+ IXGBE_SET_IQDROPS(sc, total_missed_rx);
/*
* Aggregate following types of errors as RX errors:
@@ -1558,7 +1553,7 @@ ixgbe_update_stats_counters(struct adapter *adapter)
* - oversized packets count,
* - jabber count.
*/
- IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->illerrc + stats->xec +
+ IXGBE_SET_IERRORS(sc, stats->crcerrs + stats->illerrc + stats->xec +
stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc +
stats->rjc);
} /* ixgbe_update_stats_counters */
@@ -1569,15 +1564,15 @@ ixgbe_update_stats_counters(struct adapter *adapter)
* Add sysctl variables, one per statistic, to the system.
************************************************************************/
static void
-ixgbe_add_hw_stats(struct adapter *adapter)
+ixgbe_add_hw_stats(struct ixgbe_softc *sc)
{
- device_t dev = iflib_get_dev(adapter->ctx);
+ device_t dev = iflib_get_dev(sc->ctx);
struct ix_rx_queue *rx_que;
struct ix_tx_queue *tx_que;
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
struct sysctl_oid *tree = device_get_sysctl_tree(dev);
struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
- struct ixgbe_hw_stats *stats = &adapter->stats.pf;
+ struct ixgbe_hw_stats *stats = &sc->stats.pf;
struct sysctl_oid *stat_node, *queue_node;
struct sysctl_oid_list *stat_list, *queue_list;
int i;
@@ -1587,13 +1582,13 @@ ixgbe_add_hw_stats(struct adapter *adapter)
/* Driver Statistics */
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped",
- CTLFLAG_RD, &adapter->dropped_pkts, "Driver dropped packets");
+ CTLFLAG_RD, &sc->dropped_pkts, "Driver dropped packets");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events",
- CTLFLAG_RD, &adapter->watchdog_events, "Watchdog timeouts");
+ CTLFLAG_RD, &sc->watchdog_events, "Watchdog timeouts");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
- CTLFLAG_RD, &adapter->link_irq, "Link MSI-X IRQ Handled");
+ CTLFLAG_RD, &sc->link_irq, "Link MSI-X IRQ Handled");
- for (i = 0, tx_que = adapter->tx_queues; i < adapter->num_tx_queues; i++, tx_que++) {
+ for (i = 0, tx_que = sc->tx_queues; i < sc->num_tx_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf,
@@ -1613,7 +1608,7 @@ ixgbe_add_hw_stats(struct adapter *adapter)
"Queue Packets Transmitted");
}
- for (i = 0, rx_que = adapter->rx_queues; i < adapter->num_rx_queues; i++, rx_que++) {
+ for (i = 0, rx_que = sc->rx_queues; i < sc->num_rx_queues; i++, rx_que++) {
struct rx_ring *rxr = &rx_que->rxr;
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf,
@@ -1622,11 +1617,11 @@ ixgbe_add_hw_stats(struct adapter *adapter)
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate",
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- &adapter->rx_queues[i], 0,
+ &sc->rx_queues[i], 0,
ixgbe_sysctl_interrupt_rate_handler, "IU",
"Interrupt Rate");
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "irqs",
- CTLFLAG_RD, &(adapter->rx_queues[i].irqs),
+ CTLFLAG_RD, &(sc->rx_queues[i].irqs),
"irqs on this queue");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head",
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, rxr, 0,
@@ -1651,7 +1646,7 @@ ixgbe_add_hw_stats(struct adapter *adapter)
stat_list = SYSCTL_CHILDREN(stat_node);
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_errs",
- CTLFLAG_RD, &adapter->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS);
+ CTLFLAG_RD, &sc->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS);
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "crc_errs",
CTLFLAG_RD, &stats->crcerrs, "CRC Errors");
SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "ill_errs",
@@ -1761,7 +1756,7 @@ ixgbe_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS)
if (!txr)
return (0);
- val = IXGBE_READ_REG(&txr->adapter->hw, IXGBE_TDH(txr->me));
+ val = IXGBE_READ_REG(&txr->sc->hw, IXGBE_TDH(txr->me));
error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr)
return error;
@@ -1784,7 +1779,7 @@ ixgbe_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS)
if (!txr)
return (0);
- val = IXGBE_READ_REG(&txr->adapter->hw, IXGBE_TDT(txr->me));
+ val = IXGBE_READ_REG(&txr->sc->hw, IXGBE_TDT(txr->me));
error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr)
return error;
@@ -1807,7 +1802,7 @@ ixgbe_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS)
if (!rxr)
return (0);
- val = IXGBE_READ_REG(&rxr->adapter->hw, IXGBE_RDH(rxr->me));
+ val = IXGBE_READ_REG(&rxr->sc->hw, IXGBE_RDH(rxr->me));
error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr)
return error;
@@ -1830,7 +1825,7 @@ ixgbe_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS)
if (!rxr)
return (0);
- val = IXGBE_READ_REG(&rxr->adapter->hw, IXGBE_RDT(rxr->me));
+ val = IXGBE_READ_REG(&rxr->sc->hw, IXGBE_RDT(rxr->me));
error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr)
return error;
@@ -1849,13 +1844,13 @@ ixgbe_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS)
static void
ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
u16 index, bit;
index = (vtag >> 5) & 0x7F;
bit = vtag & 0x1F;
- adapter->shadow_vfta[index] |= (1 << bit);
- ++adapter->num_vlans;
+ sc->shadow_vfta[index] |= (1 << bit);
+ ++sc->num_vlans;
ixgbe_setup_vlan_hw_support(ctx);
} /* ixgbe_if_vlan_register */
@@ -1867,13 +1862,13 @@ ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag)
static void
ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
u16 index, bit;
index = (vtag >> 5) & 0x7F;
bit = vtag & 0x1F;
- adapter->shadow_vfta[index] &= ~(1 << bit);
- --adapter->num_vlans;
+ sc->shadow_vfta[index] &= ~(1 << bit);
+ --sc->num_vlans;
/* Re-init to load the changes */
ixgbe_setup_vlan_hw_support(ctx);
} /* ixgbe_if_vlan_unregister */
@@ -1885,8 +1880,8 @@ static void
ixgbe_setup_vlan_hw_support(if_ctx_t ctx)
{
struct ifnet *ifp = iflib_get_ifp(ctx);
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
struct rx_ring *rxr;
int i;
u32 ctrl;
@@ -1898,13 +1893,13 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx)
* the VFTA and other state, so if there
* have been no vlan's registered do nothing.
*/
- if (adapter->num_vlans == 0)
+ if (sc->num_vlans == 0)
return;
/* Setup the queues for vlans */
if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) {
- for (i = 0; i < adapter->num_rx_queues; i++) {
- rxr = &adapter->rx_queues[i].rxr;
+ for (i = 0; i < sc->num_rx_queues; i++) {
+ rxr = &sc->rx_queues[i].rxr;
/* On 82599 the VLAN enable is per/queue in RXDCTL */
if (hw->mac.type != ixgbe_mac_82598EB) {
ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
@@ -1922,9 +1917,9 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx)
* we need to repopulate it now.
*/
for (i = 0; i < IXGBE_VFTA_SIZE; i++)
- if (adapter->shadow_vfta[i] != 0)
+ if (sc->shadow_vfta[i] != 0)
IXGBE_WRITE_REG(hw, IXGBE_VFTA(i),
- adapter->shadow_vfta[i]);
+ sc->shadow_vfta[i]);
ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
/* Enable the Filter Table if enabled */
@@ -1944,10 +1939,10 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx)
* the slot this adapter is plugged into.
************************************************************************/
static void
-ixgbe_get_slot_info(struct adapter *adapter)
+ixgbe_get_slot_info(struct ixgbe_softc *sc)
{
- device_t dev = iflib_get_dev(adapter->ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ device_t dev = iflib_get_dev(sc->ctx);
+ struct ixgbe_hw *hw = &sc->hw;
int bus_info_valid = true;
u32 offset;
u16 link;
@@ -2043,8 +2038,8 @@ display:
static int
ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_rx_queue *rx_que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_rx_queue *rx_que = sc->rx_queues;
struct ix_tx_queue *tx_que;
int error, rid, vector = 0;
int cpu_id = 0;
@@ -2052,7 +2047,7 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix)
/* Admin Que is vector 0*/
rid = vector + 1;
- for (int i = 0; i < adapter->num_rx_queues; i++, vector++, rx_que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, vector++, rx_que++) {
rid = vector + 1;
snprintf(buf, sizeof(buf), "rxq%d", i);
@@ -2062,12 +2057,12 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix)
if (error) {
device_printf(iflib_get_dev(ctx),
"Failed to allocate que int %d err: %d", i, error);
- adapter->num_rx_queues = i + 1;
+ sc->num_rx_queues = i + 1;
goto fail;
}
rx_que->msix = vector;
- if (adapter->feat_en & IXGBE_FEATURE_RSS) {
+ if (sc->feat_en & IXGBE_FEATURE_RSS) {
/*
* The queue ID is used as the RSS layer bucket ID.
* We look up the queue ID -> RSS CPU ID and select
@@ -2082,42 +2077,42 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix)
* This just happens to match the default RSS
* round-robin bucket -> queue -> CPU allocation.
*/
- if (adapter->num_rx_queues > 1)
+ if (sc->num_rx_queues > 1)
cpu_id = i;
}
}
- for (int i = 0; i < adapter->num_tx_queues; i++) {
+ for (int i = 0; i < sc->num_tx_queues; i++) {
snprintf(buf, sizeof(buf), "txq%d", i);
- tx_que = &adapter->tx_queues[i];
- tx_que->msix = i % adapter->num_rx_queues;
+ tx_que = &sc->tx_queues[i];
+ tx_que->msix = i % sc->num_rx_queues;
iflib_softirq_alloc_generic(ctx,
- &adapter->rx_queues[tx_que->msix].que_irq,
+ &sc->rx_queues[tx_que->msix].que_irq,
IFLIB_INTR_TX, tx_que, tx_que->txr.me, buf);
}
rid = vector + 1;
- error = iflib_irq_alloc_generic(ctx, &adapter->irq, rid,
- IFLIB_INTR_ADMIN, ixgbe_msix_link, adapter, 0, "aq");
+ error = iflib_irq_alloc_generic(ctx, &sc->irq, rid,
+ IFLIB_INTR_ADMIN, ixgbe_msix_link, sc, 0, "aq");
if (error) {
device_printf(iflib_get_dev(ctx),
"Failed to register admin handler");
return (error);
}
- adapter->vector = vector;
+ sc->vector = vector;
return (0);
fail:
- iflib_irq_free(ctx, &adapter->irq);
- rx_que = adapter->rx_queues;
- for (int i = 0; i < adapter->num_rx_queues; i++, rx_que++)
+ iflib_irq_free(ctx, &sc->irq);
+ rx_que = sc->rx_queues;
+ for (int i = 0; i < sc->num_rx_queues; i++, rx_que++)
iflib_irq_free(ctx, &rx_que->que_irq);
return (error);
} /* ixgbe_if_msix_intr_assign */
static inline void
-ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que)
+ixgbe_perform_aim(struct ixgbe_softc *sc, struct ix_rx_queue *que)
{
uint32_t newitr = 0;
struct rx_ring *rxr = &que->rxr;
@@ -2129,7 +2124,7 @@ ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que)
* the last interval.
*/
if (que->eitr_setting) {
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix),
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EITR(que->msix),
que->eitr_setting);
}
@@ -2154,7 +2149,7 @@ ixgbe_perform_aim(struct adapter *adapter, struct ix_rx_queue *que)
newitr = (newitr / 2);
}
- if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
+ if (sc->hw.mac.type == ixgbe_mac_82598EB) {
newitr |= newitr << 16;
} else {
newitr |= IXGBE_EITR_CNT_WDIS;
@@ -2177,19 +2172,19 @@ static int
ixgbe_msix_que(void *arg)
{
struct ix_rx_queue *que = arg;
- struct adapter *adapter = que->adapter;
- struct ifnet *ifp = iflib_get_ifp(que->adapter->ctx);
+ struct ixgbe_softc *sc = que->sc;
+ struct ifnet *ifp = iflib_get_ifp(que->sc->ctx);
/* Protect against spurious interrupts */
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return (FILTER_HANDLED);
- ixgbe_disable_queue(adapter, que->msix);
+ ixgbe_disable_queue(sc, que->msix);
++que->irqs;
/* Check for AIM */
- if (adapter->enable_aim) {
- ixgbe_perform_aim(adapter, que);
+ if (sc->enable_aim) {
+ ixgbe_perform_aim(sc, que);
}
return (FILTER_SCHEDULE_THREAD);
@@ -2204,8 +2199,8 @@ ixgbe_msix_que(void *arg)
static void
ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
int layer;
INIT_DEBUGOUT("ixgbe_if_media_status: begin");
@@ -2213,17 +2208,17 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
- if (!adapter->link_active)
+ if (!sc->link_active)
return;
ifmr->ifm_status |= IFM_ACTIVE;
- layer = adapter->phy_layer;
+ layer = sc->phy_layer;
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T ||
layer & IXGBE_PHYSICAL_LAYER_1000BASE_T ||
layer & IXGBE_PHYSICAL_LAYER_100BASE_TX ||
layer & IXGBE_PHYSICAL_LAYER_10BASE_T)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_T | IFM_FDX;
break;
@@ -2239,13 +2234,13 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
}
if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ||
layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_TWINAX | IFM_FDX;
break;
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_LR | IFM_FDX;
break;
@@ -2254,7 +2249,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
break;
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LRM)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_LRM | IFM_FDX;
break;
@@ -2264,7 +2259,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR ||
layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_SR | IFM_FDX;
break;
@@ -2273,7 +2268,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
break;
}
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_CX4 | IFM_FDX;
break;
@@ -2284,7 +2279,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
*/
#ifndef IFM_ETH_XTYPE
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_SR | IFM_FDX;
break;
@@ -2298,7 +2293,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
else if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4 ||
layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX ||
layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_CX4 | IFM_FDX;
break;
@@ -2311,7 +2306,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
}
#else
if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_KR | IFM_FDX;
break;
@@ -2325,7 +2320,7 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
else if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4 ||
layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX ||
layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX)
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
ifmr->ifm_active |= IFM_10G_KX4 | IFM_FDX;
break;
@@ -2360,9 +2355,9 @@ ixgbe_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
static int
ixgbe_if_media_change(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifmedia *ifm = iflib_get_media(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
ixgbe_link_speed speed = 0;
INIT_DEBUGOUT("ixgbe_if_media_change: begin");
@@ -2425,7 +2420,7 @@ ixgbe_if_media_change(if_ctx_t ctx)
hw->mac.autotry_restart = true;
hw->mac.ops.setup_link(hw, speed, true);
- adapter->advertise =
+ sc->advertise =
((speed & IXGBE_LINK_SPEED_10GB_FULL) ? 4 : 0) |
((speed & IXGBE_LINK_SPEED_1GB_FULL) ? 2 : 0) |
((speed & IXGBE_LINK_SPEED_100_FULL) ? 1 : 0) |
@@ -2445,12 +2440,12 @@ invalid:
static int
ixgbe_if_promisc_set(if_ctx_t ctx, int flags)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
u32 rctl;
int mcnt = 0;
- rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
+ rctl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL);
rctl &= (~IXGBE_FCTRL_UPE);
if (ifp->if_flags & IFF_ALLMULTI)
mcnt = MAX_NUM_MULTICAST_ADDRESSES;
@@ -2459,15 +2454,15 @@ ixgbe_if_promisc_set(if_ctx_t ctx, int flags)
}
if (mcnt < MAX_NUM_MULTICAST_ADDRESSES)
rctl &= (~IXGBE_FCTRL_MPE);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl);
if (ifp->if_flags & IFF_PROMISC) {
rctl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl);
} else if (ifp->if_flags & IFF_ALLMULTI) {
rctl |= IXGBE_FCTRL_MPE;
rctl &= ~IXGBE_FCTRL_UPE;
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, rctl);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, rctl);
}
return (0);
} /* ixgbe_if_promisc_set */
@@ -2478,12 +2473,12 @@ ixgbe_if_promisc_set(if_ctx_t ctx, int flags)
static int
ixgbe_msix_link(void *arg)
{
- struct adapter *adapter = arg;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = arg;
+ struct ixgbe_hw *hw = &sc->hw;
u32 eicr, eicr_mask;
s32 retval;
- ++adapter->link_irq;
+ ++sc->link_irq;
/* Pause other interrupts */
IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER);
@@ -2498,28 +2493,28 @@ ixgbe_msix_link(void *arg)
/* Link status change */
if (eicr & IXGBE_EICR_LSC) {
IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC);
- adapter->task_requests |= IXGBE_REQUEST_TASK_LSC;
+ sc->task_requests |= IXGBE_REQUEST_TASK_LSC;
}
- if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
- if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
+ if (sc->hw.mac.type != ixgbe_mac_82598EB) {
+ if ((sc->feat_en & IXGBE_FEATURE_FDIR) &&
(eicr & IXGBE_EICR_FLOW_DIR)) {
/* This is probably overkill :) */
- if (!atomic_cmpset_int(&adapter->fdir_reinit, 0, 1))
+ if (!atomic_cmpset_int(&sc->fdir_reinit, 0, 1))
return (FILTER_HANDLED);
/* Disable the interrupt */
IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EICR_FLOW_DIR);
- adapter->task_requests |= IXGBE_REQUEST_TASK_FDIR;
+ sc->task_requests |= IXGBE_REQUEST_TASK_FDIR;
} else
if (eicr & IXGBE_EICR_ECC) {
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"\nCRITICAL: ECC ERROR!! Please Reboot!!\n");
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC);
}
/* Check for over temp condition */
- if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR) {
- switch (adapter->hw.mac.type) {
+ if (sc->feat_en & IXGBE_FEATURE_TEMP_SENSOR) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_X550EM_a:
if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
break;
@@ -2530,9 +2525,9 @@ ixgbe_msix_link(void *arg)
retval = hw->phy.ops.check_overtemp(hw);
if (retval != IXGBE_ERR_OVERTEMP)
break;
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"\nCRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n");
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"System shutdown required!\n");
break;
default:
@@ -2541,9 +2536,9 @@ ixgbe_msix_link(void *arg)
retval = hw->phy.ops.check_overtemp(hw);
if (retval != IXGBE_ERR_OVERTEMP)
break;
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"\nCRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n");
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"System shutdown required!\n");
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_TS);
break;
@@ -2551,9 +2546,9 @@ ixgbe_msix_link(void *arg)
}
/* Check for VF message */
- if ((adapter->feat_en & IXGBE_FEATURE_SRIOV) &&
+ if ((sc->feat_en & IXGBE_FEATURE_SRIOV) &&
(eicr & IXGBE_EICR_MAILBOX))
- adapter->task_requests |= IXGBE_REQUEST_TASK_MBX;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MBX;
}
if (ixgbe_is_sfp(hw)) {
@@ -2565,20 +2560,20 @@ ixgbe_msix_link(void *arg)
if (eicr & eicr_mask) {
IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask);
- adapter->task_requests |= IXGBE_REQUEST_TASK_MOD;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MOD;
}
if ((hw->mac.type == ixgbe_mac_82599EB) &&
(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
IXGBE_WRITE_REG(hw, IXGBE_EICR,
IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
- adapter->task_requests |= IXGBE_REQUEST_TASK_MSF;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MSF;
}
}
/* Check for fan failure */
- if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) {
- ixgbe_check_fan_failure(adapter, eicr, true);
+ if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL) {
+ ixgbe_check_fan_failure(sc, eicr, true);
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
}
@@ -2586,10 +2581,10 @@ ixgbe_msix_link(void *arg)
if ((hw->phy.type == ixgbe_phy_x550em_ext_t) &&
(eicr & IXGBE_EICR_GPI_SDP0_X540)) {
IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0_X540);
- adapter->task_requests |= IXGBE_REQUEST_TASK_PHY;
+ sc->task_requests |= IXGBE_REQUEST_TASK_PHY;
}
- return (adapter->task_requests != 0) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED;
+ return (sc->task_requests != 0) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED;
} /* ixgbe_msix_link */
/************************************************************************
@@ -2602,7 +2597,7 @@ ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS)
int error;
unsigned int reg, usec, rate;
- reg = IXGBE_READ_REG(&que->adapter->hw, IXGBE_EITR(que->msix));
+ reg = IXGBE_READ_REG(&que->sc->hw, IXGBE_EITR(que->msix));
usec = ((reg & 0x0FF8) >> 3);
if (usec > 0)
rate = 500000 / usec;
@@ -2619,7 +2614,7 @@ ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS)
ixgbe_max_interrupt_rate = rate;
reg |= ((4000000/rate) & 0xff8);
}
- IXGBE_WRITE_REG(&que->adapter->hw, IXGBE_EITR(que->msix), reg);
+ IXGBE_WRITE_REG(&que->sc->hw, IXGBE_EITR(que->msix), reg);
return (0);
} /* ixgbe_sysctl_interrupt_rate_handler */
@@ -2630,9 +2625,9 @@ ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS)
static void
ixgbe_add_device_sysctls(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct sysctl_oid_list *child;
struct sysctl_ctx_list *ctx_list;
@@ -2642,49 +2637,49 @@ ixgbe_add_device_sysctls(if_ctx_t ctx)
/* Sysctls for all devices */
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fc",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_flowcntl, "I",
+ sc, 0, ixgbe_sysctl_flowcntl, "I",
IXGBE_SYSCTL_DESC_SET_FC);
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "advertise_speed",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_advertise, "I",
+ sc, 0, ixgbe_sysctl_advertise, "I",
IXGBE_SYSCTL_DESC_ADV_SPEED);
- adapter->enable_aim = ixgbe_enable_aim;
+ sc->enable_aim = ixgbe_enable_aim;
SYSCTL_ADD_INT(ctx_list, child, OID_AUTO, "enable_aim", CTLFLAG_RW,
- &adapter->enable_aim, 0, "Interrupt Moderation");
+ &sc->enable_aim, 0, "Interrupt Moderation");
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "fw_version",
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0,
ixgbe_sysctl_print_fw_version, "A", "Prints FW/NVM Versions");
#ifdef IXGBE_DEBUG
/* testing sysctls (for all devices) */
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "power_state",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_power_state,
+ sc, 0, ixgbe_sysctl_power_state,
"I", "PCI Power State");
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "print_rss_config",
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0,
ixgbe_sysctl_print_rss_config, "A", "Prints RSS Configuration");
#endif
/* for X550 series devices */
if (hw->mac.type >= ixgbe_mac_X550)
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "dmac",
CTLTYPE_U16 | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_dmac,
+ sc, 0, ixgbe_sysctl_dmac,
"I", "DMA Coalesce");
/* for WoL-capable devices */
if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) {
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "wol_enable",
- CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
ixgbe_sysctl_wol_enable, "I", "Enable/Disable Wake on LAN");
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "wufc",
CTLTYPE_U32 | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_wufc,
+ sc, 0, ixgbe_sysctl_wufc,
"I", "Enable/Disable Wake Up Filters");
}
@@ -2699,19 +2694,19 @@ ixgbe_add_device_sysctls(if_ctx_t ctx)
SYSCTL_ADD_PROC(ctx_list, phy_list, OID_AUTO, "temp",
CTLTYPE_U16 | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
- adapter, 0, ixgbe_sysctl_phy_temp,
+ sc, 0, ixgbe_sysctl_phy_temp,
"I", "Current External PHY Temperature (Celsius)");
SYSCTL_ADD_PROC(ctx_list, phy_list, OID_AUTO,
"overtemp_occurred",
- CTLTYPE_U16 | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_U16 | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0,
ixgbe_sysctl_phy_overtemp_occurred, "I",
"External PHY High Temperature Event Occurred");
}
- if (adapter->feat_cap & IXGBE_FEATURE_EEE) {
+ if (sc->feat_cap & IXGBE_FEATURE_EEE) {
SYSCTL_ADD_PROC(ctx_list, child, OID_AUTO, "eee_state",
- CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
ixgbe_sysctl_eee_state, "I", "EEE Power Save State");
}
} /* ixgbe_add_device_sysctls */
@@ -2722,25 +2717,25 @@ ixgbe_add_device_sysctls(if_ctx_t ctx)
static int
ixgbe_allocate_pci_resources(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
int rid;
rid = PCIR_BAR(0);
- adapter->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+ sc->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
- if (!(adapter->pci_mem)) {
+ if (!(sc->pci_mem)) {
device_printf(dev, "Unable to allocate bus resource: memory\n");
return (ENXIO);
}
/* Save bus_space values for READ/WRITE_REG macros */
- adapter->osdep.mem_bus_space_tag = rman_get_bustag(adapter->pci_mem);
- adapter->osdep.mem_bus_space_handle =
- rman_get_bushandle(adapter->pci_mem);
+ sc->osdep.mem_bus_space_tag = rman_get_bustag(sc->pci_mem);
+ sc->osdep.mem_bus_space_handle =
+ rman_get_bushandle(sc->pci_mem);
/* Set hw values for shared code */
- adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle;
+ sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle;
return (0);
} /* ixgbe_allocate_pci_resources */
@@ -2757,7 +2752,7 @@ ixgbe_allocate_pci_resources(if_ctx_t ctx)
static int
ixgbe_if_detach(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
u32 ctrl_ext;
@@ -2771,12 +2766,12 @@ ixgbe_if_detach(if_ctx_t ctx)
ixgbe_setup_low_power_mode(ctx);
/* let hardware know driver is unloading */
- ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT);
+ ctrl_ext = IXGBE_READ_REG(&sc->hw, IXGBE_CTRL_EXT);
ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD;
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_CTRL_EXT, ctrl_ext);
ixgbe_free_pci_resources(ctx);
- free(adapter->mta, M_IXGBE);
+ free(sc->mta, M_IXGBE);
return (0);
} /* ixgbe_if_detach */
@@ -2789,8 +2784,8 @@ ixgbe_if_detach(if_ctx_t ctx)
static int
ixgbe_setup_low_power_mode(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
device_t dev = iflib_get_dev(ctx);
s32 error = 0;
@@ -2814,7 +2809,7 @@ ixgbe_setup_low_power_mode(if_ctx_t ctx)
* Program the Wakeup Filter Control register with user filter
* settings
*/
- IXGBE_WRITE_REG(hw, IXGBE_WUFC, adapter->wufc);
+ IXGBE_WRITE_REG(hw, IXGBE_WUFC, sc->wufc);
/* Enable wakeups and power management in Wakeup Control */
IXGBE_WRITE_REG(hw, IXGBE_WUC,
@@ -2875,10 +2870,10 @@ ixgbe_if_suspend(if_ctx_t ctx)
static int
ixgbe_if_resume(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 wus;
INIT_DEBUGOUT("ixgbe_resume: begin");
@@ -2910,7 +2905,7 @@ ixgbe_if_resume(if_ctx_t ctx)
static int
ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
int error = 0;
IOCTL_DEBUGOUT("ioctl: SIOCIFMTU (Set Interface MTU)");
@@ -2918,7 +2913,7 @@ ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
if (mtu > IXGBE_MAX_MTU) {
error = EINVAL;
} else {
- adapter->max_frame_size = mtu + IXGBE_MTU_HDR;
+ sc->max_frame_size = mtu + IXGBE_MTU_HDR;
}
return error;
@@ -2930,7 +2925,7 @@ ixgbe_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
static void
ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int crcstrip)
{
- struct adapter *sc = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ixgbe_hw *hw = &sc->hw;
/* crc stripping is set in two places:
* IXGBE_HLREG0 (modified on init_locked and hw reset)
@@ -2983,10 +2978,10 @@ ixgbe_if_crcstrip_set(if_ctx_t ctx, int onoff, int crcstrip)
void
ixgbe_if_init(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
device_t dev = iflib_get_dev(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct ix_rx_queue *rx_que;
struct ix_tx_queue *tx_que;
u32 txdctl, mhadd;
@@ -2998,19 +2993,19 @@ ixgbe_if_init(if_ctx_t ctx)
INIT_DEBUGOUT("ixgbe_if_init: begin");
/* Queue indices may change with IOV mode */
- ixgbe_align_all_queue_indices(adapter);
+ ixgbe_align_all_queue_indices(sc);
/* reprogram the RAR[0] in case user changed it. */
- ixgbe_set_rar(hw, 0, hw->mac.addr, adapter->pool, IXGBE_RAH_AV);
+ ixgbe_set_rar(hw, 0, hw->mac.addr, sc->pool, IXGBE_RAH_AV);
/* Get the latest mac address, User can use a LAA */
bcopy(IF_LLADDR(ifp), hw->mac.addr, IXGBE_ETH_LENGTH_OF_ADDRESS);
- ixgbe_set_rar(hw, 0, hw->mac.addr, adapter->pool, 1);
+ ixgbe_set_rar(hw, 0, hw->mac.addr, sc->pool, 1);
hw->addr_ctrl.rar_used_count = 1;
ixgbe_init_hw(hw);
- ixgbe_initialize_iov(adapter);
+ ixgbe_initialize_iov(sc);
ixgbe_initialize_transmit_units(ctx);
@@ -3018,7 +3013,7 @@ ixgbe_if_init(if_ctx_t ctx)
ixgbe_if_multi_set(ctx);
/* Determine the correct mbuf pool, based on frame size */
- adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
+ sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
/* Configure RX settings */
ixgbe_initialize_receive_units(ctx);
@@ -3027,22 +3022,22 @@ ixgbe_if_init(if_ctx_t ctx)
* Initialize variable holding task enqueue requests
* from MSI-X interrupts
*/
- adapter->task_requests = 0;
+ sc->task_requests = 0;
/* Enable SDP & MSI-X interrupts based on adapter */
- ixgbe_config_gpie(adapter);
+ ixgbe_config_gpie(sc);
/* Set MTU size */
if (ifp->if_mtu > ETHERMTU) {
/* aka IXGBE_MAXFRS on 82599 and newer */
mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
mhadd &= ~IXGBE_MHADD_MFS_MASK;
- mhadd |= adapter->max_frame_size << IXGBE_MHADD_MFS_SHIFT;
+ mhadd |= sc->max_frame_size << IXGBE_MHADD_MFS_SHIFT;
IXGBE_WRITE_REG(hw, IXGBE_MHADD, mhadd);
}
/* Now enable all the queues */
- for (i = 0, tx_que = adapter->tx_queues; i < adapter->num_tx_queues; i++, tx_que++) {
+ for (i = 0, tx_que = sc->tx_queues; i < sc->num_tx_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(txr->me));
@@ -3060,7 +3055,7 @@ ixgbe_if_init(if_ctx_t ctx)
IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(txr->me), txdctl);
}
- for (i = 0, rx_que = adapter->rx_queues; i < adapter->num_rx_queues; i++, rx_que++) {
+ for (i = 0, rx_que = sc->rx_queues; i < sc->num_rx_queues; i++, rx_que++) {
struct rx_ring *rxr = &rx_que->rxr;
rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me));
@@ -3094,7 +3089,7 @@ ixgbe_if_init(if_ctx_t ctx)
/* Set up MSI/MSI-X routing */
if (ixgbe_enable_msix) {
- ixgbe_configure_ivars(adapter);
+ ixgbe_configure_ivars(sc);
/* Set up auto-mask */
if (hw->mac.type == ixgbe_mac_82598EB)
IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
@@ -3103,12 +3098,12 @@ ixgbe_if_init(if_ctx_t ctx)
IXGBE_WRITE_REG(hw, IXGBE_EIAM_EX(1), 0xFFFFFFFF);
}
} else { /* Simple settings for Legacy/MSI */
- ixgbe_set_ivar(adapter, 0, 0, 0);
- ixgbe_set_ivar(adapter, 0, 0, 1);
+ ixgbe_set_ivar(sc, 0, 0, 0);
+ ixgbe_set_ivar(sc, 0, 0, 1);
IXGBE_WRITE_REG(hw, IXGBE_EIAM, IXGBE_EICS_RTX_QUEUE);
}
- ixgbe_init_fdir(adapter);
+ ixgbe_init_fdir(sc);
/*
* Check on any SFP devices that
@@ -3124,7 +3119,7 @@ ixgbe_if_init(if_ctx_t ctx)
}
/* Set moderation on the Link interrupt */
- IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR);
+ IXGBE_WRITE_REG(hw, IXGBE_EITR(sc->vector), IXGBE_LINK_ITR);
/* Enable power to the phy. */
ixgbe_set_phy_power(hw, true);
@@ -3133,7 +3128,7 @@ ixgbe_if_init(if_ctx_t ctx)
ixgbe_config_link(ctx);
/* Hardware Packet Buffer & Flow Control setup */
- ixgbe_config_delay_values(adapter);
+ ixgbe_config_delay_values(sc);
/* Initialize the FC settings */
ixgbe_start_hw(hw);
@@ -3142,13 +3137,13 @@ ixgbe_if_init(if_ctx_t ctx)
ixgbe_setup_vlan_hw_support(ctx);
/* Setup DMA Coalescing */
- ixgbe_config_dmac(adapter);
+ ixgbe_config_dmac(sc);
/* And now turn on interrupts */
ixgbe_if_enable_intr(ctx);
/* Enable the use of the MBX by the VF's */
- if (adapter->feat_en & IXGBE_FEATURE_SRIOV) {
+ if (sc->feat_en & IXGBE_FEATURE_SRIOV) {
ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
ctrl_ext |= IXGBE_CTRL_EXT_PFRSTD;
IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
@@ -3166,9 +3161,9 @@ ixgbe_if_init(if_ctx_t ctx)
* - type is RX/TX/MISC
************************************************************************/
static void
-ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, s8 type)
+ixgbe_set_ivar(struct ixgbe_softc *sc, u8 entry, u8 vector, s8 type)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 ivar, index;
vector |= IXGBE_IVAR_ALLOC_VAL;
@@ -3183,7 +3178,7 @@ ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, s8 type)
ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(index));
ivar &= ~(0xFF << (8 * (entry & 0x3)));
ivar |= (vector << (8 * (entry & 0x3)));
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_IVAR(index), ivar);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_IVAR(index), ivar);
break;
case ixgbe_mac_82599EB:
case ixgbe_mac_X540:
@@ -3212,10 +3207,10 @@ ixgbe_set_ivar(struct adapter *adapter, u8 entry, u8 vector, s8 type)
* ixgbe_configure_ivars
************************************************************************/
static void
-ixgbe_configure_ivars(struct adapter *adapter)
+ixgbe_configure_ivars(struct ixgbe_softc *sc)
{
- struct ix_rx_queue *rx_que = adapter->rx_queues;
- struct ix_tx_queue *tx_que = adapter->tx_queues;
+ struct ix_rx_queue *rx_que = sc->rx_queues;
+ struct ix_tx_queue *tx_que = sc->tx_queues;
u32 newitr;
if (ixgbe_max_interrupt_rate > 0)
@@ -3225,41 +3220,41 @@ ixgbe_configure_ivars(struct adapter *adapter)
* Disable DMA coalescing if interrupt moderation is
* disabled.
*/
- adapter->dmac = 0;
+ sc->dmac = 0;
newitr = 0;
}
- for (int i = 0; i < adapter->num_rx_queues; i++, rx_que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, rx_que++) {
struct rx_ring *rxr = &rx_que->rxr;
/* First the RX queue entry */
- ixgbe_set_ivar(adapter, rxr->me, rx_que->msix, 0);
+ ixgbe_set_ivar(sc, rxr->me, rx_que->msix, 0);
/* Set an Initial EITR value */
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(rx_que->msix), newitr);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EITR(rx_que->msix), newitr);
}
- for (int i = 0; i < adapter->num_tx_queues; i++, tx_que++) {
+ for (int i = 0; i < sc->num_tx_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
/* ... and the TX */
- ixgbe_set_ivar(adapter, txr->me, tx_que->msix, 1);
+ ixgbe_set_ivar(sc, txr->me, tx_que->msix, 1);
}
/* For the Link interrupt */
- ixgbe_set_ivar(adapter, 1, adapter->vector, -1);
+ ixgbe_set_ivar(sc, 1, sc->vector, -1);
} /* ixgbe_configure_ivars */
/************************************************************************
* ixgbe_config_gpie
************************************************************************/
static void
-ixgbe_config_gpie(struct adapter *adapter)
+ixgbe_config_gpie(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 gpie;
gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
- if (adapter->intr_type == IFLIB_INTR_MSIX) {
+ if (sc->intr_type == IFLIB_INTR_MSIX) {
/* Enable Enhanced MSI-X mode */
gpie |= IXGBE_GPIE_MSIX_MODE
| IXGBE_GPIE_EIAME
@@ -3268,11 +3263,11 @@ ixgbe_config_gpie(struct adapter *adapter)
}
/* Fan Failure Interrupt */
- if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL)
+ if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL)
gpie |= IXGBE_SDP1_GPIEN;
/* Thermal Sensor Interrupt */
- if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR)
+ if (sc->feat_en & IXGBE_FEATURE_TEMP_SENSOR)
gpie |= IXGBE_SDP0_GPIEN_X540;
/* Link detection */
@@ -3295,15 +3290,15 @@ ixgbe_config_gpie(struct adapter *adapter)
/************************************************************************
* ixgbe_config_delay_values
*
- * Requires adapter->max_frame_size to be set.
+ * Requires sc->max_frame_size to be set.
************************************************************************/
static void
-ixgbe_config_delay_values(struct adapter *adapter)
+ixgbe_config_delay_values(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 rxpb, frame, size, tmp;
- frame = adapter->max_frame_size;
+ frame = sc->max_frame_size;
/* Calculate High Water */
switch (hw->mac.type) {
@@ -3347,13 +3342,13 @@ ixgbe_config_delay_values(struct adapter *adapter)
static u_int
ixgbe_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int idx)
{
- struct adapter *adapter = arg;
- struct ixgbe_mc_addr *mta = adapter->mta;
+ struct ixgbe_softc *sc = arg;
+ struct ixgbe_mc_addr *mta = sc->mta;
if (idx == MAX_NUM_MULTICAST_ADDRESSES)
return (0);
bcopy(LLADDR(sdl), mta[idx].addr, IXGBE_ETH_LENGTH_OF_ADDRESS);
- mta[idx].vmdq = adapter->pool;
+ mta[idx].vmdq = sc->pool;
return (1);
} /* ixgbe_mc_filter_apply */
@@ -3361,7 +3356,7 @@ ixgbe_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int idx)
static void
ixgbe_if_multi_set(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ixgbe_mc_addr *mta;
struct ifnet *ifp = iflib_get_ifp(ctx);
u8 *update_ptr;
@@ -3370,13 +3365,12 @@ ixgbe_if_multi_set(if_ctx_t ctx)
IOCTL_DEBUGOUT("ixgbe_if_multi_set: begin");
- mta = adapter->mta;
+ mta = sc->mta;
bzero(mta, sizeof(*mta) * MAX_NUM_MULTICAST_ADDRESSES);
- mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixgbe_mc_filter_apply,
- adapter);
+ mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixgbe_mc_filter_apply, sc);
- fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
+ fctrl = IXGBE_READ_REG(&sc->hw, IXGBE_FCTRL);
if (ifp->if_flags & IFF_PROMISC)
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
@@ -3387,11 +3381,11 @@ ixgbe_if_multi_set(if_ctx_t ctx)
} else
fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_FCTRL, fctrl);
if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) {
update_ptr = (u8 *)mta;
- ixgbe_update_mc_addr_list(&adapter->hw, update_ptr, mcnt,
+ ixgbe_update_mc_addr_list(&sc->hw, update_ptr, mcnt,
ixgbe_mc_array_itr, true);
}
@@ -3426,18 +3420,17 @@ ixgbe_mc_array_itr(struct ixgbe_hw *hw, u8 **update_ptr, u32 *vmdq)
static void
ixgbe_if_timer(if_ctx_t ctx, uint16_t qid)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
if (qid != 0)
return;
/* Check for pluggable optics */
- if (adapter->sfp_probe)
+ if (sc->sfp_probe)
if (!ixgbe_sfp_probe(ctx))
return; /* Nothing to do */
- ixgbe_check_link(&adapter->hw, &adapter->link_speed,
- &adapter->link_up, 0);
+ ixgbe_check_link(&sc->hw, &sc->link_speed, &sc->link_up, 0);
/* Fire off the adminq task */
iflib_admin_intr_deferred(ctx);
@@ -3452,8 +3445,8 @@ ixgbe_if_timer(if_ctx_t ctx, uint16_t qid)
static bool
ixgbe_sfp_probe(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
device_t dev = iflib_get_dev(ctx);
bool result = false;
@@ -3463,7 +3456,7 @@ ixgbe_sfp_probe(if_ctx_t ctx)
if (ret)
goto out;
ret = hw->phy.ops.reset(hw);
- adapter->sfp_probe = false;
+ sc->sfp_probe = false;
if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev, "Unsupported SFP+ module detected!");
device_printf(dev,
@@ -3486,12 +3479,12 @@ static void
ixgbe_handle_mod(void *context)
{
if_ctx_t ctx = context;
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
device_t dev = iflib_get_dev(ctx);
u32 err, cage_full = 0;
- if (adapter->hw.need_crosstalk_fix) {
+ if (sc->hw.need_crosstalk_fix) {
switch (hw->mac.type) {
case ixgbe_mac_82599EB:
cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
@@ -3527,11 +3520,11 @@ ixgbe_handle_mod(void *context)
"Setup failure - unsupported SFP+ module type.\n");
goto handle_mod_out;
}
- adapter->task_requests |= IXGBE_REQUEST_TASK_MSF;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MSF;
return;
handle_mod_out:
- adapter->task_requests &= ~(IXGBE_REQUEST_TASK_MSF);
+ sc->task_requests &= ~(IXGBE_REQUEST_TASK_MSF);
} /* ixgbe_handle_mod */
@@ -3542,13 +3535,13 @@ static void
ixgbe_handle_msf(void *context)
{
if_ctx_t ctx = context;
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
u32 autoneg;
bool negotiate;
/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
- adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
+ sc->phy_layer = ixgbe_get_supported_physical_layer(hw);
autoneg = hw->phy.autoneg_advertised;
if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
@@ -3557,9 +3550,9 @@ ixgbe_handle_msf(void *context)
hw->mac.ops.setup_link(hw, autoneg, true);
/* Adjust media types shown in ifconfig */
- ifmedia_removeall(adapter->media);
- ixgbe_add_media_types(adapter->ctx);
- ifmedia_set(adapter->media, IFM_ETHER | IFM_AUTO);
+ ifmedia_removeall(sc->media);
+ ixgbe_add_media_types(sc->ctx);
+ ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO);
} /* ixgbe_handle_msf */
/************************************************************************
@@ -3569,15 +3562,15 @@ static void
ixgbe_handle_phy(void *context)
{
if_ctx_t ctx = context;
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
int error;
error = hw->phy.ops.handle_lasi(hw);
if (error == IXGBE_ERR_OVERTEMP)
- device_printf(adapter->dev, "CRITICAL: EXTERNAL PHY OVER TEMP!! PHY will downshift to lower power state!\n");
+ device_printf(sc->dev, "CRITICAL: EXTERNAL PHY OVER TEMP!! PHY will downshift to lower power state!\n");
else if (error)
- device_printf(adapter->dev,
+ device_printf(sc->dev,
"Error handling LASI interrupt: %d\n", error);
} /* ixgbe_handle_phy */
@@ -3590,8 +3583,8 @@ ixgbe_handle_phy(void *context)
static void
ixgbe_if_stop(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
INIT_DEBUGOUT("ixgbe_if_stop: begin\n");
@@ -3604,11 +3597,11 @@ ixgbe_if_stop(if_ctx_t ctx)
ixgbe_disable_tx_laser(hw);
/* Update the stack */
- adapter->link_up = false;
+ sc->link_up = false;
ixgbe_if_update_admin_status(ctx);
/* reprogram the RAR[0] in case user changed it. */
- ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, IXGBE_RAH_AV);
+ ixgbe_set_rar(&sc->hw, 0, sc->hw.mac.addr, 0, IXGBE_RAH_AV);
return;
} /* ixgbe_if_stop */
@@ -3623,70 +3616,70 @@ ixgbe_if_stop(if_ctx_t ctx)
static void
ixgbe_if_update_admin_status(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
- if (adapter->link_up) {
- if (adapter->link_active == false) {
+ if (sc->link_up) {
+ if (sc->link_active == false) {
if (bootverbose)
device_printf(dev, "Link is up %d Gbps %s \n",
- ((adapter->link_speed == 128) ? 10 : 1),
+ ((sc->link_speed == 128) ? 10 : 1),
"Full Duplex");
- adapter->link_active = true;
+ sc->link_active = true;
/* Update any Flow Control changes */
- ixgbe_fc_enable(&adapter->hw);
+ ixgbe_fc_enable(&sc->hw);
/* Update DMA coalescing config */
- ixgbe_config_dmac(adapter);
+ ixgbe_config_dmac(sc);
/* should actually be negotiated value */
iflib_link_state_change(ctx, LINK_STATE_UP, IF_Gbps(10));
- if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
- ixgbe_ping_all_vfs(adapter);
+ if (sc->feat_en & IXGBE_FEATURE_SRIOV)
+ ixgbe_ping_all_vfs(sc);
}
} else { /* Link down */
- if (adapter->link_active == true) {
+ if (sc->link_active == true) {
if (bootverbose)
device_printf(dev, "Link is Down\n");
iflib_link_state_change(ctx, LINK_STATE_DOWN, 0);
- adapter->link_active = false;
- if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
- ixgbe_ping_all_vfs(adapter);
+ sc->link_active = false;
+ if (sc->feat_en & IXGBE_FEATURE_SRIOV)
+ ixgbe_ping_all_vfs(sc);
}
}
/* Handle task requests from msix_link() */
- if (adapter->task_requests & IXGBE_REQUEST_TASK_MOD)
+ if (sc->task_requests & IXGBE_REQUEST_TASK_MOD)
ixgbe_handle_mod(ctx);
- if (adapter->task_requests & IXGBE_REQUEST_TASK_MSF)
+ if (sc->task_requests & IXGBE_REQUEST_TASK_MSF)
ixgbe_handle_msf(ctx);
- if (adapter->task_requests & IXGBE_REQUEST_TASK_MBX)
+ if (sc->task_requests & IXGBE_REQUEST_TASK_MBX)
ixgbe_handle_mbx(ctx);
- if (adapter->task_requests & IXGBE_REQUEST_TASK_FDIR)
+ if (sc->task_requests & IXGBE_REQUEST_TASK_FDIR)
ixgbe_reinit_fdir(ctx);
- if (adapter->task_requests & IXGBE_REQUEST_TASK_PHY)
+ if (sc->task_requests & IXGBE_REQUEST_TASK_PHY)
ixgbe_handle_phy(ctx);
- adapter->task_requests = 0;
+ sc->task_requests = 0;
- ixgbe_update_stats_counters(adapter);
+ ixgbe_update_stats_counters(sc);
} /* ixgbe_if_update_admin_status */
/************************************************************************
* ixgbe_config_dmac - Configure DMA Coalescing
************************************************************************/
static void
-ixgbe_config_dmac(struct adapter *adapter)
+ixgbe_config_dmac(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct ixgbe_dmac_config *dcfg = &hw->mac.dmac_config;
if (hw->mac.type < ixgbe_mac_X550 || !hw->mac.ops.dmac_config)
return;
- if (dcfg->watchdog_timer ^ adapter->dmac ||
- dcfg->link_speed ^ adapter->link_speed) {
- dcfg->watchdog_timer = adapter->dmac;
+ if (dcfg->watchdog_timer ^ sc->dmac ||
+ dcfg->link_speed ^ sc->link_speed) {
+ dcfg->watchdog_timer = sc->dmac;
dcfg->fcoe_en = false;
- dcfg->link_speed = adapter->link_speed;
+ dcfg->link_speed = sc->link_speed;
dcfg->num_tcs = 1;
INIT_DEBUGOUT2("dmac settings: watchdog %d, link speed %d\n",
@@ -3702,17 +3695,17 @@ ixgbe_config_dmac(struct adapter *adapter)
void
ixgbe_if_enable_intr(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
+ struct ix_rx_queue *que = sc->rx_queues;
u32 mask, fwsm;
mask = (IXGBE_EIMS_ENABLE_MASK & ~IXGBE_EIMS_RTX_QUEUE);
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_82599EB:
mask |= IXGBE_EIMS_ECC;
- /* Temperature sensor on some adapters */
+ /* Temperature sensor on some scs */
mask |= IXGBE_EIMS_GPI_SDP0;
/* SFP+ (RX_LOS_N & MOD_ABS_N) */
mask |= IXGBE_EIMS_GPI_SDP1;
@@ -3747,24 +3740,24 @@ ixgbe_if_enable_intr(if_ctx_t ctx)
}
/* Enable Fan Failure detection */
- if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL)
+ if (sc->feat_en & IXGBE_FEATURE_FAN_FAIL)
mask |= IXGBE_EIMS_GPI_SDP1;
/* Enable SR-IOV */
- if (adapter->feat_en & IXGBE_FEATURE_SRIOV)
+ if (sc->feat_en & IXGBE_FEATURE_SRIOV)
mask |= IXGBE_EIMS_MAILBOX;
/* Enable Flow Director */
- if (adapter->feat_en & IXGBE_FEATURE_FDIR)
+ if (sc->feat_en & IXGBE_FEATURE_FDIR)
mask |= IXGBE_EIMS_FLOW_DIR;
IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask);
/* With MSI-X we use auto clear */
- if (adapter->intr_type == IFLIB_INTR_MSIX) {
+ if (sc->intr_type == IFLIB_INTR_MSIX) {
mask = IXGBE_EIMS_ENABLE_MASK;
/* Don't autoclear Link */
mask &= ~IXGBE_EIMS_OTHER;
mask &= ~IXGBE_EIMS_LSC;
- if (adapter->feat_cap & IXGBE_FEATURE_SRIOV)
+ if (sc->feat_cap & IXGBE_FEATURE_SRIOV)
mask &= ~IXGBE_EIMS_MAILBOX;
IXGBE_WRITE_REG(hw, IXGBE_EIAC, mask);
}
@@ -3774,8 +3767,8 @@ ixgbe_if_enable_intr(if_ctx_t ctx)
* allow for handling the extended (beyond 32) MSI-X
* vectors that can be used by 82599
*/
- for (int i = 0; i < adapter->num_rx_queues; i++, que++)
- ixgbe_enable_queue(adapter, que->msix);
+ for (int i = 0; i < sc->num_rx_queues; i++, que++)
+ ixgbe_enable_queue(sc, que->msix);
IXGBE_WRITE_FLUSH(hw);
@@ -3787,18 +3780,18 @@ ixgbe_if_enable_intr(if_ctx_t ctx)
static void
ixgbe_if_disable_intr(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
- if (adapter->intr_type == IFLIB_INTR_MSIX)
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, 0);
- if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0);
+ if (sc->intr_type == IFLIB_INTR_MSIX)
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIAC, 0);
+ if (sc->hw.mac.type == ixgbe_mac_82598EB) {
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC, ~0);
} else {
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC, 0xFFFF0000);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC_EX(0), ~0);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMC_EX(1), ~0);
}
- IXGBE_WRITE_FLUSH(&adapter->hw);
+ IXGBE_WRITE_FLUSH(&sc->hw);
} /* ixgbe_if_disable_intr */
@@ -3808,7 +3801,7 @@ ixgbe_if_disable_intr(if_ctx_t ctx)
static void
ixgbe_link_intr_enable(if_ctx_t ctx)
{
- struct ixgbe_hw *hw = &((struct adapter *)iflib_get_softc(ctx))->hw;
+ struct ixgbe_hw *hw = &((struct ixgbe_softc *)iflib_get_softc(ctx))->hw;
/* Re-enable other interrupts */
IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER | IXGBE_EIMS_LSC);
@@ -3820,10 +3813,10 @@ ixgbe_link_intr_enable(if_ctx_t ctx)
static int
ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_rx_queue *que = &adapter->rx_queues[rxqid];
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_rx_queue *que = &sc->rx_queues[rxqid];
- ixgbe_enable_queue(adapter, que->msix);
+ ixgbe_enable_queue(sc, que->msix);
return (0);
} /* ixgbe_if_rx_queue_intr_enable */
@@ -3832,9 +3825,9 @@ ixgbe_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid)
* ixgbe_enable_queue
************************************************************************/
static void
-ixgbe_enable_queue(struct adapter *adapter, u32 vector)
+ixgbe_enable_queue(struct ixgbe_softc *sc, u32 vector)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u64 queue = 1ULL << vector;
u32 mask;
@@ -3855,9 +3848,9 @@ ixgbe_enable_queue(struct adapter *adapter, u32 vector)
* ixgbe_disable_queue
************************************************************************/
static void
-ixgbe_disable_queue(struct adapter *adapter, u32 vector)
+ixgbe_disable_queue(struct ixgbe_softc *sc, u32 vector)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u64 queue = 1ULL << vector;
u32 mask;
@@ -3880,10 +3873,10 @@ ixgbe_disable_queue(struct adapter *adapter, u32 vector)
int
ixgbe_intr(void *arg)
{
- struct adapter *adapter = arg;
- struct ix_rx_queue *que = adapter->rx_queues;
- struct ixgbe_hw *hw = &adapter->hw;
- if_ctx_t ctx = adapter->ctx;
+ struct ixgbe_softc *sc = arg;
+ struct ix_rx_queue *que = sc->rx_queues;
+ struct ixgbe_hw *hw = &sc->hw;
+ if_ctx_t ctx = sc->ctx;
u32 eicr, eicr_mask;
eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
@@ -3897,7 +3890,7 @@ ixgbe_intr(void *arg)
/* Check for fan failure */
if ((hw->device_id == IXGBE_DEV_ID_82598AT) &&
(eicr & IXGBE_EICR_GPI_SDP1)) {
- device_printf(adapter->dev,
+ device_printf(sc->dev,
"\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
}
@@ -3917,21 +3910,21 @@ ixgbe_intr(void *arg)
if (eicr & eicr_mask) {
IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask);
- adapter->task_requests |= IXGBE_REQUEST_TASK_MOD;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MOD;
}
if ((hw->mac.type == ixgbe_mac_82599EB) &&
(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
IXGBE_WRITE_REG(hw, IXGBE_EICR,
IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
- adapter->task_requests |= IXGBE_REQUEST_TASK_MSF;
+ sc->task_requests |= IXGBE_REQUEST_TASK_MSF;
}
}
/* External PHY interrupt */
if ((hw->phy.type == ixgbe_phy_x550em_ext_t) &&
(eicr & IXGBE_EICR_GPI_SDP0_X540))
- adapter->task_requests |= IXGBE_REQUEST_TASK_PHY;
+ sc->task_requests |= IXGBE_REQUEST_TASK_PHY;
return (FILTER_SCHEDULE_THREAD);
} /* ixgbe_intr */
@@ -3942,23 +3935,23 @@ ixgbe_intr(void *arg)
static void
ixgbe_free_pci_resources(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_rx_queue *que = sc->rx_queues;
device_t dev = iflib_get_dev(ctx);
/* Release all MSI-X queue resources */
- if (adapter->intr_type == IFLIB_INTR_MSIX)
- iflib_irq_free(ctx, &adapter->irq);
+ if (sc->intr_type == IFLIB_INTR_MSIX)
+ iflib_irq_free(ctx, &sc->irq);
if (que != NULL) {
- for (int i = 0; i < adapter->num_rx_queues; i++, que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, que++) {
iflib_irq_free(ctx, &que->que_irq);
}
}
- if (adapter->pci_mem != NULL)
+ if (sc->pci_mem != NULL)
bus_release_resource(dev, SYS_RES_MEMORY,
- rman_get_rid(adapter->pci_mem), adapter->pci_mem);
+ rman_get_rid(sc->pci_mem), sc->pci_mem);
} /* ixgbe_free_pci_resources */
/************************************************************************
@@ -3969,21 +3962,21 @@ ixgbe_free_pci_resources(if_ctx_t ctx)
static int
ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
int error, fc;
- adapter = (struct adapter *)arg1;
- fc = adapter->hw.fc.current_mode;
+ sc = (struct ixgbe_softc *)arg1;
+ fc = sc->hw.fc.current_mode;
error = sysctl_handle_int(oidp, &fc, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
/* Don't bother if it's not changed */
- if (fc == adapter->hw.fc.current_mode)
+ if (fc == sc->hw.fc.current_mode)
return (0);
- return ixgbe_set_flowcntl(adapter, fc);
+ return ixgbe_set_flowcntl(sc, fc);
} /* ixgbe_sysctl_flowcntl */
/************************************************************************
@@ -3996,28 +3989,28 @@ ixgbe_sysctl_flowcntl(SYSCTL_HANDLER_ARGS)
* 3 - full
************************************************************************/
static int
-ixgbe_set_flowcntl(struct adapter *adapter, int fc)
+ixgbe_set_flowcntl(struct ixgbe_softc *sc, int fc)
{
switch (fc) {
case ixgbe_fc_rx_pause:
case ixgbe_fc_tx_pause:
case ixgbe_fc_full:
- adapter->hw.fc.requested_mode = fc;
- if (adapter->num_rx_queues > 1)
- ixgbe_disable_rx_drop(adapter);
+ sc->hw.fc.requested_mode = fc;
+ if (sc->num_rx_queues > 1)
+ ixgbe_disable_rx_drop(sc);
break;
case ixgbe_fc_none:
- adapter->hw.fc.requested_mode = ixgbe_fc_none;
- if (adapter->num_rx_queues > 1)
- ixgbe_enable_rx_drop(adapter);
+ sc->hw.fc.requested_mode = ixgbe_fc_none;
+ if (sc->num_rx_queues > 1)
+ ixgbe_enable_rx_drop(sc);
break;
default:
return (EINVAL);
}
/* Don't autoneg if forcing a value */
- adapter->hw.fc.disable_fc_autoneg = true;
- ixgbe_fc_enable(&adapter->hw);
+ sc->hw.fc.disable_fc_autoneg = true;
+ ixgbe_fc_enable(&sc->hw);
return (0);
} /* ixgbe_set_flowcntl */
@@ -4032,21 +4025,21 @@ ixgbe_set_flowcntl(struct adapter *adapter, int fc)
* is disabled.
************************************************************************/
static void
-ixgbe_enable_rx_drop(struct adapter *adapter)
+ixgbe_enable_rx_drop(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct rx_ring *rxr;
u32 srrctl;
- for (int i = 0; i < adapter->num_rx_queues; i++) {
- rxr = &adapter->rx_queues[i].rxr;
+ for (int i = 0; i < sc->num_rx_queues; i++) {
+ rxr = &sc->rx_queues[i].rxr;
srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(rxr->me));
srrctl |= IXGBE_SRRCTL_DROP_EN;
IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rxr->me), srrctl);
}
/* enable drop for each vf */
- for (int i = 0; i < adapter->num_vfs; i++) {
+ for (int i = 0; i < sc->num_vfs; i++) {
IXGBE_WRITE_REG(hw, IXGBE_QDE,
(IXGBE_QDE_WRITE | (i << IXGBE_QDE_IDX_SHIFT) |
IXGBE_QDE_ENABLE));
@@ -4057,21 +4050,21 @@ ixgbe_enable_rx_drop(struct adapter *adapter)
* ixgbe_disable_rx_drop
************************************************************************/
static void
-ixgbe_disable_rx_drop(struct adapter *adapter)
+ixgbe_disable_rx_drop(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct rx_ring *rxr;
u32 srrctl;
- for (int i = 0; i < adapter->num_rx_queues; i++) {
- rxr = &adapter->rx_queues[i].rxr;
+ for (int i = 0; i < sc->num_rx_queues; i++) {
+ rxr = &sc->rx_queues[i].rxr;
srrctl = IXGBE_READ_REG(hw, IXGBE_SRRCTL(rxr->me));
srrctl &= ~IXGBE_SRRCTL_DROP_EN;
IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rxr->me), srrctl);
}
/* disable drop for each vf */
- for (int i = 0; i < adapter->num_vfs; i++) {
+ for (int i = 0; i < sc->num_vfs; i++) {
IXGBE_WRITE_REG(hw, IXGBE_QDE,
(IXGBE_QDE_WRITE | (i << IXGBE_QDE_IDX_SHIFT)));
}
@@ -4085,17 +4078,17 @@ ixgbe_disable_rx_drop(struct adapter *adapter)
static int
ixgbe_sysctl_advertise(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
int error, advertise;
- adapter = (struct adapter *)arg1;
- advertise = adapter->advertise;
+ sc = (struct ixgbe_softc *)arg1;
+ advertise = sc->advertise;
error = sysctl_handle_int(oidp, &advertise, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
- return ixgbe_set_advertise(adapter, advertise);
+ return ixgbe_set_advertise(sc, advertise);
} /* ixgbe_sysctl_advertise */
/************************************************************************
@@ -4108,9 +4101,9 @@ ixgbe_sysctl_advertise(SYSCTL_HANDLER_ARGS)
* 0x8 - advertise 10 Mb (yes, Mb)
************************************************************************/
static int
-ixgbe_set_advertise(struct adapter *adapter, int advertise)
+ixgbe_set_advertise(struct ixgbe_softc *sc, int advertise)
{
- device_t dev = iflib_get_dev(adapter->ctx);
+ device_t dev = iflib_get_dev(sc->ctx);
struct ixgbe_hw *hw;
ixgbe_link_speed speed = 0;
ixgbe_link_speed link_caps = 0;
@@ -4118,10 +4111,10 @@ ixgbe_set_advertise(struct adapter *adapter, int advertise)
bool negotiate = false;
/* Checks to validate new value */
- if (adapter->advertise == advertise) /* no change */
+ if (sc->advertise == advertise) /* no change */
return (0);
- hw = &adapter->hw;
+ hw = &sc->hw;
/* No speed changes for backplane media */
if (hw->phy.media_type == ixgbe_media_type_backplane)
@@ -4179,7 +4172,7 @@ ixgbe_set_advertise(struct adapter *adapter, int advertise)
hw->mac.autotry_restart = true;
hw->mac.ops.setup_link(hw, speed, true);
- adapter->advertise = advertise;
+ sc->advertise = advertise;
return (0);
} /* ixgbe_set_advertise */
@@ -4195,9 +4188,9 @@ ixgbe_set_advertise(struct adapter *adapter, int advertise)
* 0x8 - advertise 10 Mb (yes, Mb)
************************************************************************/
static int
-ixgbe_get_advertise(struct adapter *adapter)
+ixgbe_get_advertise(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
int speed;
ixgbe_link_speed link_caps = 0;
s32 err;
@@ -4238,12 +4231,12 @@ ixgbe_get_advertise(struct adapter *adapter)
static int
ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ifnet *ifp = iflib_get_ifp(adapter->ctx);
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ifnet *ifp = iflib_get_ifp(sc->ctx);
int error;
u16 newval;
- newval = adapter->dmac;
+ newval = sc->dmac;
error = sysctl_handle_16(oidp, &newval, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
@@ -4251,11 +4244,11 @@ ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
switch (newval) {
case 0:
/* Disabled */
- adapter->dmac = 0;
+ sc->dmac = 0;
break;
case 1:
/* Enable and use default */
- adapter->dmac = 1000;
+ sc->dmac = 1000;
break;
case 50:
case 100:
@@ -4266,7 +4259,7 @@ ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
case 5000:
case 10000:
/* Legal values - allow */
- adapter->dmac = newval;
+ sc->dmac = newval;
break;
default:
/* Do nothing, illegal value */
@@ -4293,8 +4286,8 @@ ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- device_t dev = adapter->dev;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ device_t dev = sc->dev;
int curr_ps, new_ps, error = 0;
curr_ps = new_ps = pci_get_powerstate(dev);
@@ -4332,8 +4325,8 @@ ixgbe_sysctl_power_state(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_wol_enable(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ixgbe_hw *hw = &sc->hw;
int new_wol_enabled;
int error = 0;
@@ -4345,7 +4338,7 @@ ixgbe_sysctl_wol_enable(SYSCTL_HANDLER_ARGS)
if (new_wol_enabled == hw->wol_enabled)
return (0);
- if (new_wol_enabled > 0 && !adapter->wol_support)
+ if (new_wol_enabled > 0 && !sc->wol_support)
return (ENODEV);
else
hw->wol_enabled = new_wol_enabled;
@@ -4373,24 +4366,24 @@ ixgbe_sysctl_wol_enable(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_wufc(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
int error = 0;
u32 new_wufc;
- new_wufc = adapter->wufc;
+ new_wufc = sc->wufc;
error = sysctl_handle_32(oidp, &new_wufc, 0, req);
if ((error) || (req->newptr == NULL))
return (error);
- if (new_wufc == adapter->wufc)
+ if (new_wufc == sc->wufc)
return (0);
if (new_wufc & 0xffffff00)
return (EINVAL);
new_wufc &= 0xff;
- new_wufc |= (0xffffff & adapter->wufc);
- adapter->wufc = new_wufc;
+ new_wufc |= (0xffffff & sc->wufc);
+ sc->wufc = new_wufc;
return (0);
} /* ixgbe_sysctl_wufc */
@@ -4402,9 +4395,9 @@ ixgbe_sysctl_wufc(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ixgbe_hw *hw = &adapter->hw;
- device_t dev = adapter->dev;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ixgbe_hw *hw = &sc->hw;
+ device_t dev = sc->dev;
struct sbuf *buf;
int error = 0, reta_size;
u32 reg;
@@ -4417,7 +4410,7 @@ ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS)
// TODO: use sbufs to make a string to print out
/* Set multiplier for RETA setup and table size based on MAC */
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_X550:
case ixgbe_mac_X550EM_x:
case ixgbe_mac_X550EM_a:
@@ -4460,19 +4453,19 @@ ixgbe_sysctl_print_rss_config(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ixgbe_hw *hw = &sc->hw;
u16 reg;
if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) {
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"Device has no supported external thermal sensor.\n");
return (ENODEV);
}
if (hw->phy.ops.read_reg(hw, IXGBE_PHY_CURRENT_TEMP,
IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, &reg)) {
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"Error reading from PHY's current temperature register\n");
return (EAGAIN);
}
@@ -4492,19 +4485,19 @@ ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ixgbe_hw *hw = &sc->hw;
u16 reg;
if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) {
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"Device has no supported external thermal sensor.\n");
return (ENODEV);
}
if (hw->phy.ops.read_reg(hw, IXGBE_PHY_OVERTEMP_STATUS,
IXGBE_MDIO_VENDOR_SPECIFIC_1_DEV_TYPE, &reg)) {
- device_printf(iflib_get_dev(adapter->ctx),
+ device_printf(iflib_get_dev(sc->ctx),
"Error reading from PHY's temperature status register\n");
return (EAGAIN);
}
@@ -4527,13 +4520,13 @@ ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS)
static int
ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- device_t dev = adapter->dev;
- struct ifnet *ifp = iflib_get_ifp(adapter->ctx);
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ device_t dev = sc->dev;
+ struct ifnet *ifp = iflib_get_ifp(sc->ctx);
int curr_eee, new_eee, error = 0;
s32 retval;
- curr_eee = new_eee = !!(adapter->feat_en & IXGBE_FEATURE_EEE);
+ curr_eee = new_eee = !!(sc->feat_en & IXGBE_FEATURE_EEE);
error = sysctl_handle_int(oidp, &new_eee, 0, req);
if ((error) || (req->newptr == NULL))
@@ -4544,14 +4537,14 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS)
return (0);
/* Not supported */
- if (!(adapter->feat_cap & IXGBE_FEATURE_EEE))
+ if (!(sc->feat_cap & IXGBE_FEATURE_EEE))
return (EINVAL);
/* Bounds checking */
if ((new_eee < 0) || (new_eee > 1))
return (EINVAL);
- retval = ixgbe_setup_eee(&adapter->hw, new_eee);
+ retval = ixgbe_setup_eee(&sc->hw, new_eee);
if (retval) {
device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
return (EINVAL);
@@ -4564,9 +4557,9 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS)
/* Cache new value */
if (new_eee)
- adapter->feat_en |= IXGBE_FEATURE_EEE;
+ sc->feat_en |= IXGBE_FEATURE_EEE;
else
- adapter->feat_en &= ~IXGBE_FEATURE_EEE;
+ sc->feat_en &= ~IXGBE_FEATURE_EEE;
return (error);
} /* ixgbe_sysctl_eee_state */
@@ -4575,54 +4568,54 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS)
* ixgbe_init_device_features
************************************************************************/
static void
-ixgbe_init_device_features(struct adapter *adapter)
+ixgbe_init_device_features(struct ixgbe_softc *sc)
{
- adapter->feat_cap = IXGBE_FEATURE_NETMAP
+ sc->feat_cap = IXGBE_FEATURE_NETMAP
| IXGBE_FEATURE_RSS
| IXGBE_FEATURE_MSI
| IXGBE_FEATURE_MSIX
| IXGBE_FEATURE_LEGACY_IRQ;
/* Set capabilities first... */
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_82598EB:
- if (adapter->hw.device_id == IXGBE_DEV_ID_82598AT)
- adapter->feat_cap |= IXGBE_FEATURE_FAN_FAIL;
+ if (sc->hw.device_id == IXGBE_DEV_ID_82598AT)
+ sc->feat_cap |= IXGBE_FEATURE_FAN_FAIL;
break;
case ixgbe_mac_X540:
- adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
- adapter->feat_cap |= IXGBE_FEATURE_FDIR;
- if ((adapter->hw.device_id == IXGBE_DEV_ID_X540_BYPASS) &&
- (adapter->hw.bus.func == 0))
- adapter->feat_cap |= IXGBE_FEATURE_BYPASS;
+ sc->feat_cap |= IXGBE_FEATURE_SRIOV;
+ sc->feat_cap |= IXGBE_FEATURE_FDIR;
+ if ((sc->hw.device_id == IXGBE_DEV_ID_X540_BYPASS) &&
+ (sc->hw.bus.func == 0))
+ sc->feat_cap |= IXGBE_FEATURE_BYPASS;
break;
case ixgbe_mac_X550:
- adapter->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR;
- adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
- adapter->feat_cap |= IXGBE_FEATURE_FDIR;
+ sc->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR;
+ sc->feat_cap |= IXGBE_FEATURE_SRIOV;
+ sc->feat_cap |= IXGBE_FEATURE_FDIR;
break;
case ixgbe_mac_X550EM_x:
- adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
- adapter->feat_cap |= IXGBE_FEATURE_FDIR;
+ sc->feat_cap |= IXGBE_FEATURE_SRIOV;
+ sc->feat_cap |= IXGBE_FEATURE_FDIR;
break;
case ixgbe_mac_X550EM_a:
- adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
- adapter->feat_cap |= IXGBE_FEATURE_FDIR;
- adapter->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ;
- if ((adapter->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T) ||
- (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L)) {
- adapter->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR;
- adapter->feat_cap |= IXGBE_FEATURE_EEE;
+ sc->feat_cap |= IXGBE_FEATURE_SRIOV;
+ sc->feat_cap |= IXGBE_FEATURE_FDIR;
+ sc->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ;
+ if ((sc->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T) ||
+ (sc->hw.device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L)) {
+ sc->feat_cap |= IXGBE_FEATURE_TEMP_SENSOR;
+ sc->feat_cap |= IXGBE_FEATURE_EEE;
}
break;
case ixgbe_mac_82599EB:
- adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
- adapter->feat_cap |= IXGBE_FEATURE_FDIR;
- if ((adapter->hw.device_id == IXGBE_DEV_ID_82599_BYPASS) &&
- (adapter->hw.bus.func == 0))
- adapter->feat_cap |= IXGBE_FEATURE_BYPASS;
- if (adapter->hw.device_id == IXGBE_DEV_ID_82599_QSFP_SF_QP)
- adapter->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ;
+ sc->feat_cap |= IXGBE_FEATURE_SRIOV;
+ sc->feat_cap |= IXGBE_FEATURE_FDIR;
+ if ((sc->hw.device_id == IXGBE_DEV_ID_82599_BYPASS) &&
+ (sc->hw.bus.func == 0))
+ sc->feat_cap |= IXGBE_FEATURE_BYPASS;
+ if (sc->hw.device_id == IXGBE_DEV_ID_82599_QSFP_SF_QP)
+ sc->feat_cap &= ~IXGBE_FEATURE_LEGACY_IRQ;
break;
default:
break;
@@ -4630,43 +4623,43 @@ ixgbe_init_device_features(struct adapter *adapter)
/* Enabled by default... */
/* Fan failure detection */
- if (adapter->feat_cap & IXGBE_FEATURE_FAN_FAIL)
- adapter->feat_en |= IXGBE_FEATURE_FAN_FAIL;
+ if (sc->feat_cap & IXGBE_FEATURE_FAN_FAIL)
+ sc->feat_en |= IXGBE_FEATURE_FAN_FAIL;
/* Netmap */
- if (adapter->feat_cap & IXGBE_FEATURE_NETMAP)
- adapter->feat_en |= IXGBE_FEATURE_NETMAP;
+ if (sc->feat_cap & IXGBE_FEATURE_NETMAP)
+ sc->feat_en |= IXGBE_FEATURE_NETMAP;
/* EEE */
- if (adapter->feat_cap & IXGBE_FEATURE_EEE)
- adapter->feat_en |= IXGBE_FEATURE_EEE;
+ if (sc->feat_cap & IXGBE_FEATURE_EEE)
+ sc->feat_en |= IXGBE_FEATURE_EEE;
/* Thermal Sensor */
- if (adapter->feat_cap & IXGBE_FEATURE_TEMP_SENSOR)
- adapter->feat_en |= IXGBE_FEATURE_TEMP_SENSOR;
+ if (sc->feat_cap & IXGBE_FEATURE_TEMP_SENSOR)
+ sc->feat_en |= IXGBE_FEATURE_TEMP_SENSOR;
/* Enabled via global sysctl... */
/* Flow Director */
if (ixgbe_enable_fdir) {
- if (adapter->feat_cap & IXGBE_FEATURE_FDIR)
- adapter->feat_en |= IXGBE_FEATURE_FDIR;
+ if (sc->feat_cap & IXGBE_FEATURE_FDIR)
+ sc->feat_en |= IXGBE_FEATURE_FDIR;
else
- device_printf(adapter->dev, "Device does not support Flow Director. Leaving disabled.");
+ device_printf(sc->dev, "Device does not support Flow Director. Leaving disabled.");
}
/*
* Message Signal Interrupts - Extended (MSI-X)
* Normal MSI is only enabled if MSI-X calls fail.
*/
if (!ixgbe_enable_msix)
- adapter->feat_cap &= ~IXGBE_FEATURE_MSIX;
+ sc->feat_cap &= ~IXGBE_FEATURE_MSIX;
/* Receive-Side Scaling (RSS) */
- if ((adapter->feat_cap & IXGBE_FEATURE_RSS) && ixgbe_enable_rss)
- adapter->feat_en |= IXGBE_FEATURE_RSS;
+ if ((sc->feat_cap & IXGBE_FEATURE_RSS) && ixgbe_enable_rss)
+ sc->feat_en |= IXGBE_FEATURE_RSS;
/* Disable features with unmet dependencies... */
/* No MSI-X */
- if (!(adapter->feat_cap & IXGBE_FEATURE_MSIX)) {
- adapter->feat_cap &= ~IXGBE_FEATURE_RSS;
- adapter->feat_cap &= ~IXGBE_FEATURE_SRIOV;
- adapter->feat_en &= ~IXGBE_FEATURE_RSS;
- adapter->feat_en &= ~IXGBE_FEATURE_SRIOV;
+ if (!(sc->feat_cap & IXGBE_FEATURE_MSIX)) {
+ sc->feat_cap &= ~IXGBE_FEATURE_RSS;
+ sc->feat_cap &= ~IXGBE_FEATURE_SRIOV;
+ sc->feat_en &= ~IXGBE_FEATURE_RSS;
+ sc->feat_en &= ~IXGBE_FEATURE_SRIOV;
}
} /* ixgbe_init_device_features */
@@ -4674,15 +4667,15 @@ ixgbe_init_device_features(struct adapter *adapter)
* ixgbe_check_fan_failure
************************************************************************/
static void
-ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt)
+ixgbe_check_fan_failure(struct ixgbe_softc *sc, u32 reg, bool in_interrupt)
{
u32 mask;
- mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&adapter->hw) :
+ mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&sc->hw) :
IXGBE_ESDP_SDP1;
if (reg & mask)
- device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
+ device_printf(sc->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
} /* ixgbe_check_fan_failure */
/************************************************************************
@@ -4729,9 +4722,9 @@ ixgbe_sbuf_fw_version(struct ixgbe_hw *hw, struct sbuf *buf)
static void
ixgbe_print_fw_version(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
- device_t dev = adapter->dev;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
+ device_t dev = sc->dev;
struct sbuf *buf;
int error = 0;
@@ -4758,9 +4751,9 @@ ixgbe_print_fw_version(if_ctx_t ctx)
static int
ixgbe_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter = (struct adapter *)arg1;
- struct ixgbe_hw *hw = &adapter->hw;
- device_t dev = adapter->dev;
+ struct ixgbe_softc *sc = (struct ixgbe_softc *)arg1;
+ struct ixgbe_hw *hw = &sc->hw;
+ device_t dev = sc->dev;
struct sbuf *buf;
int error = 0;
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index acebf0a65e12..f2bae7a14cad 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -71,40 +71,40 @@ PVID_END
/************************************************************************
* Function prototypes
************************************************************************/
-static void *ixv_register(device_t dev);
-static int ixv_if_attach_pre(if_ctx_t ctx);
-static int ixv_if_attach_post(if_ctx_t ctx);
-static int ixv_if_detach(if_ctx_t ctx);
-
-static int ixv_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t qid);
-static int ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nqs, int nqsets);
-static int ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nqs, int nqsets);
-static void ixv_if_queues_free(if_ctx_t ctx);
-static void ixv_identify_hardware(if_ctx_t ctx);
-static void ixv_init_device_features(struct adapter *);
-static int ixv_allocate_pci_resources(if_ctx_t ctx);
-static void ixv_free_pci_resources(if_ctx_t ctx);
-static int ixv_setup_interface(if_ctx_t ctx);
-static void ixv_if_media_status(if_ctx_t , struct ifmediareq *);
-static int ixv_if_media_change(if_ctx_t ctx);
-static void ixv_if_update_admin_status(if_ctx_t ctx);
-static int ixv_if_msix_intr_assign(if_ctx_t ctx, int msix);
-
-static int ixv_if_mtu_set(if_ctx_t ctx, uint32_t mtu);
-static void ixv_if_init(if_ctx_t ctx);
-static void ixv_if_local_timer(if_ctx_t ctx, uint16_t qid);
-static void ixv_if_stop(if_ctx_t ctx);
-static int ixv_negotiate_api(struct adapter *);
-
-static void ixv_initialize_transmit_units(if_ctx_t ctx);
-static void ixv_initialize_receive_units(if_ctx_t ctx);
-static void ixv_initialize_rss_mapping(struct adapter *);
-
-static void ixv_setup_vlan_support(if_ctx_t ctx);
-static void ixv_configure_ivars(struct adapter *);
-static void ixv_if_enable_intr(if_ctx_t ctx);
-static void ixv_if_disable_intr(if_ctx_t ctx);
-static void ixv_if_multi_set(if_ctx_t ctx);
+static void *ixv_register(device_t);
+static int ixv_if_attach_pre(if_ctx_t);
+static int ixv_if_attach_post(if_ctx_t);
+static int ixv_if_detach(if_ctx_t);
+
+static int ixv_if_rx_queue_intr_enable(if_ctx_t, uint16_t);
+static int ixv_if_tx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int);
+static int ixv_if_rx_queues_alloc(if_ctx_t, caddr_t *, uint64_t *, int, int);
+static void ixv_if_queues_free(if_ctx_t);
+static void ixv_identify_hardware(if_ctx_t);
+static void ixv_init_device_features(struct ixgbe_softc *);
+static int ixv_allocate_pci_resources(if_ctx_t);
+static void ixv_free_pci_resources(if_ctx_t);
+static int ixv_setup_interface(if_ctx_t);
+static void ixv_if_media_status(if_ctx_t, struct ifmediareq *);
+static int ixv_if_media_change(if_ctx_t);
+static void ixv_if_update_admin_status(if_ctx_t);
+static int ixv_if_msix_intr_assign(if_ctx_t, int);
+
+static int ixv_if_mtu_set(if_ctx_t, uint32_t);
+static void ixv_if_init(if_ctx_t);
+static void ixv_if_local_timer(if_ctx_t, uint16_t);
+static void ixv_if_stop(if_ctx_t);
+static int ixv_negotiate_api(struct ixgbe_softc *);
+
+static void ixv_initialize_transmit_units(if_ctx_t);
+static void ixv_initialize_receive_units(if_ctx_t);
+static void ixv_initialize_rss_mapping(struct ixgbe_softc *);
+
+static void ixv_setup_vlan_support(if_ctx_t);
+static void ixv_configure_ivars(struct ixgbe_softc *);
+static void ixv_if_enable_intr(if_ctx_t);
+static void ixv_if_disable_intr(if_ctx_t);
+static void ixv_if_multi_set(if_ctx_t);
static void ixv_if_register_vlan(if_ctx_t, u16);
static void ixv_if_unregister_vlan(if_ctx_t, u16);
@@ -112,13 +112,13 @@ static void ixv_if_unregister_vlan(if_ctx_t, u16);
static uint64_t ixv_if_get_counter(if_ctx_t, ift_counter);
static bool ixv_if_needs_restart(if_ctx_t, enum iflib_restart_event);
-static void ixv_save_stats(struct adapter *);
-static void ixv_init_stats(struct adapter *);
-static void ixv_update_stats(struct adapter *);
-static void ixv_add_stats_sysctls(struct adapter *adapter);
+static void ixv_save_stats(struct ixgbe_softc *);
+static void ixv_init_stats(struct ixgbe_softc *);
+static void ixv_update_stats(struct ixgbe_softc *);
+static void ixv_add_stats_sysctls(struct ixgbe_softc *);
static int ixv_sysctl_debug(SYSCTL_HANDLER_ARGS);
-static void ixv_set_ivar(struct adapter *, u8, u8, s8);
+static void ixv_set_ivar(struct ixgbe_softc *, u8, u8, s8);
static u8 *ixv_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
@@ -140,7 +140,7 @@ static device_method_t ixv_methods[] = {
};
static driver_t ixv_driver = {
- "ixv", ixv_methods, sizeof(struct adapter),
+ "ixv", ixv_methods, sizeof(struct ixgbe_softc),
};
devclass_t ixv_devclass;
@@ -178,7 +178,7 @@ static device_method_t ixv_if_methods[] = {
};
static driver_t ixv_if_driver = {
- "ixv_if", ixv_if_methods, sizeof(struct adapter)
+ "ixv_if", ixv_if_methods, sizeof(struct ixgbe_softc)
};
/*
@@ -246,29 +246,29 @@ static int
ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
int ntxqs, int ntxqsets)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- if_softc_ctx_t scctx = adapter->shared;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ if_softc_ctx_t scctx = sc->shared;
struct ix_tx_queue *que;
int i, j, error;
- MPASS(adapter->num_tx_queues == ntxqsets);
+ MPASS(sc->num_tx_queues == ntxqsets);
MPASS(ntxqs == 1);
/* Allocate queue structure memory */
- adapter->tx_queues =
+ sc->tx_queues =
(struct ix_tx_queue *)malloc(sizeof(struct ix_tx_queue) * ntxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
- if (!adapter->tx_queues) {
+ if (!sc->tx_queues) {
device_printf(iflib_get_dev(ctx),
"Unable to allocate TX ring memory\n");
return (ENOMEM);
}
- for (i = 0, que = adapter->tx_queues; i < ntxqsets; i++, que++) {
+ for (i = 0, que = sc->tx_queues; i < ntxqsets; i++, que++) {
struct tx_ring *txr = &que->txr;
txr->me = i;
- txr->adapter = que->adapter = adapter;
+ txr->sc = que->sc = sc;
/* Allocate report status array */
if (!(txr->tx_rsq = (qidx_t *)malloc(sizeof(qidx_t) * scctx->isc_ntxd[0], M_DEVBUF, M_NOWAIT | M_ZERO))) {
@@ -288,7 +288,7 @@ ixv_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
}
device_printf(iflib_get_dev(ctx), "allocated for %d queues\n",
- adapter->num_tx_queues);
+ sc->num_tx_queues);
return (0);
@@ -305,28 +305,28 @@ static int
ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
int nrxqs, int nrxqsets)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ix_rx_queue *que;
int i, error;
- MPASS(adapter->num_rx_queues == nrxqsets);
+ MPASS(sc->num_rx_queues == nrxqsets);
MPASS(nrxqs == 1);
/* Allocate queue structure memory */
- adapter->rx_queues =
+ sc->rx_queues =
(struct ix_rx_queue *)malloc(sizeof(struct ix_rx_queue) * nrxqsets,
M_DEVBUF, M_NOWAIT | M_ZERO);
- if (!adapter->rx_queues) {
+ if (!sc->rx_queues) {
device_printf(iflib_get_dev(ctx),
"Unable to allocate TX ring memory\n");
error = ENOMEM;
goto fail;
}
- for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) {
+ for (i = 0, que = sc->rx_queues; i < nrxqsets; i++, que++) {
struct rx_ring *rxr = &que->rxr;
rxr->me = i;
- rxr->adapter = que->adapter = adapter;
+ rxr->sc = que->sc = sc;
/* get the virtual and physical address of the hw queues */
@@ -338,7 +338,7 @@ ixv_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
}
device_printf(iflib_get_dev(ctx), "allocated for %d rx queues\n",
- adapter->num_rx_queues);
+ sc->num_rx_queues);
return (0);
@@ -354,14 +354,14 @@ fail:
static void
ixv_if_queues_free(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_tx_queue *que = adapter->tx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_tx_queue *que = sc->tx_queues;
int i;
if (que == NULL)
goto free;
- for (i = 0; i < adapter->num_tx_queues; i++, que++) {
+ for (i = 0; i < sc->num_tx_queues; i++, que++) {
struct tx_ring *txr = &que->txr;
if (txr->tx_rsq == NULL)
break;
@@ -369,13 +369,13 @@ ixv_if_queues_free(if_ctx_t ctx)
free(txr->tx_rsq, M_DEVBUF);
txr->tx_rsq = NULL;
}
- if (adapter->tx_queues != NULL)
- free(adapter->tx_queues, M_DEVBUF);
+ if (sc->tx_queues != NULL)
+ free(sc->tx_queues, M_DEVBUF);
free:
- if (adapter->rx_queues != NULL)
- free(adapter->rx_queues, M_DEVBUF);
- adapter->tx_queues = NULL;
- adapter->rx_queues = NULL;
+ if (sc->rx_queues != NULL)
+ free(sc->rx_queues, M_DEVBUF);
+ sc->tx_queues = NULL;
+ sc->rx_queues = NULL;
} /* ixv_if_queues_free */
/************************************************************************
@@ -390,7 +390,7 @@ free:
static int
ixv_if_attach_pre(if_ctx_t ctx)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
device_t dev;
if_softc_ctx_t scctx;
struct ixgbe_hw *hw;
@@ -398,15 +398,15 @@ ixv_if_attach_pre(if_ctx_t ctx)
INIT_DEBUGOUT("ixv_attach: begin");
- /* Allocate, clear, and link in our adapter structure */
+ /* Allocate, clear, and link in our sc structure */
dev = iflib_get_dev(ctx);
- adapter = iflib_get_softc(ctx);
- adapter->dev = dev;
- adapter->ctx = ctx;
- adapter->hw.back = adapter;
- scctx = adapter->shared = iflib_get_softc_ctx(ctx);
- adapter->media = iflib_get_media(ctx);
- hw = &adapter->hw;
+ sc = iflib_get_softc(ctx);
+ sc->dev = dev;
+ sc->ctx = ctx;
+ sc->hw.back = sc;
+ scctx = sc->shared = iflib_get_softc_ctx(ctx);
+ sc->media = iflib_get_media(ctx);
+ hw = &sc->hw;
/* Do base PCI setup - map BAR0 */
if (ixv_allocate_pci_resources(ctx)) {
@@ -419,11 +419,11 @@ ixv_if_attach_pre(if_ctx_t ctx)
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, ixv_sysctl_debug, "I", "Debug Info");
+ sc, 0, ixv_sysctl_debug, "I", "Debug Info");
/* Determine hardware revision */
ixv_identify_hardware(ctx);
- ixv_init_device_features(adapter);
+ ixv_init_device_features(sc);
/* Initialize the shared code */
error = ixgbe_init_ops_vf(hw);
@@ -456,7 +456,7 @@ ixv_if_attach_pre(if_ctx_t ctx)
}
/* Negotiate mailbox API version */
- error = ixv_negotiate_api(adapter);
+ error = ixv_negotiate_api(sc);
if (error) {
device_printf(dev,
"Mailbox API negotiation failed during attach!\n");
@@ -474,7 +474,7 @@ ixv_if_attach_pre(if_ctx_t ctx)
/* Most of the iflib initialization... */
iflib_set_mac(ctx, hw->mac.addr);
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_X550_vf:
case ixgbe_mac_X550EM_x_vf:
case ixgbe_mac_X550EM_a_vf:
@@ -522,7 +522,7 @@ err_out:
static int
ixv_if_attach_post(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
int error = 0;
@@ -534,9 +534,9 @@ ixv_if_attach_post(if_ctx_t ctx)
}
/* Do the stats setup */
- ixv_save_stats(adapter);
- ixv_init_stats(adapter);
- ixv_add_stats_sysctls(adapter);
+ ixv_save_stats(sc);
+ ixv_init_stats(sc);
+ ixv_add_stats_sysctls(sc);
end:
return error;
@@ -567,7 +567,7 @@ ixv_if_detach(if_ctx_t ctx)
static int
ixv_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
int error = 0;
@@ -576,7 +576,7 @@ ixv_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
error = EINVAL;
} else {
ifp->if_mtu = mtu;
- adapter->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR;
+ sc->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR;
}
return error;
@@ -595,10 +595,10 @@ ixv_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
static void
ixv_if_init(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
device_t dev = iflib_get_dev(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
int error = 0;
INIT_DEBUGOUT("ixv_if_init: begin");
@@ -615,7 +615,7 @@ ixv_if_init(if_ctx_t ctx)
/* Reset VF and renegotiate mailbox API version */
hw->mac.ops.reset_hw(hw);
hw->mac.ops.start_hw(hw);
- error = ixv_negotiate_api(adapter);
+ error = ixv_negotiate_api(sc);
if (error) {
device_printf(dev,
"Mailbox API negotiation failed in if_init!\n");
@@ -627,7 +627,7 @@ ixv_if_init(if_ctx_t ctx)
/* Setup Multicast table */
ixv_if_multi_set(ctx);
- adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
+ sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
/* Configure RX settings */
ixv_initialize_receive_units(ctx);
@@ -636,19 +636,19 @@ ixv_if_init(if_ctx_t ctx)
ixv_setup_vlan_support(ctx);
/* Set up MSI-X routing */
- ixv_configure_ivars(adapter);
+ ixv_configure_ivars(sc);
/* Set up auto-mask */
IXGBE_WRITE_REG(hw, IXGBE_VTEIAM, IXGBE_EICS_RTX_QUEUE);
/* Set moderation on the Link interrupt */
- IXGBE_WRITE_REG(hw, IXGBE_VTEITR(adapter->vector), IXGBE_LINK_ITR);
+ IXGBE_WRITE_REG(hw, IXGBE_VTEITR(sc->vector), IXGBE_LINK_ITR);
/* Stats init */
- ixv_init_stats(adapter);
+ ixv_init_stats(sc);
/* Config/Enable Link */
- hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up,
+ hw->mac.ops.check_link(hw, &sc->link_speed, &sc->link_up,
false);
/* And now turn on interrupts */
@@ -661,9 +661,9 @@ ixv_if_init(if_ctx_t ctx)
* ixv_enable_queue
************************************************************************/
static inline void
-ixv_enable_queue(struct adapter *adapter, u32 vector)
+ixv_enable_queue(struct ixgbe_softc *sc, u32 vector)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 queue = 1 << vector;
u32 mask;
@@ -675,9 +675,9 @@ ixv_enable_queue(struct adapter *adapter, u32 vector)
* ixv_disable_queue
************************************************************************/
static inline void
-ixv_disable_queue(struct adapter *adapter, u32 vector)
+ixv_disable_queue(struct ixgbe_softc *sc, u32 vector)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u64 queue = (u64)(1 << vector);
u32 mask;
@@ -693,9 +693,9 @@ static int
ixv_msix_que(void *arg)
{
struct ix_rx_queue *que = arg;
- struct adapter *adapter = que->adapter;
+ struct ixgbe_softc *sc = que->sc;
- ixv_disable_queue(adapter, que->msix);
+ ixv_disable_queue(sc, que->msix);
++que->irqs;
return (FILTER_SCHEDULE_THREAD);
@@ -707,11 +707,11 @@ ixv_msix_que(void *arg)
static int
ixv_msix_mbx(void *arg)
{
- struct adapter *adapter = arg;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = arg;
+ struct ixgbe_hw *hw = &sc->hw;
u32 reg;
- ++adapter->link_irq;
+ ++sc->link_irq;
/* First get the cause */
reg = IXGBE_READ_REG(hw, IXGBE_VTEICS);
@@ -720,7 +720,7 @@ ixv_msix_mbx(void *arg)
/* Link status change */
if (reg & IXGBE_EICR_LSC)
- iflib_admin_intr_deferred(adapter->ctx);
+ iflib_admin_intr_deferred(sc->ctx);
IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, IXGBE_EIMS_OTHER);
@@ -736,7 +736,7 @@ ixv_msix_mbx(void *arg)
static void
ixv_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
INIT_DEBUGOUT("ixv_media_status: begin");
@@ -745,12 +745,12 @@ ixv_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
- if (!adapter->link_active)
+ if (!sc->link_active)
return;
ifmr->ifm_status |= IFM_ACTIVE;
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case IXGBE_LINK_SPEED_1GB_FULL:
ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
break;
@@ -775,7 +775,7 @@ ixv_if_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
static int
ixv_if_media_change(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifmedia *ifm = iflib_get_media(ctx);
INIT_DEBUGOUT("ixv_media_change: begin");
@@ -787,7 +787,7 @@ ixv_if_media_change(if_ctx_t ctx)
case IFM_AUTO:
break;
default:
- device_printf(adapter->dev, "Only auto media type\n");
+ device_printf(sc->dev, "Only auto media type\n");
return (EINVAL);
}
@@ -802,9 +802,9 @@ ixv_if_media_change(if_ctx_t ctx)
* start with the most featured API first.
************************************************************************/
static int
-ixv_negotiate_api(struct adapter *adapter)
+ixv_negotiate_api(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
int mbx_api[] = { ixgbe_mbox_api_11,
ixgbe_mbox_api_10,
ixgbe_mbox_api_unknown };
@@ -829,7 +829,7 @@ static void
ixv_if_multi_set(if_ctx_t ctx)
{
u8 mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS];
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
u8 *update_ptr;
struct ifmultiaddr *ifma;
if_t ifp = iflib_get_ifp(ctx);
@@ -848,7 +848,7 @@ ixv_if_multi_set(if_ctx_t ctx)
update_ptr = mta;
- adapter->hw.mac.ops.update_mc_addr_list(&adapter->hw, update_ptr, mcnt,
+ sc->hw.mac.ops.update_mc_addr_list(&sc->hw, update_ptr, mcnt,
ixv_mc_array_itr, true);
} /* ixv_if_multi_set */
@@ -899,42 +899,42 @@ ixv_if_local_timer(if_ctx_t ctx, uint16_t qid)
static void
ixv_if_update_admin_status(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
s32 status;
- adapter->hw.mac.get_link_status = true;
+ sc->hw.mac.get_link_status = true;
- status = ixgbe_check_link(&adapter->hw, &adapter->link_speed,
- &adapter->link_up, false);
+ status = ixgbe_check_link(&sc->hw, &sc->link_speed,
+ &sc->link_up, false);
- if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == false) {
+ if (status != IXGBE_SUCCESS && sc->hw.adapter_stopped == false) {
/* Mailbox's Clear To Send status is lost or timeout occurred.
* We need reinitialization. */
iflib_get_ifp(ctx)->if_init(ctx);
}
- if (adapter->link_up) {
- if (adapter->link_active == false) {
+ if (sc->link_up) {
+ if (sc->link_active == false) {
if (bootverbose)
device_printf(dev, "Link is up %d Gbps %s \n",
- ((adapter->link_speed == 128) ? 10 : 1),
+ ((sc->link_speed == 128) ? 10 : 1),
"Full Duplex");
- adapter->link_active = true;
+ sc->link_active = true;
iflib_link_state_change(ctx, LINK_STATE_UP,
IF_Gbps(10));
}
} else { /* Link down */
- if (adapter->link_active == true) {
+ if (sc->link_active == true) {
if (bootverbose)
device_printf(dev, "Link is Down\n");
iflib_link_state_change(ctx, LINK_STATE_DOWN, 0);
- adapter->link_active = false;
+ sc->link_active = false;
}
}
/* Stats Update */
- ixv_update_stats(adapter);
+ ixv_update_stats(sc);
} /* ixv_if_update_admin_status */
@@ -947,19 +947,19 @@ ixv_if_update_admin_status(if_ctx_t ctx)
static void
ixv_if_stop(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
INIT_DEBUGOUT("ixv_stop: begin\n");
ixv_if_disable_intr(ctx);
hw->mac.ops.reset_hw(hw);
- adapter->hw.adapter_stopped = false;
+ sc->hw.adapter_stopped = false;
hw->mac.ops.stop_adapter(hw);
/* Update the stack */
- adapter->link_up = false;
+ sc->link_up = false;
ixv_if_update_admin_status(ctx);
/* reprogram the RAR[0] in case user changed it. */
@@ -973,9 +973,9 @@ ixv_if_stop(if_ctx_t ctx)
static void
ixv_identify_hardware(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
/* Save off the information about this board */
hw->vendor_id = pci_get_vendor(dev);
@@ -1014,14 +1014,14 @@ ixv_identify_hardware(if_ctx_t ctx)
static int
ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
- struct ix_rx_queue *rx_que = adapter->rx_queues;
+ struct ix_rx_queue *rx_que = sc->rx_queues;
struct ix_tx_queue *tx_que;
int error, rid, vector = 0;
char buf[16];
- for (int i = 0; i < adapter->num_rx_queues; i++, vector++, rx_que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, vector++, rx_que++) {
rid = vector + 1;
snprintf(buf, sizeof(buf), "rxq%d", i);
@@ -1031,31 +1031,31 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
if (error) {
device_printf(iflib_get_dev(ctx),
"Failed to allocate que int %d err: %d", i, error);
- adapter->num_rx_queues = i + 1;
+ sc->num_rx_queues = i + 1;
goto fail;
}
rx_que->msix = vector;
}
- for (int i = 0; i < adapter->num_tx_queues; i++) {
+ for (int i = 0; i < sc->num_tx_queues; i++) {
snprintf(buf, sizeof(buf), "txq%d", i);
- tx_que = &adapter->tx_queues[i];
- tx_que->msix = i % adapter->num_rx_queues;
+ tx_que = &sc->tx_queues[i];
+ tx_que->msix = i % sc->num_rx_queues;
iflib_softirq_alloc_generic(ctx,
- &adapter->rx_queues[tx_que->msix].que_irq,
+ &sc->rx_queues[tx_que->msix].que_irq,
IFLIB_INTR_TX, tx_que, tx_que->txr.me, buf);
}
rid = vector + 1;
- error = iflib_irq_alloc_generic(ctx, &adapter->irq, rid,
- IFLIB_INTR_ADMIN, ixv_msix_mbx, adapter, 0, "aq");
+ error = iflib_irq_alloc_generic(ctx, &sc->irq, rid,
+ IFLIB_INTR_ADMIN, ixv_msix_mbx, sc, 0, "aq");
if (error) {
device_printf(iflib_get_dev(ctx),
"Failed to register admin handler");
return (error);
}
- adapter->vector = vector;
+ sc->vector = vector;
/*
* Due to a broken design QEMU will fail to properly
* enable the guest for MSIX unless the vectors in
@@ -1063,7 +1063,7 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
* ENABLE in the MSIX control register again at this
* point to cause it to successfully initialize us.
*/
- if (adapter->hw.mac.type == ixgbe_mac_82599_vf) {
+ if (sc->hw.mac.type == ixgbe_mac_82599_vf) {
int msix_ctrl;
pci_find_cap(dev, PCIY_MSIX, &rid);
rid += PCIR_MSIX_CTRL;
@@ -1075,9 +1075,9 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
return (0);
fail:
- iflib_irq_free(ctx, &adapter->irq);
- rx_que = adapter->rx_queues;
- for (int i = 0; i < adapter->num_rx_queues; i++, rx_que++)
+ iflib_irq_free(ctx, &sc->irq);
+ rx_que = sc->rx_queues;
+ for (int i = 0; i < sc->num_rx_queues; i++, rx_que++)
iflib_irq_free(ctx, &rx_que->que_irq);
return (error);
@@ -1089,23 +1089,23 @@ fail:
static int
ixv_allocate_pci_resources(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
int rid;
rid = PCIR_BAR(0);
- adapter->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+ sc->pci_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
- if (!(adapter->pci_mem)) {
+ if (!(sc->pci_mem)) {
device_printf(dev, "Unable to allocate bus resource: memory\n");
return (ENXIO);
}
- adapter->osdep.mem_bus_space_tag = rman_get_bustag(adapter->pci_mem);
- adapter->osdep.mem_bus_space_handle =
- rman_get_bushandle(adapter->pci_mem);
- adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle;
+ sc->osdep.mem_bus_space_tag = rman_get_bustag(sc->pci_mem);
+ sc->osdep.mem_bus_space_handle =
+ rman_get_bushandle(sc->pci_mem);
+ sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle;
return (0);
} /* ixv_allocate_pci_resources */
@@ -1116,23 +1116,23 @@ ixv_allocate_pci_resources(if_ctx_t ctx)
static void
ixv_free_pci_resources(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_rx_queue *que = sc->rx_queues;
device_t dev = iflib_get_dev(ctx);
/* Release all MSI-X queue resources */
- if (adapter->intr_type == IFLIB_INTR_MSIX)
- iflib_irq_free(ctx, &adapter->irq);
+ if (sc->intr_type == IFLIB_INTR_MSIX)
+ iflib_irq_free(ctx, &sc->irq);
if (que != NULL) {
- for (int i = 0; i < adapter->num_rx_queues; i++, que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, que++) {
iflib_irq_free(ctx, &que->que_irq);
}
}
- if (adapter->pci_mem != NULL)
+ if (sc->pci_mem != NULL)
bus_release_resource(dev, SYS_RES_MEMORY,
- rman_get_rid(adapter->pci_mem), adapter->pci_mem);
+ rman_get_rid(sc->pci_mem), sc->pci_mem);
} /* ixv_free_pci_resources */
/************************************************************************
@@ -1143,8 +1143,8 @@ ixv_free_pci_resources(if_ctx_t ctx)
static int
ixv_setup_interface(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- if_softc_ctx_t scctx = adapter->shared;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ if_softc_ctx_t scctx = sc->shared;
struct ifnet *ifp = iflib_get_ifp(ctx);
INIT_DEBUGOUT("ixv_setup_interface: begin");
@@ -1153,9 +1153,9 @@ ixv_setup_interface(if_ctx_t ctx)
ifp->if_snd.ifq_maxlen = scctx->isc_ntxd[0] - 2;
- adapter->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR;
- ifmedia_add(adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL);
- ifmedia_set(adapter->media, IFM_ETHER | IFM_AUTO);
+ sc->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR;
+ ifmedia_add(sc->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+ ifmedia_set(sc->media, IFM_ETHER | IFM_AUTO);
return 0;
} /* ixv_setup_interface */
@@ -1166,20 +1166,20 @@ ixv_setup_interface(if_ctx_t ctx)
static uint64_t
ixv_if_get_counter(if_ctx_t ctx, ift_counter cnt)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
if_t ifp = iflib_get_ifp(ctx);
switch (cnt) {
case IFCOUNTER_IPACKETS:
- return (adapter->ipackets);
+ return (sc->ipackets);
case IFCOUNTER_OPACKETS:
- return (adapter->opackets);
+ return (sc->opackets);
case IFCOUNTER_IBYTES:
- return (adapter->ibytes);
+ return (sc->ibytes);
case IFCOUNTER_OBYTES:
- return (adapter->obytes);
+ return (sc->obytes);
case IFCOUNTER_IMCASTS:
- return (adapter->imcasts);
+ return (sc->imcasts);
default:
return (if_get_counter_default(ifp, cnt));
}
@@ -1210,13 +1210,13 @@ ixv_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event)
static void
ixv_initialize_transmit_units(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
- if_softc_ctx_t scctx = adapter->shared;
- struct ix_tx_queue *que = adapter->tx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
+ if_softc_ctx_t scctx = sc->shared;
+ struct ix_tx_queue *que = sc->tx_queues;
int i;
- for (i = 0; i < adapter->num_tx_queues; i++, que++) {
+ for (i = 0; i < sc->num_tx_queues; i++, que++) {
struct tx_ring *txr = &que->txr;
u64 tdba = txr->tx_paddr;
u32 txctrl, txdctl;
@@ -1228,8 +1228,8 @@ ixv_initialize_transmit_units(if_ctx_t ctx)
IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(j), txdctl);
/* Set the HW Tx Head and Tail indices */
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDH(j), 0);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VFTDT(j), 0);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VFTDH(j), 0);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VFTDT(j), 0);
/* Set Tx Tail register */
txr->tail = IXGBE_VFTDT(j);
@@ -1267,15 +1267,15 @@ ixv_initialize_transmit_units(if_ctx_t ctx)
* ixv_initialize_rss_mapping
************************************************************************/
static void
-ixv_initialize_rss_mapping(struct adapter *adapter)
+ixv_initialize_rss_mapping(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 reta = 0, mrqc, rss_key[10];
int queue_id;
int i, j;
u32 rss_hash_config;
- if (adapter->feat_en & IXGBE_FEATURE_RSS) {
+ if (sc->feat_en & IXGBE_FEATURE_RSS) {
/* Fetch the configured RSS key */
rss_getkey((uint8_t *)&rss_key);
} else {
@@ -1289,17 +1289,17 @@ ixv_initialize_rss_mapping(struct adapter *adapter)
/* Set up the redirection table */
for (i = 0, j = 0; i < 64; i++, j++) {
- if (j == adapter->num_rx_queues)
+ if (j == sc->num_rx_queues)
j = 0;
- if (adapter->feat_en & IXGBE_FEATURE_RSS) {
+ if (sc->feat_en & IXGBE_FEATURE_RSS) {
/*
* Fetch the RSS bucket id for the given indirection
* entry. Cap it at the number of configured buckets
* (which is num_rx_queues.)
*/
queue_id = rss_get_indirection_to_bucket(i);
- queue_id = queue_id % adapter->num_rx_queues;
+ queue_id = queue_id % sc->num_rx_queues;
} else
queue_id = j;
@@ -1316,7 +1316,7 @@ ixv_initialize_rss_mapping(struct adapter *adapter)
}
/* Perform hash on these packet types */
- if (adapter->feat_en & IXGBE_FEATURE_RSS)
+ if (sc->feat_en & IXGBE_FEATURE_RSS)
rss_hash_config = rss_gethashconfig();
else {
/*
@@ -1340,17 +1340,17 @@ ixv_initialize_rss_mapping(struct adapter *adapter)
if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6)
mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_TCP;
if (rss_hash_config & RSS_HASHTYPE_RSS_IPV6_EX)
- device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_IPV6_EX defined, but not supported\n",
+ device_printf(sc->dev, "%s: RSS_HASHTYPE_RSS_IPV6_EX defined, but not supported\n",
__func__);
if (rss_hash_config & RSS_HASHTYPE_RSS_TCP_IPV6_EX)
- device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_TCP_IPV6_EX defined, but not supported\n",
+ device_printf(sc->dev, "%s: RSS_HASHTYPE_RSS_TCP_IPV6_EX defined, but not supported\n",
__func__);
if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4)
mrqc |= IXGBE_MRQC_RSS_FIELD_IPV4_UDP;
if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6)
mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP;
if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6_EX)
- device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV6_EX defined, but not supported\n",
+ device_printf(sc->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV6_EX defined, but not supported\n",
__func__);
IXGBE_WRITE_REG(hw, IXGBE_VFMRQC, mrqc);
} /* ixv_initialize_rss_mapping */
@@ -1362,11 +1362,11 @@ ixv_initialize_rss_mapping(struct adapter *adapter)
static void
ixv_initialize_receive_units(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
if_softc_ctx_t scctx;
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
struct ifnet *ifp = iflib_get_ifp(ctx);
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ix_rx_queue *que = sc->rx_queues;
u32 bufsz, psrtype;
if (ifp->if_mtu > ETHERMTU)
@@ -1380,18 +1380,18 @@ ixv_initialize_receive_units(if_ctx_t ctx)
| IXGBE_PSRTYPE_IPV6HDR
| IXGBE_PSRTYPE_L2HDR;
- if (adapter->num_rx_queues > 1)
+ if (sc->num_rx_queues > 1)
psrtype |= 1 << 29;
IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, psrtype);
/* Tell PF our max_frame size */
- if (ixgbevf_rlpml_set_vf(hw, adapter->max_frame_size) != 0) {
- device_printf(adapter->dev, "There is a problem with the PF setup. It is likely the receive unit for this VF will not function correctly.\n");
+ if (ixgbevf_rlpml_set_vf(hw, sc->max_frame_size) != 0) {
+ device_printf(sc->dev, "There is a problem with the PF setup. It is likely the receive unit for this VF will not function correctly.\n");
}
- scctx = adapter->shared;
+ scctx = sc->shared;
- for (int i = 0; i < adapter->num_rx_queues; i++, que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, que++) {
struct rx_ring *rxr = &que->rxr;
u64 rdba = rxr->rx_paddr;
u32 reg, rxdctl;
@@ -1476,8 +1476,8 @@ ixv_initialize_receive_units(if_ctx_t ctx)
* Do not touch RSS and RETA settings for older hardware
* as those are shared among PF and all VF.
*/
- if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
- ixv_initialize_rss_mapping(adapter);
+ if (sc->hw.mac.type >= ixgbe_mac_X550_vf)
+ ixv_initialize_rss_mapping(sc);
} /* ixv_initialize_receive_units */
/************************************************************************
@@ -1487,8 +1487,8 @@ static void
ixv_setup_vlan_support(if_ctx_t ctx)
{
struct ifnet *ifp = iflib_get_ifp(ctx);
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
u32 ctrl, vid, vfta, retry;
/*
@@ -1497,12 +1497,12 @@ ixv_setup_vlan_support(if_ctx_t ctx)
* the VFTA and other state, so if there
* have been no vlan's registered do nothing.
*/
- if (adapter->num_vlans == 0)
+ if (sc->num_vlans == 0)
return;
if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) {
/* Enable the queues */
- for (int i = 0; i < adapter->num_rx_queues; i++) {
+ for (int i = 0; i < sc->num_rx_queues; i++) {
ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
ctrl |= IXGBE_RXDCTL_VME;
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl);
@@ -1510,7 +1510,7 @@ ixv_setup_vlan_support(if_ctx_t ctx)
* Let Rx path know that it needs to store VLAN tag
* as part of extra mbuf info.
*/
- adapter->rx_queues[i].rxr.vtag_strip = true;
+ sc->rx_queues[i].rxr.vtag_strip = true;
}
}
@@ -1559,13 +1559,13 @@ ixv_setup_vlan_support(if_ctx_t ctx)
static void
ixv_if_register_vlan(if_ctx_t ctx, u16 vtag)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
u16 index, bit;
index = (vtag >> 5) & 0x7F;
bit = vtag & 0x1F;
ixv_shadow_vfta[index] |= (1 << bit);
- ++adapter->num_vlans;
+ ++sc->num_vlans;
} /* ixv_if_register_vlan */
/************************************************************************
@@ -1577,13 +1577,13 @@ ixv_if_register_vlan(if_ctx_t ctx, u16 vtag)
static void
ixv_if_unregister_vlan(if_ctx_t ctx, u16 vtag)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
u16 index, bit;
index = (vtag >> 5) & 0x7F;
bit = vtag & 0x1F;
ixv_shadow_vfta[index] &= ~(1 << bit);
- --adapter->num_vlans;
+ --sc->num_vlans;
} /* ixv_if_unregister_vlan */
/************************************************************************
@@ -1592,9 +1592,9 @@ ixv_if_unregister_vlan(if_ctx_t ctx, u16 vtag)
static void
ixv_if_enable_intr(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ixgbe_hw *hw = &adapter->hw;
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ixgbe_hw *hw = &sc->hw;
+ struct ix_rx_queue *que = sc->rx_queues;
u32 mask = (IXGBE_EIMS_ENABLE_MASK & ~IXGBE_EIMS_RTX_QUEUE);
IXGBE_WRITE_REG(hw, IXGBE_VTEIMS, mask);
@@ -1603,8 +1603,8 @@ ixv_if_enable_intr(if_ctx_t ctx)
mask &= ~(IXGBE_EIMS_OTHER | IXGBE_EIMS_LSC);
IXGBE_WRITE_REG(hw, IXGBE_VTEIAC, mask);
- for (int i = 0; i < adapter->num_rx_queues; i++, que++)
- ixv_enable_queue(adapter, que->msix);
+ for (int i = 0; i < sc->num_rx_queues; i++, que++)
+ ixv_enable_queue(sc, que->msix);
IXGBE_WRITE_FLUSH(hw);
} /* ixv_if_enable_intr */
@@ -1615,10 +1615,10 @@ ixv_if_enable_intr(if_ctx_t ctx)
static void
ixv_if_disable_intr(if_ctx_t ctx)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VTEIAC, 0);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VTEIMC, ~0);
- IXGBE_WRITE_FLUSH(&adapter->hw);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VTEIAC, 0);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VTEIMC, ~0);
+ IXGBE_WRITE_FLUSH(&sc->hw);
} /* ixv_if_disable_intr */
/************************************************************************
@@ -1627,10 +1627,10 @@ ixv_if_disable_intr(if_ctx_t ctx)
static int
ixv_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid)
{
- struct adapter *adapter = iflib_get_softc(ctx);
- struct ix_rx_queue *que = &adapter->rx_queues[rxqid];
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
+ struct ix_rx_queue *que = &sc->rx_queues[rxqid];
- ixv_enable_queue(adapter, que->rxr.me);
+ ixv_enable_queue(sc, que->rxr.me);
return (0);
} /* ixv_if_rx_queue_intr_enable */
@@ -1644,9 +1644,9 @@ ixv_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid)
* - type is RX/TX/MISC
************************************************************************/
static void
-ixv_set_ivar(struct adapter *adapter, u8 entry, u8 vector, s8 type)
+ixv_set_ivar(struct ixgbe_softc *sc, u8 entry, u8 vector, s8 type)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
u32 ivar, index;
vector |= IXGBE_IVAR_ALLOC_VAL;
@@ -1669,24 +1669,24 @@ ixv_set_ivar(struct adapter *adapter, u8 entry, u8 vector, s8 type)
* ixv_configure_ivars
************************************************************************/
static void
-ixv_configure_ivars(struct adapter *adapter)
+ixv_configure_ivars(struct ixgbe_softc *sc)
{
- struct ix_rx_queue *que = adapter->rx_queues;
+ struct ix_rx_queue *que = sc->rx_queues;
- MPASS(adapter->num_rx_queues == adapter->num_tx_queues);
+ MPASS(sc->num_rx_queues == sc->num_tx_queues);
- for (int i = 0; i < adapter->num_rx_queues; i++, que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, que++) {
/* First the RX queue entry */
- ixv_set_ivar(adapter, i, que->msix, 0);
+ ixv_set_ivar(sc, i, que->msix, 0);
/* ... and the TX */
- ixv_set_ivar(adapter, i, que->msix, 1);
+ ixv_set_ivar(sc, i, que->msix, 1);
/* Set an initial value in EITR */
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VTEITR(que->msix),
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VTEITR(que->msix),
IXGBE_EITR_DEFAULT);
}
/* For the mailbox interrupt */
- ixv_set_ivar(adapter, 1, adapter->vector, -1);
+ ixv_set_ivar(sc, 1, sc->vector, -1);
} /* ixv_configure_ivars */
/************************************************************************
@@ -1698,19 +1698,19 @@ ixv_configure_ivars(struct adapter *adapter)
* it were.
************************************************************************/
static void
-ixv_save_stats(struct adapter *adapter)
+ixv_save_stats(struct ixgbe_softc *sc)
{
- if (adapter->stats.vf.vfgprc || adapter->stats.vf.vfgptc) {
- adapter->stats.vf.saved_reset_vfgprc +=
- adapter->stats.vf.vfgprc - adapter->stats.vf.base_vfgprc;
- adapter->stats.vf.saved_reset_vfgptc +=
- adapter->stats.vf.vfgptc - adapter->stats.vf.base_vfgptc;
- adapter->stats.vf.saved_reset_vfgorc +=
- adapter->stats.vf.vfgorc - adapter->stats.vf.base_vfgorc;
- adapter->stats.vf.saved_reset_vfgotc +=
- adapter->stats.vf.vfgotc - adapter->stats.vf.base_vfgotc;
- adapter->stats.vf.saved_reset_vfmprc +=
- adapter->stats.vf.vfmprc - adapter->stats.vf.base_vfmprc;
+ if (sc->stats.vf.vfgprc || sc->stats.vf.vfgptc) {
+ sc->stats.vf.saved_reset_vfgprc +=
+ sc->stats.vf.vfgprc - sc->stats.vf.base_vfgprc;
+ sc->stats.vf.saved_reset_vfgptc +=
+ sc->stats.vf.vfgptc - sc->stats.vf.base_vfgptc;
+ sc->stats.vf.saved_reset_vfgorc +=
+ sc->stats.vf.vfgorc - sc->stats.vf.base_vfgorc;
+ sc->stats.vf.saved_reset_vfgotc +=
+ sc->stats.vf.vfgotc - sc->stats.vf.base_vfgotc;
+ sc->stats.vf.saved_reset_vfmprc +=
+ sc->stats.vf.vfmprc - sc->stats.vf.base_vfmprc;
}
} /* ixv_save_stats */
@@ -1718,27 +1718,27 @@ ixv_save_stats(struct adapter *adapter)
* ixv_init_stats
************************************************************************/
static void
-ixv_init_stats(struct adapter *adapter)
+ixv_init_stats(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
- adapter->stats.vf.last_vfgprc = IXGBE_READ_REG(hw, IXGBE_VFGPRC);
- adapter->stats.vf.last_vfgorc = IXGBE_READ_REG(hw, IXGBE_VFGORC_LSB);
- adapter->stats.vf.last_vfgorc |=
+ sc->stats.vf.last_vfgprc = IXGBE_READ_REG(hw, IXGBE_VFGPRC);
+ sc->stats.vf.last_vfgorc = IXGBE_READ_REG(hw, IXGBE_VFGORC_LSB);
+ sc->stats.vf.last_vfgorc |=
(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGORC_MSB))) << 32);
- adapter->stats.vf.last_vfgptc = IXGBE_READ_REG(hw, IXGBE_VFGPTC);
- adapter->stats.vf.last_vfgotc = IXGBE_READ_REG(hw, IXGBE_VFGOTC_LSB);
- adapter->stats.vf.last_vfgotc |=
+ sc->stats.vf.last_vfgptc = IXGBE_READ_REG(hw, IXGBE_VFGPTC);
+ sc->stats.vf.last_vfgotc = IXGBE_READ_REG(hw, IXGBE_VFGOTC_LSB);
+ sc->stats.vf.last_vfgotc |=
(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
- adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
+ sc->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
- adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
- adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
- adapter->stats.vf.base_vfgptc = adapter->stats.vf.last_vfgptc;
- adapter->stats.vf.base_vfgotc = adapter->stats.vf.last_vfgotc;
- adapter->stats.vf.base_vfmprc = adapter->stats.vf.last_vfmprc;
+ sc->stats.vf.base_vfgprc = sc->stats.vf.last_vfgprc;
+ sc->stats.vf.base_vfgorc = sc->stats.vf.last_vfgorc;
+ sc->stats.vf.base_vfgptc = sc->stats.vf.last_vfgptc;
+ sc->stats.vf.base_vfgotc = sc->stats.vf.last_vfgotc;
+ sc->stats.vf.base_vfmprc = sc->stats.vf.last_vfmprc;
} /* ixv_init_stats */
#define UPDATE_STAT_32(reg, last, count) \
@@ -1767,43 +1767,43 @@ ixv_init_stats(struct adapter *adapter)
* ixv_update_stats - Update the board statistics counters.
************************************************************************/
void
-ixv_update_stats(struct adapter *adapter)
+ixv_update_stats(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
- struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
+ struct ixgbe_hw *hw = &sc->hw;
+ struct ixgbevf_hw_stats *stats = &sc->stats.vf;
- UPDATE_STAT_32(IXGBE_VFGPRC, adapter->stats.vf.last_vfgprc,
- adapter->stats.vf.vfgprc);
- UPDATE_STAT_32(IXGBE_VFGPTC, adapter->stats.vf.last_vfgptc,
- adapter->stats.vf.vfgptc);
+ UPDATE_STAT_32(IXGBE_VFGPRC, sc->stats.vf.last_vfgprc,
+ sc->stats.vf.vfgprc);
+ UPDATE_STAT_32(IXGBE_VFGPTC, sc->stats.vf.last_vfgptc,
+ sc->stats.vf.vfgptc);
UPDATE_STAT_36(IXGBE_VFGORC_LSB, IXGBE_VFGORC_MSB,
- adapter->stats.vf.last_vfgorc, adapter->stats.vf.vfgorc);
+ sc->stats.vf.last_vfgorc, sc->stats.vf.vfgorc);
UPDATE_STAT_36(IXGBE_VFGOTC_LSB, IXGBE_VFGOTC_MSB,
- adapter->stats.vf.last_vfgotc, adapter->stats.vf.vfgotc);
- UPDATE_STAT_32(IXGBE_VFMPRC, adapter->stats.vf.last_vfmprc,
- adapter->stats.vf.vfmprc);
+ sc->stats.vf.last_vfgotc, sc->stats.vf.vfgotc);
+ UPDATE_STAT_32(IXGBE_VFMPRC, sc->stats.vf.last_vfmprc,
+ sc->stats.vf.vfmprc);
/* Fill out the OS statistics structure */
- IXGBE_SET_IPACKETS(adapter, stats->vfgprc);
- IXGBE_SET_OPACKETS(adapter, stats->vfgptc);
- IXGBE_SET_IBYTES(adapter, stats->vfgorc);
- IXGBE_SET_OBYTES(adapter, stats->vfgotc);
- IXGBE_SET_IMCASTS(adapter, stats->vfmprc);
+ IXGBE_SET_IPACKETS(sc, stats->vfgprc);
+ IXGBE_SET_OPACKETS(sc, stats->vfgptc);
+ IXGBE_SET_IBYTES(sc, stats->vfgorc);
+ IXGBE_SET_OBYTES(sc, stats->vfgotc);
+ IXGBE_SET_IMCASTS(sc, stats->vfmprc);
} /* ixv_update_stats */
/************************************************************************
* ixv_add_stats_sysctls - Add statistic sysctls for the VF.
************************************************************************/
static void
-ixv_add_stats_sysctls(struct adapter *adapter)
+ixv_add_stats_sysctls(struct ixgbe_softc *sc)
{
- device_t dev = adapter->dev;
- struct ix_tx_queue *tx_que = adapter->tx_queues;
- struct ix_rx_queue *rx_que = adapter->rx_queues;
+ device_t dev = sc->dev;
+ struct ix_tx_queue *tx_que = sc->tx_queues;
+ struct ix_rx_queue *rx_que = sc->rx_queues;
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
struct sysctl_oid *tree = device_get_sysctl_tree(dev);
struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
- struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
+ struct ixgbevf_hw_stats *stats = &sc->stats.vf;
struct sysctl_oid *stat_node, *queue_node;
struct sysctl_oid_list *stat_list, *queue_list;
@@ -1812,11 +1812,11 @@ ixv_add_stats_sysctls(struct adapter *adapter)
/* Driver Statistics */
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events",
- CTLFLAG_RD, &adapter->watchdog_events, "Watchdog timeouts");
+ CTLFLAG_RD, &sc->watchdog_events, "Watchdog timeouts");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
- CTLFLAG_RD, &adapter->link_irq, "Link MSI-X IRQ Handled");
+ CTLFLAG_RD, &sc->link_irq, "Link MSI-X IRQ Handled");
- for (int i = 0; i < adapter->num_tx_queues; i++, tx_que++) {
+ for (int i = 0; i < sc->num_tx_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf,
@@ -1829,7 +1829,7 @@ ixv_add_stats_sysctls(struct adapter *adapter)
CTLFLAG_RD, &(txr->total_packets), "TX Packets");
}
- for (int i = 0; i < adapter->num_rx_queues; i++, rx_que++) {
+ for (int i = 0; i < sc->num_rx_queues; i++, rx_que++) {
struct rx_ring *rxr = &rx_que->rxr;
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf,
@@ -1871,15 +1871,15 @@ ixv_add_stats_sysctls(struct adapter *adapter)
* maintained by the driver and hardware.
************************************************************************/
static void
-ixv_print_debug_info(struct adapter *adapter)
+ixv_print_debug_info(struct ixgbe_softc *sc)
{
- device_t dev = adapter->dev;
- struct ixgbe_hw *hw = &adapter->hw;
+ device_t dev = sc->dev;
+ struct ixgbe_hw *hw = &sc->hw;
device_printf(dev, "Error Byte Count = %u \n",
IXGBE_READ_REG(hw, IXGBE_ERRBC));
- device_printf(dev, "MBX IRQ Handled: %lu\n", (long)adapter->link_irq);
+ device_printf(dev, "MBX IRQ Handled: %lu\n", (long)sc->link_irq);
} /* ixv_print_debug_info */
/************************************************************************
@@ -1888,8 +1888,8 @@ ixv_print_debug_info(struct adapter *adapter)
static int
ixv_sysctl_debug(SYSCTL_HANDLER_ARGS)
{
- struct adapter *adapter;
- int error, result;
+ struct ixgbe_softc *sc;
+ int error, result;
result = -1;
error = sysctl_handle_int(oidp, &result, 0, req);
@@ -1898,8 +1898,8 @@ ixv_sysctl_debug(SYSCTL_HANDLER_ARGS)
return (error);
if (result == 1) {
- adapter = (struct adapter *)arg1;
- ixv_print_debug_info(adapter);
+ sc = (struct ixgbe_softc *)arg1;
+ ixv_print_debug_info(sc);
}
return error;
@@ -1909,14 +1909,14 @@ ixv_sysctl_debug(SYSCTL_HANDLER_ARGS)
* ixv_init_device_features
************************************************************************/
static void
-ixv_init_device_features(struct adapter *adapter)
+ixv_init_device_features(struct ixgbe_softc *sc)
{
- adapter->feat_cap = IXGBE_FEATURE_NETMAP
- | IXGBE_FEATURE_VF
- | IXGBE_FEATURE_LEGACY_TX;
+ sc->feat_cap = IXGBE_FEATURE_NETMAP
+ | IXGBE_FEATURE_VF
+ | IXGBE_FEATURE_LEGACY_TX;
/* A tad short on feature flags for VFs, atm. */
- switch (adapter->hw.mac.type) {
+ switch (sc->hw.mac.type) {
case ixgbe_mac_82599_vf:
break;
case ixgbe_mac_X540_vf:
@@ -1924,8 +1924,8 @@ ixv_init_device_features(struct adapter *adapter)
case ixgbe_mac_X550_vf:
case ixgbe_mac_X550EM_x_vf:
case ixgbe_mac_X550EM_a_vf:
- adapter->feat_cap |= IXGBE_FEATURE_NEEDS_CTXD;
- adapter->feat_cap |= IXGBE_FEATURE_RSS;
+ sc->feat_cap |= IXGBE_FEATURE_NEEDS_CTXD;
+ sc->feat_cap |= IXGBE_FEATURE_RSS;
break;
default:
break;
@@ -1933,16 +1933,16 @@ ixv_init_device_features(struct adapter *adapter)
/* Enabled by default... */
/* Is a virtual function (VF) */
- if (adapter->feat_cap & IXGBE_FEATURE_VF)
- adapter->feat_en |= IXGBE_FEATURE_VF;
+ if (sc->feat_cap & IXGBE_FEATURE_VF)
+ sc->feat_en |= IXGBE_FEATURE_VF;
/* Netmap */
- if (adapter->feat_cap & IXGBE_FEATURE_NETMAP)
- adapter->feat_en |= IXGBE_FEATURE_NETMAP;
+ if (sc->feat_cap & IXGBE_FEATURE_NETMAP)
+ sc->feat_en |= IXGBE_FEATURE_NETMAP;
/* Receive-Side Scaling (RSS) */
- if (adapter->feat_cap & IXGBE_FEATURE_RSS)
- adapter->feat_en |= IXGBE_FEATURE_RSS;
+ if (sc->feat_cap & IXGBE_FEATURE_RSS)
+ sc->feat_en |= IXGBE_FEATURE_RSS;
/* Needs advanced context descriptor regardless of offloads req'd */
- if (adapter->feat_cap & IXGBE_FEATURE_NEEDS_CTXD)
- adapter->feat_en |= IXGBE_FEATURE_NEEDS_CTXD;
+ if (sc->feat_cap & IXGBE_FEATURE_NEEDS_CTXD)
+ sc->feat_en |= IXGBE_FEATURE_NEEDS_CTXD;
} /* ixv_init_device_features */
diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c
index 3cc4d788ecd4..5462aac56acc 100644
--- a/sys/dev/ixgbe/if_sriov.c
+++ b/sys/dev/ixgbe/if_sriov.c
@@ -78,51 +78,51 @@ ixgbe_define_iov_schemas(device_t dev, int *error)
* ixgbe_align_all_queue_indices
************************************************************************/
inline void
-ixgbe_align_all_queue_indices(struct adapter *adapter)
+ixgbe_align_all_queue_indices(struct ixgbe_softc *sc)
{
int i;
int index;
- for (i = 0; i < adapter->num_rx_queues; i++) {
- index = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, i);
- adapter->rx_queues[i].rxr.me = index;
+ for (i = 0; i < sc->num_rx_queues; i++) {
+ index = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i);
+ sc->rx_queues[i].rxr.me = index;
}
- for (i = 0; i < adapter->num_tx_queues; i++) {
- index = ixgbe_vf_que_index(adapter->iov_mode, adapter->pool, i);
- adapter->tx_queues[i].txr.me = index;
+ for (i = 0; i < sc->num_tx_queues; i++) {
+ index = ixgbe_vf_que_index(sc->iov_mode, sc->pool, i);
+ sc->tx_queues[i].txr.me = index;
}
}
/* Support functions for SR-IOV/VF management */
static inline void
-ixgbe_send_vf_msg(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
+ixgbe_send_vf_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
{
if (vf->flags & IXGBE_VF_CTS)
msg |= IXGBE_VT_MSGTYPE_CTS;
- adapter->hw.mbx.ops.write(&adapter->hw, &msg, 1, vf->pool);
+ sc->hw.mbx.ops.write(&sc->hw, &msg, 1, vf->pool);
}
static inline void
-ixgbe_send_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
+ixgbe_send_vf_ack(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
{
msg &= IXGBE_VT_MSG_MASK;
- ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_ACK);
+ ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_ACK);
}
static inline void
-ixgbe_send_vf_nack(struct adapter *adapter, struct ixgbe_vf *vf, u32 msg)
+ixgbe_send_vf_nack(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
{
msg &= IXGBE_VT_MSG_MASK;
- ixgbe_send_vf_msg(adapter, vf, msg | IXGBE_VT_MSGTYPE_NACK);
+ ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_NACK);
}
static inline void
-ixgbe_process_vf_ack(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_process_vf_ack(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
if (!(vf->flags & IXGBE_VF_CTS))
- ixgbe_send_vf_nack(adapter, vf, 0);
+ ixgbe_send_vf_nack(sc, vf, 0);
}
static inline boolean_t
@@ -152,10 +152,10 @@ ixgbe_vf_que_index(int mode, int vfnum, int num)
}
static inline void
-ixgbe_update_max_frame(struct adapter * adapter, int max_frame)
+ixgbe_update_max_frame(struct ixgbe_softc * sc, int max_frame)
{
- if (adapter->max_frame_size < max_frame)
- adapter->max_frame_size = max_frame;
+ if (sc->max_frame_size < max_frame)
+ sc->max_frame_size = max_frame;
}
inline u32
@@ -204,26 +204,26 @@ ixgbe_get_mtqc(int iov_mode)
}
void
-ixgbe_ping_all_vfs(struct adapter *adapter)
+ixgbe_ping_all_vfs(struct ixgbe_softc *sc)
{
struct ixgbe_vf *vf;
- for (int i = 0; i < adapter->num_vfs; i++) {
- vf = &adapter->vfs[i];
+ for (int i = 0; i < sc->num_vfs; i++) {
+ vf = &sc->vfs[i];
if (vf->flags & IXGBE_VF_ACTIVE)
- ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
+ ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG);
}
} /* ixgbe_ping_all_vfs */
static void
-ixgbe_vf_set_default_vlan(struct adapter *adapter, struct ixgbe_vf *vf,
+ixgbe_vf_set_default_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf,
uint16_t tag)
{
struct ixgbe_hw *hw;
uint32_t vmolr, vmvir;
- hw = &adapter->hw;
+ hw = &sc->hw;
vf->vlan_tag = tag;
@@ -257,7 +257,7 @@ ixgbe_vf_set_default_vlan(struct adapter *adapter, struct ixgbe_vf *vf,
static boolean_t
-ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_vf_frame_size_compatible(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
/*
@@ -265,7 +265,7 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
* 82599-based cards. X540 and later support any combination of jumbo
* frames on PFs and VFs.
*/
- if (adapter->hw.mac.type != ixgbe_mac_82599EB)
+ if (sc->hw.mac.type != ixgbe_mac_82599EB)
return (true);
switch (vf->api_ver) {
@@ -275,7 +275,7 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
* On legacy (1.0 and older) VF versions, we don't support jumbo
* frames on either the PF or the VF.
*/
- if (adapter->max_frame_size > ETHER_MAX_LEN ||
+ if (sc->max_frame_size > ETHER_MAX_LEN ||
vf->maximum_frame_size > ETHER_MAX_LEN)
return (false);
@@ -295,7 +295,7 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
* Jumbo frames only work with VFs if the PF is also using jumbo
* frames.
*/
- if (adapter->max_frame_size <= ETHER_MAX_LEN)
+ if (sc->max_frame_size <= ETHER_MAX_LEN)
return (true);
return (false);
@@ -304,25 +304,25 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
static void
-ixgbe_process_vf_reset(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_process_vf_reset(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
- ixgbe_vf_set_default_vlan(adapter, vf, vf->default_vlan);
+ ixgbe_vf_set_default_vlan(sc, vf, vf->default_vlan);
// XXX clear multicast addresses
- ixgbe_clear_rar(&adapter->hw, vf->rar_index);
+ ixgbe_clear_rar(&sc->hw, vf->rar_index);
vf->api_ver = IXGBE_API_VER_UNKNOWN;
} /* ixgbe_process_vf_reset */
static void
-ixgbe_vf_enable_transmit(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_vf_enable_transmit(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
struct ixgbe_hw *hw;
uint32_t vf_index, vfte;
- hw = &adapter->hw;
+ hw = &sc->hw;
vf_index = IXGBE_VF_INDEX(vf->pool);
vfte = IXGBE_READ_REG(hw, IXGBE_VFTE(vf_index));
@@ -332,16 +332,16 @@ ixgbe_vf_enable_transmit(struct adapter *adapter, struct ixgbe_vf *vf)
static void
-ixgbe_vf_enable_receive(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_vf_enable_receive(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
struct ixgbe_hw *hw;
uint32_t vf_index, vfre;
- hw = &adapter->hw;
+ hw = &sc->hw;
vf_index = IXGBE_VF_INDEX(vf->pool);
vfre = IXGBE_READ_REG(hw, IXGBE_VFRE(vf_index));
- if (ixgbe_vf_frame_size_compatible(adapter, vf))
+ if (ixgbe_vf_frame_size_compatible(sc, vf))
vfre |= IXGBE_VF_BIT(vf->pool);
else
vfre &= ~IXGBE_VF_BIT(vf->pool);
@@ -350,25 +350,25 @@ ixgbe_vf_enable_receive(struct adapter *adapter, struct ixgbe_vf *vf)
static void
-ixgbe_vf_reset_msg(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
+ixgbe_vf_reset_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
{
struct ixgbe_hw *hw;
uint32_t ack;
uint32_t resp[IXGBE_VF_PERMADDR_MSG_LEN];
- hw = &adapter->hw;
+ hw = &sc->hw;
- ixgbe_process_vf_reset(adapter, vf);
+ ixgbe_process_vf_reset(sc, vf);
if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) {
- ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr,
+ ixgbe_set_rar(&sc->hw, vf->rar_index, vf->ether_addr,
vf->pool, true);
ack = IXGBE_VT_MSGTYPE_ACK;
} else
ack = IXGBE_VT_MSGTYPE_NACK;
- ixgbe_vf_enable_transmit(adapter, vf);
- ixgbe_vf_enable_receive(adapter, vf);
+ ixgbe_vf_enable_transmit(sc, vf);
+ ixgbe_vf_enable_receive(sc, vf);
vf->flags |= IXGBE_VF_CTS;
@@ -380,7 +380,7 @@ ixgbe_vf_reset_msg(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
static void
-ixgbe_vf_set_mac(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
+ixgbe_vf_set_mac(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
{
uint8_t *mac;
@@ -388,21 +388,21 @@ ixgbe_vf_set_mac(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
/* Check that the VF has permission to change the MAC address. */
if (!(vf->flags & IXGBE_VF_CAP_MAC) && ixgbe_vf_mac_changed(vf, mac)) {
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
if (ixgbe_validate_mac_addr(mac) != 0) {
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
bcopy(mac, vf->ether_addr, ETHER_ADDR_LEN);
- ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr, vf->pool,
+ ixgbe_set_rar(&sc->hw, vf->rar_index, vf->ether_addr, vf->pool,
true);
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
} /* ixgbe_vf_set_mac */
@@ -411,7 +411,7 @@ ixgbe_vf_set_mac(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
* 1 of 128 32 bit addresses (4096 possible).
*/
static void
-ixgbe_vf_set_mc_addr(struct adapter *adapter, struct ixgbe_vf *vf, u32 *msg)
+ixgbe_vf_set_mc_addr(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 *msg)
{
u16 *list = (u16*)&msg[1];
int entries;
@@ -420,7 +420,7 @@ ixgbe_vf_set_mc_addr(struct adapter *adapter, struct ixgbe_vf *vf, u32 *msg)
entries = (msg[0] & IXGBE_VT_MSGINFO_MASK) >> IXGBE_VT_MSGINFO_SHIFT;
entries = min(entries, IXGBE_MAX_VF_MC);
- vmolr = IXGBE_READ_REG(&adapter->hw, IXGBE_VMOLR(vf->pool));
+ vmolr = IXGBE_READ_REG(&sc->hw, IXGBE_VMOLR(vf->pool));
vf->num_mc_hashes = entries;
@@ -429,56 +429,56 @@ ixgbe_vf_set_mc_addr(struct adapter *adapter, struct ixgbe_vf *vf, u32 *msg)
vf->mc_hash[i] = list[i];
vec_reg = (vf->mc_hash[i] >> 5) & 0x7F;
vec_bit = vf->mc_hash[i] & 0x1F;
- mta_reg = IXGBE_READ_REG(&adapter->hw, IXGBE_MTA(vec_reg));
+ mta_reg = IXGBE_READ_REG(&sc->hw, IXGBE_MTA(vec_reg));
mta_reg |= (1 << vec_bit);
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_MTA(vec_reg), mta_reg);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_MTA(vec_reg), mta_reg);
}
vmolr |= IXGBE_VMOLR_ROMPE;
- IXGBE_WRITE_REG(&adapter->hw, IXGBE_VMOLR(vf->pool), vmolr);
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ IXGBE_WRITE_REG(&sc->hw, IXGBE_VMOLR(vf->pool), vmolr);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
} /* ixgbe_vf_set_mc_addr */
static void
-ixgbe_vf_set_vlan(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
+ixgbe_vf_set_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
{
struct ixgbe_hw *hw;
int enable;
uint16_t tag;
- hw = &adapter->hw;
+ hw = &sc->hw;
enable = IXGBE_VT_MSGINFO(msg[0]);
tag = msg[1] & IXGBE_VLVF_VLANID_MASK;
if (!(vf->flags & IXGBE_VF_CAP_VLAN)) {
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
/* It is illegal to enable vlan tag 0. */
if (tag == 0 && enable != 0) {
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
ixgbe_set_vfta(hw, tag, vf->pool, enable, false);
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
} /* ixgbe_vf_set_vlan */
static void
-ixgbe_vf_set_lpe(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
+ixgbe_vf_set_lpe(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
{
struct ixgbe_hw *hw;
uint32_t vf_max_size, pf_max_size, mhadd;
- hw = &adapter->hw;
+ hw = &sc->hw;
vf_max_size = msg[1];
if (vf_max_size < ETHER_CRC_LEN) {
/* We intentionally ACK invalid LPE requests. */
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
return;
}
@@ -486,43 +486,43 @@ ixgbe_vf_set_lpe(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
if (vf_max_size > IXGBE_MAX_FRAME_SIZE) {
/* We intentionally ACK invalid LPE requests. */
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
return;
}
vf->maximum_frame_size = vf_max_size;
- ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
+ ixgbe_update_max_frame(sc, vf->maximum_frame_size);
/*
* We might have to disable reception to this VF if the frame size is
* not compatible with the config on the PF.
*/
- ixgbe_vf_enable_receive(adapter, vf);
+ ixgbe_vf_enable_receive(sc, vf);
mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
pf_max_size = (mhadd & IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
- if (pf_max_size < adapter->max_frame_size) {
+ if (pf_max_size < sc->max_frame_size) {
mhadd &= ~IXGBE_MHADD_MFS_MASK;
- mhadd |= adapter->max_frame_size << IXGBE_MHADD_MFS_SHIFT;
+ mhadd |= sc->max_frame_size << IXGBE_MHADD_MFS_SHIFT;
IXGBE_WRITE_REG(hw, IXGBE_MHADD, mhadd);
}
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
} /* ixgbe_vf_set_lpe */
static void
-ixgbe_vf_set_macvlan(struct adapter *adapter, struct ixgbe_vf *vf,
+ixgbe_vf_set_macvlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf,
uint32_t *msg)
{
//XXX implement this
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
} /* ixgbe_vf_set_macvlan */
static void
-ixgbe_vf_api_negotiate(struct adapter *adapter, struct ixgbe_vf *vf,
+ixgbe_vf_api_negotiate(struct ixgbe_softc *sc, struct ixgbe_vf *vf,
uint32_t *msg)
{
@@ -530,37 +530,37 @@ ixgbe_vf_api_negotiate(struct adapter *adapter, struct ixgbe_vf *vf,
case IXGBE_API_VER_1_0:
case IXGBE_API_VER_1_1:
vf->api_ver = msg[1];
- ixgbe_send_vf_ack(adapter, vf, msg[0]);
+ ixgbe_send_vf_ack(sc, vf, msg[0]);
break;
default:
vf->api_ver = IXGBE_API_VER_UNKNOWN;
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
break;
}
} /* ixgbe_vf_api_negotiate */
static void
-ixgbe_vf_get_queues(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
+ixgbe_vf_get_queues(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
{
struct ixgbe_hw *hw;
uint32_t resp[IXGBE_VF_GET_QUEUES_RESP_LEN];
int num_queues;
- hw = &adapter->hw;
+ hw = &sc->hw;
/* GET_QUEUES is not supported on pre-1.1 APIs. */
switch (msg[0]) {
case IXGBE_API_VER_1_0:
case IXGBE_API_VER_UNKNOWN:
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
resp[0] = IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK |
IXGBE_VT_MSGTYPE_CTS;
- num_queues = ixgbe_vf_queues(adapter->iov_mode);
+ num_queues = ixgbe_vf_queues(sc->iov_mode);
resp[IXGBE_VF_TX_QUEUES] = num_queues;
resp[IXGBE_VF_RX_QUEUES] = num_queues;
resp[IXGBE_VF_TRANS_VLAN] = (vf->default_vlan != 0);
@@ -573,7 +573,7 @@ ixgbe_vf_get_queues(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg)
static void
ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf)
{
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
#ifdef KTR
struct ifnet *ifp = iflib_get_ifp(ctx);
#endif
@@ -581,7 +581,7 @@ ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf)
uint32_t msg[IXGBE_VFMAILBOX_SIZE];
int error;
- hw = &adapter->hw;
+ hw = &sc->hw;
error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
@@ -591,39 +591,39 @@ ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf)
CTR3(KTR_MALLOC, "%s: received msg %x from %d", ifp->if_xname,
msg[0], vf->pool);
if (msg[0] == IXGBE_VF_RESET) {
- ixgbe_vf_reset_msg(adapter, vf, msg);
+ ixgbe_vf_reset_msg(sc, vf, msg);
return;
}
if (!(vf->flags & IXGBE_VF_CTS)) {
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
return;
}
switch (msg[0] & IXGBE_VT_MSG_MASK) {
case IXGBE_VF_SET_MAC_ADDR:
- ixgbe_vf_set_mac(adapter, vf, msg);
+ ixgbe_vf_set_mac(sc, vf, msg);
break;
case IXGBE_VF_SET_MULTICAST:
- ixgbe_vf_set_mc_addr(adapter, vf, msg);
+ ixgbe_vf_set_mc_addr(sc, vf, msg);
break;
case IXGBE_VF_SET_VLAN:
- ixgbe_vf_set_vlan(adapter, vf, msg);
+ ixgbe_vf_set_vlan(sc, vf, msg);
break;
case IXGBE_VF_SET_LPE:
- ixgbe_vf_set_lpe(adapter, vf, msg);
+ ixgbe_vf_set_lpe(sc, vf, msg);
break;
case IXGBE_VF_SET_MACVLAN:
- ixgbe_vf_set_macvlan(adapter, vf, msg);
+ ixgbe_vf_set_macvlan(sc, vf, msg);
break;
case IXGBE_VF_API_NEGOTIATE:
- ixgbe_vf_api_negotiate(adapter, vf, msg);
+ ixgbe_vf_api_negotiate(sc, vf, msg);
break;
case IXGBE_VF_GET_QUEUES:
- ixgbe_vf_get_queues(adapter, vf, msg);
+ ixgbe_vf_get_queues(sc, vf, msg);
break;
default:
- ixgbe_send_vf_nack(adapter, vf, msg[0]);
+ ixgbe_send_vf_nack(sc, vf, msg[0]);
}
} /* ixgbe_process_vf_msg */
@@ -633,25 +633,25 @@ void
ixgbe_handle_mbx(void *context)
{
if_ctx_t ctx = context;
- struct adapter *adapter = iflib_get_softc(ctx);
+ struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ixgbe_hw *hw;
struct ixgbe_vf *vf;
int i;
- hw = &adapter->hw;
+ hw = &sc->hw;
- for (i = 0; i < adapter->num_vfs; i++) {
- vf = &adapter->vfs[i];
+ for (i = 0; i < sc->num_vfs; i++) {
+ vf = &sc->vfs[i];
if (vf->flags & IXGBE_VF_ACTIVE) {
if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
- ixgbe_process_vf_reset(adapter, vf);
+ ixgbe_process_vf_reset(sc, vf);
if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
ixgbe_process_vf_msg(ctx, vf);
if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
- ixgbe_process_vf_ack(adapter, vf);
+ ixgbe_process_vf_ack(sc, vf);
}
}
} /* ixgbe_handle_mbx */
@@ -659,11 +659,11 @@ ixgbe_handle_mbx(void *context)
int
ixgbe_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
int retval = 0;
- adapter = iflib_get_softc(ctx);
- adapter->iov_mode = IXGBE_NO_VM;
+ sc = iflib_get_softc(ctx);
+ sc->iov_mode = IXGBE_NO_VM;
if (num_vfs == 0) {
/* Would we ever get num_vfs = 0? */
@@ -678,36 +678,36 @@ ixgbe_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config)
* With 32 VFs, you can have up to four queues per VF.
*/
if (num_vfs >= IXGBE_32_VM)
- adapter->iov_mode = IXGBE_64_VM;
+ sc->iov_mode = IXGBE_64_VM;
else
- adapter->iov_mode = IXGBE_32_VM;
+ sc->iov_mode = IXGBE_32_VM;
/* Again, reserving 1 VM's worth of queues for the PF */
- adapter->pool = adapter->iov_mode - 1;
+ sc->pool = sc->iov_mode - 1;
- if ((num_vfs > adapter->pool) || (num_vfs >= IXGBE_64_VM)) {
+ if ((num_vfs > sc->pool) || (num_vfs >= IXGBE_64_VM)) {
retval = ENOSPC;
goto err_init_iov;
}
- adapter->vfs = malloc(sizeof(*adapter->vfs) * num_vfs, M_IXGBE_SRIOV,
+ sc->vfs = malloc(sizeof(*sc->vfs) * num_vfs, M_IXGBE_SRIOV,
M_NOWAIT | M_ZERO);
- if (adapter->vfs == NULL) {
+ if (sc->vfs == NULL) {
retval = ENOMEM;
goto err_init_iov;
}
- adapter->num_vfs = num_vfs;
- ixgbe_if_init(adapter->ctx);
- adapter->feat_en |= IXGBE_FEATURE_SRIOV;
+ sc->num_vfs = num_vfs;
+ ixgbe_if_init(sc->ctx);
+ sc->feat_en |= IXGBE_FEATURE_SRIOV;
return (retval);
err_init_iov:
- adapter->num_vfs = 0;
- adapter->pool = 0;
- adapter->iov_mode = IXGBE_NO_VM;
+ sc->num_vfs = 0;
+ sc->pool = 0;
+ sc->iov_mode = IXGBE_NO_VM;
return (retval);
} /* ixgbe_if_iov_init */
@@ -716,16 +716,16 @@ void
ixgbe_if_iov_uninit(if_ctx_t ctx)
{
struct ixgbe_hw *hw;
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
uint32_t pf_reg, vf_reg;
- adapter = iflib_get_softc(ctx);
- hw = &adapter->hw;
+ sc = iflib_get_softc(ctx);
+ hw = &sc->hw;
/* Enable rx/tx for the PF and disable it for all VFs. */
- pf_reg = IXGBE_VF_INDEX(adapter->pool);
- IXGBE_WRITE_REG(hw, IXGBE_VFRE(pf_reg), IXGBE_VF_BIT(adapter->pool));
- IXGBE_WRITE_REG(hw, IXGBE_VFTE(pf_reg), IXGBE_VF_BIT(adapter->pool));
+ pf_reg = IXGBE_VF_INDEX(sc->pool);
+ IXGBE_WRITE_REG(hw, IXGBE_VFRE(pf_reg), IXGBE_VF_BIT(sc->pool));
+ IXGBE_WRITE_REG(hw, IXGBE_VFTE(pf_reg), IXGBE_VF_BIT(sc->pool));
if (pf_reg == 0)
vf_reg = 1;
@@ -736,19 +736,19 @@ ixgbe_if_iov_uninit(if_ctx_t ctx)
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0);
- free(adapter->vfs, M_IXGBE_SRIOV);
- adapter->vfs = NULL;
- adapter->num_vfs = 0;
- adapter->feat_en &= ~IXGBE_FEATURE_SRIOV;
+ free(sc->vfs, M_IXGBE_SRIOV);
+ sc->vfs = NULL;
+ sc->num_vfs = 0;
+ sc->feat_en &= ~IXGBE_FEATURE_SRIOV;
} /* ixgbe_if_iov_uninit */
static void
-ixgbe_init_vf(struct adapter *adapter, struct ixgbe_vf *vf)
+ixgbe_init_vf(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
{
struct ixgbe_hw *hw;
uint32_t vf_index, pfmbimr;
- hw = &adapter->hw;
+ hw = &sc->hw;
if (!(vf->flags & IXGBE_VF_ACTIVE))
return;
@@ -758,29 +758,29 @@ ixgbe_init_vf(struct adapter *adapter, struct ixgbe_vf *vf)
pfmbimr |= IXGBE_VF_BIT(vf->pool);
IXGBE_WRITE_REG(hw, IXGBE_PFMBIMR(vf_index), pfmbimr);
- ixgbe_vf_set_default_vlan(adapter, vf, vf->vlan_tag);
+ ixgbe_vf_set_default_vlan(sc, vf, vf->vlan_tag);
// XXX multicast addresses
if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) {
- ixgbe_set_rar(&adapter->hw, vf->rar_index,
+ ixgbe_set_rar(&sc->hw, vf->rar_index,
vf->ether_addr, vf->pool, true);
}
- ixgbe_vf_enable_transmit(adapter, vf);
- ixgbe_vf_enable_receive(adapter, vf);
+ ixgbe_vf_enable_transmit(sc, vf);
+ ixgbe_vf_enable_receive(sc, vf);
- ixgbe_send_vf_msg(adapter, vf, IXGBE_PF_CONTROL_MSG);
+ ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG);
} /* ixgbe_init_vf */
void
-ixgbe_initialize_iov(struct adapter *adapter)
+ixgbe_initialize_iov(struct ixgbe_softc *sc)
{
- struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_hw *hw = &sc->hw;
uint32_t mrqc, mtqc, vt_ctl, vf_reg, gcr_ext, gpie;
int i;
- if (adapter->iov_mode == IXGBE_NO_VM)
+ if (sc->iov_mode == IXGBE_NO_VM)
return;
/* RMW appropriate registers based on IOV mode */
@@ -794,7 +794,7 @@ ixgbe_initialize_iov(struct adapter *adapter)
gcr_ext |= IXGBE_GCR_EXT_MSIX_EN;
gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;
gpie &= ~IXGBE_GPIE_VTMODE_MASK;
- switch (adapter->iov_mode) {
+ switch (sc->iov_mode) {
case IXGBE_64_VM:
mrqc |= IXGBE_MRQC_VMDQRSS64EN;
mtqc |= IXGBE_MTQC_64VF;
@@ -808,7 +808,7 @@ ixgbe_initialize_iov(struct adapter *adapter)
gpie |= IXGBE_GPIE_VTMODE_32;
break;
default:
- panic("Unexpected SR-IOV mode %d", adapter->iov_mode);
+ panic("Unexpected SR-IOV mode %d", sc->iov_mode);
}
/* Write... */
IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);
@@ -817,55 +817,55 @@ ixgbe_initialize_iov(struct adapter *adapter)
IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
/* Enable rx/tx for the PF. */
- vf_reg = IXGBE_VF_INDEX(adapter->pool);
- IXGBE_WRITE_REG(hw, IXGBE_VFRE(vf_reg), IXGBE_VF_BIT(adapter->pool));
- IXGBE_WRITE_REG(hw, IXGBE_VFTE(vf_reg), IXGBE_VF_BIT(adapter->pool));
+ vf_reg = IXGBE_VF_INDEX(sc->pool);
+ IXGBE_WRITE_REG(hw, IXGBE_VFRE(vf_reg), IXGBE_VF_BIT(sc->pool));
+ IXGBE_WRITE_REG(hw, IXGBE_VFTE(vf_reg), IXGBE_VF_BIT(sc->pool));
/* Allow VM-to-VM communication. */
IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
vt_ctl = IXGBE_VT_CTL_VT_ENABLE | IXGBE_VT_CTL_REPLEN;
- vt_ctl |= (adapter->pool << IXGBE_VT_CTL_POOL_SHIFT);
+ vt_ctl |= (sc->pool << IXGBE_VT_CTL_POOL_SHIFT);
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl);
- for (i = 0; i < adapter->num_vfs; i++)
- ixgbe_init_vf(adapter, &adapter->vfs[i]);
+ for (i = 0; i < sc->num_vfs; i++)
+ ixgbe_init_vf(sc, &sc->vfs[i]);
} /* ixgbe_initialize_iov */
/* Check the max frame setting of all active VF's */
void
-ixgbe_recalculate_max_frame(struct adapter *adapter)
+ixgbe_recalculate_max_frame(struct ixgbe_softc *sc)
{
struct ixgbe_vf *vf;
- for (int i = 0; i < adapter->num_vfs; i++) {
- vf = &adapter->vfs[i];
+ for (int i = 0; i < sc->num_vfs; i++) {
+ vf = &sc->vfs[i];
if (vf->flags & IXGBE_VF_ACTIVE)
- ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
+ ixgbe_update_max_frame(sc, vf->maximum_frame_size);
}
} /* ixgbe_recalculate_max_frame */
int
ixgbe_if_iov_vf_add(if_ctx_t ctx, u16 vfnum, const nvlist_t *config)
{
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
struct ixgbe_vf *vf;
const void *mac;
- adapter = iflib_get_softc(ctx);
+ sc = iflib_get_softc(ctx);
- KASSERT(vfnum < adapter->num_vfs, ("VF index %d is out of range %d",
- vfnum, adapter->num_vfs));
+ KASSERT(vfnum < sc->num_vfs, ("VF index %d is out of range %d",
+ vfnum, sc->num_vfs));
- vf = &adapter->vfs[vfnum];
+ vf = &sc->vfs[vfnum];
vf->pool= vfnum;
/* RAR[0] is used by the PF so use vfnum + 1 for VF RAR. */
vf->rar_index = vfnum + 1;
vf->default_vlan = 0;
vf->maximum_frame_size = ETHER_MAX_LEN;
- ixgbe_update_max_frame(adapter, vf->maximum_frame_size);
+ ixgbe_update_max_frame(sc, vf->maximum_frame_size);
if (nvlist_exists_binary(config, "mac-addr")) {
mac = nvlist_get_binary(config, "mac-addr", NULL);
@@ -881,7 +881,7 @@ ixgbe_if_iov_vf_add(if_ctx_t ctx, u16 vfnum, const nvlist_t *config)
vf->flags |= IXGBE_VF_ACTIVE;
- ixgbe_init_vf(adapter, vf);
+ ixgbe_init_vf(sc, vf);
return (0);
} /* ixgbe_if_iov_vf_add */
diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c
index 2cecf79b3422..983bf86ba820 100644
--- a/sys/dev/ixgbe/ix_txrx.c
+++ b/sys/dev/ixgbe/ix_txrx.c
@@ -45,19 +45,16 @@
/************************************************************************
* Local Function prototypes
************************************************************************/
-static int ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi);
-static void ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx);
-static int ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear);
-
-static void ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru);
-static void ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx,
- uint8_t flidx __unused, qidx_t pidx);
-static int ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx,
- qidx_t budget);
-static int ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri);
-
-static void ixgbe_rx_checksum(uint32_t staterr, if_rxd_info_t ri,
- uint32_t ptype);
+static int ixgbe_isc_txd_encap(void *, if_pkt_info_t);
+static void ixgbe_isc_txd_flush(void *, uint16_t, qidx_t);
+static int ixgbe_isc_txd_credits_update(void *, uint16_t, bool);
+
+static void ixgbe_isc_rxd_refill(void *, if_rxd_update_t);
+static void ixgbe_isc_rxd_flush(void *, uint16_t, uint8_t, qidx_t);
+static int ixgbe_isc_rxd_available(void *, uint16_t, qidx_t, qidx_t);
+static int ixgbe_isc_rxd_pkt_get(void *, if_rxd_info_t);
+
+static void ixgbe_rx_checksum(uint32_t, if_rxd_info_t, uint32_t);
static int ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *,
if_pkt_info_t);
@@ -174,7 +171,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi)
static int
ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
if_softc_ctx_t scctx = sc->shared;
struct ix_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx];
struct tx_ring *txr = &que->txr;
@@ -255,7 +252,7 @@ ixgbe_isc_txd_encap(void *arg, if_pkt_info_t pi)
static void
ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
struct ix_tx_queue *que = &sc->tx_queues[txqid];
struct tx_ring *txr = &que->txr;
@@ -268,7 +265,7 @@ ixgbe_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx)
static int
ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
if_softc_ctx_t scctx = sc->shared;
struct ix_tx_queue *que = &sc->tx_queues[txqid];
struct tx_ring *txr = &que->txr;
@@ -325,7 +322,7 @@ ixgbe_isc_txd_credits_update(void *arg, uint16_t txqid, bool clear)
static void
ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
struct ix_rx_queue *que = &sc->rx_queues[iru->iru_qsidx];
struct rx_ring *rxr = &que->rxr;
uint64_t *paddrs;
@@ -350,7 +347,7 @@ ixgbe_isc_rxd_refill(void *arg, if_rxd_update_t iru)
static void
ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pidx)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
struct ix_rx_queue *que = &sc->rx_queues[qsidx];
struct rx_ring *rxr = &que->rxr;
@@ -363,7 +360,7 @@ ixgbe_isc_rxd_flush(void *arg, uint16_t qsidx, uint8_t flidx __unused, qidx_t pi
static int
ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget)
{
- struct adapter *sc = arg;
+ struct ixgbe_softc *sc = arg;
struct ix_rx_queue *que = &sc->rx_queues[qsidx];
struct rx_ring *rxr = &que->rxr;
union ixgbe_adv_rx_desc *rxd;
@@ -397,10 +394,10 @@ ixgbe_isc_rxd_available(void *arg, uint16_t qsidx, qidx_t pidx, qidx_t budget)
static int
ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
{
- struct adapter *adapter = arg;
- struct ix_rx_queue *que = &adapter->rx_queues[ri->iri_qsidx];
+ struct ixgbe_softc *sc = arg;
+ struct ix_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
struct rx_ring *rxr = &que->rxr;
- struct ifnet *ifp = iflib_get_ifp(adapter->ctx);
+ struct ifnet *ifp = iflib_get_ifp(sc->ctx);
union ixgbe_adv_rx_desc *rxd;
uint16_t pkt_info, len, cidx, i;
@@ -437,7 +434,7 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
/* Make sure bad packets are discarded */
if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) {
- if (adapter->feat_en & IXGBE_FEATURE_VF)
+ if (sc->feat_en & IXGBE_FEATURE_VF)
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
rxr->rx_discarded++;
@@ -446,7 +443,7 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
ri->iri_frags[i].irf_flid = 0;
ri->iri_frags[i].irf_idx = cidx;
ri->iri_frags[i].irf_len = len;
- if (++cidx == adapter->shared->isc_nrxd[0])
+ if (++cidx == sc->shared->isc_nrxd[0])
cidx = 0;
i++;
/* even a 16K packet shouldn't consume more than 8 clusters */
@@ -462,7 +459,7 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss);
ri->iri_rsstype = ixgbe_determine_rsstype(pkt_info);
- if ((adapter->feat_en & IXGBE_FEATURE_RSS) == 0) {
+ if ((sc->feat_en & IXGBE_FEATURE_RSS) == 0) {
if (ri->iri_rsstype == M_HASHTYPE_OPAQUE)
ri->iri_rsstype = M_HASHTYPE_NONE;
else
diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h
index 93bfff427a27..4c5e6946567a 100644
--- a/sys/dev/ixgbe/ixgbe.h
+++ b/sys/dev/ixgbe/ixgbe.h
@@ -279,7 +279,7 @@ struct ixgbe_mc_addr {
* The transmit ring, one per queue
*/
struct tx_ring {
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
union ixgbe_adv_tx_desc *tx_base;
uint64_t tx_paddr;
u32 tail;
@@ -306,7 +306,7 @@ struct tx_ring {
*/
struct rx_ring {
struct ix_rx_queue *que;
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
u32 me;
u32 tail;
union ixgbe_adv_rx_desc *rx_base;
@@ -335,7 +335,7 @@ struct rx_ring {
* for the associated tx and rx ring.
*/
struct ix_rx_queue {
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
u32 msix; /* This queue's MSIX vector */
u32 eitr_setting;
struct resource *res;
@@ -347,7 +347,7 @@ struct ix_rx_queue {
};
struct ix_tx_queue {
- struct adapter *adapter;
+ struct ixgbe_softc *sc;
u32 msix; /* This queue's MSIX vector */
struct tx_ring txr;
};
@@ -367,8 +367,8 @@ struct ixgbe_vf {
uint16_t api_ver;
};
-/* Our adapter structure */
-struct adapter {
+/* Our softc structure */
+struct ixgbe_softc {
struct ixgbe_hw hw;
struct ixgbe_osdep osdep;
if_ctx_t ctx;
@@ -580,11 +580,11 @@ ixv_check_ether_addr(u8 *addr)
/* Shared Prototypes */
-int ixgbe_allocate_queues(struct adapter *);
-int ixgbe_setup_transmit_structures(struct adapter *);
-void ixgbe_free_transmit_structures(struct adapter *);
-int ixgbe_setup_receive_structures(struct adapter *);
-void ixgbe_free_receive_structures(struct adapter *);
+int ixgbe_allocate_queues(struct ixgbe_softc *);
+int ixgbe_setup_transmit_structures(struct ixgbe_softc *);
+void ixgbe_free_transmit_structures(struct ixgbe_softc *);
+int ixgbe_setup_receive_structures(struct ixgbe_softc *);
+void ixgbe_free_receive_structures(struct ixgbe_softc *);
int ixgbe_get_regs(SYSCTL_HANDLER_ARGS);
#include "ixgbe_bypass.h"
diff --git a/sys/dev/ixgbe/ixgbe_bypass.h b/sys/dev/ixgbe/ixgbe_bypass.h
index 42a8eeb72e71..941037793e59 100644
--- a/sys/dev/ixgbe/ixgbe_bypass.h
+++ b/sys/dev/ixgbe/ixgbe_bypass.h
@@ -46,6 +46,6 @@
#define LEAP_YR(y) ((y % 400 == 0) || ((y % 4 == 0) && (y % 100 != 0)))
#define SEC_THIS_YEAR(y) (LEAP_YR(y) ? SEC_PER_LYEAR : SEC_PER_YEAR)
-void ixgbe_bypass_init(struct adapter *);
+void ixgbe_bypass_init(struct ixgbe_softc *);
#endif /* _IXGBE_BYPASS_H_ */
diff --git a/sys/dev/ixgbe/ixgbe_fdir.h b/sys/dev/ixgbe/ixgbe_fdir.h
index f94ec1049b27..8631a675c7b7 100644
--- a/sys/dev/ixgbe/ixgbe_fdir.h
+++ b/sys/dev/ixgbe/ixgbe_fdir.h
@@ -44,7 +44,7 @@
*/
int fdir_pballoc = 1;
-void ixgbe_init_fdir(struct adapter *);
+void ixgbe_init_fdir(struct ixgbe_softc *);
#else
diff --git a/sys/dev/ixgbe/ixgbe_osdep.c b/sys/dev/ixgbe/ixgbe_osdep.c
index 61617b69ff04..49ae5e27f46e 100644
--- a/sys/dev/ixgbe/ixgbe_osdep.c
+++ b/sys/dev/ixgbe/ixgbe_osdep.c
@@ -37,42 +37,42 @@
inline u16
ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg)
{
- return pci_read_config(((struct adapter *)hw->back)->dev, reg, 2);
+ return pci_read_config(((struct ixgbe_softc *)hw->back)->dev, reg, 2);
}
inline void
ixgbe_write_pci_cfg(struct ixgbe_hw *hw, u32 reg, u16 value)
{
- pci_write_config(((struct adapter *)hw->back)->dev, reg, value, 2);
+ pci_write_config(((struct ixgbe_softc *)hw->back)->dev, reg, value, 2);
}
inline u32
ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
{
- return bus_space_read_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
- ((struct adapter *)hw->back)->osdep.mem_bus_space_handle, reg);
+ return bus_space_read_4(((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_tag,
+ ((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle, reg);
}
inline void
ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 val)
{
- bus_space_write_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
- ((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
+ bus_space_write_4(((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_tag,
+ ((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle,
reg, val);
}
inline u32
ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset)
{
- return bus_space_read_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
- ((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
+ return bus_space_read_4(((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_tag,
+ ((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle,
reg + (offset << 2));
}
inline void
ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset, u32 val)
{
- bus_space_write_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
- ((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
+ bus_space_write_4(((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_tag,
+ ((struct ixgbe_softc *)hw->back)->osdep.mem_bus_space_handle,
reg + (offset << 2), val);
}
diff --git a/sys/dev/ixgbe/ixgbe_sriov.h b/sys/dev/ixgbe/ixgbe_sriov.h
index f80d5e9dacf9..28d936729882 100644
--- a/sys/dev/ixgbe/ixgbe_sriov.h
+++ b/sys/dev/ixgbe/ixgbe_sriov.h
@@ -70,12 +70,12 @@
int ixgbe_if_iov_vf_add(if_ctx_t, u16, const nvlist_t *);
int ixgbe_if_iov_init(if_ctx_t, u16, const nvlist_t *);
void ixgbe_if_iov_uninit(if_ctx_t);
-void ixgbe_initialize_iov(struct adapter *);
-void ixgbe_recalculate_max_frame(struct adapter *);
-void ixgbe_ping_all_vfs(struct adapter *);
+void ixgbe_initialize_iov(struct ixgbe_softc *);
+void ixgbe_recalculate_max_frame(struct ixgbe_softc *);
+void ixgbe_ping_all_vfs(struct ixgbe_softc *);
int ixgbe_pci_iov_detach(device_t);
void ixgbe_define_iov_schemas(device_t, int *);
-void ixgbe_align_all_queue_indices(struct adapter *);
+void ixgbe_align_all_queue_indices(struct ixgbe_softc *);
int ixgbe_vf_que_index(int, int, int);
u32 ixgbe_get_mtqc(int);
u32 ixgbe_get_mrqc(int);