drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnge/bnge_auxr.c- Extension
.c- Size
- 5978 bytes
- Lines
- 260
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/errno.hlinux/interrupt.hlinux/pci.hlinux/netdevice.hlinux/rtnetlink.hlinux/bitops.hlinux/irq.hasm/byteorder.hlinux/bitmap.hlinux/auxiliary_bus.hlinux/bnge/hsi.hbnge.hbnge_hwrm.hbnge_auxr.h
Detected Declarations
function bnge_fill_msix_vecsfunction bnge_register_devfunction bnge_unregister_devfunction bnge_send_msgfunction bnge_rdma_aux_device_uninitfunction bnge_aux_dev_releasefunction bnge_rdma_aux_device_delfunction bnge_set_auxr_dev_infofunction bnge_rdma_aux_device_addfunction bnge_rdma_aux_device_initexport bnge_register_devexport bnge_unregister_devexport bnge_send_msg
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2025 Broadcom.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <linux/bitops.h>
#include <linux/irq.h>
#include <asm/byteorder.h>
#include <linux/bitmap.h>
#include <linux/auxiliary_bus.h>
#include <linux/bnge/hsi.h>
#include "bnge.h"
#include "bnge_hwrm.h"
#include "bnge_auxr.h"
static DEFINE_IDA(bnge_aux_dev_ids);
static void bnge_fill_msix_vecs(struct bnge_dev *bd,
struct bnge_msix_info *info)
{
struct bnge_auxr_dev *auxr_dev = bd->auxr_dev;
int num_msix, i;
if (!auxr_dev->auxr_info->msix_requested) {
dev_warn(bd->dev, "Requested MSI-X vectors not allocated\n");
return;
}
num_msix = auxr_dev->auxr_info->msix_requested;
for (i = 0; i < num_msix; i++) {
info[i].vector = bd->irq_tbl[i].vector;
info[i].db_offset = bd->db_offset;
info[i].ring_idx = i;
}
}
int bnge_register_dev(struct bnge_auxr_dev *auxr_dev,
void *handle)
{
struct bnge_dev *bd = pci_get_drvdata(auxr_dev->pdev);
struct bnge_auxr_info *auxr_info;
int rc = 0;
netdev_lock(bd->netdev);
mutex_lock(&auxr_dev->auxr_dev_lock);
if (!bd->irq_tbl) {
rc = -ENODEV;
goto exit;
}
if (!bnge_aux_has_enough_resources(bd)) {
rc = -ENOMEM;
goto exit;
}
auxr_info = auxr_dev->auxr_info;
auxr_info->handle = handle;
auxr_info->msix_requested = bd->aux_num_msix;
bnge_fill_msix_vecs(bd, bd->auxr_dev->msix_info);
auxr_dev->flags |= BNGE_ARDEV_MSIX_ALLOC;
exit:
mutex_unlock(&auxr_dev->auxr_dev_lock);
netdev_unlock(bd->netdev);
return rc;
}
EXPORT_SYMBOL(bnge_register_dev);
void bnge_unregister_dev(struct bnge_auxr_dev *auxr_dev)
{
struct bnge_dev *bd = pci_get_drvdata(auxr_dev->pdev);
struct bnge_auxr_info *auxr_info;
auxr_info = auxr_dev->auxr_info;
netdev_lock(bd->netdev);
mutex_lock(&auxr_dev->auxr_dev_lock);
if (auxr_info->msix_requested)
auxr_dev->flags &= ~BNGE_ARDEV_MSIX_ALLOC;
auxr_info->msix_requested = 0;
mutex_unlock(&auxr_dev->auxr_dev_lock);
netdev_unlock(bd->netdev);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/rtnetlink.h`, `linux/bitops.h`.
- Detected declarations: `function bnge_fill_msix_vecs`, `function bnge_register_dev`, `function bnge_unregister_dev`, `function bnge_send_msg`, `function bnge_rdma_aux_device_uninit`, `function bnge_aux_dev_release`, `function bnge_rdma_aux_device_del`, `function bnge_set_auxr_dev_info`, `function bnge_rdma_aux_device_add`, `function bnge_rdma_aux_device_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.