/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* InfiniBand Communication Manager routines for iSER
*/
/*
* iser_ib_cm_handler()
*/
{
case IBT_CM_EVENT_REQ_RCV:
break;
case IBT_CM_EVENT_REP_RCV:
break;
case IBT_CM_EVENT_CONN_EST:
break;
case IBT_CM_EVENT_CONN_CLOSED:
"IBT_CM_EVENT_CONN_CLOSED");
break;
case IBT_CM_EVENT_FAILURE:
break;
case IBT_CM_EVENT_MRA_RCV:
/* Not supported */
break;
case IBT_CM_EVENT_LAP_RCV:
/* Not supported */
break;
case IBT_CM_EVENT_APR_RCV:
/* Not supported */
break;
default:
break;
}
return (ret);
}
/* ARGSUSED */
static ibt_cm_status_t
{
int status;
/*
* CM private data brings IP information
* Private data received is a stream of bytes and may not be properly
* aligned. So, bcopy the data onto the stack before accessing it.
*/
sizeof (iser_private_data_t));
/* extract the CM IP info */
&ipcm_info);
if (status != IBT_SUCCESS) {
return (IBT_CM_REJECT);
}
"(0x%08x) src port (0x%04x) dst IP: (0x%08x)", (void *)&ipcm_info,
/* Allocate a channel to establish the new connection */
"a channel from src IP (0x%08x) src port (0x%04x) "
"to dst IP: (0x%08x) on hca(%llx %d)",
return (IBT_CM_REJECT);
}
/* Set the local and remote ip */
/* Set the local and remote port numbers on the channel handle */
/* Allocate the iser_conn_t for the IDM svc binding */
/* Set up the iser_conn attributes */
/* Hold a reference to the iSER service handle */
/*
* Now set a pointer to the iser_conn in the iser_chan for
* access during CM event handling
*/
return (IBT_CM_ACCEPT);
}
/* ARGSUSED */
static ibt_cm_status_t
{
/* pre-post work requests into the receive queue */
/* It looks like the RTU need not be send specifically */
return (IBT_CM_ACCEPT);
}
static ibt_cm_status_t
{
/*
* An ibt_open_rc_channel() comes in as a IBT_CM_EVENT_REQ_RCV on the
* iSER-IB target, upon which the target sends a Response, accepting
* the request. This comes in as a IBT_CM_EVENT_REP_RCV on the iSER-IB
* initiator, which then sends an RTU. Upon getting this RTU from the
* iSER-IB initiator, the IBT_CM_EVENT_CONN_EST event is generated on
* the target. Then subsequently an IBT_CM_EVENT_CONN_EST event is
* generated on the initiator.
*
* Our new connection has been established on the target. If we are
* receiving this event on the target side, the iser_channel can be
* used as it is already populated. On the target side, an IDM
* connection is then allocated and the IDM layer is notified.
* If we are on the initiator we needn't do anything, since we
* already have the IDM linkage in place for this connection.
*/
if (status != IDM_STATUS_SUCCESS) {
/*
* No IDM rsrcs or something equally Bad.
* Return non-SUCCESS to IBCM. He'll give
* us a CONN_CLOSED, which we'll handle
* below.
*/
"idm_svc_conn_create_failed");
return (IBT_CM_NO_RESOURCE);
}
/* We no longer need the hold on the iSER service handle */
/* Hold a reference on the IDM connection handle */
/* Set the transport ops and conn on the idm_conn handle */
/*
* Set the local and remote addresses in the idm conn handle.
*/
/*
* Kick the state machine. At CS_S3_XPT_UP the state machine
* will notify the client (target) about the new connection.
*/
/*
* Post work requests on the receive queue
*/
}
return (IBT_CM_ACCEPT);
}
static ibt_cm_status_t
{
case IBT_CM_CLOSED_DREP_RCVD: /* we requested a disconnect */
case IBT_CM_CLOSED_ALREADY: /* duplicate close */
/* ignore these */
return (IBT_CM_ACCEPT);
case IBT_CM_CLOSED_DREQ_RCVD: /* request to close the channel */
case IBT_CM_CLOSED_REJ_RCVD: /* reject after conn establishment */
case IBT_CM_CLOSED_DREQ_TIMEOUT: /* our close request timed out */
case IBT_CM_CLOSED_DUP: /* duplicate close request */
case IBT_CM_CLOSED_ABORT: /* aborted connection establishment */
case IBT_CM_CLOSED_STALE: /* stale / unref connection */
/* handle these depending upon our connection state */
case ISER_CONN_STAGE_CLOSED:
/* do nothing, just drop the lock */
break;
/*
* We blew up or were offlined during connection
* establishment. Teardown the iSER conn and chan
* handles.
*/
break;
case ISER_CONN_STAGE_IC_FREED:
case ISER_CONN_STAGE_CLOSING:
/* we're down, set CLOSED */
break;
/* for all other stages, fail the transport */
break;
default:
ASSERT(0);
}
/* accept the event */
return (IBT_CM_ACCEPT);
default:
/* unknown event */
return (IBT_CM_REJECT);
}
}
/*
* Handle EVENT FAILURE
*/
static ibt_cm_status_t
{
"code: %d msg: %d reason: %d", (void *)chan,
/* channel not established yet */
return (IBT_CM_ACCEPT);
}
/*
* This end is active, just ignore, ibt_open_rc_channel()
* caller will take care of cleanup.
*/
return (IBT_CM_ACCEPT);
}
/* handle depending upon our connection state */
case ISER_CONN_STAGE_CLOSED:
/* do nothing, just drop the lock */
break;
/*
* We blew up or were offlined during connection
* establishment. Teardown the iSER conn and chan
* handles.
*/
break;
case ISER_CONN_STAGE_IC_FREED:
case ISER_CONN_STAGE_CLOSING:
/* update to CLOSED, then drop the lock */
break;
/* fail the transport and move the conn to CLOSING */
break;
default:
ASSERT(0);
}
/* accept the event */
return (IBT_CM_ACCEPT);
}