drivers/net/ethernet/cisco/enic/vnic_intr.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cisco/enic/vnic_intr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cisco/enic/vnic_intr.c- Extension
.c- Size
- 1605 bytes
- Lines
- 64
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/types.hlinux/pci.hlinux/delay.hvnic_dev.hvnic_intr.henic.h
Detected Declarations
function vnic_intr_freefunction vnic_intr_alloc_with_typefunction vnic_intr_allocfunction vnic_intr_initfunction vnic_intr_coalescing_timer_setfunction vnic_intr_clean
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2008-2010 Cisco Systems, Inc. All rights reserved.
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include "vnic_dev.h"
#include "vnic_intr.h"
#include "enic.h"
void vnic_intr_free(struct vnic_intr *intr)
{
intr->ctrl = NULL;
}
int vnic_intr_alloc_with_type(struct vnic_dev *vdev, struct vnic_intr *intr,
unsigned int index, unsigned int res_type)
{
intr->index = index;
intr->vdev = vdev;
intr->ctrl = vnic_dev_get_res(vdev, res_type, index);
if (!intr->ctrl) {
vdev_err(vdev, "Failed to hook INTR[%d].ctrl resource\n",
index);
return -EINVAL;
}
return 0;
}
int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
unsigned int index)
{
return vnic_intr_alloc_with_type(vdev, intr, index, RES_TYPE_INTR_CTRL);
}
void vnic_intr_init(struct vnic_intr *intr, u32 coalescing_timer,
unsigned int coalescing_type, unsigned int mask_on_assertion)
{
vnic_intr_coalescing_timer_set(intr, coalescing_timer);
iowrite32(coalescing_type, &intr->ctrl->coalescing_type);
iowrite32(mask_on_assertion, &intr->ctrl->mask_on_assertion);
iowrite32(0, &intr->ctrl->int_credits);
}
void vnic_intr_coalescing_timer_set(struct vnic_intr *intr,
u32 coalescing_timer)
{
iowrite32(vnic_dev_intr_coal_timer_usec_to_hw(intr->vdev,
coalescing_timer), &intr->ctrl->coalescing_timer);
}
void vnic_intr_clean(struct vnic_intr *intr)
{
iowrite32(0, &intr->ctrl->int_credits);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/types.h`, `linux/pci.h`, `linux/delay.h`, `vnic_dev.h`, `vnic_intr.h`, `enic.h`.
- Detected declarations: `function vnic_intr_free`, `function vnic_intr_alloc_with_type`, `function vnic_intr_alloc`, `function vnic_intr_init`, `function vnic_intr_coalescing_timer_set`, `function vnic_intr_clean`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.