• Home
  • Raw
  • Download

Lines Matching refs:conn

477 int iscsit_queue_rsp(struct iscsi_conn *conn, struct iscsi_cmd *cmd)  in iscsit_queue_rsp()  argument
479 return iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); in iscsit_queue_rsp()
483 void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) in iscsit_aborted_task() argument
485 spin_lock_bh(&conn->cmd_lock); in iscsit_aborted_task()
488 spin_unlock_bh(&conn->cmd_lock); in iscsit_aborted_task()
499 iscsit_xmit_nondatain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_xmit_nondatain_pdu() argument
511 if (conn->conn_ops->HeaderDigest) { in iscsit_xmit_nondatain_pdu()
514 iscsit_do_crypto_hash_buf(conn->conn_tx_hash, hdr, in iscsit_xmit_nondatain_pdu()
540 if (conn->conn_ops->DataDigest) { in iscsit_xmit_nondatain_pdu()
541 iscsit_do_crypto_hash_buf(conn->conn_tx_hash, in iscsit_xmit_nondatain_pdu()
558 ret = iscsit_send_tx_data(cmd, conn, 1); in iscsit_xmit_nondatain_pdu()
560 iscsit_tx_thread_wait_for_tcp(conn); in iscsit_xmit_nondatain_pdu()
573 iscsit_xmit_datain_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_xmit_datain_pdu() argument
585 if (conn->conn_ops->HeaderDigest) { in iscsit_xmit_datain_pdu()
588 iscsit_do_crypto_hash_buf(conn->conn_tx_hash, cmd->pdu, in iscsit_xmit_datain_pdu()
617 if (conn->conn_ops->DataDigest) { in iscsit_xmit_datain_pdu()
618 cmd->data_crc = iscsit_do_crypto_hash_sg(conn->conn_tx_hash, in iscsit_xmit_datain_pdu()
635 ret = iscsit_fe_sendpage_sg(cmd, conn); in iscsit_xmit_datain_pdu()
640 iscsit_tx_thread_wait_for_tcp(conn); in iscsit_xmit_datain_pdu()
647 static int iscsit_xmit_pdu(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_xmit_pdu() argument
652 return iscsit_xmit_datain_pdu(conn, cmd, buf); in iscsit_xmit_pdu()
654 return iscsit_xmit_nondatain_pdu(conn, cmd, buf, buf_len); in iscsit_xmit_pdu()
657 static enum target_prot_op iscsit_get_sup_prot_ops(struct iscsi_conn *conn) in iscsit_get_sup_prot_ops() argument
790 struct iscsi_conn *conn, in iscsit_add_reject() argument
796 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsit_add_reject()
810 spin_lock_bh(&conn->cmd_lock); in iscsit_add_reject()
811 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_add_reject()
812 spin_unlock_bh(&conn->cmd_lock); in iscsit_add_reject()
815 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_add_reject()
827 struct iscsi_conn *conn; in iscsit_add_reject_from_cmd() local
830 if (!cmd->conn) { in iscsit_add_reject_from_cmd()
835 conn = cmd->conn; in iscsit_add_reject_from_cmd()
848 spin_lock_bh(&conn->cmd_lock); in iscsit_add_reject_from_cmd()
849 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_add_reject_from_cmd()
850 spin_unlock_bh(&conn->cmd_lock); in iscsit_add_reject_from_cmd()
854 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_add_reject_from_cmd()
951 static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) in iscsit_ack_from_expstatsn() argument
956 conn->exp_statsn = exp_statsn; in iscsit_ack_from_expstatsn()
958 if (conn->sess->sess_ops->RDMAExtensions) in iscsit_ack_from_expstatsn()
961 spin_lock_bh(&conn->cmd_lock); in iscsit_ack_from_expstatsn()
962 list_for_each_entry_safe(cmd, cmd_p, &conn->conn_cmd_list, i_conn_node) { in iscsit_ack_from_expstatsn()
973 spin_unlock_bh(&conn->cmd_lock); in iscsit_ack_from_expstatsn()
994 int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_setup_scsi_cmd() argument
1002 atomic_long_inc(&conn->sess->cmd_pdus); in iscsit_setup_scsi_cmd()
1060 if (payload_length && !conn->sess->sess_ops->ImmediateData) { in iscsit_setup_scsi_cmd()
1084 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) { in iscsit_setup_scsi_cmd()
1087 payload_length, conn->conn_ops->MaxXmitDataSegmentLength); in iscsit_setup_scsi_cmd()
1092 if (payload_length > conn->sess->sess_ops->FirstBurstLength) { in iscsit_setup_scsi_cmd()
1095 payload_length, conn->sess->sess_ops->FirstBurstLength); in iscsit_setup_scsi_cmd()
1133 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; in iscsit_setup_scsi_cmd()
1135 cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); in iscsit_setup_scsi_cmd()
1142 if (!conn->sess->sess_ops->RDMAExtensions && in iscsit_setup_scsi_cmd()
1158 conn->sess->se_sess, be32_to_cpu(hdr->data_length), in iscsit_setup_scsi_cmd()
1165 conn->cid); in iscsit_setup_scsi_cmd()
1196 spin_lock_bh(&conn->cmd_lock); in iscsit_setup_scsi_cmd()
1197 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_setup_scsi_cmd()
1198 spin_unlock_bh(&conn->cmd_lock); in iscsit_setup_scsi_cmd()
1214 iscsit_start_dataout_timer(cmd, cmd->conn); in iscsit_set_unsolicited_dataout()
1219 int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_process_scsi_cmd() argument
1234 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, in iscsit_process_scsi_cmd()
1244 iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn)); in iscsit_process_scsi_cmd()
1295 rc = iscsit_dump_data_payload(cmd->conn, length, 1); in iscsit_get_immediate_data()
1310 cmdsn_ret = iscsit_sequence_cmd(cmd->conn, cmd, in iscsit_get_immediate_data()
1335 iscsit_add_cmd_to_immediate_queue(cmd, cmd->conn, cmd->i_state); in iscsit_get_immediate_data()
1343 iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_handle_scsi_cmd() argument
1350 rc = iscsit_setup_scsi_cmd(conn, cmd, buf); in iscsit_handle_scsi_cmd()
1363 rc = iscsit_process_scsi_cmd(conn, cmd, hdr); in iscsit_handle_scsi_cmd()
1449 __iscsit_check_dataout_hdr(struct iscsi_conn *conn, void *buf, in __iscsit_check_dataout_hdr() argument
1458 atomic_long_add(payload_length, &conn->sess->rx_data_octets); in __iscsit_check_dataout_hdr()
1463 payload_length, conn->cid); in __iscsit_check_dataout_hdr()
1469 return iscsit_dump_data_payload(conn, payload_length, 1); in __iscsit_check_dataout_hdr()
1475 return iscsit_dump_data_payload(conn, payload_length, 1); in __iscsit_check_dataout_hdr()
1490 if (conn->sess->sess_ops->InitialR2T) { in __iscsit_check_dataout_hdr()
1517 return iscsit_dump_data_payload(conn, payload_length, 1); in __iscsit_check_dataout_hdr()
1535 return iscsit_dump_data_payload(conn, payload_length, 1); in __iscsit_check_dataout_hdr()
1553 iscsit_check_dataout_hdr(struct iscsi_conn *conn, void *buf, in iscsit_check_dataout_hdr() argument
1567 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) { in iscsit_check_dataout_hdr()
1570 conn->conn_ops->MaxXmitDataSegmentLength); in iscsit_check_dataout_hdr()
1571 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, buf); in iscsit_check_dataout_hdr()
1574 cmd = iscsit_find_cmd_from_itt_or_dump(conn, hdr->itt, payload_length); in iscsit_check_dataout_hdr()
1578 rc = __iscsit_check_dataout_hdr(conn, buf, cmd, payload_length, &success); in iscsit_check_dataout_hdr()
1588 iscsit_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_get_dataout() argument
1616 if (conn->conn_ops->DataDigest) { in iscsit_get_dataout()
1623 rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); in iscsit_get_dataout()
1630 if (conn->conn_ops->DataDigest) { in iscsit_get_dataout()
1633 data_crc = iscsit_do_crypto_hash_sg(conn->conn_rx_hash, cmd, in iscsit_get_dataout()
1659 struct iscsi_conn *conn = cmd->conn; in iscsit_check_dataout_payload() local
1670 conn->conn_transport->iscsit_get_dataout(conn, cmd, false); in iscsit_check_dataout_payload()
1694 static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf) in iscsit_handle_data_out() argument
1701 rc = iscsit_check_dataout_hdr(conn, buf, &cmd); in iscsit_handle_data_out()
1707 rc = iscsit_get_dataout(conn, cmd, hdr); in iscsit_handle_data_out()
1716 int iscsit_setup_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_setup_nop_out() argument
1724 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_setup_nop_out()
1735 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_setup_nop_out()
1742 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) { in iscsit_setup_nop_out()
1746 conn->conn_ops->MaxXmitDataSegmentLength); in iscsit_setup_nop_out()
1748 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_setup_nop_out()
1772 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; in iscsit_setup_nop_out()
1783 int iscsit_process_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_process_nop_out() argument
1793 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_process_nop_out()
1796 spin_lock_bh(&conn->cmd_lock); in iscsit_process_nop_out()
1797 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_process_nop_out()
1798 spin_unlock_bh(&conn->cmd_lock); in iscsit_process_nop_out()
1800 iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn)); in iscsit_process_nop_out()
1803 iscsit_add_cmd_to_response_queue(cmd, conn, in iscsit_process_nop_out()
1808 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, in iscsit_process_nop_out()
1821 cmd_p = iscsit_find_cmd_from_ttt(conn, be32_to_cpu(hdr->ttt)); in iscsit_process_nop_out()
1825 iscsit_stop_nopin_response_timer(conn); in iscsit_process_nop_out()
1828 iscsit_add_cmd_to_immediate_queue(cmd_p, conn, cmd_p->i_state); in iscsit_process_nop_out()
1830 iscsit_start_nopin_timer(conn); in iscsit_process_nop_out()
1845 static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_handle_nop_out() argument
1854 ret = iscsit_setup_nop_out(conn, cmd, hdr); in iscsit_handle_nop_out()
1882 if (conn->conn_ops->DataDigest) { in iscsit_handle_nop_out()
1889 rx_got = rx_data(conn, &cmd->iov_misc[0], niov, rx_size); in iscsit_handle_nop_out()
1895 if (conn->conn_ops->DataDigest) { in iscsit_handle_nop_out()
1896 iscsit_do_crypto_hash_buf(conn->conn_rx_hash, ping_data, in iscsit_handle_nop_out()
1904 if (!conn->sess->sess_ops->ErrorRecoveryLevel) { in iscsit_handle_nop_out()
1940 return iscsit_process_nop_out(conn, cmd, hdr); in iscsit_handle_nop_out()
1972 iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_handle_task_mgt_cmd() argument
1988 hdr->rtt, hdr->refcmdsn, conn->cid); in iscsit_handle_task_mgt_cmd()
2018 conn->sess->se_sess, 0, DMA_NONE, in iscsit_handle_task_mgt_cmd()
2077 if (iscsit_tmr_task_warm_reset(conn, tmr_req, buf) < 0) { in iscsit_handle_task_mgt_cmd()
2083 if (iscsit_tmr_task_cold_reset(conn, tmr_req, buf) < 0) { in iscsit_handle_task_mgt_cmd()
2097 if (iscsit_check_task_reassign_expdatasn(tmr_req, conn) < 0) in iscsit_handle_task_mgt_cmd()
2112 spin_lock_bh(&conn->cmd_lock); in iscsit_handle_task_mgt_cmd()
2113 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_handle_task_mgt_cmd()
2114 spin_unlock_bh(&conn->cmd_lock); in iscsit_handle_task_mgt_cmd()
2117 int cmdsn_ret = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); in iscsit_handle_task_mgt_cmd()
2127 iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn)); in iscsit_handle_task_mgt_cmd()
2145 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_handle_task_mgt_cmd()
2153 iscsit_setup_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_setup_text_cmd() argument
2158 if (payload_length > conn->conn_ops->MaxXmitDataSegmentLength) { in iscsit_setup_text_cmd()
2161 payload_length, conn->conn_ops->MaxXmitDataSegmentLength); in iscsit_setup_text_cmd()
2180 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; in iscsit_setup_text_cmd()
2193 iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_process_text_cmd() argument
2227 spin_lock_bh(&conn->cmd_lock); in iscsit_process_text_cmd()
2228 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_process_text_cmd()
2229 spin_unlock_bh(&conn->cmd_lock); in iscsit_process_text_cmd()
2232 iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn)); in iscsit_process_text_cmd()
2235 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, in iscsit_process_text_cmd()
2252 iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_handle_text_cmd() argument
2260 rc = iscsit_setup_text_cmd(conn, cmd, hdr); in iscsit_handle_text_cmd()
2286 if (conn->conn_ops->DataDigest) { in iscsit_handle_text_cmd()
2293 rx_got = rx_data(conn, &iov[0], niov, rx_size); in iscsit_handle_text_cmd()
2297 if (conn->conn_ops->DataDigest) { in iscsit_handle_text_cmd()
2298 iscsit_do_crypto_hash_buf(conn->conn_rx_hash, in iscsit_handle_text_cmd()
2306 if (!conn->sess->sess_ops->ErrorRecoveryLevel) { in iscsit_handle_text_cmd()
2333 return iscsit_process_text_cmd(conn, cmd, hdr); in iscsit_handle_text_cmd()
2341 int iscsit_logout_closesession(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_logout_closesession() argument
2344 struct iscsi_session *sess = conn->sess; in iscsit_logout_closesession()
2347 " for SID: %u.\n", conn->cid, conn->sess->sid); in iscsit_logout_closesession()
2350 atomic_set(&conn->conn_logout_remove, 1); in iscsit_logout_closesession()
2351 conn->conn_logout_reason = ISCSI_LOGOUT_REASON_CLOSE_SESSION; in iscsit_logout_closesession()
2353 iscsit_inc_conn_usage_count(conn); in iscsit_logout_closesession()
2366 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_logout_closesession()
2371 int iscsit_logout_closeconnection(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_logout_closeconnection() argument
2374 struct iscsi_session *sess = conn->sess; in iscsit_logout_closeconnection()
2377 " %hu on CID: %hu.\n", cmd->logout_cid, conn->cid); in iscsit_logout_closeconnection()
2383 if (conn->cid == cmd->logout_cid) { in iscsit_logout_closeconnection()
2384 spin_lock_bh(&conn->state_lock); in iscsit_logout_closeconnection()
2386 conn->conn_state = TARG_CONN_STATE_IN_LOGOUT; in iscsit_logout_closeconnection()
2388 atomic_set(&conn->conn_logout_remove, 1); in iscsit_logout_closeconnection()
2389 conn->conn_logout_reason = ISCSI_LOGOUT_REASON_CLOSE_CONNECTION; in iscsit_logout_closeconnection()
2390 iscsit_inc_conn_usage_count(conn); in iscsit_logout_closeconnection()
2392 spin_unlock_bh(&conn->state_lock); in iscsit_logout_closeconnection()
2406 iscsit_add_cmd_to_response_queue(cmd, conn, in iscsit_logout_closeconnection()
2414 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_logout_closeconnection()
2419 int iscsit_logout_removeconnforrecovery(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_logout_removeconnforrecovery() argument
2421 struct iscsi_session *sess = conn->sess; in iscsit_logout_removeconnforrecovery()
2424 " CID: %hu on CID: %hu.\n", cmd->logout_cid, conn->cid); in iscsit_logout_removeconnforrecovery()
2430 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_logout_removeconnforrecovery()
2434 if (conn->cid == cmd->logout_cid) { in iscsit_logout_removeconnforrecovery()
2437 cmd->logout_cid, conn->cid); in iscsit_logout_removeconnforrecovery()
2439 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_logout_removeconnforrecovery()
2443 iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); in iscsit_logout_removeconnforrecovery()
2449 iscsit_handle_logout_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, in iscsit_handle_logout_cmd() argument
2455 struct iscsi_tiqn *tiqn = iscsit_snmp_get_tiqn(conn); in iscsit_handle_logout_cmd()
2472 hdr->cid, conn->cid); in iscsit_handle_logout_cmd()
2474 if (conn->conn_state != TARG_CONN_STATE_LOGGED_IN) { in iscsit_handle_logout_cmd()
2484 conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; in iscsit_handle_logout_cmd()
2498 be16_to_cpu(hdr->cid) == conn->cid)) in iscsit_handle_logout_cmd()
2501 spin_lock_bh(&conn->cmd_lock); in iscsit_handle_logout_cmd()
2502 list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list); in iscsit_handle_logout_cmd()
2503 spin_unlock_bh(&conn->cmd_lock); in iscsit_handle_logout_cmd()
2506 iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn)); in iscsit_handle_logout_cmd()
2518 cmdsn_ret = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); in iscsit_handle_logout_cmd()
2530 struct iscsi_conn *conn, in iscsit_handle_snack() argument
2541 hdr->begrun, hdr->runlength, conn->cid); in iscsit_handle_snack()
2543 if (!conn->sess->sess_ops->ErrorRecoveryLevel) { in iscsit_handle_snack()
2546 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_handle_snack()
2555 return iscsit_handle_recovery_datain_or_r2t(conn, buf, in iscsit_handle_snack()
2561 return iscsit_handle_status_snack(conn, hdr->itt, in iscsit_handle_snack()
2565 return iscsit_handle_data_ack(conn, be32_to_cpu(hdr->ttt), in iscsit_handle_snack()
2571 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_handle_snack()
2576 return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_handle_snack()
2584 static void iscsit_rx_thread_wait_for_tcp(struct iscsi_conn *conn) in iscsit_rx_thread_wait_for_tcp() argument
2586 if ((conn->sock->sk->sk_shutdown & SEND_SHUTDOWN) || in iscsit_rx_thread_wait_for_tcp()
2587 (conn->sock->sk->sk_shutdown & RCV_SHUTDOWN)) { in iscsit_rx_thread_wait_for_tcp()
2589 &conn->rx_half_close_comp, in iscsit_rx_thread_wait_for_tcp()
2601 struct iscsi_conn *conn = cmd->conn; in iscsit_handle_immediate_data() local
2639 if (conn->conn_ops->DataDigest) { in iscsit_handle_immediate_data()
2646 rx_got = rx_data(conn, &cmd->iov_data[0], iov_count, rx_size); in iscsit_handle_immediate_data()
2651 iscsit_rx_thread_wait_for_tcp(conn); in iscsit_handle_immediate_data()
2655 if (conn->conn_ops->DataDigest) { in iscsit_handle_immediate_data()
2658 data_crc = iscsit_do_crypto_hash_sg(conn->conn_rx_hash, cmd, in iscsit_handle_immediate_data()
2667 if (!conn->sess->sess_ops->ErrorRecoveryLevel) { in iscsit_handle_immediate_data()
2702 static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) in iscsit_build_conn_drop_async_message() argument
2708 lockdep_assert_held(&conn->sess->conn_lock); in iscsit_build_conn_drop_async_message()
2714 list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) { in iscsit_build_conn_drop_async_message()
2731 cmd->logout_cid = conn->cid; in iscsit_build_conn_drop_async_message()
2745 struct iscsi_conn *conn) in iscsit_send_conn_drop_async_message() argument
2757 cmd->stat_sn = conn->stat_sn++; in iscsit_send_conn_drop_async_message()
2759 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_send_conn_drop_async_message()
2760 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_send_conn_drop_async_message()
2763 hdr->param2 = cpu_to_be16(conn->sess->sess_ops->DefaultTime2Wait); in iscsit_send_conn_drop_async_message()
2764 hdr->param3 = cpu_to_be16(conn->sess->sess_ops->DefaultTime2Retain); in iscsit_send_conn_drop_async_message()
2768 cmd->logout_cid, conn->cid); in iscsit_send_conn_drop_async_message()
2770 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, NULL, 0); in iscsit_send_conn_drop_async_message()
2773 static void iscsit_tx_thread_wait_for_tcp(struct iscsi_conn *conn) in iscsit_tx_thread_wait_for_tcp() argument
2775 if ((conn->sock->sk->sk_shutdown & SEND_SHUTDOWN) || in iscsit_tx_thread_wait_for_tcp()
2776 (conn->sock->sk->sk_shutdown & RCV_SHUTDOWN)) { in iscsit_tx_thread_wait_for_tcp()
2778 &conn->tx_half_close_comp, in iscsit_tx_thread_wait_for_tcp()
2784 iscsit_build_datain_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_datain_pdu() argument
2817 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_datain_pdu()
2818 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_datain_pdu()
2825 ntohl(hdr->offset), datain->length, conn->cid); in iscsit_build_datain_pdu()
2829 static int iscsit_send_datain(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_send_datain() argument
2855 atomic_long_add(datain.length, &conn->sess->tx_data_octets); in iscsit_send_datain()
2866 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_send_datain()
2867 cmd->stat_sn = conn->stat_sn++; in iscsit_send_datain()
2874 iscsit_build_datain_pdu(cmd, conn, &datain, hdr, set_statsn); in iscsit_send_datain()
2876 ret = conn->conn_transport->iscsit_xmit_pdu(conn, cmd, dr, &datain, 0); in iscsit_send_datain()
2890 iscsit_build_logout_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_logout_rsp() argument
2895 struct iscsi_session *sess = conn->sess; in iscsit_build_logout_rsp()
2923 " successful.\n", cmd->logout_cid, conn->cid); in iscsit_build_logout_rsp()
2942 conn->sess, cmd->logout_cid); in iscsit_build_logout_rsp()
2955 cmd->logout_cid, conn->cid); in iscsit_build_logout_rsp()
2968 cmd->stat_sn = conn->stat_sn++; in iscsit_build_logout_rsp()
2971 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_build_logout_rsp()
2972 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_logout_rsp()
2973 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_logout_rsp()
2978 cmd->logout_cid, conn->cid); in iscsit_build_logout_rsp()
2985 iscsit_send_logout(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_send_logout() argument
2989 rc = iscsit_build_logout_rsp(cmd, conn, in iscsit_send_logout()
2994 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, NULL, 0); in iscsit_send_logout()
2998 iscsit_build_nopin_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_nopin_rsp() argument
3008 cmd->stat_sn = (nopout_response) ? conn->stat_sn++ : in iscsit_build_nopin_rsp()
3009 conn->stat_sn; in iscsit_build_nopin_rsp()
3013 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_build_nopin_rsp()
3015 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_nopin_rsp()
3016 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_nopin_rsp()
3030 struct iscsi_conn *conn, in iscsit_send_unsolicited_nopin() argument
3036 iscsit_build_nopin_rsp(cmd, conn, hdr, false); in iscsit_send_unsolicited_nopin()
3039 " 0x%08x CID: %hu\n", hdr->ttt, cmd->stat_sn, conn->cid); in iscsit_send_unsolicited_nopin()
3041 ret = conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, NULL, 0); in iscsit_send_unsolicited_nopin()
3054 iscsit_send_nopin(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_send_nopin() argument
3058 iscsit_build_nopin_rsp(cmd, conn, hdr, true); in iscsit_send_nopin()
3066 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, in iscsit_send_nopin()
3073 struct iscsi_conn *conn) in iscsit_send_r2t() argument
3090 if (conn->conn_transport->iscsit_get_r2t_ttt) in iscsit_send_r2t()
3091 conn->conn_transport->iscsit_get_r2t_ttt(conn, cmd, r2t); in iscsit_send_r2t()
3093 r2t->targ_xfer_tag = session_get_next_ttt(conn->sess); in iscsit_send_r2t()
3095 hdr->statsn = cpu_to_be32(conn->stat_sn); in iscsit_send_r2t()
3096 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_send_r2t()
3097 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_send_r2t()
3106 r2t->offset, r2t->xfer_len, conn->cid); in iscsit_send_r2t()
3112 ret = conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, NULL, 0); in iscsit_send_r2t()
3118 iscsit_start_dataout_timer(cmd, conn); in iscsit_send_r2t()
3129 struct iscsi_conn *conn, in iscsit_build_r2ts_for_cmd() argument
3142 if (conn->sess->sess_ops->DataSequenceInOrder && in iscsit_build_r2ts_for_cmd()
3146 while (cmd->outstanding_r2ts < conn->sess->sess_ops->MaxOutstandingR2T) { in iscsit_build_r2ts_for_cmd()
3147 if (conn->sess->sess_ops->DataSequenceInOrder) { in iscsit_build_r2ts_for_cmd()
3152 conn->sess->sess_ops->MaxBurstLength - in iscsit_build_r2ts_for_cmd()
3159 conn->sess->sess_ops->MaxBurstLength - in iscsit_build_r2ts_for_cmd()
3163 conn->sess->sess_ops->MaxBurstLength; in iscsit_build_r2ts_for_cmd()
3168 xfer_len = conn->sess->sess_ops->MaxBurstLength; in iscsit_build_r2ts_for_cmd()
3212 void iscsit_build_rsp_pdu(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_rsp_pdu() argument
3216 cmd->stat_sn = conn->stat_sn++; in iscsit_build_rsp_pdu()
3218 atomic_long_inc(&conn->sess->rsp_pdus); in iscsit_build_rsp_pdu()
3235 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_build_rsp_pdu()
3236 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_rsp_pdu()
3237 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_rsp_pdu()
3242 cmd->se_cmd.scsi_status, conn->cid); in iscsit_build_rsp_pdu()
3246 static int iscsit_send_response(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_send_response() argument
3253 iscsit_build_rsp_pdu(cmd, conn, inc_stat_sn, hdr); in iscsit_send_response()
3281 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, data_buf, in iscsit_send_response()
3303 iscsit_build_task_mgt_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_task_mgt_rsp() argument
3312 cmd->stat_sn = conn->stat_sn++; in iscsit_build_task_mgt_rsp()
3315 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_build_task_mgt_rsp()
3316 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_task_mgt_rsp()
3317 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_task_mgt_rsp()
3321 cmd->init_task_tag, cmd->stat_sn, hdr->response, conn->cid); in iscsit_build_task_mgt_rsp()
3326 iscsit_send_task_mgt_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) in iscsit_send_task_mgt_rsp() argument
3330 iscsit_build_task_mgt_rsp(cmd, conn, hdr); in iscsit_send_task_mgt_rsp()
3332 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, NULL, 0); in iscsit_send_task_mgt_rsp()
3343 struct iscsi_conn *conn = cmd->conn; in iscsit_build_sendtargets_response() local
3353 buffer_len = min(conn->conn_ops->MaxRecvDataSegmentLength, in iscsit_build_sendtargets_response()
3398 cmd->conn->sess->sess_ops->InitiatorName))) { in iscsit_build_sendtargets_response()
3442 sockaddr = &conn->local_sockaddr; in iscsit_build_sendtargets_response()
3488 iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_text_rsp() argument
3507 cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); in iscsit_build_text_rsp()
3514 cmd->stat_sn = conn->stat_sn++; in iscsit_build_text_rsp()
3517 iscsit_increment_maxcmdsn(cmd, conn->sess); in iscsit_build_text_rsp()
3524 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_text_rsp()
3525 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_text_rsp()
3529 cmd->targ_xfer_tag, cmd->stat_sn, text_length, conn->cid, in iscsit_build_text_rsp()
3539 struct iscsi_conn *conn) in iscsit_send_text_rsp() argument
3544 text_length = iscsit_build_text_rsp(cmd, conn, hdr, in iscsit_send_text_rsp()
3545 conn->conn_transport->transport_type); in iscsit_send_text_rsp()
3549 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, in iscsit_send_text_rsp()
3555 iscsit_build_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn, in iscsit_build_reject() argument
3563 cmd->stat_sn = conn->stat_sn++; in iscsit_build_reject()
3565 hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); in iscsit_build_reject()
3566 hdr->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); in iscsit_build_reject()
3573 struct iscsi_conn *conn) in iscsit_send_reject() argument
3577 iscsit_build_reject(cmd, conn, hdr); in iscsit_send_reject()
3580 " CID: %hu\n", ntohl(hdr->statsn), hdr->reason, conn->cid); in iscsit_send_reject()
3582 return conn->conn_transport->iscsit_xmit_pdu(conn, cmd, NULL, in iscsit_send_reject()
3587 void iscsit_thread_get_cpumask(struct iscsi_conn *conn) in iscsit_thread_get_cpumask() argument
3598 ord = conn->bitmap_id % cpumask_weight(cpu_online_mask); in iscsit_thread_get_cpumask()
3601 cpumask_set_cpu(cpu, conn->conn_cpumask); in iscsit_thread_get_cpumask()
3609 cpumask_setall(conn->conn_cpumask); in iscsit_thread_get_cpumask()
3613 iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) in iscsit_immediate_queue() argument
3619 ret = iscsit_send_r2t(cmd, conn); in iscsit_immediate_queue()
3624 spin_lock_bh(&conn->cmd_lock); in iscsit_immediate_queue()
3626 spin_unlock_bh(&conn->cmd_lock); in iscsit_immediate_queue()
3631 iscsit_mod_nopin_response_timer(conn); in iscsit_immediate_queue()
3632 ret = iscsit_send_unsolicited_nopin(cmd, conn, 1); in iscsit_immediate_queue()
3637 ret = iscsit_send_unsolicited_nopin(cmd, conn, 0); in iscsit_immediate_queue()
3645 conn->cid); in iscsit_immediate_queue()
3657 iscsit_handle_immediate_queue(struct iscsi_conn *conn) in iscsit_handle_immediate_queue() argument
3659 struct iscsit_transport *t = conn->conn_transport; in iscsit_handle_immediate_queue()
3665 while ((qr = iscsit_get_cmd_from_immediate_queue(conn))) { in iscsit_handle_immediate_queue()
3666 atomic_set(&conn->check_immediate_queue, 0); in iscsit_handle_immediate_queue()
3671 ret = t->iscsit_immediate_queue(conn, cmd, state); in iscsit_handle_immediate_queue()
3680 iscsit_response_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) in iscsit_response_queue() argument
3687 ret = iscsit_send_datain(cmd, conn); in iscsit_response_queue()
3699 if (atomic_read(&conn->check_immediate_queue)) in iscsit_response_queue()
3716 ret = iscsit_send_response(cmd, conn); in iscsit_response_queue()
3719 ret = iscsit_send_logout(cmd, conn); in iscsit_response_queue()
3723 cmd, conn); in iscsit_response_queue()
3726 ret = iscsit_send_nopin(cmd, conn); in iscsit_response_queue()
3729 ret = iscsit_send_reject(cmd, conn); in iscsit_response_queue()
3732 ret = iscsit_send_task_mgt_rsp(cmd, conn); in iscsit_response_queue()
3735 ret = iscsit_tmr_post_handler(cmd, conn); in iscsit_response_queue()
3737 iscsit_fall_back_to_erl0(conn->sess); in iscsit_response_queue()
3740 ret = iscsit_send_text_rsp(cmd, conn); in iscsit_response_queue()
3746 state, conn->cid); in iscsit_response_queue()
3754 if (!iscsit_logout_post_handler(cmd, conn)) in iscsit_response_queue()
3772 cmd->i_state, conn->cid); in iscsit_response_queue()
3776 if (atomic_read(&conn->check_immediate_queue)) in iscsit_response_queue()
3786 static int iscsit_handle_response_queue(struct iscsi_conn *conn) in iscsit_handle_response_queue() argument
3788 struct iscsit_transport *t = conn->conn_transport; in iscsit_handle_response_queue()
3794 while ((qr = iscsit_get_cmd_from_response_queue(conn))) { in iscsit_handle_response_queue()
3799 ret = t->iscsit_response_queue(conn, cmd, state); in iscsit_handle_response_queue()
3810 struct iscsi_conn *conn = arg; in iscsi_target_tx_thread() local
3824 iscsit_thread_check_cpumask(conn, current, 1); in iscsi_target_tx_thread()
3826 wait_event_interruptible(conn->queues_wq, in iscsi_target_tx_thread()
3827 !iscsit_conn_all_queues_empty(conn)); in iscsi_target_tx_thread()
3833 ret = iscsit_handle_immediate_queue(conn); in iscsi_target_tx_thread()
3837 ret = iscsit_handle_response_queue(conn); in iscsi_target_tx_thread()
3854 if (conn->conn_state != TARG_CONN_STATE_IN_LOGIN) in iscsi_target_tx_thread()
3855 iscsit_take_action_for_connection_exit(conn, &conn_freed); in iscsi_target_tx_thread()
3865 static int iscsi_target_rx_opcode(struct iscsi_conn *conn, unsigned char *buf) in iscsi_target_rx_opcode() argument
3873 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsi_target_rx_opcode()
3877 ret = iscsit_handle_scsi_cmd(conn, cmd, buf); in iscsi_target_rx_opcode()
3880 ret = iscsit_handle_data_out(conn, buf); in iscsi_target_rx_opcode()
3885 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsi_target_rx_opcode()
3889 ret = iscsit_handle_nop_out(conn, cmd, buf); in iscsi_target_rx_opcode()
3892 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsi_target_rx_opcode()
3896 ret = iscsit_handle_task_mgt_cmd(conn, cmd, buf); in iscsi_target_rx_opcode()
3900 cmd = iscsit_find_cmd_from_itt(conn, hdr->itt); in iscsi_target_rx_opcode()
3904 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsi_target_rx_opcode()
3909 ret = iscsit_handle_text_cmd(conn, cmd, buf); in iscsi_target_rx_opcode()
3912 cmd = iscsit_allocate_cmd(conn, TASK_INTERRUPTIBLE); in iscsi_target_rx_opcode()
3916 ret = iscsit_handle_logout_cmd(conn, cmd, buf); in iscsi_target_rx_opcode()
3918 wait_for_completion_timeout(&conn->conn_logout_comp, in iscsi_target_rx_opcode()
3922 ret = iscsit_handle_snack(conn, buf); in iscsi_target_rx_opcode()
3926 if (!conn->sess->sess_ops->ErrorRecoveryLevel) { in iscsi_target_rx_opcode()
3939 return iscsit_add_reject(conn, ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf); in iscsi_target_rx_opcode()
3942 static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) in iscsi_target_check_conn_state() argument
3946 spin_lock_bh(&conn->state_lock); in iscsi_target_check_conn_state()
3947 ret = (conn->conn_state != TARG_CONN_STATE_LOGGED_IN); in iscsi_target_check_conn_state()
3948 spin_unlock_bh(&conn->state_lock); in iscsi_target_check_conn_state()
3953 static void iscsit_get_rx_pdu(struct iscsi_conn *conn) in iscsit_get_rx_pdu() argument
3969 iscsit_thread_check_cpumask(conn, current, 0); in iscsit_get_rx_pdu()
3976 ret = rx_data(conn, &iov, 1, ISCSI_HDR_LEN); in iscsit_get_rx_pdu()
3978 iscsit_rx_thread_wait_for_tcp(conn); in iscsit_get_rx_pdu()
3982 if (conn->conn_ops->HeaderDigest) { in iscsit_get_rx_pdu()
3986 ret = rx_data(conn, &iov, 1, ISCSI_CRC_LEN); in iscsit_get_rx_pdu()
3988 iscsit_rx_thread_wait_for_tcp(conn); in iscsit_get_rx_pdu()
3992 iscsit_do_crypto_hash_buf(conn->conn_rx_hash, buffer, in iscsit_get_rx_pdu()
4005 atomic_long_inc(&conn->sess->conn_digest_errors); in iscsit_get_rx_pdu()
4012 if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) in iscsit_get_rx_pdu()
4017 if (conn->sess->sess_ops->SessionType && in iscsit_get_rx_pdu()
4022 iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR, in iscsit_get_rx_pdu()
4027 ret = iscsi_target_rx_opcode(conn, buffer); in iscsit_get_rx_pdu()
4038 struct iscsi_conn *conn = arg; in iscsi_target_rx_thread() local
4050 rc = wait_for_completion_interruptible(&conn->rx_login_comp); in iscsi_target_rx_thread()
4051 if (rc < 0 || iscsi_target_check_conn_state(conn)) in iscsi_target_rx_thread()
4054 if (!conn->conn_transport->iscsit_get_rx_pdu) in iscsi_target_rx_thread()
4057 conn->conn_transport->iscsit_get_rx_pdu(conn); in iscsi_target_rx_thread()
4060 atomic_set(&conn->transport_failed, 1); in iscsi_target_rx_thread()
4061 iscsit_take_action_for_connection_exit(conn, &conn_freed); in iscsi_target_rx_thread()
4073 static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) in iscsit_release_commands_from_conn() argument
4077 struct iscsi_session *sess = conn->sess; in iscsit_release_commands_from_conn()
4083 spin_lock_bh(&conn->cmd_lock); in iscsit_release_commands_from_conn()
4084 list_splice_init(&conn->conn_cmd_list, &tmp_list); in iscsit_release_commands_from_conn()
4101 &conn->conn_cmd_list); in iscsit_release_commands_from_conn()
4107 spin_unlock_bh(&conn->cmd_lock); in iscsit_release_commands_from_conn()
4119 struct iscsi_conn *conn) in iscsit_stop_timers_for_cmds() argument
4123 spin_lock_bh(&conn->cmd_lock); in iscsit_stop_timers_for_cmds()
4124 list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { in iscsit_stop_timers_for_cmds()
4128 spin_unlock_bh(&conn->cmd_lock); in iscsit_stop_timers_for_cmds()
4132 struct iscsi_conn *conn) in iscsit_close_connection() argument
4134 int conn_logout = (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT); in iscsit_close_connection()
4135 struct iscsi_session *sess = conn->sess; in iscsit_close_connection()
4138 " %u\n", conn->cid, sess->sid); in iscsit_close_connection()
4150 if (!conn->conn_transport->rdma_shutdown) in iscsit_close_connection()
4151 complete(&conn->conn_logout_comp); in iscsit_close_connection()
4154 if (conn->tx_thread && in iscsit_close_connection()
4155 cmpxchg(&conn->tx_thread_active, true, false)) { in iscsit_close_connection()
4156 send_sig(SIGINT, conn->tx_thread, 1); in iscsit_close_connection()
4157 kthread_stop(conn->tx_thread); in iscsit_close_connection()
4160 if (conn->rx_thread && in iscsit_close_connection()
4161 cmpxchg(&conn->rx_thread_active, true, false)) { in iscsit_close_connection()
4162 send_sig(SIGINT, conn->rx_thread, 1); in iscsit_close_connection()
4163 kthread_stop(conn->rx_thread); in iscsit_close_connection()
4168 bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, in iscsit_close_connection()
4172 iscsit_stop_timers_for_cmds(conn); in iscsit_close_connection()
4173 iscsit_stop_nopin_response_timer(conn); in iscsit_close_connection()
4174 iscsit_stop_nopin_timer(conn); in iscsit_close_connection()
4176 if (conn->conn_transport->iscsit_wait_conn) in iscsit_close_connection()
4177 conn->conn_transport->iscsit_wait_conn(conn); in iscsit_close_connection()
4188 if (atomic_read(&conn->connection_recovery)) { in iscsit_close_connection()
4189 iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(conn); in iscsit_close_connection()
4190 iscsit_prepare_cmds_for_reallegiance(conn); in iscsit_close_connection()
4192 iscsit_clear_ooo_cmdsns_for_conn(conn); in iscsit_close_connection()
4193 iscsit_release_commands_from_conn(conn); in iscsit_close_connection()
4195 iscsit_free_queue_reqs_for_conn(conn); in iscsit_close_connection()
4202 if (atomic_read(&conn->conn_logout_remove)) { in iscsit_close_connection()
4203 if (conn->conn_logout_reason == ISCSI_LOGOUT_REASON_CLOSE_SESSION) { in iscsit_close_connection()
4204 iscsit_dec_conn_usage_count(conn); in iscsit_close_connection()
4207 if (conn->conn_logout_reason == ISCSI_LOGOUT_REASON_CLOSE_CONNECTION) in iscsit_close_connection()
4208 iscsit_dec_conn_usage_count(conn); in iscsit_close_connection()
4210 atomic_set(&conn->conn_logout_remove, 0); in iscsit_close_connection()
4216 list_del(&conn->conn_list); in iscsit_close_connection()
4223 if (atomic_read(&conn->connection_recovery)) in iscsit_close_connection()
4224 iscsit_build_conn_drop_async_message(conn); in iscsit_close_connection()
4233 spin_lock_bh(&conn->state_lock); in iscsit_close_connection()
4234 if (atomic_read(&conn->sleep_on_conn_wait_comp)) { in iscsit_close_connection()
4235 spin_unlock_bh(&conn->state_lock); in iscsit_close_connection()
4236 complete(&conn->conn_wait_comp); in iscsit_close_connection()
4237 wait_for_completion(&conn->conn_post_wait_comp); in iscsit_close_connection()
4238 spin_lock_bh(&conn->state_lock); in iscsit_close_connection()
4247 if (atomic_read(&conn->connection_wait_rcfr)) { in iscsit_close_connection()
4248 spin_unlock_bh(&conn->state_lock); in iscsit_close_connection()
4249 complete(&conn->conn_wait_rcfr_comp); in iscsit_close_connection()
4250 wait_for_completion(&conn->conn_post_wait_comp); in iscsit_close_connection()
4251 spin_lock_bh(&conn->state_lock); in iscsit_close_connection()
4253 atomic_set(&conn->connection_reinstatement, 1); in iscsit_close_connection()
4254 spin_unlock_bh(&conn->state_lock); in iscsit_close_connection()
4260 iscsit_check_conn_usage_count(conn); in iscsit_close_connection()
4262 ahash_request_free(conn->conn_tx_hash); in iscsit_close_connection()
4263 if (conn->conn_rx_hash) { in iscsit_close_connection()
4266 tfm = crypto_ahash_reqtfm(conn->conn_rx_hash); in iscsit_close_connection()
4267 ahash_request_free(conn->conn_rx_hash); in iscsit_close_connection()
4271 if (conn->sock) in iscsit_close_connection()
4272 sock_release(conn->sock); in iscsit_close_connection()
4274 if (conn->conn_transport->iscsit_free_conn) in iscsit_close_connection()
4275 conn->conn_transport->iscsit_free_conn(conn); in iscsit_close_connection()
4278 conn->conn_state = TARG_CONN_STATE_FREE; in iscsit_close_connection()
4279 iscsit_free_conn(conn); in iscsit_close_connection()
4440 struct iscsi_conn *conn) in iscsit_logout_post_handler_closesession() argument
4442 struct iscsi_session *sess = conn->sess; in iscsit_logout_post_handler_closesession()
4453 if (!conn->conn_transport->rdma_shutdown) { in iscsit_logout_post_handler_closesession()
4454 sleep = cmpxchg(&conn->tx_thread_active, true, false); in iscsit_logout_post_handler_closesession()
4459 atomic_set(&conn->conn_logout_remove, 0); in iscsit_logout_post_handler_closesession()
4460 complete(&conn->conn_logout_comp); in iscsit_logout_post_handler_closesession()
4462 iscsit_dec_conn_usage_count(conn); in iscsit_logout_post_handler_closesession()
4469 struct iscsi_conn *conn) in iscsit_logout_post_handler_samecid() argument
4473 if (!conn->conn_transport->rdma_shutdown) { in iscsit_logout_post_handler_samecid()
4474 sleep = cmpxchg(&conn->tx_thread_active, true, false); in iscsit_logout_post_handler_samecid()
4479 atomic_set(&conn->conn_logout_remove, 0); in iscsit_logout_post_handler_samecid()
4480 complete(&conn->conn_logout_comp); in iscsit_logout_post_handler_samecid()
4482 iscsit_cause_connection_reinstatement(conn, sleep); in iscsit_logout_post_handler_samecid()
4483 iscsit_dec_conn_usage_count(conn); in iscsit_logout_post_handler_samecid()
4487 struct iscsi_conn *conn, in iscsit_logout_post_handler_diffcid() argument
4491 struct iscsi_session *sess = conn->sess; in iscsit_logout_post_handler_diffcid()
4527 struct iscsi_conn *conn) in iscsit_logout_post_handler() argument
4537 iscsit_logout_post_handler_closesession(conn); in iscsit_logout_post_handler()
4542 if (conn->cid == cmd->logout_cid) { in iscsit_logout_post_handler()
4547 iscsit_logout_post_handler_samecid(conn); in iscsit_logout_post_handler()
4553 iscsit_logout_post_handler_diffcid(conn, in iscsit_logout_post_handler()
4585 struct iscsi_conn *conn; in iscsit_fail_session() local
4588 list_for_each_entry(conn, &sess->sess_conn_list, conn_list) { in iscsit_fail_session()
4590 conn->conn_state = TARG_CONN_STATE_CLEANUP_WAIT; in iscsit_fail_session()
4604 struct iscsi_conn *conn, *conn_tmp = NULL; in iscsit_stop_session() local
4610 list_for_each_entry_safe(conn, conn_tmp, &sess->sess_conn_list, in iscsit_stop_session()
4615 if (list_is_last(&conn->conn_list, &sess->sess_conn_list)) { in iscsit_stop_session()
4621 iscsit_inc_conn_usage_count(conn); in iscsit_stop_session()
4624 iscsit_cause_connection_reinstatement(conn, 1); in iscsit_stop_session()
4627 iscsit_dec_conn_usage_count(conn); in iscsit_stop_session()
4633 list_for_each_entry(conn, &sess->sess_conn_list, conn_list) in iscsit_stop_session()
4634 iscsit_cause_connection_reinstatement(conn, 0); in iscsit_stop_session()