drivers/net/ethernet/cisco/enic/enic_res.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cisco/enic/enic_res.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cisco/enic/enic_res.c- Extension
.c- Size
- 11359 bytes
- Lines
- 453
- 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.
- 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.
- 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/netdevice.hwq_enet_desc.hrq_enet_desc.hcq_enet_desc.hvnic_resource.hvnic_enet.hvnic_dev.hvnic_wq.hvnic_rq.hvnic_cq.hvnic_intr.hvnic_stats.hvnic_nic.hvnic_rss.henic_res.henic.h
Detected Declarations
function enic_get_vnic_configfunction enic_add_vlanfunction enic_del_vlanfunction enic_set_nic_cfgfunction enic_set_rss_keyfunction enic_set_rss_cpufunction enic_free_vnic_resourcesfunction enic_get_res_countsfunction enic_init_vnic_resourcesfunction enic_alloc_vnic_resourcesfunction enic_ext_cq
Annotated Snippet
if (err) { \
dev_err(enic_get_dev(enic), \
"Error getting %s, %d\n", #m, err); \
return err; \
} \
} while (0)
GET_CONFIG(flags);
GET_CONFIG(wq_desc_count);
GET_CONFIG(rq_desc_count);
GET_CONFIG(mtu);
GET_CONFIG(intr_timer_type);
GET_CONFIG(intr_mode);
GET_CONFIG(intr_timer_usec);
GET_CONFIG(loop_tag);
GET_CONFIG(num_arfs);
GET_CONFIG(max_rq_ring);
GET_CONFIG(max_wq_ring);
GET_CONFIG(max_cq_ring);
if (!c->max_wq_ring)
c->max_wq_ring = ENIC_MAX_WQ_DESCS_DEFAULT;
if (!c->max_rq_ring)
c->max_rq_ring = ENIC_MAX_RQ_DESCS_DEFAULT;
if (!c->max_cq_ring)
c->max_cq_ring = ENIC_MAX_CQ_DESCS_DEFAULT;
c->wq_desc_count =
min_t(u32, c->max_wq_ring,
max_t(u32, ENIC_MIN_WQ_DESCS, c->wq_desc_count));
c->wq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */
c->rq_desc_count =
min_t(u32, c->max_rq_ring,
max_t(u32, ENIC_MIN_RQ_DESCS, c->rq_desc_count));
c->rq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */
if (c->mtu == 0)
c->mtu = 1500;
c->mtu = min_t(u16, ENIC_MAX_MTU, max_t(u16, ENIC_MIN_MTU, c->mtu));
c->intr_timer_usec = min_t(u32, c->intr_timer_usec,
vnic_dev_get_intr_coal_timer_max(enic->vdev));
dev_info(enic_get_dev(enic),
"vNIC MAC addr %pM wq/rq %d/%d max wq/rq/cq %d/%d/%d mtu %d\n",
enic->mac_addr, c->wq_desc_count, c->rq_desc_count,
c->max_wq_ring, c->max_rq_ring, c->max_cq_ring, c->mtu);
dev_info(enic_get_dev(enic), "vNIC csum tx/rx %s/%s "
"tso/lro %s/%s rss %s intr mode %s type %s timer %d usec "
"loopback tag 0x%04x\n",
ENIC_SETTING(enic, TXCSUM) ? "yes" : "no",
ENIC_SETTING(enic, RXCSUM) ? "yes" : "no",
ENIC_SETTING(enic, TSO) ? "yes" : "no",
ENIC_SETTING(enic, LRO) ? "yes" : "no",
ENIC_SETTING(enic, RSS) ? "yes" : "no",
c->intr_mode == VENET_INTR_MODE_INTX ? "INTx" :
c->intr_mode == VENET_INTR_MODE_MSI ? "MSI" :
c->intr_mode == VENET_INTR_MODE_ANY ? "any" :
"unknown",
c->intr_timer_type == VENET_INTR_TYPE_MIN ? "min" :
c->intr_timer_type == VENET_INTR_TYPE_IDLE ? "idle" :
"unknown",
c->intr_timer_usec,
c->loop_tag);
return 0;
}
int enic_add_vlan(struct enic *enic, u16 vlanid)
{
u64 a0 = vlanid, a1 = 0;
int wait = 1000;
int err;
err = vnic_dev_cmd(enic->vdev, CMD_VLAN_ADD, &a0, &a1, wait);
if (err)
dev_err(enic_get_dev(enic), "Can't add vlan id, %d\n", err);
return err;
}
int enic_del_vlan(struct enic *enic, u16 vlanid)
{
u64 a0 = vlanid, a1 = 0;
int wait = 1000;
int err;
err = vnic_dev_cmd(enic->vdev, CMD_VLAN_DEL, &a0, &a1, wait);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/types.h`, `linux/pci.h`, `linux/netdevice.h`, `wq_enet_desc.h`, `rq_enet_desc.h`, `cq_enet_desc.h`.
- Detected declarations: `function enic_get_vnic_config`, `function enic_add_vlan`, `function enic_del_vlan`, `function enic_set_nic_cfg`, `function enic_set_rss_key`, `function enic_set_rss_cpu`, `function enic_free_vnic_resources`, `function enic_get_res_counts`, `function enic_init_vnic_resources`, `function enic_alloc_vnic_resources`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.