drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c- Extension
.c- Size
- 63630 bytes
- Lines
- 2006
- 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
bnx2x_stats.hbnx2x_cmn.hbnx2x_sriov.h
Detected Declarations
function bnx2x_hilofunction bnx2x_get_port_stats_dma_lenfunction bnx2x_dp_statsfunction bnx2x_storm_stats_postfunction bnx2x_hw_stats_postfunction bnx2x_stats_compfunction bnx2x_stats_pmf_updatefunction bnx2x_port_stats_initfunction bnx2x_func_stats_initfunction bnx2x_stats_startfunction bnx2x_stats_pmf_startfunction bnx2x_stats_restartfunction bnx2x_bmac_stats_updatefunction bnx2x_mstat_stats_updatefunction bnx2x_emac_stats_updatefunction bnx2x_hw_stats_updatefunction bnx2x_storm_stats_validate_countersfunction bnx2x_storm_stats_updatefunction for_each_eth_queuefunction bnx2x_net_stats_updatefunction bnx2x_drv_stats_updatefunction for_each_queuefunction bnx2x_edebug_stats_stoppedfunction bnx2x_stats_updatefunction bnx2x_port_stats_stopfunction bnx2x_stats_stopfunction bnx2x_stats_do_nothingfunction bnx2x_stats_handlefunction bnx2x_port_stats_base_initfunction bnx2x_prep_fw_stats_reqfunction for_each_eth_queuefunction bnx2x_memset_statsfunction bnx2x_stats_initfunction bnx2x_save_statisticsfunction bnx2x_afex_collect_statsfunction for_each_eth_queuefunction bnx2x_stats_safe_exec
Annotated Snippet
if (bp->flags & BC_SUPPORTS_PFC_STATS) {
res += offsetof(struct host_port_stats,
pfc_frames_rx_lo) -
offsetof(struct host_port_stats,
pfc_frames_tx_hi) + 4 ;
}
}
res >>= 2;
WARN_ON(res > 2 * DMAE_LEN32_RD_MAX);
return res;
}
/*
* Init service functions
*/
static void bnx2x_dp_stats(struct bnx2x *bp)
{
int i;
DP(BNX2X_MSG_STATS, "dumping stats:\n"
"fw_stats_req\n"
" hdr\n"
" cmd_num %d\n"
" reserved0 %d\n"
" drv_stats_counter %d\n"
" reserved1 %d\n"
" stats_counters_addrs %x %x\n",
bp->fw_stats_req->hdr.cmd_num,
bp->fw_stats_req->hdr.reserved0,
bp->fw_stats_req->hdr.drv_stats_counter,
bp->fw_stats_req->hdr.reserved1,
bp->fw_stats_req->hdr.stats_counters_addrs.hi,
bp->fw_stats_req->hdr.stats_counters_addrs.lo);
for (i = 0; i < bp->fw_stats_req->hdr.cmd_num; i++) {
DP(BNX2X_MSG_STATS,
"query[%d]\n"
" kind %d\n"
" index %d\n"
" funcID %d\n"
" reserved %d\n"
" address %x %x\n",
i, bp->fw_stats_req->query[i].kind,
bp->fw_stats_req->query[i].index,
bp->fw_stats_req->query[i].funcID,
bp->fw_stats_req->query[i].reserved,
bp->fw_stats_req->query[i].address.hi,
bp->fw_stats_req->query[i].address.lo);
}
}
/* Post the next statistics ramrod. Protect it with the spin in
* order to ensure the strict order between statistics ramrods
* (each ramrod has a sequence number passed in a
* bp->fw_stats_req->hdr.drv_stats_counter and ramrods must be
* sent in order).
*/
static void bnx2x_storm_stats_post(struct bnx2x *bp)
{
int rc;
if (bp->stats_pending)
return;
bp->fw_stats_req->hdr.drv_stats_counter =
cpu_to_le16(bp->stats_counter++);
DP(BNX2X_MSG_STATS, "Sending statistics ramrod %d\n",
le16_to_cpu(bp->fw_stats_req->hdr.drv_stats_counter));
/* adjust the ramrod to include VF queues statistics */
bnx2x_iov_adjust_stats_req(bp);
bnx2x_dp_stats(bp);
/* send FW stats ramrod */
rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_STAT_QUERY, 0,
U64_HI(bp->fw_stats_req_mapping),
U64_LO(bp->fw_stats_req_mapping),
NONE_CONNECTION_TYPE);
if (rc == 0)
bp->stats_pending = 1;
}
static void bnx2x_hw_stats_post(struct bnx2x *bp)
{
struct dmae_command *dmae = &bp->stats_dmae;
u32 *stats_comp = bnx2x_sp(bp, stats_comp);
Annotation
- Immediate include surface: `bnx2x_stats.h`, `bnx2x_cmn.h`, `bnx2x_sriov.h`.
- Detected declarations: `function bnx2x_hilo`, `function bnx2x_get_port_stats_dma_len`, `function bnx2x_dp_stats`, `function bnx2x_storm_stats_post`, `function bnx2x_hw_stats_post`, `function bnx2x_stats_comp`, `function bnx2x_stats_pmf_update`, `function bnx2x_port_stats_init`, `function bnx2x_func_stats_init`, `function bnx2x_stats_start`.
- 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.