drivers/infiniband/hw/bnxt_re/hw_counters.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/bnxt_re/hw_counters.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/bnxt_re/hw_counters.c- Extension
.c- Size
- 17136 bytes
- Lines
- 434
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/pci.hrdma/ib_mad.hrdma/ib_pma.hroce_hsi.hqplib_res.hqplib_sp.hqplib_fp.hqplib_rcfw.hbnxt_re.hhw_counters.h
Detected Declarations
function bnxt_re_copy_ext_statsfunction bnxt_re_get_ext_statfunction bnxt_re_copy_err_statsfunction bnxt_re_assign_pma_port_ext_countersfunction bnxt_re_assign_pma_port_countersfunction bnxt_re_ib_get_hw_stats
Annotated Snippet
if (rc) {
clear_bit(BNXT_RE_FLAG_ISSUE_ROCE_STATS,
&rdev->flags);
goto done;
}
bnxt_re_copy_err_stats(rdev, stats, err_s);
if (bnxt_ext_stats_supported(rdev->chip_ctx, rdev->dev_attr->dev_cap_flags,
rdev->is_virtfn)) {
rc = bnxt_re_get_ext_stat(rdev, stats);
if (rc) {
clear_bit(BNXT_RE_FLAG_ISSUE_ROCE_STATS,
&rdev->flags);
goto done;
}
}
}
done:
return bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx) ?
BNXT_RE_NUM_EXT_COUNTERS : BNXT_RE_NUM_STD_COUNTERS;
}
struct rdma_hw_stats *bnxt_re_ib_alloc_hw_port_stats(struct ib_device *ibdev,
u32 port_num)
{
struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
int num_counters = 0;
if (bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx))
num_counters = BNXT_RE_NUM_EXT_COUNTERS;
else
num_counters = BNXT_RE_NUM_STD_COUNTERS;
return rdma_alloc_hw_stats_struct(bnxt_re_stat_descs, num_counters,
RDMA_HW_STATS_DEFAULT_LIFESPAN);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/pci.h`, `rdma/ib_mad.h`, `rdma/ib_pma.h`, `roce_hsi.h`, `qplib_res.h`, `qplib_sp.h`, `qplib_fp.h`.
- Detected declarations: `function bnxt_re_copy_ext_stats`, `function bnxt_re_get_ext_stat`, `function bnxt_re_copy_err_stats`, `function bnxt_re_assign_pma_port_ext_counters`, `function bnxt_re_assign_pma_port_counters`, `function bnxt_re_ib_get_hw_stats`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.