drivers/net/ethernet/intel/ice/ice_idc.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_idc.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/ice/ice_idc.c
Extension
.c
Size
10365 bytes
Lines
465
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2021, Intel Corporation. */

/* Inter-Driver Communication */
#include "ice.h"
#include "ice_lib.h"
#include "ice_dcb_lib.h"

static DEFINE_XARRAY_ALLOC1(ice_aux_id);

/**
 * ice_get_auxiliary_drv - retrieve iidc_rdma_core_auxiliary_drv struct
 * @cdev: pointer to iidc_rdma_core_dev_info struct
 *
 * This function has to be called with a device_lock on the
 * cdev->adev.dev to avoid race conditions.
 *
 * Return: pointer to the matched auxiliary driver struct
 */
static struct iidc_rdma_core_auxiliary_drv *
ice_get_auxiliary_drv(struct iidc_rdma_core_dev_info *cdev)
{
	struct auxiliary_device *adev;

	adev = cdev->adev;
	if (!adev || !adev->dev.driver)
		return NULL;

	return container_of(adev->dev.driver,
			    struct iidc_rdma_core_auxiliary_drv, adrv.driver);
}

/**
 * ice_send_event_to_aux - send event to RDMA AUX driver
 * @pf: pointer to PF struct
 * @event: event struct
 */
void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_rdma_event *event)
{
	struct iidc_rdma_core_auxiliary_drv *iadrv;
	struct iidc_rdma_core_dev_info *cdev;

	if (WARN_ON_ONCE(!in_task()))
		return;

	cdev = pf->cdev_info;
	if (!cdev)
		return;

	mutex_lock(&pf->adev_mutex);
	if (!cdev->adev)
		goto finish;

	device_lock(&cdev->adev->dev);
	iadrv = ice_get_auxiliary_drv(cdev);
	if (iadrv && iadrv->event_handler)
		iadrv->event_handler(cdev, event);
	device_unlock(&cdev->adev->dev);
finish:
	mutex_unlock(&pf->adev_mutex);
}

/**
 * ice_add_rdma_qset - Add Leaf Node for RDMA Qset
 * @cdev: pointer to iidc_rdma_core_dev_info struct
 * @qset: Resource to be allocated
 *
 * Return: Zero on success or error code encountered
 */
int ice_add_rdma_qset(struct iidc_rdma_core_dev_info *cdev,
		      struct iidc_rdma_qset_params *qset)
{
	u16 max_rdmaqs[ICE_MAX_TRAFFIC_CLASS];
	struct ice_vsi *vsi;
	struct device *dev;
	struct ice_pf *pf;
	u32 qset_teid;
	u16 qs_handle;
	int status;
	int i;

	if (WARN_ON(!cdev || !qset))
		return -EINVAL;

	pf = pci_get_drvdata(cdev->pdev);
	dev = ice_pf_to_dev(pf);

	if (!ice_is_rdma_ena(pf))
		return -EINVAL;

Annotation

Implementation Notes