drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c- Extension
.c- Size
- 417795 bytes
- Lines
- 14066
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/pci.hlinux/netdevice.hlinux/delay.hlinux/ethtool.hlinux/mutex.hbnx2x.hbnx2x_cmn.h
Detected Declarations
function bnx2x_bits_enfunction bnx2x_bits_disfunction bnx2x_check_lfafunction bnx2x_get_epiofunction bnx2x_set_epiofunction bnx2x_set_cfg_pinfunction bnx2x_get_cfg_pinfunction bnx2x_ets_e2e3a0_disabledfunction bnx2x_ets_get_min_w_val_nigfunction bnx2x_ets_get_credit_upper_boundfunction bnx2x_ets_e3b0_set_credit_upper_bound_nigfunction bnx2x_ets_e3b0_nig_disabledfunction bnx2x_ets_e3b0_set_credit_upper_bound_pbffunction bnx2x_ets_e3b0_pbf_disabledfunction bnx2x_ets_e3b0_disabledfunction bnx2x_ets_disabledfunction bnx2x_ets_e3b0_cli_mapfunction bnx2x_ets_e3b0_set_cos_bwfunction bnx2x_ets_e3b0_get_total_bwfunction bnx2x_ets_e3b0_sp_pri_to_cos_initfunction SPfunction bnx2x_e3b0_sp_get_pri_cli_regfunction bnx2x_e3b0_sp_get_pri_cli_reg_nigfunction bnx2x_e3b0_sp_get_pri_cli_reg_pbffunction SPfunction bnx2x_ets_e3b0_configfunction bnx2x_ets_bw_limit_commonfunction bnx2x_ets_bw_limitfunction bnx2x_ets_strictfunction bnx2x_update_pfc_xmacfunction bnx2x_set_mdio_clkfunction bnx2x_set_mdio_emac_per_phyfunction bnx2x_is_4_port_modefunction bnx2x_emac_initfunction bnx2x_set_xumac_nigfunction bnx2x_set_umac_rxtxfunction bnx2x_umac_enablefunction bnx2x_xmac_initfunction bnx2x_set_xmac_rxtxfunction bnx2x_xmac_enablefunction bnx2x_emac_enablefunction bnx2x_update_pfc_bmac1function bnx2x_update_pfc_bmac2function bnx2x_pfc_nig_rx_priority_maskfunction bnx2x_update_mngfunction bnx2x_update_link_attrfunction bnx2x_update_pfc_nigfunction bnx2x_update_pfc
Annotated Snippet
if (cur_speed_cap_mask != params->speed_cap_mask[cfg_idx]) {
DP(NETIF_MSG_LINK, "Speed Cap mismatch %x vs. %x\n",
cur_speed_cap_mask,
params->speed_cap_mask[cfg_idx]);
return LFA_SPEED_CAP_MISMATCH;
}
}
cur_req_fc_auto_adv =
REG_RD(bp, params->lfa_base +
offsetof(struct shmem_lfa, additional_config)) &
REQ_FC_AUTO_ADV_MASK;
if ((u16)cur_req_fc_auto_adv != params->req_fc_auto_adv) {
DP(NETIF_MSG_LINK, "Flow Ctrl AN mismatch %x vs. %x\n",
cur_req_fc_auto_adv, params->req_fc_auto_adv);
return LFA_FLOW_CTRL_MISMATCH;
}
eee_status = REG_RD(bp, params->shmem2_base +
offsetof(struct shmem2_region,
eee_status[params->port]));
if (((eee_status & SHMEM_EEE_LPI_REQUESTED_BIT) ^
(params->eee_mode & EEE_MODE_ENABLE_LPI)) ||
((eee_status & SHMEM_EEE_REQUESTED_BIT) ^
(params->eee_mode & EEE_MODE_ADV_LPI))) {
DP(NETIF_MSG_LINK, "EEE mismatch %x vs. %x\n", params->eee_mode,
eee_status);
return LFA_EEE_MISMATCH;
}
/* LFA conditions are met */
return 0;
}
/******************************************************************/
/* EPIO/GPIO section */
/******************************************************************/
static void bnx2x_get_epio(struct bnx2x *bp, u32 epio_pin, u32 *en)
{
u32 epio_mask, gp_oenable;
*en = 0;
/* Sanity check */
if (epio_pin > 31) {
DP(NETIF_MSG_LINK, "Invalid EPIO pin %d to get\n", epio_pin);
return;
}
epio_mask = 1 << epio_pin;
/* Set this EPIO to output */
gp_oenable = REG_RD(bp, MCP_REG_MCPR_GP_OENABLE);
REG_WR(bp, MCP_REG_MCPR_GP_OENABLE, gp_oenable & ~epio_mask);
*en = (REG_RD(bp, MCP_REG_MCPR_GP_INPUTS) & epio_mask) >> epio_pin;
}
static void bnx2x_set_epio(struct bnx2x *bp, u32 epio_pin, u32 en)
{
u32 epio_mask, gp_output, gp_oenable;
/* Sanity check */
if (epio_pin > 31) {
DP(NETIF_MSG_LINK, "Invalid EPIO pin %d to set\n", epio_pin);
return;
}
DP(NETIF_MSG_LINK, "Setting EPIO pin %d to %d\n", epio_pin, en);
epio_mask = 1 << epio_pin;
/* Set this EPIO to output */
gp_output = REG_RD(bp, MCP_REG_MCPR_GP_OUTPUTS);
if (en)
gp_output |= epio_mask;
else
gp_output &= ~epio_mask;
REG_WR(bp, MCP_REG_MCPR_GP_OUTPUTS, gp_output);
/* Set the value for this EPIO */
gp_oenable = REG_RD(bp, MCP_REG_MCPR_GP_OENABLE);
REG_WR(bp, MCP_REG_MCPR_GP_OENABLE, gp_oenable | epio_mask);
}
static void bnx2x_set_cfg_pin(struct bnx2x *bp, u32 pin_cfg, u32 val)
{
if (pin_cfg == PIN_CFG_NA)
return;
if (pin_cfg >= PIN_CFG_EPIO0) {
bnx2x_set_epio(bp, pin_cfg - PIN_CFG_EPIO0, val);
} else {
u8 gpio_num = (pin_cfg - PIN_CFG_GPIO0_P0) & 0x3;
u8 gpio_port = (pin_cfg - PIN_CFG_GPIO0_P0) >> 2;
bnx2x_set_gpio(bp, gpio_num, (u8)val, gpio_port);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/delay.h`, `linux/ethtool.h`, `linux/mutex.h`, `bnx2x.h`.
- Detected declarations: `function bnx2x_bits_en`, `function bnx2x_bits_dis`, `function bnx2x_check_lfa`, `function bnx2x_get_epio`, `function bnx2x_set_epio`, `function bnx2x_set_cfg_pin`, `function bnx2x_get_cfg_pin`, `function bnx2x_ets_e2e3a0_disabled`, `function bnx2x_ets_get_min_w_val_nig`, `function bnx2x_ets_get_credit_upper_bound`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.