/*
* 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.
*/
#include <sys/byteorder.h>
/*
*/
int
{
int status;
return (ISER_STATUS_FAIL);
}
"alloc failed");
return (ISER_STATUS_FAIL);
}
/* Send iSER Hello Message to declare iSER parameters to the target */
/* Allocate an iSER WR handle and tuck this msg into it */
iser_wr = iser_wr_get();
"iser wr handle");
return (ISER_STATUS_FAIL);
}
/* Use the address of our generic iser_wr handle as our WRID */
/* Populate the rest of the work request */
/*
* Avoid race condition by incrementing this channel's
* SQ posted count prior to calling ibt_post_send
*/
chan->ic_sq_post_count++;
if (status != IBT_SUCCESS) {
"failure (%d)", status);
chan->ic_sq_post_count--;
return (ISER_STATUS_FAIL);
}
return (ISER_STATUS_SUCCESS);
}
int
{
int status;
"found");
return (ISER_STATUS_FAIL);
}
"cache alloc failed");
return (ISER_STATUS_FAIL);
}
/* Use the iSER Hello Reply Message */
/* Allocate an iSER WR handle and tuck this msg into it */
iser_wr = iser_wr_get();
"allocate iser wr handle");
return (ISER_STATUS_FAIL);
}
/* Use the address of our generic iser_wr handle as our WRID */
/* Populate the rest of the work request */
chan->ic_sq_post_count++;
if (status != IBT_SUCCESS) {
"failure (%d)", status);
chan->ic_sq_post_count--;
return (ISER_STATUS_FAIL);
}
return (ISER_STATUS_SUCCESS);
}
/*
* iser_xfer_ctrlpdu
*
* This is iSER's implementation of the 'Send_control' operational primitive.
* This iSER layer uses the Send Message type of RCaP to transfer the iSCSI
* Control-type PDU. A special case is that the transfer of SCSI Data-out PDUs
* carrying unsolicited data are also treated as iSCSI Control-Type PDUs. The
* message payload contains an iSER header followed by the iSCSI Control-type
* the iSCSI Control-type PDU.
* This function is invoked by an initiator iSCSI layer requesting the transfer
* of a iSCSI command PDU or a target iSCSI layer requesting the transfer of a
* iSCSI response PDU.
*/
int
{
int status;
/* Bail out if the connection is closed */
return (ISER_STATUS_FAIL);
}
/* Pull the BHS out of the PDU handle */
/*
* All SCSI command PDU (except SCSI Read and SCSI Write) and the SCSI
* Response PDU are sent to the remote end using the SendSE Message.
*
* The StatSN may need to be sent (and possibly advanced) at this time
* for some PDUs, identified by the IDM_PDU_SET_STATSN flag.
*/
}
/*
* Setup a Send Message for carrying the iSCSI control-type PDU
* preceeded by an iSER header.
*/
return (ISER_STATUS_FAIL);
}
"alloc failed");
return (ISER_STATUS_FAIL);
}
/*
* Initialize header assuming no transfers
*/
/*
* On the initiator side, the task buffers will be used to identify
* if there are any buffers to be advertised
*/
}
}
/* Release our reference on the task */
}
/* Copy the BHS after the iSER header */
pdu->isp_hdrlen);
if (pdu->isp_datalen > 0) {
/* Copy the isp_data after the PDU header */
pdu->isp_datalen);
/* Set the SGE's ds_len */
} else {
/* No data, so set the SGE's ds_len to the headers length */
}
/*
* Build Work Request to be posted on the Send Queue.
*/
/* Allocate an iSER WR handle and tuck the msg and pdu into it */
iser_wr = iser_wr_get();
"iser wr handle");
return (ISER_STATUS_FAIL);
}
/*
* Use the address of our generic iser_wr handle as our WRID
* and populate the rest of the work request
*/
/* Increment this channel's SQ posted count */
chan->ic_sq_post_count++;
/* Post Send Work Request on the specified channel */
if (status != IBT_SUCCESS) {
"failure (%d)", status);
chan->ic_sq_post_count--;
return (ISER_STATUS_FAIL);
}
return (ISER_STATUS_SUCCESS);
}
/*
* iser_xfer_buf_to_ini
* This is iSER's implementation of the 'Put_Data' operational primitive.
* The iSCSI layer at the target invokes this function when it is ready to
* return the SCSI Read Data to the initiator. This function generates and
* sends an RDMA Write Message containing the read data to the initiator.
*/
int
{
int status;
/* Grab the iSER resources from the task and buf handles */
/* Bail out if the connection is closed */
return (ISER_STATUS_FAIL);
}
/* Pull the Read STag data out of the iSER header in the task hdl */
/* Set up the WR raddr and rkey based upon the Read iSER STag */
/* Set the transfer length from the IDM buf handle */
/* Allocate an iSER WR handle and tuck the IDM buf handle into it */
iser_wr = iser_wr_get();
"iser wr handle");
return (ISER_STATUS_FAIL);
}
/* Use the address of our generic iser_wr handle as our WRID */
/* Populate the rest of the work request */
#ifdef DEBUG
#endif
/* Increment this channel's SQ posted count */
if (status != IBT_SUCCESS) {
"failure (%d)", status);
return (ISER_STATUS_FAIL);
}
return (ISER_STATUS_SUCCESS);
}
/*
* iser_xfer_buf_from_ini
* This is iSER's implementation of the 'Get_Data' operational primitive.
* The iSCSI layer at the target invokes this function when it is ready to
* receive the SCSI Write Data from the initiator. This function generates and
* sends an RDMA Read Message to get the data from the initiator. No R2T PDUs
* are generated.
*/
int
{
int status;
/* Grab the iSER resources from the task and buf handles */
/* Bail out if the connection is closed */
return (ISER_STATUS_FAIL);
}
/* Pull the Write STag data out of the iSER header in the task hdl */
/* Set up the WR raddr and rkey based upon the iSER Write STag */
/* Set the transfer length from the IDM buf handle */
/* Allocate an iSER WR handle and tuck the IDM buf handle into it */
iser_wr = iser_wr_get();
"iser wr handle");
return (ISER_STATUS_FAIL);
}
/* Use the address of our generic iser_wr handle as our WRID */
/* Populate the rest of the work request */
#ifdef DEBUG
#endif
/* Increment this channel's SQ posted count */
if (status != IBT_SUCCESS) {
"failure (%d)", status);
return (ISER_STATUS_FAIL);
}
return (ISER_STATUS_SUCCESS);
}