drivers/scsi/qedi/qedi_iscsi.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedi/qedi_iscsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedi/qedi_iscsi.c- Extension
.c- Size
- 44523 bytes
- Lines
- 1711
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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/blkdev.hlinux/etherdevice.hlinux/if_ether.hlinux/if_vlan.hscsi/scsi_tcq.hqedi.hqedi_iscsi.hqedi_gbl.h
Detected Declarations
function Copyrightfunction qedi_eh_host_resetfunction qedi_conn_free_login_resourcesfunction qedi_conn_alloc_login_resourcesfunction qedi_destroy_cmd_poolfunction qedi_alloc_sgetfunction qedi_setup_cmd_poolfunction qedi_session_createfunction qedi_session_destroyfunction qedi_conn_createfunction qedi_mark_device_missingfunction qedi_mark_device_availablefunction qedi_bind_conn_to_iscsi_cidfunction qedi_conn_bindfunction qedi_iscsi_update_connfunction qedi_calc_mssfunction qedi_iscsi_offload_connfunction qedi_conn_startfunction qedi_conn_destroyfunction qedi_ep_get_paramfunction qedi_host_get_paramfunction qedi_conn_get_statsfunction qedi_iscsi_prep_generic_pdu_bdfunction qedi_iscsi_send_generic_requestfunction qedi_mtask_xmitfunction qedi_task_xmitfunction qedi_offload_workfunction qedi_ep_connectfunction qedi_ep_pollfunction qedi_cleanup_active_cmd_listfunction qedi_ep_disconnectfunction qedi_data_availfunction qedi_set_pathfunction qedi_attr_is_visiblefunction qedi_cleanup_taskfunction qedi_start_conn_recoveryfunction qedi_process_iscsi_errorfunction qedi_process_tcp_error
Annotated Snippet
test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
ret = -ENOMEM;
return ERR_PTR(ret);
}
if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) {
QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n");
return ERR_PTR(-ENXIO);
}
ep = iscsi_create_endpoint(sizeof(struct qedi_endpoint));
if (!ep) {
QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n");
ret = -ENOMEM;
return ERR_PTR(ret);
}
qedi_ep = ep->dd_data;
memset(qedi_ep, 0, sizeof(struct qedi_endpoint));
INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
qedi_ep->state = EP_STATE_IDLE;
qedi_ep->iscsi_cid = (u32)-1;
qedi_ep->qedi = qedi;
if (dst_addr->sa_family == AF_INET) {
addr = (struct sockaddr_in *)dst_addr;
memcpy(qedi_ep->dst_addr, &addr->sin_addr.s_addr,
sizeof(struct in_addr));
qedi_ep->dst_port = ntohs(addr->sin_port);
qedi_ep->ip_type = TCP_IPV4;
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
"dst_addr=%pI4, dst_port=%u\n",
qedi_ep->dst_addr, qedi_ep->dst_port);
} else if (dst_addr->sa_family == AF_INET6) {
addr6 = (struct sockaddr_in6 *)dst_addr;
memcpy(qedi_ep->dst_addr, &addr6->sin6_addr,
sizeof(struct in6_addr));
qedi_ep->dst_port = ntohs(addr6->sin6_port);
qedi_ep->ip_type = TCP_IPV6;
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
"dst_addr=%pI6, dst_port=%u\n",
qedi_ep->dst_addr, qedi_ep->dst_port);
} else {
QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n");
}
ret = qedi_alloc_sq(qedi, qedi_ep);
if (ret)
goto ep_conn_exit;
ret = qedi_ops->acquire_conn(qedi->cdev, &qedi_ep->handle,
&qedi_ep->fw_cid, &qedi_ep->p_doorbell);
if (ret) {
QEDI_ERR(&qedi->dbg_ctx, "Could not acquire connection\n");
ret = -ENXIO;
goto ep_free_sq;
}
iscsi_cid = qedi_ep->handle;
qedi_ep->iscsi_cid = iscsi_cid;
init_waitqueue_head(&qedi_ep->ofld_wait);
init_waitqueue_head(&qedi_ep->tcp_ofld_wait);
qedi_ep->state = EP_STATE_OFLDCONN_START;
qedi->ep_tbl[iscsi_cid] = qedi_ep;
buf = (char *)&path_req;
len = sizeof(path_req);
memset(&path_req, 0, len);
msg_type = ISCSI_KEVENT_PATH_REQ;
path_req.handle = (u64)qedi_ep->iscsi_cid;
path_req.pmtu = qedi->ll2_mtu;
qedi_ep->pmtu = qedi->ll2_mtu;
if (qedi_ep->ip_type == TCP_IPV4) {
memcpy(&path_req.dst.v4_addr, &qedi_ep->dst_addr,
sizeof(struct in_addr));
path_req.ip_addr_len = 4;
} else {
memcpy(&path_req.dst.v6_addr, &qedi_ep->dst_addr,
sizeof(struct in6_addr));
path_req.ip_addr_len = 16;
}
ret = iscsi_offload_mesg(shost, &qedi_iscsi_transport, msg_type, buf,
len);
if (ret) {
QEDI_ERR(&qedi->dbg_ctx,
"iscsi_offload_mesg() failed for cid=0x%x ret=%d\n",
iscsi_cid, ret);
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/etherdevice.h`, `linux/if_ether.h`, `linux/if_vlan.h`, `scsi/scsi_tcq.h`, `qedi.h`, `qedi_iscsi.h`, `qedi_gbl.h`.
- Detected declarations: `function Copyright`, `function qedi_eh_host_reset`, `function qedi_conn_free_login_resources`, `function qedi_conn_alloc_login_resources`, `function qedi_destroy_cmd_pool`, `function qedi_alloc_sget`, `function qedi_setup_cmd_pool`, `function qedi_session_create`, `function qedi_session_destroy`, `function qedi_conn_create`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.