drivers/net/ethernet/cisco/enic/enic_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cisco/enic/enic_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cisco/enic/enic_main.c- Extension
.c- Size
- 77715 bytes
- Lines
- 3042
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/string.hlinux/errno.hlinux/types.hlinux/init.hlinux/interrupt.hlinux/workqueue.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/if.hlinux/if_ether.hlinux/if_vlan.hlinux/in.hlinux/ip.hlinux/ipv6.hlinux/tcp.hlinux/rtnetlink.hlinux/prefetch.hnet/ip6_checksum.hlinux/ktime.hlinux/numa.hlinux/cpu_rmap.hlinux/crash_dump.hnet/busy_poll.hnet/vxlan.hnet/netdev_queues.hcq_enet_desc.hvnic_dev.hvnic_intr.hvnic_stats.h
Detected Declarations
function enic_init_affinity_hintfunction enic_free_affinity_hintfunction enic_set_affinity_hintfunction enic_unset_affinity_hintfunction enic_udp_tunnel_set_portfunction enic_udp_tunnel_unset_portfunction enic_features_checkfunction enic_is_dynamicfunction enic_sriov_enabledfunction enic_is_sriov_vffunction enic_is_valid_vffunction enic_log_q_errorfunction enic_msglvl_checkfunction enic_mtu_checkfunction enic_set_rx_coal_settingfunction enic_link_checkfunction enic_notify_checkfunction enic_isr_legacyfunction enic_isr_msifunction enic_isr_msixfunction enic_isr_msix_errfunction enic_isr_msix_notifyfunction enic_queue_wq_skb_contfunction enic_queue_wq_skb_vlanfunction enic_queue_wq_skb_csum_l4function enic_preload_tcp_csum_encapfunction enic_preload_tcp_csumfunction enic_queue_wq_skb_tsofunction enic_queue_wq_skb_encapfunction enic_queue_wq_skbfunction enic_hard_start_xmitfunction enic_get_statsfunction enic_mc_syncfunction enic_mc_unsyncfunction enic_uc_syncfunction enic_uc_unsyncfunction enic_reset_addr_listsfunction enic_set_mac_addrfunction enic_set_mac_address_dynamicfunction enic_set_mac_addressfunction enic_set_rx_modefunction enic_tx_timeoutfunction enic_set_vf_macfunction enic_set_vf_portfunction enic_get_vf_portfunction enic_set_int_moderationfunction enic_calc_int_moderationfunction enic_poll
Annotated Snippet
static const struct net_device_ops enic_netdev_dynamic_ops = {
.ndo_open = enic_open,
.ndo_stop = enic_stop,
.ndo_start_xmit = enic_hard_start_xmit,
.ndo_get_stats64 = enic_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_rx_mode = enic_set_rx_mode,
.ndo_set_mac_address = enic_set_mac_address_dynamic,
.ndo_change_mtu = enic_change_mtu,
.ndo_vlan_rx_add_vid = enic_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = enic_vlan_rx_kill_vid,
.ndo_tx_timeout = enic_tx_timeout,
.ndo_set_vf_port = enic_set_vf_port,
.ndo_get_vf_port = enic_get_vf_port,
.ndo_set_vf_mac = enic_set_vf_mac,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = enic_poll_controller,
#endif
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer,
#endif
.ndo_features_check = enic_features_check,
};
static const struct net_device_ops enic_netdev_ops = {
.ndo_open = enic_open,
.ndo_stop = enic_stop,
.ndo_start_xmit = enic_hard_start_xmit,
.ndo_get_stats64 = enic_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = enic_set_mac_address,
.ndo_set_rx_mode = enic_set_rx_mode,
.ndo_change_mtu = enic_change_mtu,
.ndo_vlan_rx_add_vid = enic_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = enic_vlan_rx_kill_vid,
.ndo_tx_timeout = enic_tx_timeout,
.ndo_set_vf_port = enic_set_vf_port,
.ndo_get_vf_port = enic_get_vf_port,
.ndo_set_vf_mac = enic_set_vf_mac,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = enic_poll_controller,
#endif
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = enic_rx_flow_steer,
#endif
.ndo_features_check = enic_features_check,
};
static const struct netdev_stat_ops enic_netdev_stat_ops = {
.get_queue_stats_rx = enic_get_queue_stats_rx,
.get_queue_stats_tx = enic_get_queue_stats_tx,
.get_base_stats = enic_get_base_stats,
};
static void enic_free_enic_resources(struct enic *enic)
{
kfree(enic->wq);
enic->wq = NULL;
kfree(enic->rq);
enic->rq = NULL;
kfree(enic->cq);
enic->cq = NULL;
kfree(enic->napi);
enic->napi = NULL;
kfree(enic->msix_entry);
enic->msix_entry = NULL;
kfree(enic->msix);
enic->msix = NULL;
kfree(enic->intr);
enic->intr = NULL;
}
static int enic_alloc_enic_resources(struct enic *enic)
{
enic->wq = kzalloc_objs(struct enic_wq, enic->wq_avail);
if (!enic->wq)
goto free_queues;
enic->rq = kzalloc_objs(struct enic_rq, enic->rq_avail);
if (!enic->rq)
goto free_queues;
enic->cq = kzalloc_objs(struct vnic_cq, enic->cq_avail);
if (!enic->cq)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/string.h`, `linux/errno.h`, `linux/types.h`, `linux/init.h`, `linux/interrupt.h`, `linux/workqueue.h`.
- Detected declarations: `function enic_init_affinity_hint`, `function enic_free_affinity_hint`, `function enic_set_affinity_hint`, `function enic_unset_affinity_hint`, `function enic_udp_tunnel_set_port`, `function enic_udp_tunnel_unset_port`, `function enic_features_check`, `function enic_is_dynamic`, `function enic_sriov_enabled`, `function enic_is_sriov_vf`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.