drivers/infiniband/hw/ocrdma/ocrdma_hw.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/ocrdma/ocrdma_hw.c- Extension
.c- Size
- 91936 bytes
- Lines
- 3240
- 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/sched.hlinux/interrupt.hlinux/log2.hlinux/dma-mapping.hlinux/if_ether.hrdma/ib_verbs.hrdma/ib_user_verbs.hrdma/ib_cache.hocrdma.hocrdma_hw.hocrdma_verbs.hocrdma_ah.h
Detected Declarations
enum mbx_statusenum additional_statusenum cqe_statusfunction ocrdma_eq_inc_tailfunction ocrdma_mcq_inc_tailfunction ocrdma_mq_inc_headfunction get_ibqp_statefunction get_ocrdma_qp_statefunction ocrdma_get_mbx_errnofunction ocrdma_get_mbx_cqe_errnofunction ocrdma_ring_cq_dbfunction ocrdma_ring_mq_dbfunction ocrdma_ring_eq_dbfunction ocrdma_init_mchfunction ocrdma_free_qfunction ocrdma_alloc_qfunction ocrdma_build_q_pagesfunction ocrdma_mbx_delete_qfunction ocrdma_mbx_create_eqfunction ocrdma_create_eqfunction ocrdma_get_irqfunction _ocrdma_destroy_eqfunction ocrdma_destroy_eqfunction ocrdma_destroy_eqsfunction ocrdma_mbx_mq_cq_createfunction ocrdma_encoded_q_lenfunction ocrdma_mbx_create_mqfunction ocrdma_create_mqfunction ocrdma_destroy_mqfunction ocrdma_process_qpcat_errorfunction ocrdma_dispatch_ibeventfunction ocrdma_process_grp5_ayncfunction ocrdma_process_link_statefunction ocrdma_process_acqefunction ocrdma_process_mcqefunction ocrdma_mq_cq_handlerfunction list_for_eachfunction ocrdma_qp_buddy_cq_handlerfunction ocrdma_qp_cq_handlerfunction ocrdma_cq_handlerfunction ocrdma_irq_handlerfunction ocrdma_post_mqefunction ocrdma_wait_mqe_cmplfunction ocrdma_mbx_cmdfunction ocrdma_nonemb_mbx_cmdfunction ocrdma_get_attrfunction ocrdma_check_fw_configfunction ocrdma_mbx_query_fw_ver
Annotated Snippet
switch (add_status) {
case OCRDMA_MBX_ADDI_STATUS_INSUFFICIENT_RESOURCES:
err_num = -EAGAIN;
break;
default:
err_num = -EFAULT;
}
break;
default:
err_num = -EFAULT;
}
return err_num;
}
char *port_speed_string(struct ocrdma_dev *dev)
{
char *str = "";
u16 speeds_supported;
speeds_supported = dev->phy.fixed_speeds_supported |
dev->phy.auto_speeds_supported;
if (speeds_supported & OCRDMA_PHY_SPEED_40GBPS)
str = "40Gbps ";
else if (speeds_supported & OCRDMA_PHY_SPEED_10GBPS)
str = "10Gbps ";
else if (speeds_supported & OCRDMA_PHY_SPEED_1GBPS)
str = "1Gbps ";
return str;
}
static int ocrdma_get_mbx_cqe_errno(u16 cqe_status)
{
int err_num = -EINVAL;
switch (cqe_status) {
case OCRDMA_MBX_CQE_STATUS_INSUFFICIENT_PRIVILEDGES:
err_num = -EPERM;
break;
case OCRDMA_MBX_CQE_STATUS_INVALID_PARAMETER:
err_num = -EINVAL;
break;
case OCRDMA_MBX_CQE_STATUS_INSUFFICIENT_RESOURCES:
case OCRDMA_MBX_CQE_STATUS_QUEUE_FLUSHING:
err_num = -EINVAL;
break;
case OCRDMA_MBX_CQE_STATUS_DMA_FAILED:
default:
err_num = -EINVAL;
break;
}
return err_num;
}
void ocrdma_ring_cq_db(struct ocrdma_dev *dev, u16 cq_id, bool armed,
bool solicited, u16 cqe_popped)
{
u32 val = cq_id & OCRDMA_DB_CQ_RING_ID_MASK;
val |= ((cq_id & OCRDMA_DB_CQ_RING_ID_EXT_MASK) <<
OCRDMA_DB_CQ_RING_ID_EXT_MASK_SHIFT);
if (armed)
val |= (1 << OCRDMA_DB_CQ_REARM_SHIFT);
if (solicited)
val |= (1 << OCRDMA_DB_CQ_SOLICIT_SHIFT);
val |= (cqe_popped << OCRDMA_DB_CQ_NUM_POPPED_SHIFT);
iowrite32(val, dev->nic_info.db + OCRDMA_DB_CQ_OFFSET);
}
static void ocrdma_ring_mq_db(struct ocrdma_dev *dev)
{
u32 val = 0;
val |= dev->mq.sq.id & OCRDMA_MQ_ID_MASK;
val |= 1 << OCRDMA_MQ_NUM_MQE_SHIFT;
iowrite32(val, dev->nic_info.db + OCRDMA_DB_MQ_OFFSET);
}
static void ocrdma_ring_eq_db(struct ocrdma_dev *dev, u16 eq_id,
bool arm, bool clear_int, u16 num_eqe)
{
u32 val = 0;
val |= eq_id & OCRDMA_EQ_ID_MASK;
val |= ((eq_id & OCRDMA_EQ_ID_EXT_MASK) << OCRDMA_EQ_ID_EXT_MASK_SHIFT);
if (arm)
val |= (1 << OCRDMA_REARM_SHIFT);
if (clear_int)
val |= (1 << OCRDMA_EQ_CLR_SHIFT);
Annotation
- Immediate include surface: `linux/sched.h`, `linux/interrupt.h`, `linux/log2.h`, `linux/dma-mapping.h`, `linux/if_ether.h`, `rdma/ib_verbs.h`, `rdma/ib_user_verbs.h`, `rdma/ib_cache.h`.
- Detected declarations: `enum mbx_status`, `enum additional_status`, `enum cqe_status`, `function ocrdma_eq_inc_tail`, `function ocrdma_mcq_inc_tail`, `function ocrdma_mq_inc_head`, `function get_ibqp_state`, `function get_ocrdma_qp_state`, `function ocrdma_get_mbx_errno`, `function ocrdma_get_mbx_cqe_errno`.
- 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.