Files
scst/srpt/session-management.txt
T
Gleb Chesnokov b836a17e35 srpt: Update RDMA target documentation
The SRPT guides mix current RDMA/CM code with Linux 2.6, procfs and
OFED 1.5 procedures. Their parameter defaults, session names and
tuning advice no longer describe the driver built by this tree.

Commit 020ec68ddc ("ib_srpt: Change default behavior from using SRQ
to not using SRQ") changed receive queues, and commit 434207ab53
("ib_srpt: Restore immediate data support") changed request sizing.
Commit fa58faf95b ("ib_srpt: Add RDMA/CM support") added the IP-based
session naming mode.

Commit 08e532715d ("Remove procfs support") invalidated the in-tree
setup, while commit d6fd03107f ("Split Makefiles: move kernel build
rules into Kbuild files") moved the fault-injection flag.

Commit c2bd2e8bf5 ("ib_srpt: Remove "thread" kernel module parameter and keep thread=1 behavior - the other two modes could cause soft lockup complaints")
made threaded completion unconditional.

Use ib_srpt.c, ib_srpt.h and conftests for current behavior. Scope
SCSI multiqueue advice after Linux commit f664a3cc17b7 ("scsi: kill
off the legacy IO path"), and mark OFED, HA, benchmark and test
recipes as historical or destructive.
2026-08-21 10:05:36 +03:00

40 lines
2.3 KiB
Plaintext

ib_srpt and session management
==============================
The following actions related to SRP sessions can all occur concurrently:
* The communication manager invokes either srpt_cm_handler() or
srpt_rdma_cm_handler().
* HCA driver invokes the queue pair (QP) completion handler srpt_completion().
* HCA driver invokes the QP async event handler srpt_qp_event().
* HCA transfers data between initiator and target via RDMA.
* srpt_do_compl_work() polls the QP.
* SCST core invokes one of the callback functions defined in srpt_template.
The actions that occur over the lifetime of a session are as follows:
- A REQ message is received from the initiator.
- srpt_cm_req_recv() is invoked, allocates an I/O context ring and a queue pair
and creates an SCST session.
- If the connection request is not accepted, a REJ message is sent and
srpt_close_ch() is invoked. The srpt_close_ch() call causes the allocated
resources to be freed asynchronously.
- If the connection request is accepted a REP message is sent to the initiator.
- Once an RTU message is received from the initiator, srpt_cm_rtu_recv() is
invoked. That function changes the queue pair state into RTS, the channel
state into CH_LIVE and triggers processing of the wait list.
- RDMA communication starts and continues until either a DREQ message is
received or sent. A DREQ is sent either because a target port is disabled or
because the SCST core requested to close the session.
- After a DREQ has been sent either a DREP will be received or the TimeWait
state will be reached. Both trigger a srpt_close_ch() call.
- srpt_close_ch() changes the channel state into CH_DRAINING, the
queue pair state into IB_QPS_ERR and queues a zero-length write.
- Upon receipt of the zero-length write completion the channel state is
changed into CH_DISCONNECTED. This is the last work completion so once the
channel state has reached CH_DISCONNECTED it is guaranteed that the queue
pair completion handler won't be invoked again.
- scst_unregister_session() is called.
- Once scst_unregister_session() has finished srpt_unreg_sess() is invoked.
- srpt_unreg_sess() destroys the CM ID and decrements the channel refcount.
- Once the channel refcount drops to zero srpt_free_ch() is invoked which
frees the queue pair and other IB resources.