drivers/infiniband/ulp/iser/iser_verbs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/iser/iser_verbs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/ulp/iser/iser_verbs.c- Extension
.c- Size
- 25285 bytes
- Lines
- 953
- 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/kernel.hlinux/slab.hlinux/delay.hiscsi_iser.h
Detected Declarations
function Copyrightfunction iser_event_handlerfunction Queuefunction iser_free_device_ib_resfunction iser_create_fastreg_descfunction iser_destroy_fastreg_descfunction iser_alloc_fastreg_poolfunction iser_free_fastreg_poolfunction list_for_each_entry_safefunction iser_create_ib_conn_resfunction iser_device_try_releasefunction iser_release_workfunction poolfunction iser_conn_releasefunction iser_conn_terminatefunction iser_connect_errorfunction iser_calc_scsi_paramsfunction iser_addr_handlerfunction iser_route_handlerfunction iser_connected_handlerfunction iser_cleanup_handlerfunction iser_cma_handlerfunction iser_conn_initfunction iser_connectfunction iser_post_recvlfunction iser_post_recvmfunction iser_post_sendfunction iser_check_task_pi_statusfunction iser_err_comp
Annotated Snippet
if (IS_ERR(desc->rsc.sig_mr)) {
ret = PTR_ERR(desc->rsc.sig_mr);
iser_err("Failed to allocate sig_mr err=%d\n", ret);
goto err_alloc_mr_integrity;
}
}
return desc;
err_alloc_mr_integrity:
ib_dereg_mr(desc->rsc.mr);
err_alloc_mr:
kfree(desc);
return ERR_PTR(ret);
}
static void iser_destroy_fastreg_desc(struct iser_fr_desc *desc)
{
struct iser_reg_resources *res = &desc->rsc;
ib_dereg_mr(res->mr);
if (res->sig_mr) {
ib_dereg_mr(res->sig_mr);
res->sig_mr = NULL;
}
kfree(desc);
}
/**
* iser_alloc_fastreg_pool - Creates pool of fast_reg descriptors
* for fast registration work requests.
* @ib_conn: connection RDMA resources
* @cmds_max: max number of SCSI commands for this connection
* @size: max number of pages per map request
*
* Return: 0 on success, or errno code on failure
*/
int iser_alloc_fastreg_pool(struct ib_conn *ib_conn,
unsigned cmds_max,
unsigned int size)
{
struct iser_device *device = ib_conn->device;
struct iser_fr_pool *fr_pool = &ib_conn->fr_pool;
struct iser_fr_desc *desc;
int i, ret;
INIT_LIST_HEAD(&fr_pool->list);
INIT_LIST_HEAD(&fr_pool->all_list);
spin_lock_init(&fr_pool->lock);
fr_pool->size = 0;
for (i = 0; i < cmds_max; i++) {
desc = iser_create_fastreg_desc(device, device->pd,
ib_conn->pi_support, size);
if (IS_ERR(desc)) {
ret = PTR_ERR(desc);
goto err;
}
list_add_tail(&desc->list, &fr_pool->list);
list_add_tail(&desc->all_list, &fr_pool->all_list);
fr_pool->size++;
}
return 0;
err:
iser_free_fastreg_pool(ib_conn);
return ret;
}
/**
* iser_free_fastreg_pool - releases the pool of fast_reg descriptors
* @ib_conn: connection RDMA resources
*/
void iser_free_fastreg_pool(struct ib_conn *ib_conn)
{
struct iser_fr_pool *fr_pool = &ib_conn->fr_pool;
struct iser_fr_desc *desc, *tmp;
int i = 0;
if (list_empty(&fr_pool->all_list))
return;
iser_info("freeing conn %p fr pool\n", ib_conn);
list_for_each_entry_safe(desc, tmp, &fr_pool->all_list, all_list) {
list_del(&desc->all_list);
iser_destroy_fastreg_desc(desc);
++i;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/delay.h`, `iscsi_iser.h`.
- Detected declarations: `function Copyright`, `function iser_event_handler`, `function Queue`, `function iser_free_device_ib_res`, `function iser_create_fastreg_desc`, `function iser_destroy_fastreg_desc`, `function iser_alloc_fastreg_pool`, `function iser_free_fastreg_pool`, `function list_for_each_entry_safe`, `function iser_create_ib_conn_res`.
- 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.