drivers/infiniband/hw/hfi1/verbs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/verbs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/verbs.c- Extension
.c- Size
- 57234 bytes
- Lines
- 1947
- 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
rdma/ib_mad.hrdma/ib_user_verbs.hlinux/io.hlinux/module.hlinux/utsname.hlinux/rculist.hlinux/mm.hlinux/vmalloc.hrdma/opa_addr.hlinux/nospec.hhfi.hcommon.hdevice.htrace.hqp.hverbs_txreq.hdebugfs.hfault.haffinity.hipoib.h
Detected Declarations
function qp_okfunction hfi1_fault_txfunction tid_qp_okfunction hfi1_kdeth_eager_rcvfunction hfi1_kdeth_expected_rcvfunction hfi1_do_pkey_checkfunction hfi1_handle_packetfunction list_for_each_entry_rcufunction hfi1_ib_rcvfunction hfi1_16B_rcvfunction mem_timerfunction verbs_sdma_completefunction hfi1_wait_kmemfunction wait_kmemfunction build_verbs_ulp_payloadfunction update_tx_opstatsfunction build_verbs_tx_descfunction update_hcrcfunction hfi1_verbs_send_dmafunction pio_waitfunction verbs_pio_completefunction hfi1_verbs_send_piofunction egress_pkey_matches_entryfunction egress_pkey_checkfunction egress_pkey_matches_entryfunction get_send_routinefunction hfi1_verbs_sendfunction hfi1_fill_device_attrfunction opa_speed_to_ibfunction widthfunction query_portfunction modify_devicefunction shut_down_portfunction hfi1_get_guid_befunction ah_to_scfunction hfi1_check_ahfunction hfi1_notify_new_ahfunction hfi1_get_npkeysfunction init_ibportfunction hfi1_get_dev_fw_strfunction init_cntr_namesfunction hfi1_sps_intsfunction get_hw_statsfunction hfi1_register_ib_devicefunction hfi1_unregister_ib_devicefunction hfi1_cnp_rcv
Annotated Snippet
list_for_each_entry_rcu(p, &mcast->qp_list, list) {
packet->qp = p->qp;
if (hfi1_do_pkey_check(packet))
goto unlock_drop;
spin_lock_irqsave(&packet->qp->r_lock, flags);
packet_handler = qp_ok(packet);
if (likely(packet_handler))
packet_handler(packet);
else
ibp->rvp.n_pkt_drops++;
spin_unlock_irqrestore(&packet->qp->r_lock, flags);
}
rcu_read_unlock();
/*
* Notify rvt_multicast_detach() if it is waiting for us
* to finish.
*/
if (atomic_dec_return(&mcast->refcount) <= 1)
wake_up(&mcast->wait);
} else {
/* Get the destination QP number. */
if (packet->etype == RHF_RCV_TYPE_BYPASS &&
hfi1_16B_get_l4(packet->hdr) == OPA_16B_L4_FM)
qp_num = hfi1_16B_get_dest_qpn(packet->mgmt);
else
qp_num = ib_bth_get_qpn(packet->ohdr);
rcu_read_lock();
packet->qp = rvt_lookup_qpn(rdi, &ibp->rvp, qp_num);
if (!packet->qp)
goto unlock_drop;
if (hfi1_do_pkey_check(packet))
goto unlock_drop;
spin_lock_irqsave(&packet->qp->r_lock, flags);
packet_handler = qp_ok(packet);
if (likely(packet_handler))
packet_handler(packet);
else
ibp->rvp.n_pkt_drops++;
spin_unlock_irqrestore(&packet->qp->r_lock, flags);
rcu_read_unlock();
}
return;
unlock_drop:
rcu_read_unlock();
drop:
ibp->rvp.n_pkt_drops++;
}
/**
* hfi1_ib_rcv - process an incoming packet
* @packet: data packet information
*
* This is called to process an incoming packet at interrupt level.
*/
void hfi1_ib_rcv(struct hfi1_packet *packet)
{
struct hfi1_ctxtdata *rcd = packet->rcd;
trace_input_ibhdr(rcd->dd, packet, !!(rhf_dc_info(packet->rhf)));
hfi1_handle_packet(packet, hfi1_check_mcast(packet->dlid));
}
void hfi1_16B_rcv(struct hfi1_packet *packet)
{
struct hfi1_ctxtdata *rcd = packet->rcd;
trace_input_ibhdr(rcd->dd, packet, false);
hfi1_handle_packet(packet, hfi1_check_mcast(packet->dlid));
}
/*
* This is called from a timer to check for QPs
* which need kernel memory in order to send a packet.
*/
static void mem_timer(struct timer_list *t)
{
struct hfi1_ibdev *dev = timer_container_of(dev, t, mem_timer);
struct list_head *list = &dev->memwait;
struct rvt_qp *qp = NULL;
struct iowait *wait;
unsigned long flags;
struct hfi1_qp_priv *priv;
write_seqlock_irqsave(&dev->iowait_lock, flags);
if (!list_empty(list)) {
wait = list_first_entry(list, struct iowait, list);
qp = iowait_to_qp(wait);
Annotation
- Immediate include surface: `rdma/ib_mad.h`, `rdma/ib_user_verbs.h`, `linux/io.h`, `linux/module.h`, `linux/utsname.h`, `linux/rculist.h`, `linux/mm.h`, `linux/vmalloc.h`.
- Detected declarations: `function qp_ok`, `function hfi1_fault_tx`, `function tid_qp_ok`, `function hfi1_kdeth_eager_rcv`, `function hfi1_kdeth_expected_rcv`, `function hfi1_do_pkey_check`, `function hfi1_handle_packet`, `function list_for_each_entry_rcu`, `function hfi1_ib_rcv`, `function hfi1_16B_rcv`.
- 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.