drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c- Extension
.c- Size
- 67167 bytes
- Lines
- 2549
- 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.
- 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/io-64-nonatomic-lo-hi.hlinux/slab.hnetxen_nic.hnetxen_nic_hw.hnet/ip.h
Detected Declarations
function netxen_pcie_sem_lockfunction netxen_pcie_sem_unlockfunction netxen_niu_xg_init_portfunction netxen_niu_disable_xg_portfunction netxen_p2_nic_set_promiscfunction netxen_p2_nic_set_mac_addrfunction netxen_nic_enable_mcast_filterfunction netxen_nic_disable_mcast_filterfunction netxen_nic_set_mcast_addrfunction netxen_p2_nic_set_multifunction netdev_mc_countfunction netxen_send_cmd_descsfunction nx_p3_sre_macaddr_changefunction nx_p3_nic_add_macfunction netxen_p3_nic_set_multifunction netxen_p3_nic_set_promiscfunction netxen_p3_free_mac_listfunction netxen_p3_nic_set_mac_addrfunction netxen_config_intr_coalescefunction netxen_config_hw_lrofunction netxen_config_bridged_modefunction netxen_config_rssfunction netxen_config_ipaddrfunction netxen_linkevent_requestfunction netxen_send_lro_cleanupfunction netxen_nic_change_mtufunction netxen_get_flash_blockfunction netxen_get_flash_mac_addrfunction netxen_p3_get_mac_addrfunction netxen_nic_pci_set_crbwindow_128Mfunction netxen_nic_pci_get_crb_addr_2Mfunction netxen_nic_pci_set_crbwindow_2Mfunction netxen_nic_map_indirect_address_128Mfunction netxen_nic_hw_write_wx_128Mfunction netxen_nic_hw_read_wx_128Mfunction netxen_nic_hw_write_wx_2Mfunction netxen_nic_hw_read_wx_2Mfunction netxen_nic_io_write_128Mfunction netxen_nic_io_read_128Mfunction netxen_nic_io_write_2Mfunction netxen_nic_io_read_2Mfunction netxen_get_ioaddrfunction netxen_nic_pci_set_window_128Mfunction netxen_nic_pci_set_window_2Mfunction netxen_nic_pci_mem_access_directfunction netxen_pci_camqm_read_2Mfunction netxen_pci_camqm_write_2Mfunction netxen_nic_pci_mem_write_128M
Annotated Snippet
netdev_mc_count(netdev) > adapter->max_mc_count) {
netxen_nic_disable_mcast_filter(adapter);
return;
}
netxen_nic_enable_mcast_filter(adapter);
i = 0;
netdev_for_each_mc_addr(ha, netdev)
netxen_nic_set_mcast_addr(adapter, i++, ha->addr);
/* Clear out remaining addresses */
while (i < adapter->max_mc_count)
netxen_nic_set_mcast_addr(adapter, i++, null_addr);
}
static int
netxen_send_cmd_descs(struct netxen_adapter *adapter,
struct cmd_desc_type0 *cmd_desc_arr, int nr_desc)
{
u32 i, producer;
struct netxen_cmd_buffer *pbuf;
struct nx_host_tx_ring *tx_ring;
i = 0;
if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
return -EIO;
tx_ring = adapter->tx_ring;
__netif_tx_lock_bh(tx_ring->txq);
producer = tx_ring->producer;
if (nr_desc >= netxen_tx_avail(tx_ring)) {
netif_tx_stop_queue(tx_ring->txq);
smp_mb();
if (netxen_tx_avail(tx_ring) > nr_desc) {
if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
netif_tx_wake_queue(tx_ring->txq);
} else {
__netif_tx_unlock_bh(tx_ring->txq);
return -EBUSY;
}
}
do {
pbuf = &tx_ring->cmd_buf_arr[producer];
pbuf->skb = NULL;
pbuf->frag_count = 0;
memcpy(&tx_ring->desc_head[producer],
&cmd_desc_arr[i], sizeof(struct cmd_desc_type0));
producer = get_next_index(producer, tx_ring->num_desc);
i++;
} while (i != nr_desc);
tx_ring->producer = producer;
netxen_nic_update_cmd_producer(adapter, tx_ring);
__netif_tx_unlock_bh(tx_ring->txq);
return 0;
}
static int
nx_p3_sre_macaddr_change(struct netxen_adapter *adapter, u8 *addr, unsigned op)
{
nx_nic_req_t req;
nx_mac_req_t *mac_req;
u64 word;
memset(&req, 0, sizeof(nx_nic_req_t));
req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
word = NX_MAC_EVENT | ((u64)adapter->portnum << 16);
req.req_hdr = cpu_to_le64(word);
mac_req = (nx_mac_req_t *)&req.words[0];
mac_req->op = op;
memcpy(mac_req->mac_addr, addr, ETH_ALEN);
return netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
}
static int nx_p3_nic_add_mac(struct netxen_adapter *adapter,
const u8 *addr, struct list_head *del_list)
Annotation
- Immediate include surface: `linux/io-64-nonatomic-lo-hi.h`, `linux/slab.h`, `netxen_nic.h`, `netxen_nic_hw.h`, `net/ip.h`.
- Detected declarations: `function netxen_pcie_sem_lock`, `function netxen_pcie_sem_unlock`, `function netxen_niu_xg_init_port`, `function netxen_niu_disable_xg_port`, `function netxen_p2_nic_set_promisc`, `function netxen_p2_nic_set_mac_addr`, `function netxen_nic_enable_mcast_filter`, `function netxen_nic_disable_mcast_filter`, `function netxen_nic_set_mcast_addr`, `function netxen_p2_nic_set_multi`.
- 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.
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.