4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #include <sys/cpuvar.h>
27 #include <sys/ddi.h>
28 #include <sys/sunddi.h>
29 #include <sys/modctl.h>
30 #include <sys/socket.h>
31 #include <sys/strsubr.h>
32 #include <sys/note.h>
33 #include <sys/sdt.h>
34
35 #define IDM_CONN_SM_STRINGS
36 #define IDM_CN_NOTIFY_STRINGS
37 #include <sys/idm/idm.h>
38
39 boolean_t idm_sm_logging = B_FALSE;
40
41 extern idm_global_t idm; /* Global state */
42
43 static void
592 event_ctx->iec_pdu_forwarded = B_TRUE;
593 pdu = (idm_pdu_t *)event_ctx->iec_info;
594 idm_pdu_rx_forward(ic, pdu);
595 /* FALLTHROUGH */
596 case CE_TRANSPORT_FAIL:
597 case CE_LOGOUT_OTHER_CONN_SND:
598 case CE_LOGOUT_OTHER_CONN_RCV:
599 /* T7 */
600 (void) untimeout(ic->ic_state_timeout);
601 (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL);
602 idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx);
603 break;
604 case CE_LOGOUT_SESSION_SUCCESS:
605 /*
606 * T8
607 * A session reinstatement request can be received while a
608 * session is active and a login is in process. The iSCSI
609 * connections are shut down by a CE_LOGOUT_SESSION_SUCCESS
610 * event sent from the session to the IDM layer.
611 */
612 if (IDM_CONN_ISTGT(ic)) {
613 ic->ic_transport_ops->it_tgt_conn_disconnect(ic);
614 } else {
615 ic->ic_transport_ops->it_ini_conn_disconnect(ic);
616 }
617 idm_update_state(ic, CS_S11_COMPLETE, event_ctx);
618 break;
619
620 case CE_LOGIN_SND:
621 ASSERT(ic->ic_client_callback == NULL);
622 /*
623 * Initiator connections will see initial login PDU
624 * in this state. Target connections see initial
625 * login PDU in "xpt up" state.
626 */
627 mutex_enter(&ic->ic_state_mutex);
628 if (!(ic->ic_state_flags & CF_INITIAL_LOGIN)) {
629 idm_initial_login_actions(ic, event_ctx);
630 }
631 mutex_exit(&ic->ic_state_mutex);
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013 by Delphix. All rights reserved.
25 */
26
27 #include <sys/cpuvar.h>
28 #include <sys/ddi.h>
29 #include <sys/sunddi.h>
30 #include <sys/modctl.h>
31 #include <sys/socket.h>
32 #include <sys/strsubr.h>
33 #include <sys/note.h>
34 #include <sys/sdt.h>
35
36 #define IDM_CONN_SM_STRINGS
37 #define IDM_CN_NOTIFY_STRINGS
38 #include <sys/idm/idm.h>
39
40 boolean_t idm_sm_logging = B_FALSE;
41
42 extern idm_global_t idm; /* Global state */
43
44 static void
593 event_ctx->iec_pdu_forwarded = B_TRUE;
594 pdu = (idm_pdu_t *)event_ctx->iec_info;
595 idm_pdu_rx_forward(ic, pdu);
596 /* FALLTHROUGH */
597 case CE_TRANSPORT_FAIL:
598 case CE_LOGOUT_OTHER_CONN_SND:
599 case CE_LOGOUT_OTHER_CONN_RCV:
600 /* T7 */
601 (void) untimeout(ic->ic_state_timeout);
602 (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL);
603 idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx);
604 break;
605 case CE_LOGOUT_SESSION_SUCCESS:
606 /*
607 * T8
608 * A session reinstatement request can be received while a
609 * session is active and a login is in process. The iSCSI
610 * connections are shut down by a CE_LOGOUT_SESSION_SUCCESS
611 * event sent from the session to the IDM layer.
612 */
613 (void) untimeout(ic->ic_state_timeout);
614 if (IDM_CONN_ISTGT(ic)) {
615 ic->ic_transport_ops->it_tgt_conn_disconnect(ic);
616 } else {
617 ic->ic_transport_ops->it_ini_conn_disconnect(ic);
618 }
619 idm_update_state(ic, CS_S11_COMPLETE, event_ctx);
620 break;
621
622 case CE_LOGIN_SND:
623 ASSERT(ic->ic_client_callback == NULL);
624 /*
625 * Initiator connections will see initial login PDU
626 * in this state. Target connections see initial
627 * login PDU in "xpt up" state.
628 */
629 mutex_enter(&ic->ic_state_mutex);
630 if (!(ic->ic_state_flags & CF_INITIAL_LOGIN)) {
631 idm_initial_login_actions(ic, event_ctx);
632 }
633 mutex_exit(&ic->ic_state_mutex);
|