drivers/net/ethernet/qlogic/qed/qed_rdma.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_rdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_rdma.c- Extension
.c- Size
- 58259 bytes
- Lines
- 2040
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/types.hasm/byteorder.hlinux/bitops.hlinux/delay.hlinux/dma-mapping.hlinux/errno.hlinux/io.hlinux/kernel.hlinux/list.hlinux/module.hlinux/mutex.hlinux/pci.hlinux/slab.hlinux/spinlock.hlinux/string.hnet/addrconf.hqed.hqed_cxt.hqed_hsi.hqed_iro_hsi.hqed_hw.hqed_init_ops.hqed_int.hqed_ll2.hqed_mcp.hqed_reg_addr.hlinux/qed/qed_rdma_if.hqed_rdma.hqed_roce.hqed_sp.h
Detected Declarations
function Copyrightfunction qed_rdma_bmap_alloc_idfunction qed_bmap_set_idfunction qed_bmap_release_idfunction qed_bmap_test_idfunction qed_bmap_is_emptyfunction qed_rdma_get_sb_idfunction qed_rdma_info_allocfunction qed_rdma_info_freefunction qed_rdma_allocfunction qed_rdma_bmap_freefunction qed_rdma_resc_freefunction qed_rdma_free_tidfunction qed_rdma_free_reserved_lkeyfunction qed_rdma_freefunction qed_rdma_init_eventsfunction qed_rdma_init_devinfofunction qed_rdma_init_portfunction qed_rdma_init_hwfunction qed_rdma_start_fwfunction qed_rdma_alloc_tidfunction qed_rdma_reserve_lkeyfunction qed_rdma_setupfunction qed_rdma_stopfunction qed_rdma_add_userfunction qed_rdma_cnq_prod_updatefunction qed_fill_rdma_dev_infofunction qed_rdma_get_sb_startfunction qed_rdma_get_min_cnq_msixfunction qed_rdma_set_intfunction qed_rdma_get_intfunction qed_rdma_alloc_pdfunction qed_rdma_free_pdfunction qed_rdma_alloc_xrcdfunction qed_rdma_free_xrcdfunction qed_rdma_toggle_bit_create_resize_cqfunction qed_rdma_create_cqfunction qed_rdma_destroy_cqfunction qed_rdma_set_fw_macfunction qed_rdma_query_qpfunction qed_rdma_destroy_qpfunction qed_rdma_create_qpfunction qed_rdma_modify_qpfunction qed_rdma_register_tidfunction qed_rdma_deregister_tidfunction qed_rdma_modify_srqfunction qed_rdma_destroy_srqfunction qed_rdma_create_srq
Annotated Snippet
if (rc) {
qed_ptt_release(p_hwfn, p_ptt);
return rc;
}
} else {
qed_roce_stop(p_hwfn);
}
qed_ptt_release(p_hwfn, p_ptt);
/* Get SPQ entry */
memset(&init_data, 0, sizeof(init_data));
init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
init_data.comp_mode = QED_SPQ_MODE_EBLOCK;
/* Stop RoCE */
rc = qed_sp_init_request(p_hwfn, &p_ent, RDMA_RAMROD_FUNC_CLOSE,
p_hwfn->p_rdma_info->proto, &init_data);
if (rc)
goto out;
p_ramrod = &p_ent->ramrod.rdma_close_func;
p_ramrod->num_cnqs = p_hwfn->p_rdma_info->num_cnqs;
p_ramrod->cnq_start_offset = (u8)RESC_START(p_hwfn, QED_RDMA_CNQ_RAM);
rc = qed_spq_post(p_hwfn, p_ent, NULL);
out:
qed_rdma_free(p_hwfn);
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "RDMA stop done, rc = %d\n", rc);
return rc;
}
static int qed_rdma_add_user(void *rdma_cxt,
struct qed_rdma_add_user_out_params *out_params)
{
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
u32 dpi_start_offset;
u32 returned_id = 0;
int rc;
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Adding User\n");
/* Allocate DPI */
spin_lock_bh(&p_hwfn->p_rdma_info->lock);
rc = qed_rdma_bmap_alloc_id(p_hwfn, &p_hwfn->p_rdma_info->dpi_map,
&returned_id);
spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
out_params->dpi = (u16)returned_id;
/* Calculate the corresponding DPI address */
dpi_start_offset = p_hwfn->dpi_start_offset;
out_params->dpi_addr = p_hwfn->doorbells + dpi_start_offset +
out_params->dpi * p_hwfn->dpi_size;
out_params->dpi_phys_addr = p_hwfn->db_phys_addr +
dpi_start_offset +
((out_params->dpi) * p_hwfn->dpi_size);
out_params->dpi_size = p_hwfn->dpi_size;
out_params->wid_count = p_hwfn->wid_count;
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Adding user - done, rc = %d\n", rc);
return rc;
}
static struct qed_rdma_port *qed_rdma_query_port(void *rdma_cxt)
{
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
struct qed_rdma_port *p_port = p_hwfn->p_rdma_info->port;
struct qed_mcp_link_state *p_link_output;
DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "RDMA Query port\n");
/* The link state is saved only for the leading hwfn */
p_link_output = &QED_LEADING_HWFN(p_hwfn->cdev)->mcp_info->link_output;
p_port->port_state = p_link_output->link_up ? QED_RDMA_PORT_UP
: QED_RDMA_PORT_DOWN;
p_port->link_speed = p_link_output->speed;
p_port->max_msg_size = RDMA_MAX_DATA_SIZE_IN_WQE;
return p_port;
}
Annotation
- Immediate include surface: `linux/types.h`, `asm/byteorder.h`, `linux/bitops.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/errno.h`, `linux/io.h`, `linux/kernel.h`.
- Detected declarations: `function Copyright`, `function qed_rdma_bmap_alloc_id`, `function qed_bmap_set_id`, `function qed_bmap_release_id`, `function qed_bmap_test_id`, `function qed_bmap_is_empty`, `function qed_rdma_get_sb_id`, `function qed_rdma_info_alloc`, `function qed_rdma_info_free`, `function qed_rdma_alloc`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.