drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c- Extension
.c- Size
- 18439 bytes
- Lines
- 756
- 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.
- 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/bug.hlinux/errno.hlinux/spinlock.husnic_log.husnic_vnic.husnic_fwd.husnic_uiom.husnic_debugfs.husnic_ib_qp_grp.husnic_ib_sysfs.husnic_transport.h
Detected Declarations
function Copyrightfunction usnic_ib_qp_grp_dump_hdrfunction usnic_ib_qp_grp_dump_rowsfunction get_qp_res_chunkfunction enable_qp_grpfunction disable_qp_grpfunction init_filter_actionfunction create_roce_custom_flowfunction release_roce_custom_flowfunction create_udp_flowfunction release_udp_flowfunction create_and_add_flowfunction release_and_remove_flowfunction release_and_remove_all_flowsfunction usnic_ib_qp_grp_modifyfunction alloc_res_chunk_listfunction free_qp_grp_resfunction qp_grp_and_vf_bindfunction qp_grp_and_vf_unbindfunction log_specfunction qp_grp_id_from_flowfunction usnic_ib_qp_grp_createfunction usnic_ib_qp_grp_destroyfunction usnic_ib_qp_grp_get_chunk
Annotated Snippet
if (status) {
usnic_err("Failed to enable qp %d of %s:%d\n with err %d\n",
res->vnic_idx, qp_grp->ufdev->name,
vnic_idx, status);
goto out_err;
}
}
return 0;
out_err:
for (i--; i >= 0; i--) {
res = res_chunk->res[i];
usnic_fwd_disable_qp(qp_grp->ufdev, vnic_idx,
res->vnic_idx);
}
return status;
}
static int disable_qp_grp(struct usnic_ib_qp_grp *qp_grp)
{
int i, vnic_idx;
struct usnic_vnic_res_chunk *res_chunk;
struct usnic_vnic_res *res;
int status = 0;
lockdep_assert_held(&qp_grp->lock);
vnic_idx = usnic_vnic_get_index(qp_grp->vf->vnic);
res_chunk = get_qp_res_chunk(qp_grp);
if (IS_ERR(res_chunk)) {
usnic_err("Unable to get qp res with err %ld\n",
PTR_ERR(res_chunk));
return PTR_ERR(res_chunk);
}
for (i = 0; i < res_chunk->cnt; i++) {
res = res_chunk->res[i];
status = usnic_fwd_disable_qp(qp_grp->ufdev, vnic_idx,
res->vnic_idx);
if (status) {
usnic_err("Failed to disable rq %d of %s:%d\n with err %d\n",
res->vnic_idx,
qp_grp->ufdev->name,
vnic_idx, status);
}
}
return status;
}
static int init_filter_action(struct usnic_ib_qp_grp *qp_grp,
struct usnic_filter_action *uaction)
{
struct usnic_vnic_res_chunk *res_chunk;
res_chunk = usnic_ib_qp_grp_get_chunk(qp_grp, USNIC_VNIC_RES_TYPE_RQ);
if (IS_ERR(res_chunk)) {
usnic_err("Unable to get %s with err %ld\n",
usnic_vnic_res_type_to_str(USNIC_VNIC_RES_TYPE_RQ),
PTR_ERR(res_chunk));
return PTR_ERR(res_chunk);
}
uaction->vnic_idx = usnic_vnic_get_index(qp_grp->vf->vnic);
uaction->action.type = FILTER_ACTION_RQ_STEERING;
uaction->action.u.rq_idx = res_chunk->res[DFLT_RQ_IDX]->vnic_idx;
return 0;
}
static struct usnic_ib_qp_grp_flow*
create_roce_custom_flow(struct usnic_ib_qp_grp *qp_grp,
struct usnic_transport_spec *trans_spec)
{
uint16_t port_num;
int err;
struct filter filter;
struct usnic_filter_action uaction;
struct usnic_ib_qp_grp_flow *qp_flow;
struct usnic_fwd_flow *flow;
enum usnic_transport_type trans_type;
trans_type = trans_spec->trans_type;
port_num = trans_spec->usnic_roce.port_num;
/* Reserve Port */
port_num = usnic_transport_rsrv_port(trans_type, port_num);
Annotation
- Immediate include surface: `linux/bug.h`, `linux/errno.h`, `linux/spinlock.h`, `usnic_log.h`, `usnic_vnic.h`, `usnic_fwd.h`, `usnic_uiom.h`, `usnic_debugfs.h`.
- Detected declarations: `function Copyright`, `function usnic_ib_qp_grp_dump_hdr`, `function usnic_ib_qp_grp_dump_rows`, `function get_qp_res_chunk`, `function enable_qp_grp`, `function disable_qp_grp`, `function init_filter_action`, `function create_roce_custom_flow`, `function release_roce_custom_flow`, `function create_udp_flow`.
- 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.
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.