drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c- Extension
.c- Size
- 45830 bytes
- Lines
- 1637
- 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.
- 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/errno.hlinux/kernel.hlinux/mm.hlinux/pci.hlinux/bnge/hsi.hlinux/if_vlan.hnet/netdev_queues.hbnge.hbnge_hwrm.hbnge_hwrm_lib.hbnge_rmem.hbnge_resc.hbnge_netdev.h
Detected Declarations
function bnge_hwrm_ver_getfunction bnge_hwrm_nvm_dev_infofunction bnge_hwrm_func_resetfunction bnge_hwrm_fw_set_timefunction bnge_hwrm_func_drv_rgtrfunction bnge_hwrm_func_drv_unrgtrfunction bnge_init_ctx_initializerfunction bnge_alloc_all_ctx_pg_infofunction bnge_hwrm_func_backing_store_qcapsfunction bnge_hwrm_set_pg_attrfunction bnge_hwrm_func_backing_storefunction bnge_hwrm_get_ringsfunction __bnge_hwrm_reserve_pf_ringsfunction bnge_hwrm_reserve_pf_ringsfunction bnge_hwrm_reserve_ringsfunction bnge_hwrm_func_qcfgfunction bnge_hwrm_func_resc_qcapsfunction bnge_hwrm_func_qcapsfunction bnge_hwrm_vnic_qcapsfunction bnge_hwrm_queue_qportcfgfunction bnge_hwrm_vnic_set_hdsfunction bnge_hwrm_vnic_ctx_allocfunction __bnge_hwrm_vnic_set_rssfunction bnge_hwrm_vnic_set_rssfunction bnge_hwrm_vnic_cfgfunction bnge_hwrm_update_rss_hash_cfgfunction bnge_hwrm_l2_filter_freefunction bnge_hwrm_l2_filter_allocfunction bnge_hwrm_cfa_l2_set_rx_maskfunction bnge_hwrm_vnic_allocfunction bnge_hwrm_vnic_free_onefunction bnge_hwrm_vnic_ctx_free_onefunction bnge_phy_qcaps_no_speedfunction bnge_hwrm_phy_qcapsfunction bnge_hwrm_set_link_settingfunction bnge_update_linkfunction bnge_hwrm_set_pausefunction bnge_hwrm_shutdown_linkfunction bnge_hwrm_stat_ctx_freefunction bnge_hwrm_stat_ctx_allocfunction hwrm_ring_free_send_msgfunction hwrm_ring_alloc_send_msgfunction bnge_hwrm_set_async_event_crfunction bnge_hwrm_vnic_update_tunl_tpafunction bnge_hwrm_vnic_set_tpafunction bnge_hwrm_func_qstat_extfunction bnge_hwrm_port_qstats_extfunction bnge_hwrm_port_qstats
Annotated Snippet
if (nqr->hw_stats_ctx_id != INVALID_STATS_CTX_ID) {
req->stat_ctx_id = cpu_to_le32(nqr->hw_stats_ctx_id);
bnge_hwrm_req_send(bd, req);
nqr->hw_stats_ctx_id = INVALID_STATS_CTX_ID;
}
}
bnge_hwrm_req_drop(bd, req);
}
int bnge_hwrm_stat_ctx_alloc(struct bnge_net *bn)
{
struct hwrm_stat_ctx_alloc_output *resp;
struct hwrm_stat_ctx_alloc_input *req;
struct bnge_dev *bd = bn->bd;
int rc, i;
rc = bnge_hwrm_req_init(bd, req, HWRM_STAT_CTX_ALLOC);
if (rc)
return rc;
req->stats_dma_length = cpu_to_le16(bd->hw_ring_stats_size);
req->update_period_ms = cpu_to_le32(bn->stats_coal_ticks / 1000);
resp = bnge_hwrm_req_hold(bd, req);
for (i = 0; i < bd->nq_nr_rings; i++) {
struct bnge_napi *bnapi = bn->bnapi[i];
struct bnge_nq_ring_info *nqr = &bnapi->nq_ring;
req->stats_dma_addr = cpu_to_le64(nqr->stats.hw_stats_map);
rc = bnge_hwrm_req_send(bd, req);
if (rc)
break;
nqr->hw_stats_ctx_id = le32_to_cpu(resp->stat_ctx_id);
bn->grp_info[i].fw_stats_ctx = nqr->hw_stats_ctx_id;
}
bnge_hwrm_req_drop(bd, req);
return rc;
}
int hwrm_ring_free_send_msg(struct bnge_net *bn,
struct bnge_ring_struct *ring,
u32 ring_type, int cmpl_ring_id)
{
struct hwrm_ring_free_input *req;
struct bnge_dev *bd = bn->bd;
int rc;
rc = bnge_hwrm_req_init(bd, req, HWRM_RING_FREE);
if (rc)
goto exit;
req->cmpl_ring = cpu_to_le16(cmpl_ring_id);
req->ring_type = ring_type;
req->ring_id = cpu_to_le16(ring->fw_ring_id);
bnge_hwrm_req_hold(bd, req);
rc = bnge_hwrm_req_send(bd, req);
bnge_hwrm_req_drop(bd, req);
exit:
if (rc) {
netdev_err(bd->netdev, "hwrm_ring_free type %d failed. rc:%d\n", ring_type, rc);
return -EIO;
}
return 0;
}
int hwrm_ring_alloc_send_msg(struct bnge_net *bn,
struct bnge_ring_struct *ring,
u32 ring_type, u32 map_index)
{
struct bnge_ring_mem_info *rmem = &ring->ring_mem;
struct bnge_ring_grp_info *grp_info;
struct hwrm_ring_alloc_output *resp;
struct hwrm_ring_alloc_input *req;
struct bnge_dev *bd = bn->bd;
u16 ring_id, flags = 0;
int rc;
rc = bnge_hwrm_req_init(bd, req, HWRM_RING_ALLOC);
if (rc)
goto exit;
req->enables = 0;
if (rmem->nr_pages > 1) {
req->page_tbl_addr = cpu_to_le64(rmem->dma_pg_tbl);
/* Page size is in log2 units */
req->page_size = BNGE_PAGE_SHIFT;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/kernel.h`, `linux/mm.h`, `linux/pci.h`, `linux/bnge/hsi.h`, `linux/if_vlan.h`, `net/netdev_queues.h`, `bnge.h`.
- Detected declarations: `function bnge_hwrm_ver_get`, `function bnge_hwrm_nvm_dev_info`, `function bnge_hwrm_func_reset`, `function bnge_hwrm_fw_set_time`, `function bnge_hwrm_func_drv_rgtr`, `function bnge_hwrm_func_drv_unrgtr`, `function bnge_init_ctx_initializer`, `function bnge_alloc_all_ctx_pg_info`, `function bnge_hwrm_func_backing_store_qcaps`, `function bnge_hwrm_set_pg_attr`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.