git: 494fb534f20e - stable/13 - igc: Rename 'struct adapter' to 'struct igc_softc'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Oct 2024 15:24:54 UTC
The branch stable/13 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=494fb534f20ebddf9135c550035fa4e86db26e32
commit 494fb534f20ebddf9135c550035fa4e86db26e32
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2024-10-14 13:29:55 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2024-10-21 15:21:35 +0000
igc: Rename 'struct adapter' to 'struct igc_softc'
Rename the 'struct adapter' to 'struct igc_softc' to avoid type
ambiguity in things like kgdb and make sharing code with e1000 and
ixgbe easier.
MFC after: 1 week
Sponsored by: BBOX.io
(cherry picked from commit 542f5d56317e94676cf19cb9d66207bf9a6b6758)
---
sys/dev/igc/if_igc.c | 970 ++++++++++++++++++++++++-------------------------
sys/dev/igc/if_igc.h | 28 +-
sys/dev/igc/igc_txrx.c | 36 +-
3 files changed, 517 insertions(+), 517 deletions(-)
diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index 50f26e1d6541..8d72eb9d2447 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -111,25 +111,25 @@ static int igc_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid);
static void igc_if_multi_set(if_ctx_t ctx);
static void igc_if_update_admin_status(if_ctx_t ctx);
static void igc_if_debug(if_ctx_t ctx);
-static void igc_update_stats_counters(struct igc_adapter *);
-static void igc_add_hw_stats(struct igc_adapter *adapter);
+static void igc_update_stats_counters(struct igc_softc *);
+static void igc_add_hw_stats(struct igc_softc *sc);
static int igc_if_set_promisc(if_ctx_t ctx, int flags);
static void igc_setup_vlan_hw_support(if_ctx_t ctx);
-static void igc_fw_version(struct igc_adapter *);
+static void igc_fw_version(struct igc_softc *);
static void igc_sbuf_fw_version(struct igc_fw_version *, struct sbuf *);
-static void igc_print_fw_version(struct igc_adapter *);
+static void igc_print_fw_version(struct igc_softc *);
static int igc_sysctl_print_fw_version(SYSCTL_HANDLER_ARGS);
static int igc_sysctl_nvm_info(SYSCTL_HANDLER_ARGS);
-static void igc_print_nvm_info(struct igc_adapter *);
+static void igc_print_nvm_info(struct igc_softc *);
static int igc_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
static int igc_get_rs(SYSCTL_HANDLER_ARGS);
-static void igc_print_debug_info(struct igc_adapter *);
+static void igc_print_debug_info(struct igc_softc *);
static int igc_is_valid_ether_addr(u8 *);
-static void igc_neweitr(struct igc_adapter *, struct igc_rx_queue *,
+static void igc_neweitr(struct igc_softc *, struct igc_rx_queue *,
struct tx_ring *, struct rx_ring *);
/* Management and WOL Support */
-static void igc_get_hw_control(struct igc_adapter *);
-static void igc_release_hw_control(struct igc_adapter *);
+static void igc_get_hw_control(struct igc_softc *);
+static void igc_release_hw_control(struct igc_softc *);
static void igc_get_wakeup(if_ctx_t ctx);
static void igc_enable_wakeup(if_ctx_t ctx);
@@ -146,7 +146,7 @@ static int igc_sysctl_eee(SYSCTL_HANDLER_ARGS);
static int igc_get_regs(SYSCTL_HANDLER_ARGS);
-static void igc_configure_queues(struct igc_adapter *adapter);
+static void igc_configure_queues(struct igc_softc *sc);
/*********************************************************************
@@ -165,7 +165,7 @@ static device_method_t igc_methods[] = {
};
static driver_t igc_driver = {
- "igc", igc_methods, sizeof(struct igc_adapter),
+ "igc", igc_methods, sizeof(struct igc_softc),
};
static devclass_t igc_devclass;
@@ -209,7 +209,7 @@ static device_method_t igc_if_methods[] = {
};
static driver_t igc_if_driver = {
- "igc_if", igc_if_methods, sizeof(struct igc_adapter)
+ "igc_if", igc_if_methods, sizeof(struct igc_softc)
};
/*********************************************************************
@@ -296,8 +296,8 @@ static struct if_shared_ctx igc_sctx_init = {
static int igc_get_regs(SYSCTL_HANDLER_ARGS)
{
- struct igc_adapter *adapter = (struct igc_adapter *)arg1;
- struct igc_hw *hw = &adapter->hw;
+ struct igc_softc *sc = (struct igc_softc *)arg1;
+ struct igc_hw *hw = &sc->hw;
struct sbuf *sb;
u32 *regs_buff;
int rc;
@@ -373,7 +373,7 @@ static int igc_get_regs(SYSCTL_HANDLER_ARGS)
#ifdef DUMP_DESCS
{
- if_softc_ctx_t scctx = adapter->shared;
+ if_softc_ctx_t scctx = sc->shared;
struct rx_ring *rxr = &rx_que->rxr;
struct tx_ring *txr = &tx_que->txr;
int ntxd = scctx->isc_ntxd[0];
@@ -435,7 +435,7 @@ igc_set_num_queues(if_ctx_t ctx)
static int
igc_if_attach_pre(if_ctx_t ctx)
{
- struct igc_adapter *adapter;
+ struct igc_softc *sc;
if_softc_ctx_t scctx;
device_t dev;
struct igc_hw *hw;
@@ -443,59 +443,59 @@ igc_if_attach_pre(if_ctx_t ctx)
INIT_DEBUGOUT("igc_if_attach_pre: begin");
dev = iflib_get_dev(ctx);
- adapter = iflib_get_softc(ctx);
+ sc = iflib_get_softc(ctx);
- adapter->ctx = adapter->osdep.ctx = ctx;
- adapter->dev = adapter->osdep.dev = dev;
- scctx = adapter->shared = iflib_get_softc_ctx(ctx);
- adapter->media = iflib_get_media(ctx);
- hw = &adapter->hw;
+ sc->ctx = sc->osdep.ctx = ctx;
+ sc->dev = sc->osdep.dev = dev;
+ scctx = sc->shared = iflib_get_softc_ctx(ctx);
+ sc->media = iflib_get_media(ctx);
+ hw = &sc->hw;
/* SYSCTL stuff */
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "nvm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, igc_sysctl_nvm_info, "I", "NVM Information");
+ sc, 0, igc_sysctl_nvm_info, "I", "NVM Information");
- adapter->enable_aim = igc_enable_aim;
+ sc->enable_aim = igc_enable_aim;
SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "enable_aim", CTLFLAG_RW,
- &adapter->enable_aim, 0,
+ &sc->enable_aim, 0,
"Interrupt Moderation (1=normal, 2=lowlatency)");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "fw_version", CTLTYPE_STRING | CTLFLAG_RD,
- adapter, 0, igc_sysctl_print_fw_version, "A",
+ sc, 0, igc_sysctl_print_fw_version, "A",
"Prints FW/NVM Versions");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, igc_sysctl_debug_info, "I", "Debug Information");
+ sc, 0, igc_sysctl_debug_info, "I", "Debug Information");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, igc_set_flowcntl, "I", "Flow Control");
+ sc, 0, igc_set_flowcntl, "I", "Flow Control");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "reg_dump",
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, sc, 0,
igc_get_regs, "A", "Dump Registers");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "rs_dump",
- CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, adapter, 0,
+ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0,
igc_get_rs, "I", "Dump RS indexes");
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "dmac",
- CTLTYPE_INT | CTLFLAG_RW, adapter, 0,
+ CTLTYPE_INT | CTLFLAG_RW, sc, 0,
igc_sysctl_dmac, "I", "DMA Coalesce");
/* Determine hardware and mac info */
@@ -560,13 +560,13 @@ igc_if_attach_pre(if_ctx_t ctx)
* Set the frame limits assuming
* standard ethernet sized frames.
*/
- scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size =
+ scctx->isc_max_frame_size = sc->hw.mac.max_frame_size =
ETHERMTU + ETHER_HDR_LEN + ETHERNET_FCS_SIZE;
/* Allocate multicast array memory. */
- adapter->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN *
+ sc->mta = malloc(sizeof(u8) * ETHER_ADDR_LEN *
MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
- if (adapter->mta == NULL) {
+ if (sc->mta == NULL) {
device_printf(dev, "Can not allocate multicast setup array\n");
error = ENOMEM;
goto err_late;
@@ -578,12 +578,12 @@ igc_if_attach_pre(if_ctx_t ctx)
" due to SOL/IDER session.\n");
/* Sysctl for setting Energy Efficient Ethernet */
- adapter->hw.dev_spec._i225.eee_disable = igc_eee_setting;
+ sc->hw.dev_spec._i225.eee_disable = igc_eee_setting;
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "eee_control",
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
- adapter, 0, igc_sysctl_eee, "I",
+ sc, 0, igc_sysctl_eee, "I",
"Disable Energy Efficient Ethernet");
/*
@@ -623,9 +623,9 @@ igc_if_attach_pre(if_ctx_t ctx)
}
/* Save the EEPROM/NVM versions */
- igc_fw_version(adapter);
+ igc_fw_version(sc);
- igc_print_fw_version(adapter);
+ igc_print_fw_version(sc);
/*
* Get Wake-on-Lan and Management info for later use
@@ -634,7 +634,7 @@ igc_if_attach_pre(if_ctx_t ctx)
/* Enable only WOL MAGIC by default */
scctx->isc_capenable &= ~IFCAP_WOL;
- if (adapter->wol != 0)
+ if (sc->wol != 0)
scctx->isc_capenable |= IFCAP_WOL_MAGIC;
iflib_set_mac(ctx, hw->mac.addr);
@@ -642,10 +642,10 @@ igc_if_attach_pre(if_ctx_t ctx)
return (0);
err_late:
- igc_release_hw_control(adapter);
+ igc_release_hw_control(sc);
err_pci:
igc_free_pci_resources(ctx);
- free(adapter->mta, M_DEVBUF);
+ free(sc->mta, M_DEVBUF);
return (error);
}
@@ -653,8 +653,8 @@ err_pci:
static int
igc_if_attach_post(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_hw *hw = &adapter->hw;
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_hw *hw = &sc->hw;
int error = 0;
/* Setup OS specific network interface */
@@ -666,23 +666,23 @@ igc_if_attach_post(if_ctx_t ctx)
igc_reset(ctx);
/* Initialize statistics */
- igc_update_stats_counters(adapter);
+ igc_update_stats_counters(sc);
hw->mac.get_link_status = true;
igc_if_update_admin_status(ctx);
- igc_add_hw_stats(adapter);
+ igc_add_hw_stats(sc);
/* the driver can now take control from firmware */
- igc_get_hw_control(adapter);
+ igc_get_hw_control(sc);
INIT_DEBUGOUT("igc_if_attach_post: end");
return (error);
err_late:
- igc_release_hw_control(adapter);
+ igc_release_hw_control(sc);
igc_free_pci_resources(ctx);
igc_if_queues_free(ctx);
- free(adapter->mta, M_DEVBUF);
+ free(sc->mta, M_DEVBUF);
return (error);
}
@@ -699,13 +699,13 @@ err_late:
static int
igc_if_detach(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
INIT_DEBUGOUT("igc_if_detach: begin");
- igc_phy_hw_reset(&adapter->hw);
+ igc_phy_hw_reset(&sc->hw);
- igc_release_hw_control(adapter);
+ igc_release_hw_control(sc);
igc_free_pci_resources(ctx);
return (0);
@@ -729,9 +729,9 @@ igc_if_shutdown(if_ctx_t ctx)
static int
igc_if_suspend(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
- igc_release_hw_control(adapter);
+ igc_release_hw_control(sc);
igc_enable_wakeup(ctx);
return (0);
}
@@ -748,7 +748,7 @@ static int
igc_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
{
int max_frame_size;
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
if_softc_ctx_t scctx = iflib_get_softc_ctx(ctx);
IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)");
@@ -760,7 +760,7 @@ igc_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
return (EINVAL);
}
- scctx->isc_max_frame_size = adapter->hw.mac.max_frame_size =
+ scctx->isc_max_frame_size = sc->hw.mac.max_frame_size =
mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
return (0);
}
@@ -777,8 +777,8 @@ igc_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
static void
igc_if_init(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- if_softc_ctx_t scctx = adapter->shared;
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ if_softc_ctx_t scctx = sc->shared;
struct ifnet *ifp = iflib_get_ifp(ctx);
struct igc_tx_queue *tx_que;
int i;
@@ -786,17 +786,17 @@ igc_if_init(if_ctx_t ctx)
INIT_DEBUGOUT("igc_if_init: begin");
/* Get the latest mac address, User can use a LAA */
- bcopy(if_getlladdr(ifp), adapter->hw.mac.addr,
+ bcopy(if_getlladdr(ifp), sc->hw.mac.addr,
ETHER_ADDR_LEN);
/* Put the address into the Receive Address Array */
- igc_rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
+ igc_rar_set(&sc->hw, sc->hw.mac.addr, 0);
/* Initialize the hardware */
igc_reset(ctx);
igc_if_update_admin_status(ctx);
- for (i = 0, tx_que = adapter->tx_queues; i < adapter->tx_num_queues; i++, tx_que++) {
+ for (i = 0, tx_que = sc->tx_queues; i < sc->tx_num_queues; i++, tx_que++) {
struct tx_ring *txr = &tx_que->txr;
txr->tx_rs_cidx = txr->tx_rs_pidx;
@@ -810,7 +810,7 @@ igc_if_init(if_ctx_t ctx)
}
/* Setup VLAN support, basic and offload if available */
- IGC_WRITE_REG(&adapter->hw, IGC_VET, ETHERTYPE_VLAN);
+ IGC_WRITE_REG(&sc->hw, IGC_VET, ETHERTYPE_VLAN);
/* Prepare transmit descriptors and buffers */
igc_initialize_transmit_unit(ctx);
@@ -818,7 +818,7 @@ igc_if_init(if_ctx_t ctx)
/* Setup Multicast table */
igc_if_multi_set(ctx);
- adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
+ sc->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx);
igc_initialize_receive_unit(ctx);
/* Set up VLAN support */
@@ -826,20 +826,20 @@ igc_if_init(if_ctx_t ctx)
/* Don't lose promiscuous settings */
igc_if_set_promisc(ctx, if_getflags(ifp));
- igc_clear_hw_cntrs_base_generic(&adapter->hw);
+ igc_clear_hw_cntrs_base_generic(&sc->hw);
- if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */
- igc_configure_queues(adapter);
+ if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */
+ igc_configure_queues(sc);
/* this clears any pending interrupts */
- IGC_READ_REG(&adapter->hw, IGC_ICR);
- IGC_WRITE_REG(&adapter->hw, IGC_ICS, IGC_ICS_LSC);
+ IGC_READ_REG(&sc->hw, IGC_ICR);
+ IGC_WRITE_REG(&sc->hw, IGC_ICS, IGC_ICS_LSC);
/* the driver can now take control from firmware */
- igc_get_hw_control(adapter);
+ igc_get_hw_control(sc);
/* Set Energy Efficient Ethernet */
- igc_set_eee_i225(&adapter->hw, true, true, true);
+ igc_set_eee_i225(&sc->hw, true, true, true);
}
enum eitr_latency_target {
@@ -854,7 +854,7 @@ enum eitr_latency_target {
*
*********************************************************************/
static void
-igc_neweitr(struct igc_adapter *sc, struct igc_rx_queue *que,
+igc_neweitr(struct igc_softc *sc, struct igc_rx_queue *que,
struct tx_ring *txr, struct rx_ring *rxr)
{
struct igc_hw *hw = &sc->hw;
@@ -986,12 +986,12 @@ igc_set_next_eitr:
int
igc_intr(void *arg)
{
- struct igc_adapter *adapter = arg;
- struct igc_hw *hw = &adapter->hw;
- struct igc_rx_queue *que = &adapter->rx_queues[0];
- struct tx_ring *txr = &adapter->tx_queues[0].txr;
+ struct igc_softc *sc = arg;
+ struct igc_hw *hw = &sc->hw;
+ struct igc_rx_queue *que = &sc->rx_queues[0];
+ struct tx_ring *txr = &sc->tx_queues[0].txr;
struct rx_ring *rxr = &que->rxr;
- if_ctx_t ctx = adapter->ctx;
+ if_ctx_t ctx = sc->ctx;
u32 reg_icr;
reg_icr = IGC_READ_REG(hw, IGC_ICR);
@@ -1020,9 +1020,9 @@ igc_intr(void *arg)
igc_handle_link(ctx);
if (reg_icr & IGC_ICR_RXO)
- adapter->rx_overruns++;
+ sc->rx_overruns++;
- igc_neweitr(adapter, que, txr, rxr);
+ igc_neweitr(sc, que, txr, rxr);
/* Reset state */
txr->tx_bytes = 0;
@@ -1036,20 +1036,20 @@ igc_intr(void *arg)
static int
igc_if_rx_queue_intr_enable(if_ctx_t ctx, uint16_t rxqid)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_rx_queue *rxq = &adapter->rx_queues[rxqid];
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_rx_queue *rxq = &sc->rx_queues[rxqid];
- IGC_WRITE_REG(&adapter->hw, IGC_EIMS, rxq->eims);
+ IGC_WRITE_REG(&sc->hw, IGC_EIMS, rxq->eims);
return (0);
}
static int
igc_if_tx_queue_intr_enable(if_ctx_t ctx, uint16_t txqid)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_tx_queue *txq = &adapter->tx_queues[txqid];
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_tx_queue *txq = &sc->tx_queues[txqid];
- IGC_WRITE_REG(&adapter->hw, IGC_EIMS, txq->eims);
+ IGC_WRITE_REG(&sc->hw, IGC_EIMS, txq->eims);
return (0);
}
@@ -1062,7 +1062,7 @@ static int
igc_msix_que(void *arg)
{
struct igc_rx_queue *que = arg;
- struct igc_adapter *sc = que->adapter;
+ struct igc_softc *sc = que->sc;
struct tx_ring *txr = &sc->tx_queues[que->msix].txr;
struct rx_ring *rxr = &que->rxr;
@@ -1087,22 +1087,22 @@ igc_msix_que(void *arg)
static int
igc_msix_link(void *arg)
{
- struct igc_adapter *adapter = arg;
+ struct igc_softc *sc = arg;
u32 reg_icr;
- ++adapter->link_irq;
- MPASS(adapter->hw.back != NULL);
- reg_icr = IGC_READ_REG(&adapter->hw, IGC_ICR);
+ ++sc->link_irq;
+ MPASS(sc->hw.back != NULL);
+ reg_icr = IGC_READ_REG(&sc->hw, IGC_ICR);
if (reg_icr & IGC_ICR_RXO)
- adapter->rx_overruns++;
+ sc->rx_overruns++;
if (reg_icr & (IGC_ICR_RXSEQ | IGC_ICR_LSC)) {
- igc_handle_link(adapter->ctx);
+ igc_handle_link(sc->ctx);
}
- IGC_WRITE_REG(&adapter->hw, IGC_IMS, IGC_IMS_LSC);
- IGC_WRITE_REG(&adapter->hw, IGC_EIMS, adapter->link_mask);
+ IGC_WRITE_REG(&sc->hw, IGC_IMS, IGC_IMS_LSC);
+ IGC_WRITE_REG(&sc->hw, IGC_EIMS, sc->link_mask);
return (FILTER_HANDLED);
}
@@ -1111,9 +1111,9 @@ static void
igc_handle_link(void *context)
{
if_ctx_t ctx = context;
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
- adapter->hw.mac.get_link_status = true;
+ sc->hw.mac.get_link_status = true;
iflib_admin_intr_deferred(ctx);
}
@@ -1128,7 +1128,7 @@ igc_handle_link(void *context)
static void
igc_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
INIT_DEBUGOUT("igc_if_media_status: begin");
@@ -1137,13 +1137,13 @@ igc_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
- if (!adapter->link_active) {
+ if (!sc->link_active) {
return;
}
ifmr->ifm_status |= IFM_ACTIVE;
- switch (adapter->link_speed) {
+ switch (sc->link_speed) {
case 10:
ifmr->ifm_active |= IFM_10_T;
break;
@@ -1158,7 +1158,7 @@ igc_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
break;
}
- if (adapter->link_duplex == FULL_DUPLEX)
+ if (sc->link_duplex == FULL_DUPLEX)
ifmr->ifm_active |= IFM_FDX;
else
ifmr->ifm_active |= IFM_HDX;
@@ -1175,7 +1175,7 @@ igc_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
static int
igc_if_media_change(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
struct ifmedia *ifm = iflib_get_media(ctx);
INIT_DEBUGOUT("igc_if_media_change: begin");
@@ -1183,32 +1183,32 @@ igc_if_media_change(if_ctx_t ctx)
if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
return (EINVAL);
- adapter->hw.mac.autoneg = DO_AUTO_NEG;
+ sc->hw.mac.autoneg = DO_AUTO_NEG;
switch (IFM_SUBTYPE(ifm->ifm_media)) {
case IFM_AUTO:
- adapter->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT;
+ sc->hw.phy.autoneg_advertised = AUTONEG_ADV_DEFAULT;
break;
case IFM_2500_T:
- adapter->hw.phy.autoneg_advertised = ADVERTISE_2500_FULL;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_2500_FULL;
break;
case IFM_1000_T:
- adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
break;
case IFM_100_TX:
if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
- adapter->hw.phy.autoneg_advertised = ADVERTISE_100_FULL;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_100_FULL;
else
- adapter->hw.phy.autoneg_advertised = ADVERTISE_100_HALF;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF;
break;
case IFM_10_T:
if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
- adapter->hw.phy.autoneg_advertised = ADVERTISE_10_FULL;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_10_FULL;
else
- adapter->hw.phy.autoneg_advertised = ADVERTISE_10_HALF;
+ sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF;
break;
default:
- device_printf(adapter->dev, "Unsupported media type\n");
+ device_printf(sc->dev, "Unsupported media type\n");
}
igc_if_init(ctx);
@@ -1219,12 +1219,12 @@ igc_if_media_change(if_ctx_t ctx)
static int
igc_if_set_promisc(if_ctx_t ctx, int flags)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
u32 reg_rctl;
int mcnt = 0;
- reg_rctl = IGC_READ_REG(&adapter->hw, IGC_RCTL);
+ reg_rctl = IGC_READ_REG(&sc->hw, IGC_RCTL);
reg_rctl &= ~(IGC_RCTL_SBP | IGC_RCTL_UPE);
if (flags & IFF_ALLMULTI)
mcnt = MAX_NUM_MULTICAST_ADDRESSES;
@@ -1234,18 +1234,18 @@ igc_if_set_promisc(if_ctx_t ctx, int flags)
/* Don't disable if in MAX groups */
if (mcnt < MAX_NUM_MULTICAST_ADDRESSES)
reg_rctl &= (~IGC_RCTL_MPE);
- IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl);
+ IGC_WRITE_REG(&sc->hw, IGC_RCTL, reg_rctl);
if (flags & IFF_PROMISC) {
reg_rctl |= (IGC_RCTL_UPE | IGC_RCTL_MPE);
/* Turn this on if you want to see bad packets */
if (igc_debug_sbp)
reg_rctl |= IGC_RCTL_SBP;
- IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl);
+ IGC_WRITE_REG(&sc->hw, IGC_RCTL, reg_rctl);
} else if (flags & IFF_ALLMULTI) {
reg_rctl |= IGC_RCTL_MPE;
reg_rctl &= ~IGC_RCTL_UPE;
- IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl);
+ IGC_WRITE_REG(&sc->hw, IGC_RCTL, reg_rctl);
}
return (0);
}
@@ -1273,7 +1273,7 @@ igc_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int idx)
static void
igc_if_multi_set(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
u8 *mta; /* Multicast array memory */
u32 reg_rctl = 0;
@@ -1281,12 +1281,12 @@ igc_if_multi_set(if_ctx_t ctx)
IOCTL_DEBUGOUT("igc_set_multi: begin");
- mta = adapter->mta;
+ mta = sc->mta;
bzero(mta, sizeof(u8) * ETHER_ADDR_LEN * MAX_NUM_MULTICAST_ADDRESSES);
mcnt = if_foreach_llmaddr(ifp, igc_copy_maddr, mta);
- reg_rctl = IGC_READ_REG(&adapter->hw, IGC_RCTL);
+ reg_rctl = IGC_READ_REG(&sc->hw, IGC_RCTL);
if (if_getflags(ifp) & IFF_PROMISC) {
reg_rctl |= (IGC_RCTL_UPE | IGC_RCTL_MPE);
@@ -1301,9 +1301,9 @@ igc_if_multi_set(if_ctx_t ctx)
reg_rctl &= ~(IGC_RCTL_UPE | IGC_RCTL_MPE);
if (mcnt < MAX_NUM_MULTICAST_ADDRESSES)
- igc_update_mc_addr_list(&adapter->hw, mta, mcnt);
+ igc_update_mc_addr_list(&sc->hw, mta, mcnt);
- IGC_WRITE_REG(&adapter->hw, IGC_RCTL, reg_rctl);
+ IGC_WRITE_REG(&sc->hw, IGC_RCTL, reg_rctl);
}
/*********************************************************************
@@ -1327,8 +1327,8 @@ igc_if_timer(if_ctx_t ctx, uint16_t qid)
static void
igc_if_update_admin_status(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_hw *hw = &adapter->hw;
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_hw *hw = &sc->hw;
device_t dev = iflib_get_dev(ctx);
u32 link_check, thstat, ctrl;
@@ -1352,36 +1352,36 @@ igc_if_update_admin_status(if_ctx_t ctx)
}
/* Now check for a transition */
- if (link_check && (adapter->link_active == 0)) {
- igc_get_speed_and_duplex(hw, &adapter->link_speed,
- &adapter->link_duplex);
+ if (link_check && (sc->link_active == 0)) {
+ igc_get_speed_and_duplex(hw, &sc->link_speed,
+ &sc->link_duplex);
if (bootverbose)
device_printf(dev, "Link is up %d Mbps %s\n",
- adapter->link_speed,
- ((adapter->link_duplex == FULL_DUPLEX) ?
+ sc->link_speed,
+ ((sc->link_duplex == FULL_DUPLEX) ?
"Full Duplex" : "Half Duplex"));
- adapter->link_active = 1;
+ sc->link_active = 1;
iflib_link_state_change(ctx, LINK_STATE_UP,
- IF_Mbps(adapter->link_speed));
- } else if (!link_check && (adapter->link_active == 1)) {
- adapter->link_speed = 0;
- adapter->link_duplex = 0;
- adapter->link_active = 0;
+ IF_Mbps(sc->link_speed));
+ } else if (!link_check && (sc->link_active == 1)) {
+ sc->link_speed = 0;
+ sc->link_duplex = 0;
+ sc->link_active = 0;
iflib_link_state_change(ctx, LINK_STATE_DOWN, 0);
}
- igc_update_stats_counters(adapter);
+ igc_update_stats_counters(sc);
}
static void
igc_if_watchdog_reset(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
/*
* Just count the event; iflib(4) will already trigger a
* sufficient reset of the controller.
*/
- adapter->watchdog_events++;
+ sc->watchdog_events++;
}
/*********************************************************************
@@ -1393,12 +1393,12 @@ igc_if_watchdog_reset(if_ctx_t ctx)
static void
igc_if_stop(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
INIT_DEBUGOUT("igc_if_stop: begin");
- igc_reset_hw(&adapter->hw);
- IGC_WRITE_REG(&adapter->hw, IGC_WUC, 0);
+ igc_reset_hw(&sc->hw);
+ IGC_WRITE_REG(&sc->hw, IGC_WUC, 0);
}
/*********************************************************************
@@ -1410,22 +1410,22 @@ static void
igc_identify_hardware(if_ctx_t ctx)
{
device_t dev = iflib_get_dev(ctx);
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
/* Make sure our PCI config space has the necessary stuff set */
- adapter->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
+ sc->hw.bus.pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
/* Save off the information about this board */
- adapter->hw.vendor_id = pci_get_vendor(dev);
- adapter->hw.device_id = pci_get_device(dev);
- adapter->hw.revision_id = pci_read_config(dev, PCIR_REVID, 1);
- adapter->hw.subsystem_vendor_id =
+ sc->hw.vendor_id = pci_get_vendor(dev);
+ sc->hw.device_id = pci_get_device(dev);
+ sc->hw.revision_id = pci_read_config(dev, PCIR_REVID, 1);
+ sc->hw.subsystem_vendor_id =
pci_read_config(dev, PCIR_SUBVEND_0, 2);
- adapter->hw.subsystem_device_id =
+ sc->hw.subsystem_device_id =
pci_read_config(dev, PCIR_SUBDEV_0, 2);
/* Do Shared Code Init and Setup */
- if (igc_set_mac_type(&adapter->hw)) {
+ if (igc_set_mac_type(&sc->hw)) {
device_printf(dev, "Setup init failure\n");
return;
}
@@ -1434,23 +1434,23 @@ igc_identify_hardware(if_ctx_t ctx)
static int
igc_allocate_pci_resources(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
+ struct igc_softc *sc = iflib_get_softc(ctx);
device_t dev = iflib_get_dev(ctx);
int rid;
rid = PCIR_BAR(0);
- adapter->memory = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
+ sc->memory = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
&rid, RF_ACTIVE);
- if (adapter->memory == NULL) {
+ if (sc->memory == NULL) {
device_printf(dev, "Unable to allocate bus resource: memory\n");
return (ENXIO);
}
- adapter->osdep.mem_bus_space_tag = rman_get_bustag(adapter->memory);
- adapter->osdep.mem_bus_space_handle =
- rman_get_bushandle(adapter->memory);
- adapter->hw.hw_addr = (u8 *)&adapter->osdep.mem_bus_space_handle;
+ sc->osdep.mem_bus_space_tag = rman_get_bustag(sc->memory);
+ sc->osdep.mem_bus_space_handle =
+ rman_get_bushandle(sc->memory);
+ sc->hw.hw_addr = (u8 *)&sc->osdep.mem_bus_space_handle;
- adapter->hw.back = &adapter->osdep;
+ sc->hw.back = &sc->osdep;
return (0);
}
@@ -1463,20 +1463,20 @@ igc_allocate_pci_resources(if_ctx_t ctx)
static int
igc_if_msix_intr_assign(if_ctx_t ctx, int msix)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_rx_queue *rx_que = adapter->rx_queues;
- struct igc_tx_queue *tx_que = adapter->tx_queues;
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_rx_queue *rx_que = sc->rx_queues;
+ struct igc_tx_queue *tx_que = sc->tx_queues;
int error, rid, i, vector = 0, rx_vectors;
char buf[16];
/* First set up ring resources */
- for (i = 0; i < adapter->rx_num_queues; i++, rx_que++, vector++) {
+ for (i = 0; i < sc->rx_num_queues; i++, rx_que++, vector++) {
rid = vector + 1;
snprintf(buf, sizeof(buf), "rxq%d", i);
error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, IFLIB_INTR_RXTX, igc_msix_que, rx_que, rx_que->me, buf);
if (error) {
device_printf(iflib_get_dev(ctx), "Failed to allocate que int %d err: %d", i, error);
- adapter->rx_num_queues = i + 1;
+ sc->rx_num_queues = i + 1;
goto fail;
}
@@ -1493,14 +1493,14 @@ igc_if_msix_intr_assign(if_ctx_t ctx, int msix)
rx_vectors = vector;
vector = 0;
- for (i = 0; i < adapter->tx_num_queues; i++, tx_que++, vector++) {
+ for (i = 0; i < sc->tx_num_queues; i++, tx_que++, vector++) {
snprintf(buf, sizeof(buf), "txq%d", i);
- tx_que = &adapter->tx_queues[i];
+ tx_que = &sc->tx_queues[i];
iflib_softirq_alloc_generic(ctx,
- &adapter->rx_queues[i % adapter->rx_num_queues].que_irq,
+ &sc->rx_queues[i % sc->rx_num_queues].que_irq,
IFLIB_INTR_TX, tx_que, tx_que->me, buf);
- tx_que->msix = (vector % adapter->rx_num_queues);
+ tx_que->msix = (vector % sc->rx_num_queues);
/*
* Set the bit to enable interrupt
@@ -1513,26 +1513,26 @@ igc_if_msix_intr_assign(if_ctx_t ctx, int msix)
/* Link interrupt */
rid = rx_vectors + 1;
- error = iflib_irq_alloc_generic(ctx, &adapter->irq, rid, IFLIB_INTR_ADMIN, igc_msix_link, adapter, 0, "aq");
+ error = iflib_irq_alloc_generic(ctx, &sc->irq, rid, IFLIB_INTR_ADMIN, igc_msix_link, sc, 0, "aq");
if (error) {
device_printf(iflib_get_dev(ctx), "Failed to register admin handler");
goto fail;
}
- adapter->linkvec = rx_vectors;
+ sc->linkvec = rx_vectors;
return (0);
fail:
- iflib_irq_free(ctx, &adapter->irq);
- rx_que = adapter->rx_queues;
- for (int i = 0; i < adapter->rx_num_queues; i++, rx_que++)
+ iflib_irq_free(ctx, &sc->irq);
+ rx_que = sc->rx_queues;
+ for (int i = 0; i < sc->rx_num_queues; i++, rx_que++)
iflib_irq_free(ctx, &rx_que->que_irq);
return (error);
}
static void
-igc_configure_queues(struct igc_adapter *adapter)
+igc_configure_queues(struct igc_softc *sc)
{
- struct igc_hw *hw = &adapter->hw;
+ struct igc_hw *hw = &sc->hw;
struct igc_rx_queue *rx_que;
struct igc_tx_queue *tx_que;
u32 ivar = 0, newitr = 0;
@@ -1544,10 +1544,10 @@ igc_configure_queues(struct igc_adapter *adapter)
/* Turn on MSI-X */
/* RX entries */
- for (int i = 0; i < adapter->rx_num_queues; i++) {
+ for (int i = 0; i < sc->rx_num_queues; i++) {
u32 index = i >> 1;
ivar = IGC_READ_REG_ARRAY(hw, IGC_IVAR0, index);
- rx_que = &adapter->rx_queues[i];
+ rx_que = &sc->rx_queues[i];
if (i & 1) {
ivar &= 0xFF00FFFF;
ivar |= (rx_que->msix | IGC_IVAR_VALID) << 16;
@@ -1558,10 +1558,10 @@ igc_configure_queues(struct igc_adapter *adapter)
IGC_WRITE_REG_ARRAY(hw, IGC_IVAR0, index, ivar);
}
/* TX entries */
- for (int i = 0; i < adapter->tx_num_queues; i++) {
+ for (int i = 0; i < sc->tx_num_queues; i++) {
u32 index = i >> 1;
ivar = IGC_READ_REG_ARRAY(hw, IGC_IVAR0, index);
- tx_que = &adapter->tx_queues[i];
+ tx_que = &sc->tx_queues[i];
if (i & 1) {
ivar &= 0x00FFFFFF;
ivar |= (tx_que->msix | IGC_IVAR_VALID) << 24;
@@ -1570,12 +1570,12 @@ igc_configure_queues(struct igc_adapter *adapter)
ivar |= (tx_que->msix | IGC_IVAR_VALID) << 8;
}
IGC_WRITE_REG_ARRAY(hw, IGC_IVAR0, index, ivar);
- adapter->que_mask |= tx_que->eims;
+ sc->que_mask |= tx_que->eims;
}
/* And for the link interrupt */
- ivar = (adapter->linkvec | IGC_IVAR_VALID) << 8;
- adapter->link_mask = 1 << adapter->linkvec;
+ ivar = (sc->linkvec | IGC_IVAR_VALID) << 8;
+ sc->link_mask = 1 << sc->linkvec;
IGC_WRITE_REG(hw, IGC_IVAR_MISC, ivar);
/* Set the starting interrupt rate */
@@ -1584,8 +1584,8 @@ igc_configure_queues(struct igc_adapter *adapter)
newitr |= IGC_EITR_CNT_IGNR;
- for (int i = 0; i < adapter->rx_num_queues; i++) {
- rx_que = &adapter->rx_queues[i];
+ for (int i = 0; i < sc->rx_num_queues; i++) {
+ rx_que = &sc->rx_queues[i];
IGC_WRITE_REG(hw, IGC_EITR(rx_que->msix), newitr);
}
@@ -1595,34 +1595,34 @@ igc_configure_queues(struct igc_adapter *adapter)
static void
igc_free_pci_resources(if_ctx_t ctx)
{
- struct igc_adapter *adapter = iflib_get_softc(ctx);
- struct igc_rx_queue *que = adapter->rx_queues;
+ struct igc_softc *sc = iflib_get_softc(ctx);
+ struct igc_rx_queue *que = sc->rx_queues;
device_t dev = iflib_get_dev(ctx);
*** 1509 LINES SKIPPED ***