Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SCSI Base Target/Initiator

Functions

int32_t ocs_scsi_send_rd_data (ocs_io_t *io, uint32_t flags, ocs_scsi_dif_info_t *dif_info, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint64_t wire_len, ocs_scsi_io_cb_t cb, void *arg)
 Send read data. More...
 
int32_t ocs_scsi_recv_wr_data (ocs_io_t *io, uint32_t flags, ocs_scsi_dif_info_t *dif_info, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint64_t wire_len, ocs_scsi_io_cb_t cb, void *arg)
 Prepare to receive write data. More...
 
int32_t ocs_scsi_send_resp (ocs_io_t *io, uint32_t flags, ocs_scsi_cmd_resp_t *rsp, ocs_scsi_io_cb_t cb, void *arg)
 Send response data. More...
 
int32_t ocs_scsi_tgt_abort_io (ocs_io_t *io, bool send_abts, ocs_scsi_io_cb_t cb, void *arg)
 Abort a target IO. More...
 
int32_t ocs_scsi_send_tmf_resp (ocs_io_t *io, ocs_scsi_tmf_resp_e rspcode, uint8_t *addl_rsp_info, ocs_scsi_io_cb_t cb, void *arg)
 Send TMF response data. More...
 
int32_t ocs_iscsi_send_tmf_resp (ocs_io_t *io, uint8_t response, ocs_scsi_io_cb_t cb, void *arg)
 send TMF response data More...
 
int32_t ocs_scsi_send_rd_io (ocs_node_t *node, ocs_io_t *io, uint32_t lun, void *cdb, uint32_t cdb_len, ocs_scsi_dif_info_t *dif_info, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator read IO. More...
 
int32_t ocs_scsi_send_nodata_io (ocs_node_t *node, ocs_io_t *io, uint32_t lun, void *cdb, uint32_t cdb_len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator SCSI command with no data. More...
 
int32_t ocs_scsi_send_wr_io (ocs_node_t *node, ocs_io_t *io, uint32_t lun, void *cdb, uint32_t cdb_len, ocs_scsi_dif_info_t *dif_info, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator write IO. More...
 
int32_t ocs_scsi_send_tmf (ocs_node_t *node, ocs_io_t *io, ocs_io_t *io_to_abort, uint32_t lun, ocs_scsi_tmf_cmd_e tmf, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 initiate initiator task management operation More...
 
static int32_t ocs_scsi_convert_dif_info (ocs_t *ocs, ocs_scsi_dif_info_t *scsi_dif_info, ocs_hal_dif_info_t *hal_dif_info)
 Convert SCSI API T10 DIF information into the FC HAL format. More...
 
void ocs_scsi_io_complete (ocs_io_t *io)
 Notify base that IO is complete. More...
 
uint32_t ocs_scsi_get_property (ocs_t *ocs, ocs_scsi_property_e prop)
 Return SCSI API integer valued property. More...
 
void * ocs_scsi_get_property_ptr (ocs_t *ocs, ocs_scsi_property_e prop)
 return a property pointer. More...
 
ocs_io_t * ocs_scsi_io_alloc (ocs_node_t *node, ocs_scsi_io_role_e role)
 allocate a SCSI IO context. More...
 
void ocs_scsi_io_free (ocs_io_t *io)
 Free a SCSI IO context. More...
 

Function Details

int32_t ocs_iscsi_send_tmf_resp ( ocs_io_t *  io,
uint8_t  response,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

send TMF response data

Description
This function is to send an iSCSI TMF response data to a remote initiator node.

Upon completion the callback function cb is called.
Parameters
ioPointer to IO context.
responseThe iSCSI task management response code.
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 1320 of file ocs_scsi.c.

static int32_t ocs_scsi_convert_dif_info ( ocs_t *  ocs,
ocs_scsi_dif_info_t *  scsi_dif_info,
ocs_hal_dif_info_t *  hal_dif_info 
)
static

Convert SCSI API T10 DIF information into the FC HAL format.

Parameters
ocsPointer to the ocs structure for logging.
scsi_dif_infoPointer to the SCSI API T10 DIF fields.
hal_dif_infoPointer to the FC HAL API T10 DIF fields.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1932 of file ocs_scsi.c.

uint32_t ocs_scsi_get_property ( ocs_t *  ocs,
ocs_scsi_property_e  prop 
)

Return SCSI API integer valued property.

Description
This function is called by a target-server or initiator-client to retrieve an integer valued property.
Parameters
ocsPointer to ocs.
propProperty value to return.
Returns
Returns a property value, or 0 if an invalid property was requested.

Definition at line 2048 of file ocs_scsi.c.

void* ocs_scsi_get_property_ptr ( ocs_t *  ocs,
ocs_scsi_property_e  prop 
)

return a property pointer.

Description
This function is called by a target-server or initiator-client to retrieve a pointer to the requested property.
Parameters
ocsPointer to ocs.
propProperty value to return.
Returns
Returns pointer to the requested property, otherwise NULL.

Definition at line 2119 of file ocs_scsi.c.

ocs_io_t* ocs_scsi_io_alloc ( ocs_node_t *  node,
ocs_scsi_io_role_e  role 
)

allocate a SCSI IO context.

Description
A SCSI IO context is allocated and associated with node. This function is called by initiator-clients when issuing SCSI commands to remote target devices. On completion, ocs_scsi_io_free() is called.

The returned ocs_io_t structure has an element of type ocs_scsi_ini_io_t named ini_io that is declared and used by a initiator-client for private information.
Parameters
nodePointer to associated node structure.
roleRole for IO (originator/responder).
Returns
Returns pointer to IO context or NULL.

Definition at line 2187 of file ocs_scsi.c.

void ocs_scsi_io_complete ( ocs_io_t *  io)

Notify base that IO is complete.

Description
This function is called by a target-server to notify the base driver that an IO has completed, allowing for the base driver to free resources. Note, that it is not called by initiator-clients.
Parameters
ioPointer to IO context.
Returns
None.

Definition at line 2023 of file ocs_scsi.c.

void ocs_scsi_io_free ( ocs_io_t *  io)

Free a SCSI IO context.

Description
The IO context previously allocated using ocs_scsi_io_alloc() is freed.
Parameters
ioPointer to IO context.
Returns
None.

Definition at line 2264 of file ocs_scsi.c.

int32_t ocs_scsi_recv_wr_data ( ocs_io_t *  io,
uint32_t  flags,
ocs_scsi_dif_info_t *  dif_info,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint64_t  wire_len,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

Prepare to receive write data.

This function is used by the target-server to set up a SCSI write data phase, transferring data from the remote initiator to the target. The payload is specified by the scatter-gather list sgl of length sgl_count. The len argument specifies the payload length (independent of the scatter-gather list cumulative length).

The flags argument has one bit: OCS_SCSI_LAST_DATAPHASE, which is a hint to the base driver that it may use auto SCSI response features if the hardware supports it.

Upon completion the callback function cb is called with flags indicating that the IO has completed (OCS_SCSI_IO_COMPL) and another dataphase or response may be sent, the IO has completed and no response needs to be sent (OCS_SCSI_IO_COMPL_NO_RSP), or that the IO was aborted (OCS_SCSI_IO_ABORTED).

Parameters
ioPointer to IO context.
flagsFlags controlling the receipt of data.
dif_infoPointer to a T10 PI (DIF) information structure.
sglPointer to payload scatter-gather list.
sgl_countNumber of scatter-gather list elements.
wire_lenLength of the payload on wire, in bytes.
cbCompletion callback.
argApplication supplied callback data.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 960 of file ocs_scsi.c.

int32_t ocs_scsi_send_nodata_io ( ocs_node_t *  node,
ocs_io_t *  io,
uint32_t  lun,
void *  cdb,
uint32_t  cdb_len,
ocs_scsi_rsp_io_cb_t  cb,
void *  arg 
)

Initiate initiator SCSI command with no data.

Description
This call is made by an initiator-client to send a SCSI command with no data.

Upon completion, the callback cb is invoked and passed request status. If the command completed successfully, the callback is given SCSI response data.
Parameters
nodePointer to node.
ioPointer to IO context.
lunLUN value.
cdbPointer to CDB.
cdb_lenLength of CDB.
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1724 of file ocs_scsi.c.

int32_t ocs_scsi_send_rd_data ( ocs_io_t *  io,
uint32_t  flags,
ocs_scsi_dif_info_t *  dif_info,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint64_t  wire_len,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

Send read data.

Description
This call is made by a target-server to initiate a SCSI read dataphase, transferring data from the target to the remote initiator. The payload is specified by the scatter-gather list sgl of length sgl_count. The len argument specifies the payload length (independent of the scatter-gather list cumulative length).

The c flags argument has one bit: OCS_SCSI_LAST_DATAPHASE, which is a hint to the base driver that it may use auto SCSI response features if the hardware supports it.

Upon completion the callback function cb is called with flags indicating that the IO has completed (OCS_SCSI_IO_COMPL) and another dataphase or response may be sent, the IO has completed and no response needs to be sent (OCS_SCSI_IO_COMPL_NO_RSP), or that the IO was aborted (OCS_SCSI_IO_ABORTED).
Parameters
ioPointer to IO context.
flagsFlags controlling the sending of data.
dif_infoPointer to a T10 PI (DIF) information structure.
sglPointer to payload scatter-gather list.
sgl_countNumber of scatter-gather list elements.
wire_lenLength of the payload on wire, in bytes.
cbCompletion callback.
argApplication supplied callback data.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 764 of file ocs_scsi.c.

int32_t ocs_scsi_send_rd_io ( ocs_node_t *  node,
ocs_io_t *  io,
uint32_t  lun,
void *  cdb,
uint32_t  cdb_len,
ocs_scsi_dif_info_t *  dif_info,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint32_t  len,
ocs_scsi_rsp_io_cb_t  cb,
void *  arg 
)

Initiate initiator read IO.

Description
This call is made by an initiator-client to send a SCSI read command. The payload for the command is given by a scatter-gather list sgl for sgl_count entries.

Upon completion, the callback cb is invoked and passed request status. If the command completed successfully, the callback is given SCSI response data.
Parameters
nodePointer to node.
ioPointer to IO context.
lunLUN value.
cdbPointer to CDB.
cdb_lenLength of CDB.
dif_infoPointer to a T10 PI (DIF) information structure.
sglPointer to scatter-gather list.
sgl_countCount of scatter-gather list elements.
lenLength of payload.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
returns 0 for success, a negative error code value for failure.

Definition at line 1693 of file ocs_scsi.c.

int32_t ocs_scsi_send_resp ( ocs_io_t *  io,
uint32_t  flags,
ocs_scsi_cmd_resp_t *  rsp,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

Send response data.

Description
This function is used by a target-server to send SCSI response data to a remote initiator node. The target-server populates the ocs_scsi_cmd_resp_t argument with scsi status, status qualifier, sense data and response data as needed.

Upon completion the callback function cb . The target-server will generally clean up its IO context resources and call ocs_scsi_io_complete().
Parameters
ioPointer to IO context.
flagsFlags to control sending of SCSI response.
rspPointer to response data populated by caller.
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 1079 of file ocs_scsi.c.

int32_t ocs_scsi_send_tmf ( ocs_node_t *  node,
ocs_io_t *  io,
ocs_io_t *  io_to_abort,
uint32_t  lun,
ocs_scsi_tmf_cmd_e  tmf,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint32_t  len,
ocs_scsi_rsp_io_cb_t  cb,
void *  arg 
)

initiate initiator task management operation

Description
This command is used to send a SCSI task management function command. If the command requires it (QUERY_TASK_SET for example), a payload may be associated with the command. If no payload is required, then sgl_count may be zero and sgl is ignored.

Upon completion cb is invoked with status and SCSI response data.
Parameters
nodePointer to node.
ioPointer to IO context.
io_to_abortPointer to IO context to be aborted.
lunLUN value.
tmfTask management function.
sglPointer to scatter-gather list.
sgl_countCount of scatter-gather list elements.
lenLength of payload.
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 1910 of file ocs_scsi.c.

int32_t ocs_scsi_send_tmf_resp ( ocs_io_t *  io,
ocs_scsi_tmf_resp_e  rspcode,
uint8_t *  addl_rsp_info,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

Send TMF response data.

Description
This function is used by a target-server to send SCSI TMF response data to a remote initiator node.

Upon completion the callback function cb. The target-server will generally clean up its IO context resources and call ocs_scsi_io_complete().
Parameters
ioPointer to IO context.
rspcodeTMF response code.
addl_rsp_infoAdditional TMF response information (may be NULL for zero data).
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 1270 of file ocs_scsi.c.

int32_t ocs_scsi_send_wr_io ( ocs_node_t *  node,
ocs_io_t *  io,
uint32_t  lun,
void *  cdb,
uint32_t  cdb_len,
ocs_scsi_dif_info_t *  dif_info,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint32_t  len,
ocs_scsi_rsp_io_cb_t  cb,
void *  arg 
)

Initiate initiator write IO.

Description
This call is made by an initiator-client to send a SCSI write command. The payload for the command is given by a scatter-gather list sgl for sgl_count. entries.

Upon completion, the callback cb is invoked and passed request status. If the command completed successfully, the callback is given SCSI response data.
Parameters
nodePointer to node.
ioPointer to IO context.
lunLUN value.
cdbPointer to CDB.
cdb_lenLength of CDB.
dif_infoPointer to a T10 PI (DIF) information structure.
sglPointer to scatter-gather list.
sgl_countCount of scatter-gather list elements.
lenLength of payload.
cbCompletion callback.
argApplication specified completion callback argument.
Returns
Returns 0 for success, a negative error code value for failure.

Definition at line 1761 of file ocs_scsi.c.

int32_t ocs_scsi_tgt_abort_io ( ocs_io_t *  io,
bool  send_abts,
ocs_scsi_io_cb_t  cb,
void *  arg 
)

Abort a target IO.

Description
This routine is called from a SCSI target-server and initiates an abort of a previously issued target data phase or response request.
Parameters
ioIO context.
cbSCSI target server callback.
argSCSI target server supplied callback argument.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 1201 of file ocs_scsi.c.