drivers/net/ethernet/intel/idpf/idpf_idc.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/idpf_idc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/idpf_idc.c- Extension
.c- Size
- 12380 bytes
- Lines
- 511
- 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.
- 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/export.hidpf.hidpf_virtchnl.h
Detected Declarations
function idpf_idc_initfunction idpf_vport_adev_releasefunction idpf_plug_vport_aux_devfunction idpf_idc_init_aux_vport_devfunction idpf_idc_vdev_mtu_eventfunction idpf_core_adev_releasefunction idpf_plug_core_aux_devfunction idpf_unplug_aux_devfunction idpf_idc_issue_reset_eventfunction idpf_idc_vport_dev_upfunction idpf_idc_vport_dev_downfunction idpf_idc_vport_dev_ctrlfunction idpf_idc_request_resetfunction idpf_idc_init_msix_datafunction idpf_idc_init_aux_core_devfunction idpf_idc_deinit_core_aux_devicefunction idpf_idc_deinit_vport_aux_deviceexport idpf_idc_vport_dev_ctrlexport idpf_idc_request_reset
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2025 Intel Corporation */
#include <linux/export.h>
#include "idpf.h"
#include "idpf_virtchnl.h"
static DEFINE_IDA(idpf_idc_ida);
#define IDPF_IDC_MAX_ADEV_NAME_LEN 15
/**
* idpf_idc_init - Called to initialize IDC
* @adapter: driver private data structure
*
* Return: 0 on success or cap not enabled, error code on failure.
*/
int idpf_idc_init(struct idpf_adapter *adapter)
{
int err;
if (!idpf_is_rdma_cap_ena(adapter) ||
!adapter->dev_ops.idc_init)
return 0;
err = adapter->dev_ops.idc_init(adapter);
if (err)
dev_err(&adapter->pdev->dev, "failed to initialize idc: %d\n",
err);
return err;
}
/**
* idpf_vport_adev_release - function to be mapped to aux dev's release op
* @dev: pointer to device to free
*/
static void idpf_vport_adev_release(struct device *dev)
{
struct iidc_rdma_vport_auxiliary_dev *iadev;
iadev = container_of(dev, struct iidc_rdma_vport_auxiliary_dev, adev.dev);
kfree(iadev);
iadev = NULL;
}
/**
* idpf_plug_vport_aux_dev - allocate and register a vport Auxiliary device
* @cdev_info: IDC core device info pointer
* @vdev_info: IDC vport device info pointer
*
* Return: 0 on success or error code on failure.
*/
static int idpf_plug_vport_aux_dev(struct iidc_rdma_core_dev_info *cdev_info,
struct iidc_rdma_vport_dev_info *vdev_info)
{
struct iidc_rdma_vport_auxiliary_dev *iadev;
char name[IDPF_IDC_MAX_ADEV_NAME_LEN];
struct auxiliary_device *adev;
int ret;
iadev = kzalloc_obj(*iadev);
if (!iadev)
return -ENOMEM;
adev = &iadev->adev;
vdev_info->adev = &iadev->adev;
iadev->vdev_info = vdev_info;
ret = ida_alloc(&idpf_idc_ida, GFP_KERNEL);
if (ret < 0) {
pr_err("failed to allocate unique device ID for Auxiliary driver\n");
goto err_ida_alloc;
}
adev->id = ret;
adev->dev.release = idpf_vport_adev_release;
adev->dev.parent = &cdev_info->pdev->dev;
sprintf(name, "%04x.rdma.vdev", cdev_info->pdev->vendor);
adev->name = name;
ret = auxiliary_device_init(adev);
if (ret)
goto err_aux_dev_init;
ret = auxiliary_device_add(adev);
if (ret)
goto err_aux_dev_add;
return 0;
Annotation
- Immediate include surface: `linux/export.h`, `idpf.h`, `idpf_virtchnl.h`.
- Detected declarations: `function idpf_idc_init`, `function idpf_vport_adev_release`, `function idpf_plug_vport_aux_dev`, `function idpf_idc_init_aux_vport_dev`, `function idpf_idc_vdev_mtu_event`, `function idpf_core_adev_release`, `function idpf_plug_core_aux_dev`, `function idpf_unplug_aux_dev`, `function idpf_idc_issue_reset_event`, `function idpf_idc_vport_dev_up`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.