drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h- Extension
.h- Size
- 78793 bytes
- Lines
- 2538
- 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.
- 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/pci.hlinux/netdevice.hlinux/dma-mapping.hlinux/types.hlinux/pci_regs.hlinux/ptp_clock_kernel.hlinux/net_tstamp.hlinux/timecounter.hbnx2x_hsi.h../cnic_if.hlinux/mdio.hbnx2x_reg.hbnx2x_fw_defs.hbnx2x_mfw_req.hbnx2x_link.hbnx2x_sp.hbnx2x_dcb.hbnx2x_stats.hbnx2x_vfpf.h
Detected Declarations
struct sw_rx_bdstruct sw_tx_bdstruct sw_rx_pagestruct bnx2x_agg_infostruct bnx2x_fp_txdatastruct bnx2x_alloc_poolstruct bnx2x_fastpathstruct bnx2x_commonstruct bnx2x_portstruct bnx2x_slowpathstruct attn_routestruct irostruct hw_contextstruct bnx2x_iltstruct bnx2x_vfdbstruct bnx2x_link_report_datastruct bnx2x_fw_stats_reqstruct bnx2x_fw_stats_datastruct bnx2x_prev_path_liststruct bnx2x_sp_objsstruct bnx2x_fp_statsstruct bnx2x_vlan_entrystruct bnx2xstruct bnx2x_func_init_paramsenum bnx2x_int_modeenum bnx2x_tpa_mode_tenum bnx2x_recovery_stateenum sp_rtnl_flagenum bnx2x_iov_flagenum bnx2x_udp_port_typefunction reg_poll
Annotated Snippet
struct sw_rx_bd {
u8 *data;
DEFINE_DMA_UNMAP_ADDR(mapping);
};
struct sw_tx_bd {
struct sk_buff *skb;
u16 first_bd;
u8 flags;
/* Set on the first BD descriptor when there is a split BD */
#define BNX2X_TSO_SPLIT_BD (1<<0)
#define BNX2X_HAS_SECOND_PBD (1<<1)
};
struct sw_rx_page {
struct page *page;
DEFINE_DMA_UNMAP_ADDR(mapping);
unsigned int offset;
};
union db_prod {
struct doorbell_set_prod data;
u32 raw;
};
/* dropless fc FW/HW related params */
#define BRB_SIZE(bp) (CHIP_IS_E3(bp) ? 1024 : 512)
#define MAX_AGG_QS(bp) (CHIP_IS_E1(bp) ? \
ETH_MAX_AGGREGATION_QUEUES_E1 :\
ETH_MAX_AGGREGATION_QUEUES_E1H_E2)
#define FW_DROP_LEVEL(bp) (3 + MAX_SPQ_PENDING + MAX_AGG_QS(bp))
#define FW_PREFETCH_CNT 16
#define DROPLESS_FC_HEADROOM 100
/* MC hsi */
#define BCM_PAGE_SHIFT 12
#define BCM_PAGE_SIZE (1 << BCM_PAGE_SHIFT)
#define BCM_PAGE_MASK (~(BCM_PAGE_SIZE - 1))
#define BCM_PAGE_ALIGN(addr) (((addr) + BCM_PAGE_SIZE - 1) & BCM_PAGE_MASK)
#define PAGES_PER_SGE_SHIFT 0
#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT)
#define SGE_PAGE_SHIFT 12
#define SGE_PAGE_SIZE (1 << SGE_PAGE_SHIFT)
#define SGE_PAGE_MASK (~(SGE_PAGE_SIZE - 1))
#define SGE_PAGE_ALIGN(addr) (((addr) + SGE_PAGE_SIZE - 1) & SGE_PAGE_MASK)
#define SGE_PAGES (SGE_PAGE_SIZE * PAGES_PER_SGE)
#define TPA_AGG_SIZE min_t(u32, (min_t(u32, 8, MAX_SKB_FRAGS) * \
SGE_PAGES), 0xffff)
/* SGE ring related macros */
#define NUM_RX_SGE_PAGES 2
#define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge))
#define NEXT_PAGE_SGE_DESC_CNT 2
#define MAX_RX_SGE_CNT (RX_SGE_CNT - NEXT_PAGE_SGE_DESC_CNT)
/* RX_SGE_CNT is promised to be a power of 2 */
#define RX_SGE_MASK (RX_SGE_CNT - 1)
#define NUM_RX_SGE (RX_SGE_CNT * NUM_RX_SGE_PAGES)
#define MAX_RX_SGE (NUM_RX_SGE - 1)
#define NEXT_SGE_IDX(x) ((((x) & RX_SGE_MASK) == \
(MAX_RX_SGE_CNT - 1)) ? \
(x) + 1 + NEXT_PAGE_SGE_DESC_CNT : \
(x) + 1)
#define RX_SGE(x) ((x) & MAX_RX_SGE)
/*
* Number of required SGEs is the sum of two:
* 1. Number of possible opened aggregations (next packet for
* these aggregations will probably consume SGE immediately)
* 2. Rest of BRB blocks divided by 2 (block will consume new SGE only
* after placement on BD for new TPA aggregation)
*
* Takes into account NEXT_PAGE_SGE_DESC_CNT "next" elements on each page
*/
#define NUM_SGE_REQ (MAX_AGG_QS(bp) + \
(BRB_SIZE(bp) - MAX_AGG_QS(bp)) / 2)
#define NUM_SGE_PG_REQ ((NUM_SGE_REQ + MAX_RX_SGE_CNT - 1) / \
MAX_RX_SGE_CNT)
#define SGE_TH_LO(bp) (NUM_SGE_REQ + \
NUM_SGE_PG_REQ * NEXT_PAGE_SGE_DESC_CNT)
#define SGE_TH_HI(bp) (SGE_TH_LO(bp) + DROPLESS_FC_HEADROOM)
/* Manipulate a bit vector defined as an array of u64 */
/* Number of bits in one sge_mask array element */
#define BIT_VEC64_ELEM_SZ 64
#define BIT_VEC64_ELEM_SHIFT 6
#define BIT_VEC64_ELEM_MASK ((u64)BIT_VEC64_ELEM_SZ - 1)
#define __BIT_VEC64_SET_BIT(el, bit) \
Annotation
- Immediate include surface: `linux/pci.h`, `linux/netdevice.h`, `linux/dma-mapping.h`, `linux/types.h`, `linux/pci_regs.h`, `linux/ptp_clock_kernel.h`, `linux/net_tstamp.h`, `linux/timecounter.h`.
- Detected declarations: `struct sw_rx_bd`, `struct sw_tx_bd`, `struct sw_rx_page`, `struct bnx2x_agg_info`, `struct bnx2x_fp_txdata`, `struct bnx2x_alloc_pool`, `struct bnx2x_fastpath`, `struct bnx2x_common`, `struct bnx2x_port`, `struct bnx2x_slowpath`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.