Lines Matching refs:iser_conn

237 	struct iser_conn *iser_conn = to_iser_conn(ib_conn);  in iser_create_ib_conn_res()  local
280 iser_conn->max_cmds = ISER_GET_MAX_XMIT_CMDS(max_send_wr - 1); in iser_create_ib_conn_res()
353 static int iser_conn_state_comp_exch(struct iser_conn *iser_conn, in iser_conn_state_comp_exch() argument
359 ret = (iser_conn->state == comp); in iser_conn_state_comp_exch()
361 iser_conn->state = exch; in iser_conn_state_comp_exch()
368 struct iser_conn *iser_conn; in iser_release_work() local
370 iser_conn = container_of(work, struct iser_conn, release_work); in iser_release_work()
373 wait_for_completion(&iser_conn->stop_completion); in iser_release_work()
375 wait_for_completion(&iser_conn->ib_completion); in iser_release_work()
377 mutex_lock(&iser_conn->state_mutex); in iser_release_work()
378 iser_conn->state = ISER_CONN_DOWN; in iser_release_work()
379 mutex_unlock(&iser_conn->state_mutex); in iser_release_work()
381 iser_conn_release(iser_conn); in iser_release_work()
395 static void iser_free_ib_conn_res(struct iser_conn *iser_conn, bool destroy) in iser_free_ib_conn_res() argument
397 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_free_ib_conn_res()
401 iser_conn, ib_conn->cma_id, ib_conn->qp); in iser_free_ib_conn_res()
410 if (iser_conn->rx_descs) in iser_free_ib_conn_res()
411 iser_free_rx_descriptors(iser_conn); in iser_free_ib_conn_res()
424 void iser_conn_release(struct iser_conn *iser_conn) in iser_conn_release() argument
426 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_release()
429 list_del(&iser_conn->conn_list); in iser_conn_release()
432 mutex_lock(&iser_conn->state_mutex); in iser_conn_release()
434 if (iser_conn->state != ISER_CONN_DOWN) { in iser_conn_release()
436 iser_conn, iser_conn->state); in iser_conn_release()
437 iscsi_destroy_endpoint(iser_conn->ep); in iser_conn_release()
438 iser_conn->state = ISER_CONN_DOWN; in iser_conn_release()
444 iser_free_ib_conn_res(iser_conn, true); in iser_conn_release()
445 mutex_unlock(&iser_conn->state_mutex); in iser_conn_release()
452 kfree(iser_conn); in iser_conn_release()
462 int iser_conn_terminate(struct iser_conn *iser_conn) in iser_conn_terminate() argument
464 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_terminate()
468 if (!iser_conn_state_comp_exch(iser_conn, ISER_CONN_UP, in iser_conn_terminate()
472 iser_info("iser_conn %p state %d\n", iser_conn, iser_conn->state); in iser_conn_terminate()
475 if (iser_conn->iscsi_conn) in iser_conn_terminate()
476 iscsi_suspend_queue(iser_conn->iscsi_conn); in iser_conn_terminate()
487 iser_conn, err); in iser_conn_terminate()
501 struct iser_conn *iser_conn; in iser_connect_error() local
503 iser_conn = cma_id->context; in iser_connect_error()
504 iser_conn->state = ISER_CONN_TERMINATING; in iser_connect_error()
507 static void iser_calc_scsi_params(struct iser_conn *iser_conn, in iser_calc_scsi_params() argument
510 struct iser_device *device = iser_conn->ib_conn.device; in iser_calc_scsi_params()
527 if (iser_conn->ib_conn.pi_support) in iser_calc_scsi_params()
535 iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize); in iser_calc_scsi_params()
536 iser_conn->pages_per_mr = in iser_calc_scsi_params()
537 iser_conn->scsi_sg_tablesize + reserved_mr_pages; in iser_calc_scsi_params()
546 struct iser_conn *iser_conn; in iser_addr_handler() local
550 iser_conn = cma_id->context; in iser_addr_handler()
551 if (iser_conn->state != ISER_CONN_PENDING) in iser_addr_handler()
555 ib_conn = &iser_conn->ib_conn; in iser_addr_handler()
578 iser_calc_scsi_params(iser_conn, iser_max_sectors); in iser_addr_handler()
596 struct iser_conn *iser_conn = cma_id->context; in iser_route_handler() local
597 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_route_handler()
600 if (iser_conn->state != ISER_CONN_PENDING) in iser_route_handler()
635 struct iser_conn *iser_conn; in iser_connected_handler() local
639 iser_conn = cma_id->context; in iser_connected_handler()
640 if (iser_conn->state != ISER_CONN_PENDING) in iser_connected_handler()
650 iser_conn->snd_w_inv = !(flags & ISER_SEND_W_INV_NOT_SUP); in iser_connected_handler()
654 iser_conn, iser_conn->snd_w_inv ? "remote" : "local"); in iser_connected_handler()
656 iser_conn->state = ISER_CONN_UP; in iser_connected_handler()
657 complete(&iser_conn->up_completion); in iser_connected_handler()
662 struct iser_conn *iser_conn = cma_id->context; in iser_disconnected_handler() local
664 if (iser_conn_terminate(iser_conn)) { in iser_disconnected_handler()
665 if (iser_conn->iscsi_conn) in iser_disconnected_handler()
666 iscsi_conn_failure(iser_conn->iscsi_conn, in iser_disconnected_handler()
676 struct iser_conn *iser_conn = cma_id->context; in iser_cleanup_handler() local
684 iser_free_ib_conn_res(iser_conn, destroy); in iser_cleanup_handler()
685 complete(&iser_conn->ib_completion); in iser_cleanup_handler()
691 struct iser_conn *iser_conn; in iser_cma_handler() local
694 iser_conn = cma_id->context; in iser_cma_handler()
699 mutex_lock(&iser_conn->state_mutex); in iser_cma_handler()
733 if (iser_conn->state != ISER_CONN_DOWN) { in iser_cma_handler()
734 iser_conn->ib_conn.cma_id = NULL; in iser_cma_handler()
743 mutex_unlock(&iser_conn->state_mutex); in iser_cma_handler()
748 void iser_conn_init(struct iser_conn *iser_conn) in iser_conn_init() argument
750 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_init()
752 iser_conn->state = ISER_CONN_INIT; in iser_conn_init()
753 init_completion(&iser_conn->stop_completion); in iser_conn_init()
754 init_completion(&iser_conn->ib_completion); in iser_conn_init()
755 init_completion(&iser_conn->up_completion); in iser_conn_init()
756 INIT_LIST_HEAD(&iser_conn->conn_list); in iser_conn_init()
757 mutex_init(&iser_conn->state_mutex); in iser_conn_init()
766 int iser_connect(struct iser_conn *iser_conn, struct sockaddr *src_addr, in iser_connect() argument
769 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_connect()
772 mutex_lock(&iser_conn->state_mutex); in iser_connect()
774 sprintf(iser_conn->name, "%pISp", dst_addr); in iser_connect()
776 iser_info("connecting to: %s\n", iser_conn->name); in iser_connect()
781 iser_conn->state = ISER_CONN_PENDING; in iser_connect()
784 iser_conn, RDMA_PS_TCP, IB_QPT_RC); in iser_connect()
798 wait_for_completion_interruptible(&iser_conn->up_completion); in iser_connect()
800 if (iser_conn->state != ISER_CONN_UP) { in iser_connect()
805 mutex_unlock(&iser_conn->state_mutex); in iser_connect()
808 list_add(&iser_conn->conn_list, &ig.connlist); in iser_connect()
815 iser_conn->state = ISER_CONN_DOWN; in iser_connect()
817 mutex_unlock(&iser_conn->state_mutex); in iser_connect()
818 iser_conn_release(iser_conn); in iser_connect()
822 int iser_post_recvl(struct iser_conn *iser_conn) in iser_post_recvl() argument
824 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_post_recvl()
825 struct iser_login_desc *desc = &iser_conn->login_desc; in iser_post_recvl()
846 int iser_post_recvm(struct iser_conn *iser_conn, struct iser_rx_desc *rx_desc) in iser_post_recvm() argument
848 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_post_recvm()
955 struct iser_conn *iser_conn = to_iser_conn(wc->qp->qp_context); in iser_err_comp() local
961 if (iser_conn->iscsi_conn) in iser_err_comp()
962 iscsi_conn_failure(iser_conn->iscsi_conn, in iser_err_comp()