{
struct isert_conn *isert_conn = cma_id->context;
+ pr_info("conn %p\n", isert_conn);
+
+ isert_conn->state = ISER_CONN_UP;
kref_get(&isert_conn->conn_kref);
}
* @isert_conn: isert connection struct
*
* Notes:
- * In case the connection state is UP, move state
+ * In case the connection state is FULL_FEATURE, move state
* to TEMINATING and start teardown sequence (rdma_disconnect).
+ * In case the connection state is UP, complete flush as well.
*
* This routine must be called with conn_mutex held. Thus it is
* safe to call multiple times.
{
int err;
- if (isert_conn->state == ISER_CONN_UP) {
- isert_conn->state = ISER_CONN_TERMINATING;
+ switch (isert_conn->state) {
+ case ISER_CONN_TERMINATING:
+ break;
+ case ISER_CONN_UP:
+ /*
+ * No flush completions will occur as we didn't
+ * get to ISER_CONN_FULL_FEATURE yet, complete
+ * to allow teardown progress.
+ */
+ complete(&isert_conn->conn_wait_comp_err);
+ case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
pr_info("Terminating conn %p state %d\n",
isert_conn, isert_conn->state);
+ isert_conn->state = ISER_CONN_TERMINATING;
err = rdma_disconnect(isert_conn->conn_cm_id);
if (err)
pr_warn("Failed rdma_disconnect isert_conn %p\n",
isert_conn);
+ break;
+ default:
+ pr_warn("conn %p teminating in state %d\n",
+ isert_conn, isert_conn->state);
}
}
-static void
-isert_disconnect_work(struct work_struct *work)
-{
- struct isert_conn *isert_conn = container_of(work,
- struct isert_conn, conn_logout_work);
-
- pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
- mutex_lock(&isert_conn->conn_mutex);
- isert_conn_terminate(isert_conn);
- mutex_unlock(&isert_conn->conn_mutex);
-
- pr_info("conn %p completing conn_wait\n", isert_conn);
- complete(&isert_conn->conn_wait);
-}
-
static int
isert_disconnected_handler(struct rdma_cm_id *cma_id)
{
isert_conn = (struct isert_conn *)cma_id->context;
- INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
- schedule_work(&isert_conn->conn_logout_work);
+ mutex_lock(&isert_conn->conn_mutex);
+ isert_conn_terminate(isert_conn);
+ mutex_unlock(&isert_conn->conn_mutex);
+
+ pr_info("conn %p completing conn_wait\n", isert_conn);
+ complete(&isert_conn->conn_wait);
return 0;
}
* bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls.
*/
mutex_lock(&isert_conn->conn_mutex);
- if (coalesce && isert_conn->state == ISER_CONN_UP &&
+ if (coalesce && isert_conn->state == ISER_CONN_FULL_FEATURE &&
++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) {
tx_desc->llnode_active = true;
llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist);
if (ret)
return ret;
- isert_conn->state = ISER_CONN_UP;
+ /* Now we are in FULL_FEATURE phase */
+ isert_conn->state = ISER_CONN_FULL_FEATURE;
goto post_send;
}