            ib_srpt and session management
            ==============================

The following actions related to SRP sessions can all occur concurrently:
* The communication manager invokes either srpt_ib_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_compl_thread() 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 a queue pair and creates a
  completion thread.
- 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 completion
  thread to stop and 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 wakes up the completion thread.
- 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
  from inside the srpt_close_session() function.
- After a DREQ has been sent either a DREP will be received
  (srpt_cm_drep_recv()) or the TimeWait state will be reached and will be left
  (srpt_cm_timewait_exit()).
- srpt_cm_drep_recv() and srpt_cm_timewait_exit() invoke srpt_close_ch().
- srpt_close_ch() changes the channel state into CH_DISCONNECTING, 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 and also that the completion
  handler won't call wake_up_process(ch->thread) anymore.
- That channel state change causes the polling loop in the completion thread
  to stop and also triggers a call of scst_unregister_session().
- 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.

