drivers/infiniband/hw/ionic/ionic_lif_cfg.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/ionic/ionic_lif_cfg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/ionic/ionic_lif_cfg.c- Extension
.c- Size
- 3471 bytes
- Lines
- 112
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hionic.hionic_lif.hionic_lif_cfg.h
Detected Declarations
function ionic_get_expdbfunction ionic_fill_lif_cfgfunction ionic_lif_fw_versionfunction ionic_lif_asic_rev
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2018-2025, Advanced Micro Devices, Inc. */
#include <linux/kernel.h>
#include <ionic.h>
#include <ionic_lif.h>
#include "ionic_lif_cfg.h"
#define IONIC_MIN_RDMA_VERSION 0
#define IONIC_MAX_RDMA_VERSION 2
static u8 ionic_get_expdb(struct ionic_lif *lif)
{
u8 expdb_support = 0;
if (lif->ionic->idev.phy_cmb_expdb64_pages)
expdb_support |= IONIC_EXPDB_64B_WQE;
if (lif->ionic->idev.phy_cmb_expdb128_pages)
expdb_support |= IONIC_EXPDB_128B_WQE;
if (lif->ionic->idev.phy_cmb_expdb256_pages)
expdb_support |= IONIC_EXPDB_256B_WQE;
if (lif->ionic->idev.phy_cmb_expdb512_pages)
expdb_support |= IONIC_EXPDB_512B_WQE;
return expdb_support;
}
void ionic_fill_lif_cfg(struct ionic_lif *lif, struct ionic_lif_cfg *cfg)
{
union ionic_lif_identity *ident = &lif->ionic->ident.lif;
cfg->lif = lif;
cfg->hwdev = &lif->ionic->pdev->dev;
cfg->lif_index = lif->index;
cfg->lif_hw_index = lif->hw_index;
cfg->dbid = lif->kern_pid;
cfg->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif);
cfg->dbpage = lif->kern_dbpage;
cfg->intr_ctrl = lif->ionic->idev.intr_ctrl;
cfg->db_phys = lif->ionic->bars[IONIC_PCI_BAR_DBELL].bus_addr;
if (IONIC_VERSION(ident->rdma.version, ident->rdma.minor_version) >=
IONIC_VERSION(2, 1))
cfg->page_size_supported =
le64_to_cpu(ident->rdma.page_size_cap);
else
cfg->page_size_supported = IONIC_PAGE_SIZE_SUPPORTED;
cfg->rdma_version = ident->rdma.version;
cfg->qp_opcodes = ident->rdma.qp_opcodes;
cfg->admin_opcodes = ident->rdma.admin_opcodes;
cfg->stats_type = le16_to_cpu(ident->rdma.stats_type);
cfg->npts_per_lif = le32_to_cpu(ident->rdma.npts_per_lif);
cfg->nmrs_per_lif = le32_to_cpu(ident->rdma.nmrs_per_lif);
cfg->nahs_per_lif = le32_to_cpu(ident->rdma.nahs_per_lif);
cfg->aq_base = le32_to_cpu(ident->rdma.aq_qtype.qid_base);
cfg->cq_base = le32_to_cpu(ident->rdma.cq_qtype.qid_base);
cfg->eq_base = le32_to_cpu(ident->rdma.eq_qtype.qid_base);
/*
* ionic_create_rdma_admin() may reduce aq_count or eq_count if
* it is unable to allocate all that were requested.
* aq_count is tunable; see ionic_aq_count
* eq_count is tunable; see ionic_eq_count
*/
cfg->aq_count = le32_to_cpu(ident->rdma.aq_qtype.qid_count);
cfg->eq_count = le32_to_cpu(ident->rdma.eq_qtype.qid_count);
cfg->cq_count = le32_to_cpu(ident->rdma.cq_qtype.qid_count);
cfg->qp_count = le32_to_cpu(ident->rdma.sq_qtype.qid_count);
cfg->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif);
cfg->aq_qtype = ident->rdma.aq_qtype.qtype;
cfg->sq_qtype = ident->rdma.sq_qtype.qtype;
cfg->rq_qtype = ident->rdma.rq_qtype.qtype;
cfg->cq_qtype = ident->rdma.cq_qtype.qtype;
cfg->eq_qtype = ident->rdma.eq_qtype.qtype;
cfg->udma_qgrp_shift = ident->rdma.udma_shift;
cfg->udma_count = 2;
cfg->max_stride = ident->rdma.max_stride;
cfg->expdb_mask = ionic_get_expdb(lif);
cfg->sq_expdb =
!!(lif->qtype_info[IONIC_QTYPE_TXQ].features & IONIC_QIDENT_F_EXPDB);
Annotation
- Immediate include surface: `linux/kernel.h`, `ionic.h`, `ionic_lif.h`, `ionic_lif_cfg.h`.
- Detected declarations: `function ionic_get_expdb`, `function ionic_fill_lif_cfg`, `function ionic_lif_fw_version`, `function ionic_lif_asic_rev`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source implementation candidate.
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.