drivers/soc/fsl/dpio/qbman-portal.c
Source file repositories/reference/linux-study-clean/drivers/soc/fsl/dpio/qbman-portal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/fsl/dpio/qbman-portal.c- Extension
.c- Size
- 53860 bytes
- Lines
- 1854
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- 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
asm/cacheflush.hlinux/io.hlinux/slab.hlinux/spinlock.hsoc/fsl/dpaa2-global.hqbman-portal.h
Detected Declarations
struct qbman_acquire_descstruct qbman_acquire_rsltstruct qbman_alt_fq_state_descstruct qbman_alt_fq_state_rsltstruct qbman_cdan_ctrl_descstruct qbman_cdan_ctrl_rsltstruct qbman_fq_query_descstruct qbman_bp_query_descenum qbman_sdqcr_dctenum qbman_sdqcr_fcenum qb_enqueue_commandsenum qb_pull_dt_efunction qbman_read_registerfunction qbman_write_registerfunction qbman_set_swp_cfgfunction qm_cyc_difffunction qbman_swp_initfunction qbman_swp_finishfunction qbman_swp_interrupt_read_statusfunction qbman_swp_interrupt_clear_statusfunction qbman_swp_interrupt_get_triggerfunction qbman_swp_interrupt_set_triggerfunction qbman_swp_interrupt_get_inhibitfunction qbman_swp_interrupt_set_inhibitfunction qbman_swp_mc_submitfunction responsefunction qbman_eq_desc_clearfunction qbman_eq_desc_set_no_orpfunction qbman_eq_desc_set_fqfunction qbman_eq_desc_set_qdfunction qbman_swp_enqueue_directfunction qbman_swp_enqueue_mem_backfunction qbman_swp_enqueue_multiple_directfunction qbman_swp_enqueue_multiple_mem_backfunction qbman_swp_enqueue_multiple_desc_directfunction qbman_swp_enqueue_multiple_desc_mem_backfunction qbman_swp_push_getfunction qbman_swp_push_setfunction qbman_pull_desc_clearfunction qbman_pull_desc_set_storagefunction qbman_pull_desc_set_numframesfunction qbman_pull_desc_set_fqfunction qbman_pull_desc_set_wqfunction qbman_pull_desc_set_channelfunction qbman_swp_pull_directfunction qbman_swp_pull_mem_backfunction qbman_swp_dqrr_next_directfunction qbman_swp_dqrr_next_mem_back
Annotated Snippet
struct qbman_acquire_desc {
u8 verb;
u8 reserved;
__le16 bpid;
u8 num;
u8 reserved2[59];
};
struct qbman_acquire_rslt {
u8 verb;
u8 rslt;
__le16 reserved;
u8 num;
u8 reserved2[3];
__le64 buf[7];
};
/**
* qbman_swp_acquire() - Issue a buffer acquire command
* @s: the software portal object
* @bpid: the buffer pool index
* @buffers: a pointer pointing to the acquired buffer addresses
* @num_buffers: number of buffers to be acquired, must be less than 8
*
* Return 0 for success, or negative error code if the acquire command
* fails.
*/
int qbman_swp_acquire(struct qbman_swp *s, u16 bpid, u64 *buffers,
unsigned int num_buffers)
{
struct qbman_acquire_desc *p;
struct qbman_acquire_rslt *r;
int i;
if (!num_buffers || (num_buffers > 7))
return -EINVAL;
/* Start the management command */
p = qbman_swp_mc_start(s);
if (!p)
return -EBUSY;
/* Encode the caller-provided attributes */
p->bpid = cpu_to_le16(bpid);
p->num = num_buffers;
/* Complete the management command */
r = qbman_swp_mc_complete(s, p, QBMAN_MC_ACQUIRE);
if (unlikely(!r)) {
pr_err("qbman: acquire from BPID %d failed, no response\n",
bpid);
return -EIO;
}
/* Decode the outcome */
WARN_ON((r->verb & 0x7f) != QBMAN_MC_ACQUIRE);
/* Determine success or failure */
if (unlikely(r->rslt != QBMAN_MC_RSLT_OK)) {
pr_err("qbman: acquire from BPID 0x%x failed, code=0x%02x\n",
bpid, r->rslt);
return -EIO;
}
WARN_ON(r->num > num_buffers);
/* Copy the acquired buffers to the caller's array */
for (i = 0; i < r->num; i++)
buffers[i] = le64_to_cpu(r->buf[i]);
return (int)r->num;
}
struct qbman_alt_fq_state_desc {
u8 verb;
u8 reserved[3];
__le32 fqid;
u8 reserved2[56];
};
struct qbman_alt_fq_state_rslt {
u8 verb;
u8 rslt;
u8 reserved[62];
};
#define ALT_FQ_FQID_MASK 0x00FFFFFF
int qbman_swp_alt_fq_state(struct qbman_swp *s, u32 fqid,
Annotation
- Immediate include surface: `asm/cacheflush.h`, `linux/io.h`, `linux/slab.h`, `linux/spinlock.h`, `soc/fsl/dpaa2-global.h`, `qbman-portal.h`.
- Detected declarations: `struct qbman_acquire_desc`, `struct qbman_acquire_rslt`, `struct qbman_alt_fq_state_desc`, `struct qbman_alt_fq_state_rslt`, `struct qbman_cdan_ctrl_desc`, `struct qbman_cdan_ctrl_rslt`, `struct qbman_fq_query_desc`, `struct qbman_bp_query_desc`, `enum qbman_sdqcr_dct`, `enum qbman_sdqcr_fc`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.