drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c- Extension
.c- Size
- 84111 bytes
- Lines
- 3472
- 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/slab.hlinux/vmalloc.hlinux/interrupt.hnetxen_nic_hw.hnetxen_nic.hlinux/dma-mapping.hlinux/if_vlan.hnet/ip.hlinux/ipv6.hlinux/inetdevice.hlinux/sysfs.h
Detected Declarations
function netxen_nic_update_cmd_producerfunction netxen_nic_update_cmd_consumerfunction netxen_nic_disable_intfunction netxen_nic_enable_intfunction netxen_alloc_sds_ringsfunction netxen_free_sds_ringsfunction netxen_napi_addfunction netxen_napi_delfunction netxen_napi_enablefunction netxen_napi_disablefunction nx_set_dma_maskfunction nx_update_dma_maskfunction netxen_check_hw_initfunction netxen_set_port_modefunction netxen_pcie_strap_initfunction netxen_set_msix_bitfunction netxen_init_msix_entriesfunction netxen_read_mac_addrfunction netxen_nic_set_macfunction netxen_set_multicast_listfunction netxen_fix_featuresfunction netxen_set_featuresfunction netxen_set_interrupt_modefunction netxen_get_interrupt_modefunction netxen_initialize_interrupt_registersfunction netxen_setup_msi_interruptsfunction netxen_setup_intrfunction netxen_teardown_intrfunction netxen_cleanup_pci_mapfunction netxen_setup_pci_mapfunction netxen_check_optionsfunction netxen_start_firmwarefunction netxen_nic_request_irqfunction netxen_nic_free_irqfunction netxen_nic_init_coalesce_defaultsfunction __netxen_nic_upfunction netxen_nic_upfunction __netxen_nic_downfunction netxen_nic_downfunction netxen_nic_attachfunction netxen_nic_detachfunction netxen_nic_reset_contextfunction netxen_setup_netdevfunction netxen_read_ula_infofunction netxen_mask_aer_correctablefunction netxen_nic_probefunction netxen_cleanup_minidumpfunction netxen_nic_remove
Annotated Snippet
static const struct net_device_ops netxen_netdev_ops = {
.ndo_open = netxen_nic_open,
.ndo_stop = netxen_nic_close,
.ndo_start_xmit = netxen_nic_xmit_frame,
.ndo_get_stats64 = netxen_nic_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_rx_mode = netxen_set_multicast_list,
.ndo_set_mac_address = netxen_nic_set_mac,
.ndo_change_mtu = netxen_nic_change_mtu,
.ndo_tx_timeout = netxen_tx_timeout,
.ndo_fix_features = netxen_fix_features,
.ndo_set_features = netxen_set_features,
};
static inline void netxen_set_interrupt_mode(struct netxen_adapter *adapter,
u32 mode)
{
NXWR32(adapter, NETXEN_INTR_MODE_REG, mode);
}
static inline u32 netxen_get_interrupt_mode(struct netxen_adapter *adapter)
{
return NXRD32(adapter, NETXEN_INTR_MODE_REG);
}
static void
netxen_initialize_interrupt_registers(struct netxen_adapter *adapter)
{
struct netxen_legacy_intr_set *legacy_intrp;
u32 tgt_status_reg, int_state_reg;
if (adapter->ahw.revision_id >= NX_P3_B0)
legacy_intrp = &legacy_intr[adapter->ahw.pci_func];
else
legacy_intrp = &legacy_intr[0];
tgt_status_reg = legacy_intrp->tgt_status_reg;
int_state_reg = ISR_INT_STATE_REG;
adapter->int_vec_bit = legacy_intrp->int_vec_bit;
adapter->tgt_status_reg = netxen_get_ioaddr(adapter, tgt_status_reg);
adapter->tgt_mask_reg = netxen_get_ioaddr(adapter,
legacy_intrp->tgt_mask_reg);
adapter->pci_int_reg = netxen_get_ioaddr(adapter,
legacy_intrp->pci_int_reg);
adapter->isr_int_vec = netxen_get_ioaddr(adapter, ISR_INT_VECTOR);
if (adapter->ahw.revision_id >= NX_P3_B1)
adapter->crb_int_state_reg = netxen_get_ioaddr(adapter,
int_state_reg);
else
adapter->crb_int_state_reg = netxen_get_ioaddr(adapter,
CRB_INT_VECTOR);
}
static int netxen_setup_msi_interrupts(struct netxen_adapter *adapter,
int num_msix)
{
struct pci_dev *pdev = adapter->pdev;
u32 value;
int err;
if (adapter->msix_supported) {
netxen_init_msix_entries(adapter, num_msix);
err = pci_enable_msix_range(pdev, adapter->msix_entries,
num_msix, num_msix);
if (err > 0) {
adapter->flags |= NETXEN_NIC_MSIX_ENABLED;
netxen_set_msix_bit(pdev, 1);
if (adapter->rss_supported)
adapter->max_sds_rings = num_msix;
dev_info(&pdev->dev, "using msi-x interrupts\n");
return 0;
}
/* fall through for msi */
}
if (use_msi && !pci_enable_msi(pdev)) {
value = msi_tgt_status[adapter->ahw.pci_func];
adapter->flags |= NETXEN_NIC_MSI_ENABLED;
adapter->tgt_status_reg = netxen_get_ioaddr(adapter, value);
adapter->msix_entries[0].vector = pdev->irq;
dev_info(&pdev->dev, "using msi interrupts\n");
return 0;
}
dev_err(&pdev->dev, "Failed to acquire MSI-X/MSI interrupt vector\n");
return -EIO;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/vmalloc.h`, `linux/interrupt.h`, `netxen_nic_hw.h`, `netxen_nic.h`, `linux/dma-mapping.h`, `linux/if_vlan.h`, `net/ip.h`.
- Detected declarations: `function netxen_nic_update_cmd_producer`, `function netxen_nic_update_cmd_consumer`, `function netxen_nic_disable_int`, `function netxen_nic_enable_int`, `function netxen_alloc_sds_rings`, `function netxen_free_sds_rings`, `function netxen_napi_add`, `function netxen_napi_del`, `function netxen_napi_enable`, `function netxen_napi_disable`.
- 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.