drivers/infiniband/hw/irdma/cm.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/irdma/cm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/irdma/cm.c- Extension
.c- Size
- 122662 bytes
- Lines
- 4438
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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
main.htrace.h
Detected Declarations
function irdma_free_sqbuffunction irdma_record_ird_ordfunction irdma_copy_ip_ntohlfunction irdma_copy_ip_htonlfunction irdma_get_addr_infofunction irdma_fill_sockaddr4function irdma_fill_sockaddr6function irdma_get_cmevent_infofunction irdma_send_cm_eventfunction irdma_timer_list_prepfunction hash_for_each_rcufunction irdma_free_retrans_entryfunction irdma_cleanup_retrans_entryfunction irdma_send_resetfunction irdma_active_open_errfunction irdma_passive_open_errfunction irdma_event_connect_errorfunction irdma_process_optionsfunction irdma_handle_tcp_optionsfunction irdma_build_mpa_v1function irdma_build_mpa_v2function irdma_cm_build_mpa_framefunction irdma_send_mpa_requestfunction irdma_send_mpa_rejectfunction irdma_negotiate_mpa_v2_ird_ordfunction irdma_parse_mpafunction irdma_schedule_cm_timerfunction irdma_retrans_expiredfunction irdma_handle_close_entryfunction irdma_cm_timer_tickfunction list_for_each_safefunction irdma_send_synfunction irdma_send_ackfunction irdma_send_finfunction irdma_find_listenerfunction irdma_del_multiple_qhashfunction irdma_iw_get_vlan_priofunction for_each_netdev_rcufunction irdma_get_vlan_mac_ipv6function irdma_get_vlan_ipv4function irdma_add_mqh_6function list_for_each_entry_safefunction irdma_add_mqh_4function in_dev_for_each_ifa_rtnlfunction irdma_add_mqhfunction irdma_reset_list_prepfunction hash_for_each_rcufunction irdma_dec_refcnt_listen
Annotated Snippet
if (cm_node->vlan_id < VLAN_N_VID) {
((struct vlan_ethhdr *)ethh)->h_vlan_proto =
htons(ETH_P_8021Q);
vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) |
cm_node->vlan_id;
((struct vlan_ethhdr *)ethh)->h_vlan_TCI = htons(vtag);
((struct vlan_ethhdr *)ethh)->h_vlan_encapsulated_proto =
htons(ETH_P_IP);
} else {
ethh->h_proto = htons(ETH_P_IP);
}
iph->version = IPVERSION;
iph->ihl = 5; /* 5 * 4Byte words, IP headr len */
iph->tos = cm_node->tos;
iph->tot_len = htons(pktsize);
iph->id = htons(++cm_node->tcp_cntxt.loc_id);
iph->frag_off = htons(0x4000);
iph->ttl = 0x40;
iph->protocol = IPPROTO_TCP;
iph->saddr = htonl(cm_node->loc_addr[0]);
iph->daddr = htonl(cm_node->rem_addr[0]);
} else {
sqbuf->ipv4 = false;
ip6h = (struct ipv6hdr *)buf;
buf += sizeof(*ip6h);
tcph = (struct tcphdr *)buf;
buf += sizeof(*tcph);
ether_addr_copy(ethh->h_dest, cm_node->rem_mac);
ether_addr_copy(ethh->h_source, cm_node->loc_mac);
if (cm_node->vlan_id < VLAN_N_VID) {
((struct vlan_ethhdr *)ethh)->h_vlan_proto =
htons(ETH_P_8021Q);
vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) |
cm_node->vlan_id;
((struct vlan_ethhdr *)ethh)->h_vlan_TCI = htons(vtag);
((struct vlan_ethhdr *)ethh)->h_vlan_encapsulated_proto =
htons(ETH_P_IPV6);
} else {
ethh->h_proto = htons(ETH_P_IPV6);
}
ip6h->version = 6;
ip6h->priority = cm_node->tos >> 4;
ip6h->flow_lbl[0] = cm_node->tos << 4;
ip6h->flow_lbl[1] = 0;
ip6h->flow_lbl[2] = 0;
ip6h->payload_len = htons(pktsize - sizeof(*ip6h));
ip6h->nexthdr = 6;
ip6h->hop_limit = 128;
irdma_copy_ip_htonl(ip6h->saddr.in6_u.u6_addr32,
cm_node->loc_addr);
irdma_copy_ip_htonl(ip6h->daddr.in6_u.u6_addr32,
cm_node->rem_addr);
}
tcph->source = htons(cm_node->loc_port);
tcph->dest = htons(cm_node->rem_port);
tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num);
if (flags & SET_ACK) {
cm_node->tcp_cntxt.loc_ack_num = cm_node->tcp_cntxt.rcv_nxt;
tcph->ack_seq = htonl(cm_node->tcp_cntxt.loc_ack_num);
tcph->ack = 1;
} else {
tcph->ack_seq = 0;
}
if (flags & SET_SYN) {
cm_node->tcp_cntxt.loc_seq_num++;
tcph->syn = 1;
} else {
cm_node->tcp_cntxt.loc_seq_num += hdr_len + pd_len;
}
if (flags & SET_FIN) {
cm_node->tcp_cntxt.loc_seq_num++;
tcph->fin = 1;
}
if (flags & SET_RST)
tcph->rst = 1;
tcph->doff = (u16)((sizeof(*tcph) + opts_len + 3) >> 2);
sqbuf->tcphlen = tcph->doff << 2;
tcph->window = htons(cm_node->tcp_cntxt.rcv_wnd);
tcph->urg_ptr = 0;
Annotation
- Immediate include surface: `main.h`, `trace.h`.
- Detected declarations: `function irdma_free_sqbuf`, `function irdma_record_ird_ord`, `function irdma_copy_ip_ntohl`, `function irdma_copy_ip_htonl`, `function irdma_get_addr_info`, `function irdma_fill_sockaddr4`, `function irdma_fill_sockaddr6`, `function irdma_get_cmevent_info`, `function irdma_send_cm_event`, `function irdma_timer_list_prep`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.