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.

Dependency Surface

Detected Declarations

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

Implementation Notes