drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c- Extension
.c- Size
- 430347 bytes
- Lines
- 15493
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/moduleparam.hlinux/kernel.hlinux/device.hlinux/timer.hlinux/errno.hlinux/ioport.hlinux/slab.hlinux/interrupt.hlinux/pci.hlinux/init.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/dma-mapping.hlinux/bitops.hlinux/irq.hlinux/delay.hasm/byteorder.hlinux/time.hlinux/ethtool.hlinux/mii.hlinux/if_vlan.hlinux/crash_dump.hnet/ip.hnet/ipv6.hnet/tcp.hnet/vxlan.hnet/checksum.hnet/ip6_checksum.hlinux/workqueue.hlinux/crc32.h
Detected Declarations
struct bnx2x_mac_valsstruct pbf_pN_buf_regsstruct pbf_pN_cmd_regsstruct bnx2x_mcast_list_elem_groupenum bnx2x_board_typeenum stormsfunction __storm_memset_dma_mappingfunction storm_memset_spq_addrfunction storm_memset_vf_to_pffunction storm_memset_func_enfunction storm_memset_eq_datafunction storm_memset_eq_prodfunction bnx2x_reg_wr_indfunction bnx2x_reg_rd_indfunction bnx2x_dp_dmaefunction bnx2x_post_dmaefunction bnx2x_dmae_opcode_add_compfunction bnx2x_dmae_opcode_clr_src_resetfunction bnx2x_dmae_opcodefunction bnx2x_prep_dmae_with_compfunction bnx2x_issue_dmae_with_compfunction bnx2x_write_dmaefunction bnx2x_read_dmaefunction bnx2x_write_dmae_phys_lenfunction bnx2x_get_assert_list_entryfunction bnx2x_mc_assertfunction bnx2x_fw_dump_lvlfunction SCRATCH_BUFFER_SIZEfunction bnx2x_fw_dumpfunction bnx2x_hc_int_disablefunction bnx2x_igu_int_disablefunction bnx2x_int_disablefunction bnx2x_panic_dumpfunction for_each_eth_queuefunction for_each_cos_in_tx_queuefunction for_each_cos_in_tx_queuefunction bnx2x_pbf_pN_buf_flushedfunction bnx2x_pbf_pN_cmd_flushedfunction bnx2x_flr_clnup_reg_pollfunction bnx2x_flr_clnup_poll_hw_counterfunction bnx2x_flr_clnup_poll_countfunction bnx2x_tx_hw_flushedfunction bnx2x_send_final_clnupfunction bnx2x_is_pcie_pendingfunction bnx2x_poll_hw_usage_countersfunction bnx2x_hw_enable_statusfunction bnx2x_pf_flr_clnupfunction bnx2x_hc_int_enable
Annotated Snippet
static const struct net_device_ops bnx2x_netdev_ops = {
.ndo_open = bnx2x_open,
.ndo_stop = bnx2x_close,
.ndo_start_xmit = bnx2x_start_xmit,
.ndo_select_queue = bnx2x_select_queue,
.ndo_set_rx_mode = bnx2x_set_rx_mode,
.ndo_set_mac_address = bnx2x_change_mac_addr,
.ndo_validate_addr = bnx2x_validate_addr,
.ndo_eth_ioctl = bnx2x_ioctl,
.ndo_change_mtu = bnx2x_change_mtu,
.ndo_fix_features = bnx2x_fix_features,
.ndo_set_features = bnx2x_set_features,
.ndo_tx_timeout = bnx2x_tx_timeout,
.ndo_vlan_rx_add_vid = bnx2x_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = bnx2x_vlan_rx_kill_vid,
.ndo_setup_tc = __bnx2x_setup_tc,
#ifdef CONFIG_BNX2X_SRIOV
.ndo_set_vf_mac = bnx2x_set_vf_mac,
.ndo_set_vf_vlan = bnx2x_set_vf_vlan,
.ndo_get_vf_config = bnx2x_get_vf_config,
.ndo_set_vf_spoofchk = bnx2x_set_vf_spoofchk,
#endif
#ifdef NETDEV_FCOE_WWNN
.ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn,
#endif
.ndo_get_phys_port_id = bnx2x_get_phys_port_id,
.ndo_set_vf_link_state = bnx2x_set_vf_link_state,
.ndo_features_check = bnx2x_features_check,
.ndo_hwtstamp_get = bnx2x_hwtstamp_get,
.ndo_hwtstamp_set = bnx2x_hwtstamp_set,
};
static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
struct net_device *dev, unsigned long board_type)
{
int rc;
u32 pci_cfg_dword;
bool chip_is_e1x = (board_type == BCM57710 ||
board_type == BCM57711 ||
board_type == BCM57711E);
SET_NETDEV_DEV(dev, &pdev->dev);
bp->dev = dev;
bp->pdev = pdev;
rc = pci_enable_device(pdev);
if (rc) {
dev_err(&bp->pdev->dev,
"Cannot enable PCI device, aborting\n");
goto err_out;
}
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
dev_err(&bp->pdev->dev,
"Cannot find PCI device base address, aborting\n");
rc = -ENODEV;
goto err_out_disable;
}
if (IS_PF(bp) && !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
dev_err(&bp->pdev->dev, "Cannot find second PCI device base address, aborting\n");
rc = -ENODEV;
goto err_out_disable;
}
pci_read_config_dword(pdev, PCICFG_REVISION_ID_OFFSET, &pci_cfg_dword);
if ((pci_cfg_dword & PCICFG_REVESION_ID_MASK) ==
PCICFG_REVESION_ID_ERROR_VAL) {
pr_err("PCI device error, probably due to fan failure, aborting\n");
rc = -ENODEV;
goto err_out_disable;
}
if (atomic_read(&pdev->enable_cnt) == 1) {
rc = pci_request_regions(pdev, DRV_MODULE_NAME);
if (rc) {
dev_err(&bp->pdev->dev,
"Cannot obtain PCI resources, aborting\n");
goto err_out_disable;
}
pci_set_master(pdev);
pci_save_state(pdev);
}
if (IS_PF(bp)) {
if (!pdev->pm_cap) {
dev_err(&bp->pdev->dev,
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/device.h`, `linux/timer.h`, `linux/errno.h`, `linux/ioport.h`, `linux/slab.h`.
- Detected declarations: `struct bnx2x_mac_vals`, `struct pbf_pN_buf_regs`, `struct pbf_pN_cmd_regs`, `struct bnx2x_mcast_list_elem_group`, `enum bnx2x_board_type`, `enum storms`, `function __storm_memset_dma_mapping`, `function storm_memset_spq_addr`, `function storm_memset_vf_to_pf`, `function storm_memset_func_en`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.