drivers/net/ethernet/broadcom/bnge/bnge_link.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnge/bnge_link.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnge/bnge_link.c- Extension
.c- Size
- 35475 bytes
- Lines
- 1133
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/linkmode.hbnge.hbnge_link.hbnge_hwrm_lib.h
Detected Declarations
enum bnge_media_typeenum bnge_link_speed_indicesfunction bnge_fw_to_ethtool_speedfunction bnge_set_auto_speedfunction bnge_set_force_speedfunction bnge_init_ethtool_link_settingsfunction bnge_probe_phyfunction bnge_hwrm_set_link_commonfunction bnge_auto_speed_updatedfunction bnge_hwrm_set_pause_commonfunction bnge_force_speed_updatedfunction bnge_update_phy_settingfunction bnge_get_port_module_statusfunction bnge_set_default_adv_speedsfunction bnge_support_droppedfunction bnge_support_speed_droppedfunction bnge_report_linkfunction bnge_get_ethtool_modesfunction bnge_get_linkfunction bnge_get_mediafunction bnge_fw_speed_idxfunction bnge_get_link_modefunction bnge_encoding_speed_idxfunction __bnge_get_ethtool_speedsfunction for_each_set_bitfunction bnge_get_ethtool_speedsfunction bnge_get_all_ethtool_support_speedsfunction bnge_get_all_ethtool_adv_speedsfunction bnge_get_all_ethtool_lp_speedsfunction bnge_update_speedfunction bitfunction bnge_set_ethtool_speedsfunction bnge_fw_to_ethtool_advertised_fecfunction bnge_fw_to_ethtool_support_fecfunction bnge_get_default_speedsfunction bnge_get_link_ksettingsfunction bnge_lanes_matchfunction bnge_force_link_speedfunction bnge_set_link_ksettingsfunction bnge_link_async_event_process
Annotated Snippet
if (speed == SPEED_UNKNOWN) {
netdev_info(bd->netdev,
"NIC Link is Up, speed unknown\n");
return;
}
if (bd->link_info.duplex == BNGE_LINK_DUPLEX_FULL)
duplex = "full";
else
duplex = "half";
if (bd->link_info.pause == BNGE_LINK_PAUSE_BOTH)
flow_ctrl = "ON - receive & transmit";
else if (bd->link_info.pause == BNGE_LINK_PAUSE_TX)
flow_ctrl = "ON - transmit";
else if (bd->link_info.pause == BNGE_LINK_PAUSE_RX)
flow_ctrl = "ON - receive";
else
flow_ctrl = "none";
if (bd->link_info.phy_qcfg_resp.option_flags &
PORT_PHY_QCFG_RESP_OPTION_FLAGS_SIGNAL_MODE_KNOWN) {
u8 sig_mode = bd->link_info.active_fec_sig_mode &
PORT_PHY_QCFG_RESP_SIGNAL_MODE_MASK;
switch (sig_mode) {
case PORT_PHY_QCFG_RESP_SIGNAL_MODE_NRZ:
signal = "(NRZ) ";
break;
case PORT_PHY_QCFG_RESP_SIGNAL_MODE_PAM4:
signal = "(PAM4 56Gbps) ";
break;
case PORT_PHY_QCFG_RESP_SIGNAL_MODE_PAM4_112:
signal = "(PAM4 112Gbps) ";
break;
default:
break;
}
}
netdev_info(bd->netdev, "NIC Link is Up, %u Mbps %s%s duplex, Flow control: %s\n",
speed, signal, duplex, flow_ctrl);
fec = bd->link_info.fec_cfg;
if (!(fec & PORT_PHY_QCFG_RESP_FEC_CFG_FEC_NONE_SUPPORTED))
netdev_info(bd->netdev, "FEC autoneg %s encoding: %s\n",
(fec & BNGE_FEC_AUTONEG) ? "on" : "off",
bnge_report_fec(&bd->link_info));
} else {
netif_carrier_off(bd->netdev);
netdev_info(bd->netdev, "NIC Link is Down\n");
}
}
static void bnge_get_ethtool_modes(struct bnge_net *bn,
struct ethtool_link_ksettings *lk_ksettings)
{
struct bnge_ethtool_link_info *elink_info;
struct bnge_link_info *link_info;
struct bnge_dev *bd = bn->bd;
elink_info = &bn->eth_link_info;
link_info = &bd->link_info;
if (!(bd->phy_flags & BNGE_PHY_FL_NO_PAUSE)) {
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT,
lk_ksettings->link_modes.supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
lk_ksettings->link_modes.supported);
}
if (link_info->support_auto_speeds2)
linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
lk_ksettings->link_modes.supported);
if (~elink_info->autoneg & BNGE_AUTONEG_FLOW_CTRL)
return;
if (link_info->auto_pause_setting & BNGE_LINK_PAUSE_RX)
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT,
lk_ksettings->link_modes.advertising);
if (hweight8(link_info->auto_pause_setting & BNGE_LINK_PAUSE_BOTH) == 1)
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
lk_ksettings->link_modes.advertising);
if (link_info->lp_pause & BNGE_LINK_PAUSE_RX)
linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT,
lk_ksettings->link_modes.lp_advertising);
if (hweight8(link_info->lp_pause & BNGE_LINK_PAUSE_BOTH) == 1)
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
lk_ksettings->link_modes.lp_advertising);
}
u32 bnge_get_link(struct net_device *dev)
{
struct bnge_net *bn = netdev_priv(dev);
Annotation
- Immediate include surface: `linux/linkmode.h`, `bnge.h`, `bnge_link.h`, `bnge_hwrm_lib.h`.
- Detected declarations: `enum bnge_media_type`, `enum bnge_link_speed_indices`, `function bnge_fw_to_ethtool_speed`, `function bnge_set_auto_speed`, `function bnge_set_force_speed`, `function bnge_init_ethtool_link_settings`, `function bnge_probe_phy`, `function bnge_hwrm_set_link_common`, `function bnge_auto_speed_updated`, `function bnge_hwrm_set_pause_common`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.