Lines Matching refs:iser_conn
230 struct iser_conn *iser_conn = to_iser_conn(ib_conn); in iser_create_ib_conn_res() local
273 iser_conn->max_cmds = ISER_GET_MAX_XMIT_CMDS(max_send_wr - 1); in iser_create_ib_conn_res()
345 struct iser_conn *iser_conn; in iser_release_work() local
347 iser_conn = container_of(work, struct iser_conn, release_work); in iser_release_work()
350 wait_for_completion(&iser_conn->stop_completion); in iser_release_work()
352 wait_for_completion(&iser_conn->ib_completion); in iser_release_work()
354 mutex_lock(&iser_conn->state_mutex); in iser_release_work()
355 iser_conn->state = ISER_CONN_DOWN; in iser_release_work()
356 mutex_unlock(&iser_conn->state_mutex); in iser_release_work()
358 iser_conn_release(iser_conn); in iser_release_work()
372 static void iser_free_ib_conn_res(struct iser_conn *iser_conn, bool destroy) in iser_free_ib_conn_res() argument
374 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_free_ib_conn_res()
378 iser_conn, ib_conn->cma_id, ib_conn->qp); in iser_free_ib_conn_res()
387 if (iser_conn->rx_descs) in iser_free_ib_conn_res()
388 iser_free_rx_descriptors(iser_conn); in iser_free_ib_conn_res()
401 void iser_conn_release(struct iser_conn *iser_conn) in iser_conn_release() argument
403 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_release()
406 list_del(&iser_conn->conn_list); in iser_conn_release()
409 mutex_lock(&iser_conn->state_mutex); in iser_conn_release()
411 if (iser_conn->state != ISER_CONN_DOWN) { in iser_conn_release()
413 iser_conn, iser_conn->state); in iser_conn_release()
414 iscsi_destroy_endpoint(iser_conn->ep); in iser_conn_release()
415 iser_conn->state = ISER_CONN_DOWN; in iser_conn_release()
421 iser_free_ib_conn_res(iser_conn, true); in iser_conn_release()
422 mutex_unlock(&iser_conn->state_mutex); in iser_conn_release()
429 kfree(iser_conn); in iser_conn_release()
439 int iser_conn_terminate(struct iser_conn *iser_conn) in iser_conn_terminate() argument
441 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_terminate()
444 lockdep_assert_held(&iser_conn->state_mutex); in iser_conn_terminate()
447 if (iser_conn->state != ISER_CONN_UP) in iser_conn_terminate()
450 iser_conn->state = ISER_CONN_TERMINATING; in iser_conn_terminate()
451 iser_info("iser_conn %p state %d\n", iser_conn, iser_conn->state); in iser_conn_terminate()
454 if (iser_conn->iscsi_conn) in iser_conn_terminate()
455 iscsi_suspend_queue(iser_conn->iscsi_conn); in iser_conn_terminate()
466 iser_conn, err); in iser_conn_terminate()
480 struct iser_conn *iser_conn = cma_id->context; in iser_connect_error() local
482 lockdep_assert_held(&iser_conn->state_mutex); in iser_connect_error()
484 iser_conn->state = ISER_CONN_TERMINATING; in iser_connect_error()
487 static void iser_calc_scsi_params(struct iser_conn *iser_conn, in iser_calc_scsi_params() argument
490 struct iser_device *device = iser_conn->ib_conn.device; in iser_calc_scsi_params()
507 if (iser_conn->ib_conn.pi_support) in iser_calc_scsi_params()
515 iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize); in iser_calc_scsi_params()
516 iser_conn->pages_per_mr = in iser_calc_scsi_params()
517 iser_conn->scsi_sg_tablesize + reserved_mr_pages; in iser_calc_scsi_params()
525 struct iser_conn *iser_conn = cma_id->context; in iser_addr_handler() local
530 lockdep_assert_held(&iser_conn->state_mutex); in iser_addr_handler()
532 if (iser_conn->state != ISER_CONN_PENDING) in iser_addr_handler()
536 ib_conn = &iser_conn->ib_conn; in iser_addr_handler()
559 iser_calc_scsi_params(iser_conn, iser_max_sectors); in iser_addr_handler()
577 struct iser_conn *iser_conn = cma_id->context; in iser_route_handler() local
578 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_route_handler()
581 lockdep_assert_held(&iser_conn->state_mutex); in iser_route_handler()
583 if (iser_conn->state != ISER_CONN_PENDING) in iser_route_handler()
621 struct iser_conn *iser_conn = cma_id->context; in iser_connected_handler() local
625 lockdep_assert_held(&iser_conn->state_mutex); in iser_connected_handler()
627 if (iser_conn->state != ISER_CONN_PENDING) in iser_connected_handler()
637 iser_conn->snd_w_inv = !(flags & ISER_SEND_W_INV_NOT_SUP); in iser_connected_handler()
641 iser_conn, iser_conn->snd_w_inv ? "remote" : "local"); in iser_connected_handler()
643 iser_conn->state = ISER_CONN_UP; in iser_connected_handler()
644 complete(&iser_conn->up_completion); in iser_connected_handler()
653 struct iser_conn *iser_conn = cma_id->context; in iser_cleanup_handler() local
655 lockdep_assert_held(&iser_conn->state_mutex); in iser_cleanup_handler()
661 if (iser_conn_terminate(iser_conn)) { in iser_cleanup_handler()
662 if (iser_conn->iscsi_conn) in iser_cleanup_handler()
663 iscsi_conn_failure(iser_conn->iscsi_conn, in iser_cleanup_handler()
668 iser_free_ib_conn_res(iser_conn, destroy); in iser_cleanup_handler()
669 complete(&iser_conn->ib_completion); in iser_cleanup_handler()
675 struct iser_conn *iser_conn; in iser_cma_handler() local
678 iser_conn = cma_id->context; in iser_cma_handler()
683 mutex_lock(&iser_conn->state_mutex); in iser_cma_handler()
717 if (iser_conn->state != ISER_CONN_DOWN) { in iser_cma_handler()
718 iser_conn->ib_conn.cma_id = NULL; in iser_cma_handler()
727 mutex_unlock(&iser_conn->state_mutex); in iser_cma_handler()
732 void iser_conn_init(struct iser_conn *iser_conn) in iser_conn_init() argument
734 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_conn_init()
736 iser_conn->state = ISER_CONN_INIT; in iser_conn_init()
737 init_completion(&iser_conn->stop_completion); in iser_conn_init()
738 init_completion(&iser_conn->ib_completion); in iser_conn_init()
739 init_completion(&iser_conn->up_completion); in iser_conn_init()
740 INIT_LIST_HEAD(&iser_conn->conn_list); in iser_conn_init()
741 mutex_init(&iser_conn->state_mutex); in iser_conn_init()
750 int iser_connect(struct iser_conn *iser_conn, struct sockaddr *src_addr, in iser_connect() argument
753 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_connect()
756 mutex_lock(&iser_conn->state_mutex); in iser_connect()
758 sprintf(iser_conn->name, "%pISp", dst_addr); in iser_connect()
760 iser_info("connecting to: %s\n", iser_conn->name); in iser_connect()
765 iser_conn->state = ISER_CONN_PENDING; in iser_connect()
768 iser_conn, RDMA_PS_TCP, IB_QPT_RC); in iser_connect()
782 wait_for_completion_interruptible(&iser_conn->up_completion); in iser_connect()
784 if (iser_conn->state != ISER_CONN_UP) { in iser_connect()
789 mutex_unlock(&iser_conn->state_mutex); in iser_connect()
792 list_add(&iser_conn->conn_list, &ig.connlist); in iser_connect()
799 iser_conn->state = ISER_CONN_DOWN; in iser_connect()
801 mutex_unlock(&iser_conn->state_mutex); in iser_connect()
802 iser_conn_release(iser_conn); in iser_connect()
806 int iser_post_recvl(struct iser_conn *iser_conn) in iser_post_recvl() argument
808 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_post_recvl()
809 struct iser_login_desc *desc = &iser_conn->login_desc; in iser_post_recvl()
830 int iser_post_recvm(struct iser_conn *iser_conn, struct iser_rx_desc *rx_desc) in iser_post_recvm() argument
832 struct ib_conn *ib_conn = &iser_conn->ib_conn; in iser_post_recvm()
939 struct iser_conn *iser_conn = to_iser_conn(wc->qp->qp_context); in iser_err_comp() local
945 if (iser_conn->iscsi_conn) in iser_err_comp()
946 iscsi_conn_failure(iser_conn->iscsi_conn, in iser_err_comp()