drivers/infiniband/hw/qedr/qedr_roce_cm.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/qedr/qedr_roce_cm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/qedr/qedr_roce_cm.c- Extension
.c- Size
- 19665 bytes
- Lines
- 728
- 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
linux/dma-mapping.hlinux/crc32.hlinux/iommu.hnet/ip.hnet/ipv6.hnet/udp.hrdma/ib_verbs.hrdma/ib_user_verbs.hrdma/iw_cm.hrdma/ib_umem.hrdma/ib_addr.hrdma/ib_cache.hlinux/qed/qed_if.hlinux/qed/qed_rdma_if.hqedr.hverbs.hrdma/qedr-abi.hqedr_roce_cm.h
Detected Declarations
function Copyrightfunction qedr_store_gsi_qp_cqfunction qedr_ll2_complete_tx_packetfunction qedr_ll2_complete_rx_packetfunction qedr_ll2_release_rx_packetfunction qedr_check_gsi_qp_attrsfunction qedr_ll2_post_txfunction qedr_ll2_stopfunction qedr_ll2_startfunction qedr_create_gsi_qpfunction qedr_destroy_gsi_qpfunction qedr_gsi_build_headerfunction qedr_gsi_build_packetfunction qedr_gsi_post_sendfunction qedr_gsi_post_recvfunction qedr_gsi_poll_cq
Annotated Snippet
if (rc) {
/* if failed not much to do here, partial packet has
* been posted we can't free memory, will need to wait
* for completion
*/
DP_ERR(dev, "ll2 tx: payload failed (rc=%d)\n", rc);
return rc;
}
}
return 0;
}
static int qedr_ll2_stop(struct qedr_dev *dev)
{
int rc;
if (dev->gsi_ll2_handle == QED_LL2_UNUSED_HANDLE)
return 0;
/* remove LL2 MAC address filter */
rc = dev->ops->ll2_set_mac_filter(dev->cdev,
dev->gsi_ll2_mac_address, NULL);
rc = dev->ops->ll2_terminate_connection(dev->rdma_ctx,
dev->gsi_ll2_handle);
if (rc)
DP_ERR(dev, "Failed to terminate LL2 connection (rc=%d)\n", rc);
dev->ops->ll2_release_connection(dev->rdma_ctx, dev->gsi_ll2_handle);
dev->gsi_ll2_handle = QED_LL2_UNUSED_HANDLE;
return rc;
}
static int qedr_ll2_start(struct qedr_dev *dev,
struct ib_qp_init_attr *attrs, struct qedr_qp *qp)
{
struct qed_ll2_acquire_data data;
struct qed_ll2_cbs cbs;
int rc;
/* configure and start LL2 */
cbs.rx_comp_cb = qedr_ll2_complete_rx_packet;
cbs.tx_comp_cb = qedr_ll2_complete_tx_packet;
cbs.rx_release_cb = qedr_ll2_release_rx_packet;
cbs.tx_release_cb = qedr_ll2_complete_tx_packet;
cbs.cookie = dev;
memset(&data, 0, sizeof(data));
data.input.conn_type = QED_LL2_TYPE_ROCE;
data.input.mtu = dev->ndev->mtu;
data.input.rx_num_desc = attrs->cap.max_recv_wr;
data.input.rx_drop_ttl0_flg = true;
data.input.rx_vlan_removal_en = false;
data.input.tx_num_desc = attrs->cap.max_send_wr;
data.input.tx_tc = 0;
data.input.tx_dest = QED_LL2_TX_DEST_NW;
data.input.ai_err_packet_too_big = QED_LL2_DROP_PACKET;
data.input.ai_err_no_buf = QED_LL2_DROP_PACKET;
data.input.gsi_enable = 1;
data.p_connection_handle = &dev->gsi_ll2_handle;
data.cbs = &cbs;
rc = dev->ops->ll2_acquire_connection(dev->rdma_ctx, &data);
if (rc) {
DP_ERR(dev,
"ll2 start: failed to acquire LL2 connection (rc=%d)\n",
rc);
return rc;
}
rc = dev->ops->ll2_establish_connection(dev->rdma_ctx,
dev->gsi_ll2_handle);
if (rc) {
DP_ERR(dev,
"ll2 start: failed to establish LL2 connection (rc=%d)\n",
rc);
goto err1;
}
rc = dev->ops->ll2_set_mac_filter(dev->cdev, NULL, dev->ndev->dev_addr);
if (rc)
goto err2;
return 0;
err2:
dev->ops->ll2_terminate_connection(dev->rdma_ctx, dev->gsi_ll2_handle);
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/crc32.h`, `linux/iommu.h`, `net/ip.h`, `net/ipv6.h`, `net/udp.h`, `rdma/ib_verbs.h`, `rdma/ib_user_verbs.h`.
- Detected declarations: `function Copyright`, `function qedr_store_gsi_qp_cq`, `function qedr_ll2_complete_tx_packet`, `function qedr_ll2_complete_rx_packet`, `function qedr_ll2_release_rx_packet`, `function qedr_check_gsi_qp_attrs`, `function qedr_ll2_post_tx`, `function qedr_ll2_stop`, `function qedr_ll2_start`, `function qedr_create_gsi_qp`.
- 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.