Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101942787
D32131.id95694.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
151 KB
Referenced Files
None
Subscribers
None
D32131.id95694.diff
View Options
Index: sys/dev/ixgbe/if_bypass.c
===================================================================
--- sys/dev/ixgbe/if_bypass.c
+++ 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_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 @@
* 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_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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
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 @@
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 @@
} 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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
<< 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 @@
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 @@
* 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 @@
| 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 @@
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 @@
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 */
Index: sys/dev/ixgbe/if_ix.c
===================================================================
--- sys/dev/ixgbe/if_ix.c
+++ sys/dev/ixgbe/if_ix.c
@@ -32,7 +32,6 @@
******************************************************************************/
/*$FreeBSD$*/
-
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_rss.h"
@@ -49,7 +48,6 @@
************************************************************************/
char ixgbe_driver_version[] = "4.0.1-k";
-
/************************************************************************
* PCI Device ID Table
*
@@ -109,87 +107,82 @@
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 +230,7 @@
};
static driver_t ix_driver = {
- "ix", ix_methods, sizeof(struct adapter),
+ "ix", ix_methods, sizeof(struct ixgbe_softc),
};
devclass_t ix_devclass;
@@ -293,7 +286,7 @@
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);
@@ -410,35 +403,35 @@
************************************************************************/
static int
ixgbe_if_tx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs,
- int ntxqs, int ntxqsets)
+ 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 +450,13 @@
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 +473,32 @@
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 +509,7 @@
}
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 +520,13 @@
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 +535,12 @@
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 +548,15 @@
* 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 +567,7 @@
/* 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 +582,17 @@
/* 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 +617,7 @@
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 +652,7 @@
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 +664,9 @@
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 +682,7 @@
/* 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 +696,11 @@
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 +726,8 @@
* 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 +743,7 @@
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 +753,9 @@
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 +777,14 @@
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 +846,7 @@
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 +874,7 @@
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 +885,13 @@
/* 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 +928,15 @@
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 +954,7 @@
* 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 +967,7 @@
}
/* 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 +992,7 @@
/* 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 +1017,7 @@
/* 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 +1037,9 @@
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 +1058,33 @@
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 +1092,7 @@
/* 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 +1103,27 @@
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 +1144,21 @@
* 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 +1172,20 @@
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 +1196,30 @@
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 +1231,8 @@
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 +1269,85 @@
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 +1385,20 @@
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 +1409,7 @@
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 +1417,10 @@
* 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 +1469,7 @@
* 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 +1530,14 @@
}
/* 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 +1551,7 @@
* - 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 +1562,15 @@
* 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 +1580,13 @@
/* 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 +1606,7 @@
"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 +1615,11 @@
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 +1644,7 @@
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 +1754,7 @@
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 +1777,7 @@
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 +1800,7 @@
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 +1823,7 @@
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 +1842,13 @@
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 +1860,13 @@
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 +1878,8 @@
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 +1891,13 @@
* 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 +1915,9 @@
* 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 +1937,10 @@
* 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 +2036,8 @@
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 +2045,7 @@
/* 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 +2055,12 @@
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 +2075,42 @@
* 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 +2122,7 @@
* 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 +2147,7 @@
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 +2170,19 @@
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 +2197,8 @@
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 +2206,17 @@
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 +2232,13 @@
}
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 +2247,7 @@
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 +2257,7 @@
}
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 +2266,7 @@
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 +2277,7 @@
*/
#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 +2291,7 @@
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 +2304,7 @@
}
#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 +2318,7 @@
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 +2353,9 @@
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 +2418,7 @@
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 +2438,12 @@
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 +2452,15 @@
}
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 +2471,12 @@
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 +2491,28 @@
/* 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 +2523,9 @@
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 +2534,9 @@
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 +2544,9 @@
}
/* 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 +2558,20 @@
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 +2579,10 @@
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 +2595,7 @@
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 +2612,7 @@
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 +2623,9 @@
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 +2635,49 @@
/* 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 +2692,19 @@
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 +2715,25 @@
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 +2750,7 @@
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 +2764,12 @@
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 +2782,8 @@
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 +2807,7 @@
* 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 +2868,10 @@
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 +2903,7 @@
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 +2911,7 @@
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 +2923,7 @@
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 +2976,10 @@
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 +2991,19 @@
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 +3011,7 @@
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 +3020,22 @@
* 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 +3053,7 @@
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 +3087,7 @@
/* 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 +3096,12 @@
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 +3117,7 @@
}
/* 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 +3126,7 @@
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 +3135,13 @@
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 +3159,9 @@
* - 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 +3176,7 @@
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 +3205,10 @@
* 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 +3218,41 @@
* 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 +3261,11 @@
}
/* 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 +3288,15 @@
/************************************************************************
* 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 +3340,13 @@
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 +3354,7 @@
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 +3363,12 @@
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 +3379,11 @@
} 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 +3418,17 @@
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 +3443,8 @@
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 +3454,7 @@
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 +3477,12 @@
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 +3518,11 @@
"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 +3533,13 @@
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 +3548,9 @@
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 +3560,15 @@
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 +3581,8 @@
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 +3595,11 @@
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 +3614,70 @@
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 +3693,17 @@
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 +3738,24 @@
}
/* 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 +3765,8 @@
* 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 +3778,18 @@
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 +3799,7 @@
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 +3811,10 @@
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 +3823,9 @@
* 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 +3846,9 @@
* 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 +3871,10 @@
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 +3888,7 @@
/* 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 +3908,21 @@
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 +3933,23 @@
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 +3960,21 @@
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 +3987,28 @@
* 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 +4023,21 @@
* 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 +4048,21 @@
* 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 +4076,17 @@
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 +4099,9 @@
* 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 +4109,10 @@
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 +4170,7 @@
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 +4186,9 @@
* 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 +4229,12 @@
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 +4242,11 @@
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 +4257,7 @@
case 5000:
case 10000:
/* Legal values - allow */
- adapter->dmac = newval;
+ sc->dmac = newval;
break;
default:
/* Do nothing, illegal value */
@@ -4293,8 +4284,8 @@
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 +4323,8 @@
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 +4336,7 @@
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 +4364,24 @@
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 +4393,9 @@
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 +4408,7 @@
// 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 +4451,19 @@
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, ®)) {
- 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 +4483,19 @@
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, ®)) {
- 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 +4518,13 @@
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 +4535,14 @@
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 +4555,9 @@
/* 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 +4566,54 @@
* 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 +4621,43 @@
/* 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 +4665,15 @@
* 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 +4720,9 @@
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 +4749,9 @@
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;
Index: sys/dev/ixgbe/ix_txrx.c
===================================================================
--- sys/dev/ixgbe/ix_txrx.c
+++ sys/dev/ixgbe/ix_txrx.c
@@ -32,7 +32,6 @@
******************************************************************************/
/*$FreeBSD$*/
-
#ifndef IXGBE_STANDALONE_BUILD
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -41,23 +40,19 @@
#include "ixgbe.h"
-
/************************************************************************
* 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 +169,7 @@
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 +250,7 @@
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 +263,7 @@
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 +320,7 @@
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 +345,7 @@
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 +358,7 @@
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 +392,10 @@
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 +432,7 @@
/* 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 +441,7 @@
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 +457,7 @@
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
Index: sys/dev/ixgbe/ixgbe.h
===================================================================
--- sys/dev/ixgbe/ixgbe.h
+++ sys/dev/ixgbe/ixgbe.h
@@ -33,11 +33,9 @@
******************************************************************************/
/*$FreeBSD$*/
-
#ifndef _IXGBE_H_
#define _IXGBE_H_
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf_ring.h>
@@ -99,10 +97,10 @@
* bytes. Performance tests have show the 2K value to be optimal for top
* performance.
*/
-#define DEFAULT_TXD 2048
-#define PERFORM_TXD 2048
-#define MAX_TXD 4096
-#define MIN_TXD 64
+#define DEFAULT_TXD 2048
+#define PERFORM_TXD 2048
+#define MAX_TXD 4096
+#define MIN_TXD 64
/*
* RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
@@ -114,40 +112,40 @@
* against the system mbuf pool limit, you can tune nmbclusters
* to adjust for this.
*/
-#define DEFAULT_RXD 2048
-#define PERFORM_RXD 2048
-#define MAX_RXD 4096
-#define MIN_RXD 64
+#define DEFAULT_RXD 2048
+#define PERFORM_RXD 2048
+#define MAX_RXD 4096
+#define MIN_RXD 64
/* Alignment for rings */
-#define DBA_ALIGN 128
+#define DBA_ALIGN 128
/*
* This is the max watchdog interval, ie. the time that can
* pass between any two TX clean operations, such only happening
* when the TX hardware is functioning.
*/
-#define IXGBE_WATCHDOG (10 * hz)
+#define IXGBE_WATCHDOG (10 * hz)
/*
* This parameters control when the driver calls the routine to reclaim
* transmit descriptors.
*/
-#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8)
-#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32)
+#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8)
+#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32)
/* These defines are used in MTU calculations */
-#define IXGBE_MAX_FRAME_SIZE 9728
-#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN)
-#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \
- ETHER_VLAN_ENCAP_LEN)
-#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR)
-#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN)
+#define IXGBE_MAX_FRAME_SIZE 9728
+#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN)
+#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \
+ ETHER_VLAN_ENCAP_LEN)
+#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR)
+#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN)
/* Flow control constants */
-#define IXGBE_FC_PAUSE 0xFFFF
-#define IXGBE_FC_HI 0x20000
-#define IXGBE_FC_LO 0x10000
+#define IXGBE_FC_PAUSE 0xFFFF
+#define IXGBE_FC_HI 0x20000
+#define IXGBE_FC_LO 0x10000
/*
* Used for optimizing small rx mbufs. Effort is made to keep the copy
@@ -159,82 +157,65 @@
* modern Intel CPUs, results in 40 bytes wasted and a significant drop
* in observed efficiency of the optimization, 97.9% -> 81.8%.
*/
-#if __FreeBSD_version < 1002000
-#define MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr))
-#endif
-#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32)
-#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED)
-#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE)
+#define IXGBE_MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr))
-/* Keep older OS drivers building... */
-#if !defined(SYSCTL_ADD_UQUAD)
-#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
-#endif
+#define IXGBE_RX_COPY_HDR_PADDED ((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32)
+#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED)
+#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE)
/* Defines for printing debug information */
-#define DEBUG_INIT 0
-#define DEBUG_IOCTL 0
-#define DEBUG_HW 0
-
-#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n")
-#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A)
-#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B)
-#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n")
-#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A)
-#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B)
-#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n")
-#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A)
-#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B)
-
-#define MAX_NUM_MULTICAST_ADDRESSES 128
-#define IXGBE_82598_SCATTER 100
-#define IXGBE_82599_SCATTER 32
-#define IXGBE_TSO_SIZE 262140
-#define IXGBE_RX_HDR 128
-#define IXGBE_VFTA_SIZE 128
-#define IXGBE_BR_SIZE 4096
-#define IXGBE_QUEUE_MIN_FREE 32
-#define IXGBE_MAX_TX_BUSY 10
-#define IXGBE_QUEUE_HUNG 0x80000000
-
-#define IXGBE_EITR_DEFAULT 128
+#define DEBUG_INIT 0
+#define DEBUG_IOCTL 0
+#define DEBUG_HW 0
+
+#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n")
+#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A)
+#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B)
+#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n")
+#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A)
+#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B)
+#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n")
+#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A)
+#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B)
+
+#define MAX_NUM_MULTICAST_ADDRESSES 128
+#define IXGBE_82598_SCATTER 100
+#define IXGBE_82599_SCATTER 32
+#define IXGBE_TSO_SIZE 262140
+#define IXGBE_RX_HDR 128
+#define IXGBE_VFTA_SIZE 128
+#define IXGBE_BR_SIZE 4096
+#define IXGBE_QUEUE_MIN_FREE 32
+#define IXGBE_MAX_TX_BUSY 10
+#define IXGBE_QUEUE_HUNG 0x80000000
+
+#define IXGBE_EITR_DEFAULT 128
/* Supported offload bits in mbuf flag */
-#if __FreeBSD_version >= 1000000
-#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
- CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
- CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
-#elif __FreeBSD_version >= 800000
-#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
-#else
-#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP)
-#endif
+#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
+ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
+ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
#define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \
- IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \
- IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \
- IFCAP_VLAN_HWFILTER | IFCAP_WOL)
-
-/* Backward compatibility items for very old versions */
-#ifndef pci_find_cap
-#define pci_find_cap pci_find_extcap
-#endif
+ IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \
+ IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \
+ IFCAP_VLAN_HWFILTER | IFCAP_WOL)
#ifndef DEVMETHOD_END
-#define DEVMETHOD_END { NULL, NULL }
+#define DEVMETHOD_END { NULL, NULL }
#endif
/*
* Interrupt Moderation parameters
*/
-#define IXGBE_LOW_LATENCY 128
-#define IXGBE_AVE_LATENCY 400
-#define IXGBE_BULK_LATENCY 1200
+#define IXGBE_LOW_LATENCY 128
+#define IXGBE_AVE_LATENCY 400
+#define IXGBE_BULK_LATENCY 1200
/* Using 1FF (the max value), the interval is ~1.05ms */
-#define IXGBE_LINK_ITR_QUANTA 0x1FF
-#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \
- IXGBE_EITR_ITR_INT_MASK)
+#define IXGBE_LINK_ITR_QUANTA 0x1FF
+#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \
+ IXGBE_EITR_ITR_INT_MASK)
/************************************************************************
@@ -244,60 +225,60 @@
* which the driver should load.
************************************************************************/
typedef struct _ixgbe_vendor_info_t {
- unsigned int vendor_id;
- unsigned int device_id;
- unsigned int subvendor_id;
- unsigned int subdevice_id;
- unsigned int index;
+ unsigned int vendor_id;
+ unsigned int device_id;
+ unsigned int subvendor_id;
+ unsigned int subdevice_id;
+ unsigned int index;
} ixgbe_vendor_info_t;
struct ixgbe_bp_data {
- u32 low;
- u32 high;
- u32 log;
+ u32 low;
+ u32 high;
+ u32 log;
};
/*
*/
struct ixgbe_dma_alloc {
- bus_addr_t dma_paddr;
- caddr_t dma_vaddr;
- bus_dma_tag_t dma_tag;
- bus_dmamap_t dma_map;
+ bus_addr_t dma_paddr;
+ caddr_t dma_vaddr;
+ bus_dma_tag_t dma_tag;
+ bus_dmamap_t dma_map;
bus_dma_segment_t dma_seg;
- bus_size_t dma_size;
- int dma_nseg;
+ bus_size_t dma_size;
+ int dma_nseg;
};
struct ixgbe_mc_addr {
- u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
- u32 vmdq;
+ u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
+ u32 vmdq;
};
/*
* 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;
- qidx_t *tx_rsq;
- qidx_t tx_rs_cidx;
- qidx_t tx_rs_pidx;
- qidx_t tx_cidx_processed;
- uint8_t me;
+ uint64_t tx_paddr;
+ u32 tail;
+ qidx_t *tx_rsq;
+ qidx_t tx_rs_cidx;
+ qidx_t tx_rs_pidx;
+ qidx_t tx_cidx_processed;
+ uint8_t me;
/* Flow Director */
- u16 atr_sample;
- u16 atr_count;
+ u16 atr_sample;
+ u16 atr_count;
- u32 bytes; /* used for AIM */
- u32 packets;
+ u32 bytes; /* used for AIM */
+ u32 packets;
/* Soft Stats */
- u64 tso_tx;
- u64 total_packets;
+ u64 tso_tx;
+ u64 total_packets;
};
@@ -305,29 +286,29 @@
* The Receive ring, one per rx queue
*/
struct rx_ring {
- struct ix_rx_queue *que;
- struct adapter *adapter;
- u32 me;
- u32 tail;
+ struct ix_rx_queue *que;
+ struct ixgbe_softc *sc;
+ u32 me;
+ u32 tail;
union ixgbe_adv_rx_desc *rx_base;
- bool hw_rsc;
- bool vtag_strip;
- uint64_t rx_paddr;
- bus_dma_tag_t ptag;
+ bool hw_rsc;
+ bool vtag_strip;
+ uint64_t rx_paddr;
+ bus_dma_tag_t ptag;
- u32 bytes; /* Used for AIM calc */
- u32 packets;
+ u32 bytes; /* Used for AIM calc */
+ u32 packets;
/* Soft stats */
- u64 rx_irq;
- u64 rx_copies;
- u64 rx_packets;
- u64 rx_bytes;
- u64 rx_discarded;
- u64 rsc_num;
+ u64 rx_irq;
+ u64 rx_copies;
+ u64 rx_packets;
+ u64 rx_bytes;
+ u64 rx_discarded;
+ u64 rsc_num;
/* Flow Director */
- u64 flm;
+ u64 flm;
};
/*
@@ -335,68 +316,68 @@
* for the associated tx and rx ring.
*/
struct ix_rx_queue {
- struct adapter *adapter;
- u32 msix; /* This queue's MSIX vector */
- u32 eitr_setting;
+ struct ixgbe_softc *sc;
+ u32 msix; /* This queue's MSIX vector */
+ u32 eitr_setting;
struct resource *res;
- void *tag;
- int busy;
+ void *tag;
+ int busy;
struct rx_ring rxr;
- struct if_irq que_irq;
- u64 irqs;
+ struct if_irq que_irq;
+ u64 irqs;
};
struct ix_tx_queue {
- struct adapter *adapter;
- u32 msix; /* This queue's MSIX vector */
+ struct ixgbe_softc *sc;
+ u32 msix; /* This queue's MSIX vector */
struct tx_ring txr;
};
-#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */
+#define IXGBE_MAX_VF_MC 30 /* Max number of multicast entries */
struct ixgbe_vf {
- u_int pool;
- u_int rar_index;
- u_int maximum_frame_size;
- uint32_t flags;
- uint8_t ether_addr[ETHER_ADDR_LEN];
- uint16_t mc_hash[IXGBE_MAX_VF_MC];
- uint16_t num_mc_hashes;
- uint16_t default_vlan;
- uint16_t vlan_tag;
- uint16_t api_ver;
+ u_int pool;
+ u_int rar_index;
+ u_int maximum_frame_size;
+ uint32_t flags;
+ uint8_t ether_addr[ETHER_ADDR_LEN];
+ uint16_t mc_hash[IXGBE_MAX_VF_MC];
+ uint16_t num_mc_hashes;
+ uint16_t default_vlan;
+ uint16_t vlan_tag;
+ uint16_t api_ver;
};
-/* Our adapter structure */
-struct adapter {
- struct ixgbe_hw hw;
- struct ixgbe_osdep osdep;
- if_ctx_t ctx;
- if_softc_ctx_t shared;
-#define num_tx_queues shared->isc_ntxqsets
-#define num_rx_queues shared->isc_nrxqsets
-#define max_frame_size shared->isc_max_frame_size
-#define intr_type shared->isc_intr
+/* Our softc structure */
+struct ixgbe_softc {
+ struct ixgbe_hw hw;
+ struct ixgbe_osdep osdep;
+ if_ctx_t ctx;
+ if_softc_ctx_t shared;
+#define num_tx_queues shared->isc_ntxqsets
+#define num_rx_queues shared->isc_nrxqsets
+#define max_frame_size shared->isc_max_frame_size
+#define intr_type shared->isc_intr
- device_t dev;
- struct ifnet *ifp;
+ device_t dev;
+ struct ifnet *ifp;
- struct resource *pci_mem;
+ struct resource *pci_mem;
/*
* Interrupt resources: this set is
* either used for legacy, or for Link
* when doing MSI-X
*/
- struct if_irq irq;
- void *tag;
- struct resource *res;
+ struct if_irq irq;
+ void *tag;
+ struct resource *res;
- struct ifmedia *media;
- int if_flags;
- int msix;
+ struct ifmedia *media;
+ int if_flags;
+ int msix;
- u16 num_vlans;
+ u16 num_vlans;
/*
* Shadow VFTA table, this is needed because
@@ -404,33 +385,33 @@
* a soft reset and the driver needs to be able
* to repopulate it.
*/
- u32 shadow_vfta[IXGBE_VFTA_SIZE];
+ u32 shadow_vfta[IXGBE_VFTA_SIZE];
/* Info about the interface */
- int advertise; /* link speeds */
- int enable_aim; /* adaptive interrupt moderation */
- bool link_active;
- u16 num_segs;
- u32 link_speed;
- bool link_up;
- u32 vector;
- u16 dmac;
- u32 phy_layer;
+ int advertise; /* link speeds */
+ int enable_aim; /* adaptive interrupt moderation */
+ bool link_active;
+ u16 num_segs;
+ u32 link_speed;
+ bool link_up;
+ u32 vector;
+ u16 dmac;
+ u32 phy_layer;
/* Power management-related */
- bool wol_support;
- u32 wufc;
+ bool wol_support;
+ u32 wufc;
/* Mbuf cluster size */
- u32 rx_mbuf_sz;
+ u32 rx_mbuf_sz;
/* Support for pluggable optics */
- bool sfp_probe;
+ bool sfp_probe;
/* Flow Director */
- int fdir_reinit;
+ int fdir_reinit;
- u32 task_requests;
+ u32 task_requests;
/*
* Queues:
@@ -442,58 +423,52 @@
struct ix_rx_queue *rx_queues;
/* Multicast array memory */
- struct ixgbe_mc_addr *mta;
+ struct ixgbe_mc_addr *mta;
/* SR-IOV */
- int iov_mode;
- int num_vfs;
- int pool;
- struct ixgbe_vf *vfs;
+ int iov_mode;
+ int num_vfs;
+ int pool;
+ struct ixgbe_vf *vfs;
/* Bypass */
- struct ixgbe_bp_data bypass;
+ struct ixgbe_bp_data bypass;
/* Misc stats maintained by the driver */
- unsigned long dropped_pkts;
- unsigned long mbuf_header_failed;
- unsigned long mbuf_packet_failed;
- unsigned long watchdog_events;
- unsigned long link_irq;
+ unsigned long dropped_pkts;
+ unsigned long mbuf_header_failed;
+ unsigned long mbuf_packet_failed;
+ unsigned long watchdog_events;
+ unsigned long link_irq;
union {
struct ixgbe_hw_stats pf;
struct ixgbevf_hw_stats vf;
} stats;
-#if __FreeBSD_version >= 1100036
+
/* counter(9) stats */
- u64 ipackets;
- u64 ierrors;
- u64 opackets;
- u64 oerrors;
- u64 ibytes;
- u64 obytes;
- u64 imcasts;
- u64 omcasts;
- u64 iqdrops;
- u64 noproto;
-#endif
+ u64 ipackets;
+ u64 ierrors;
+ u64 opackets;
+ u64 oerrors;
+ u64 ibytes;
+ u64 obytes;
+ u64 imcasts;
+ u64 omcasts;
+ u64 iqdrops;
+ u64 noproto;
+
/* Feature capable/enabled flags. See ixgbe_features.h */
- u32 feat_cap;
- u32 feat_en;
+ u32 feat_cap;
+ u32 feat_en;
};
/* Precision Time Sync (IEEE 1588) defines */
-#define ETHERTYPE_IEEE1588 0x88F7
-#define PICOSECS_PER_TICK 20833
-#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */
-#define IXGBE_ADVTXD_TSTAMP 0x00080000
-
-/* For backward compatibility */
-#if !defined(PCIER_LINK_STA)
-#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA
-#endif
+#define ETHERTYPE_IEEE1588 0x88F7
+#define PICOSECS_PER_TICK 20833
+#define TSYNC_UDP_PORT 319 /* UDP port for the protocol */
+#define IXGBE_ADVTXD_TSTAMP 0x00080000
/* Stats macros */
-#if __FreeBSD_version >= 1100036
#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count)
#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count)
#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count)
@@ -504,63 +479,38 @@
#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count)
#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count)
#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count)
-#else
-#define IXGBE_SET_IPACKETS(sc, count) (sc)->ifp->if_ipackets = (count)
-#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count)
-#define IXGBE_SET_OPACKETS(sc, count) (sc)->ifp->if_opackets = (count)
-#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count)
-#define IXGBE_SET_COLLISIONS(sc, count) (sc)->ifp->if_collisions = (count)
-#define IXGBE_SET_IBYTES(sc, count) (sc)->ifp->if_ibytes = (count)
-#define IXGBE_SET_OBYTES(sc, count) (sc)->ifp->if_obytes = (count)
-#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count)
-#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count)
-#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count)
-#endif
/* External PHY register addresses */
-#define IXGBE_PHY_CURRENT_TEMP 0xC820
-#define IXGBE_PHY_OVERTEMP_STATUS 0xC830
+#define IXGBE_PHY_CURRENT_TEMP 0xC820
+#define IXGBE_PHY_OVERTEMP_STATUS 0xC830
/* Sysctl help messages; displayed with sysctl -d */
-#define IXGBE_SYSCTL_DESC_ADV_SPEED \
- "\nControl advertised link speed using these flags:\n" \
- "\t0x1 - advertise 100M\n" \
- "\t0x2 - advertise 1G\n" \
- "\t0x4 - advertise 10G\n" \
- "\t0x8 - advertise 10M\n\n" \
- "\t100M and 10M are only supported on certain adapters.\n"
-
-#define IXGBE_SYSCTL_DESC_SET_FC \
- "\nSet flow control mode using these values:\n" \
- "\t0 - off\n" \
- "\t1 - rx pause\n" \
- "\t2 - tx pause\n" \
- "\t3 - tx and rx pause"
-
-#define IXGBE_SYSCTL_DESC_RX_ERRS \
- "\nSum of the following RX errors counters:\n" \
- " * CRC errors,\n" \
- " * illegal byte error count,\n" \
- " * checksum error count,\n" \
- " * missed packet count,\n" \
- " * length error count,\n" \
- " * undersized packets count,\n" \
- " * fragmented packets count,\n" \
- " * oversized packets count,\n" \
- " * jabber count."
-
-/* Workaround to make 8.0 buildable */
-#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
-static __inline int
-drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
-{
-#ifdef ALTQ
- if (ALTQ_IS_ENABLED(&ifp->if_snd))
- return (1);
-#endif
- return (!buf_ring_empty(br));
-}
-#endif
+#define IXGBE_SYSCTL_DESC_ADV_SPEED \
+ "\nControl advertised link speed using these flags:\n" \
+ "\t0x1 - advertise 100M\n" \
+ "\t0x2 - advertise 1G\n" \
+ "\t0x4 - advertise 10G\n" \
+ "\t0x8 - advertise 10M\n\n" \
+ "\t100M and 10M are only supported on certain adapters.\n"
+
+#define IXGBE_SYSCTL_DESC_SET_FC \
+ "\nSet flow control mode using these values:\n" \
+ "\t0 - off\n" \
+ "\t1 - rx pause\n" \
+ "\t2 - tx pause\n" \
+ "\t3 - tx and rx pause"
+
+#define IXGBE_SYSCTL_DESC_RX_ERRS \
+ "\nSum of the following RX errors counters:\n" \
+ " * CRC errors,\n" \
+ " * illegal byte error count,\n" \
+ " * checksum error count,\n" \
+ " * missed packet count,\n" \
+ " * length error count,\n" \
+ " * undersized packets count,\n" \
+ " * fragmented packets count,\n" \
+ " * oversized packets count,\n" \
+ " * jabber count."
/*
* This checks for a zero mac addr, something that will be likely
@@ -580,11 +530,11 @@
/* 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"
Index: sys/dev/ixgbe/ixgbe_bypass.h
===================================================================
--- sys/dev/ixgbe/ixgbe_bypass.h
+++ 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_ */
Index: sys/dev/ixgbe/ixgbe_osdep.c
===================================================================
--- sys/dev/ixgbe/ixgbe_osdep.c
+++ 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);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 5:00 PM (25 m, 1 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14491749
Default Alt Text
D32131.id95694.diff (151 KB)
Attached To
Mode
D32131: ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'
Attached
Detach File
Event Timeline
Log In to Comment