drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c- Extension
.c- Size
- 61047 bytes
- Lines
- 2227
- 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.
- 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/netdevice.hlinux/if_vlan.hnet/ip.hlinux/ipv6.hnet/checksum.hlinux/printk.hlinux/jiffies.hqlcnic.h
Detected Declarations
function qlcnic_mac_hashfunction qlcnic_get_ref_handlefunction qlcnic_82xx_is_lb_pktfunction qlcnic_delete_rx_list_macfunction hlist_for_each_entry_safefunction qlcnic_add_lb_filterfunction qlcnic_82xx_change_filterfunction qlcnic_send_filterfunction hlist_for_each_entry_safefunction qlcnic_tx_encap_pktfunction qlcnic_tx_pktfunction qlcnic_map_tx_skbfunction qlcnic_unmap_buffersfunction qlcnic_clear_cmddescfunction qlcnic_xmit_framefunction qlcnic_advert_link_changefunction qlcnic_alloc_rx_skbfunction qlcnic_post_rx_buffers_nodbfunction qlcnic_process_cmd_ringfunction qlcnic_pollfunction qlcnic_tx_pollfunction qlcnic_rx_pollfunction qlcnic_handle_linkeventfunction qlcnic_handle_fw_messagefunction qlcnic_check_rx_taggingfunction qlcnic_process_rcvfunction qlcnic_process_lrofunction qlcnic_process_rcv_ringfunction qlcnic_post_rx_buffersfunction dump_skbfunction qlcnic_process_rcv_diagfunction qlcnic_82xx_process_rcv_ring_diagfunction qlcnic_82xx_napi_addfunction qlcnic_82xx_napi_delfunction qlcnic_82xx_napi_enablefunction qlcnic_82xx_napi_disablefunction qlcnic_83xx_is_lb_pktfunction qlcnic_encap_lengthfunction qlcnic_83xx_process_rcvfunction qlcnic_83xx_process_lrofunction qlcnic_83xx_process_rcv_ringfunction qlcnic_83xx_msix_sriov_vf_pollfunction qlcnic_83xx_pollfunction qlcnic_83xx_msix_tx_pollfunction qlcnic_83xx_rx_pollfunction qlcnic_83xx_napi_enablefunction qlcnic_83xx_napi_disablefunction qlcnic_83xx_napi_add
Annotated Snippet
if (tmp_fil) {
time = tmp_fil->ftime;
if (time_after(jiffies, QLCNIC_READD_AGE * HZ + time))
tmp_fil->ftime = jiffies;
return;
}
fil = kzalloc_obj(struct qlcnic_filter, GFP_ATOMIC);
if (!fil)
return;
fil->ftime = jiffies;
memcpy(fil->faddr, &src_addr, ETH_ALEN);
fil->vlan_id = vlan_id;
spin_lock(&adapter->rx_mac_learn_lock);
hlist_add_head(&(fil->fnode), head);
adapter->rx_fhash.fnum++;
spin_unlock(&adapter->rx_mac_learn_lock);
} else {
head = &adapter->fhash.fhead[hindex];
spin_lock(&adapter->mac_learn_lock);
tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id);
if (tmp_fil) {
op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL;
ret = qlcnic_sre_macaddr_change(adapter,
(u8 *)&src_addr,
vlan_id, op);
if (!ret) {
hlist_del(&tmp_fil->fnode);
adapter->fhash.fnum--;
}
spin_unlock(&adapter->mac_learn_lock);
return;
}
spin_unlock(&adapter->mac_learn_lock);
head = &adapter->rx_fhash.fhead[hindex];
spin_lock(&adapter->rx_mac_learn_lock);
tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id);
if (tmp_fil)
qlcnic_delete_rx_list_mac(adapter, tmp_fil, &src_addr,
vlan_id);
spin_unlock(&adapter->rx_mac_learn_lock);
}
}
void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring)
{
struct cmd_desc_type0 *hwdesc;
struct qlcnic_nic_req *req;
struct qlcnic_mac_req *mac_req;
struct qlcnic_vlan_req *vlan_req;
u32 producer;
u64 word;
producer = tx_ring->producer;
hwdesc = &tx_ring->desc_head[tx_ring->producer];
req = (struct qlcnic_nic_req *)hwdesc;
memset(req, 0, sizeof(struct qlcnic_nic_req));
req->qhdr = cpu_to_le64(QLCNIC_REQUEST << 23);
word = QLCNIC_MAC_EVENT | ((u64)(adapter->portnum) << 16);
req->req_hdr = cpu_to_le64(word);
mac_req = (struct qlcnic_mac_req *)&(req->words[0]);
mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD;
memcpy(mac_req->mac_addr, uaddr, ETH_ALEN);
vlan_req = (struct qlcnic_vlan_req *)&req->words[1];
vlan_req->vlan_id = cpu_to_le16(vlan_id);
tx_ring->producer = get_next_index(producer, tx_ring->num_desc);
smp_mb();
}
static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
struct cmd_desc_type0 *first_desc,
struct sk_buff *skb,
struct qlcnic_host_tx_ring *tx_ring)
{
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/if_vlan.h`, `net/ip.h`, `linux/ipv6.h`, `net/checksum.h`, `linux/printk.h`, `linux/jiffies.h`, `qlcnic.h`.
- Detected declarations: `function qlcnic_mac_hash`, `function qlcnic_get_ref_handle`, `function qlcnic_82xx_is_lb_pkt`, `function qlcnic_delete_rx_list_mac`, `function hlist_for_each_entry_safe`, `function qlcnic_add_lb_filter`, `function qlcnic_82xx_change_filter`, `function qlcnic_send_filter`, `function hlist_for_each_entry_safe`, `function qlcnic_tx_encap_pkt`.
- 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.