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

static uint32_t ocs_fc_getbe32 (void *p)
 Returns a big-endian 32-bit value given a pointer. More...
 
void ocs_scsi_io_alloc_enable (ocs_node_t *node)
 Enable IO allocation. More...
 
void ocs_scsi_io_alloc_disable (ocs_node_t *node)
 Disable IO allocation. More...
 
int32_t ocs_scsi_io_alloc_enabled (ocs_node_t *node)
 Get state of IO allocation. More...
 
ocs_io_t * ocs_scsi_io_alloc (ocs_node_t *node, ocs_scsi_io_role_e role)
 Allocate a SCSI IO context. More...
 
static void _ocs_scsi_io_free (void *arg)
 Free a SCSI IO context (internal). More...
 
void ocs_scsi_io_free (ocs_io_t *io)
 Free a SCSI IO context. 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...
 
static void ocs_log_sgl (ocs_io_t *io)
 This function logs the SGLs for an IO. More...
 
static int32_t ocs_scsi_xfer_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 xwire_len, ocs_hal_io_type_e type, int enable_ar, ocs_scsi_io_cb_t cb, void *arg)
 Send read/write data. More...
 
static void ocs_scsi_io_free_ovfl (ocs_io_t *io)
 Free overflow SGL. 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_send_tmf_resp (ocs_io_t *io, ocs_scsi_tmf_resp_e rspcode, uint8_t addl_rsp_info[3], ocs_scsi_io_cb_t cb, void *arg)
 Send TMF 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...
 
void ocs_scsi_io_complete (ocs_io_t *io)
 Notify the base driver that the IO is complete. 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 wire_len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator read IO. 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 wire_len, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator write IO. More...
 
int32_t ocs_scsi_send_wr_io_first_burst (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 wire_len, uint32_t first_burst, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Initiate initiator write 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_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_send_io (ocs_hal_io_type_e type, ocs_node_t *node, ocs_io_t *io, uint32_t lun, ocs_scsi_tmf_cmd_e tmf, uint8_t *cdb, uint32_t cdb_len, ocs_scsi_dif_info_t *dif_info, ocs_scsi_sgl_t *sgl, uint32_t sgl_count, uint32_t wire_len, uint32_t first_burst, ocs_scsi_rsp_io_cb_t cb, void *arg)
 Send an FCP IO. More...
 
static int32_t ocs_scsi_abort_io_cb (struct ocs_hal_io_s *hio, ocs_remote_node_t *rnode, uint32_t len, int32_t status, uint32_t ext_status, void *arg)
 Callback for an aborted IO. 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...
 
void ocs_scsi_del_initiator_complete (ocs_node_t *node)
 Notify that delete initiator is complete. More...
 
void ocs_scsi_del_target_complete (ocs_node_t *node)
 Notify that delete target is complete. More...
 

Function Details

static void _ocs_scsi_io_free ( void *  arg)
static

Free a SCSI IO context (internal).

Description
The IO context previously allocated using ocs_scsi_io_alloc() is freed. This is called from within the transport layer, when the reference count goes to zero.
Parameters
argPointer to the IO context.
Returns
None.

Definition at line 269 of file ocs_scsi.c.

static uint32_t ocs_fc_getbe32 ( void *  p)
inlinestatic

Returns a big-endian 32-bit value given a pointer.

Parameters
pPointer to the 32-bit big-endian location.
Returns
Returns the byte-swapped 32-bit value.

Definition at line 103 of file ocs_scsi.c.

static void ocs_log_sgl ( ocs_io_t *  io)
static

This function logs the SGLs for an IO.

Parameters
ioPointer to the IO context.

Definition at line 947 of file ocs_scsi.c.

static int32_t ocs_scsi_abort_io_cb ( struct ocs_hal_io_s *  hio,
ocs_remote_node_t *  rnode,
uint32_t  len,
int32_t  status,
uint32_t  ext_status,
void *  arg 
)
static

Callback for an aborted IO.

Description
Callback function invoked upon completion of an IO abort request.
Parameters
hioHAL IO context.
rnodeRemote node.
lenResponse length.
statusCompletion status.
ext_statusExtended completion status.
argApplication-specific callback, usually IO context.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2734 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 837 of file ocs_scsi.c.

void ocs_scsi_del_initiator_complete ( ocs_node_t *  node)

Notify that delete initiator is complete.

Description
Sent by the target-server to notify the base driver that the work started from ocs_scsi_del_initiator() is now complete and that it is safe for the node to release the rest of its resources.
Parameters
nodePointer to the node.
Returns
None.

Definition at line 2964 of file ocs_scsi.c.

void ocs_scsi_del_target_complete ( ocs_node_t *  node)

Notify that delete target is complete.

Description
Sent by the initiator-client to notify the base driver that the work started from ocs_scsi_del_target() is now complete and that it is safe for the node to release the rest of its resources.
Parameters
nodePointer to the node.
Returns
None.

Definition at line 2985 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 the ocs.
propProperty value to return.
Returns
Returns a value, or 0 if invalid property was requested.

Definition at line 2799 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 the ocs.
propProperty value to return.
Returns
Returns pointer to the requested property, or NULL otherwise.

Definition at line 2871 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 a node. This function is called by an initiator-client 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 an initiator-client for private information.
Parameters
nodePointer to the associated node structure.
roleRole for IO (originator/responder).
Returns
Returns the pointer to the IO context, or NULL.

Definition at line 192 of file ocs_scsi.c.

void ocs_scsi_io_alloc_disable ( ocs_node_t *  node)

Disable IO allocation.

Description
The SCSI and Transport IO allocation functions are disabled. If the allocation functions are not enabled, then calls to ocs_scsi_io_alloc() (and ocs_els_io_alloc() for FC) will fail.
Parameters
nodePointer to node object
Returns
None.

Definition at line 144 of file ocs_scsi.c.

void ocs_scsi_io_alloc_enable ( ocs_node_t *  node)

Enable IO allocation.

Description
The SCSI and Transport IO allocation functions are enabled. If the allocation functions are not enabled, then calls to ocs_scsi_io_alloc() (and ocs_els_io_alloc() for FC) will fail.
Parameters
nodePointer to node object.
Returns
None.

Definition at line 122 of file ocs_scsi.c.

int32_t ocs_scsi_io_alloc_enabled ( ocs_node_t *  node)

Get state of IO allocation.

Parameters
nodePointer to node object
Returns
TRUE if IO allocation is enabled, otherwise FALSE.

Definition at line 160 of file ocs_scsi.c.

void ocs_scsi_io_complete ( ocs_io_t *  io)

Notify the base driver that the 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: This function is not called by initiator-clients.
Parameters
ioPointer to IO context.
Returns
None.

Definition at line 2158 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 the IO context.
Returns
None.

Definition at line 317 of file ocs_scsi.c.

static void ocs_scsi_io_free_ovfl ( ocs_io_t *  io)
static

Free overflow SGL.

Description
Free the overflow SGL if it is present.
Parameters
ioPointer to IO object.
Returns
None.

Definition at line 1660 of file ocs_scsi.c.

static int32_t ocs_scsi_send_io ( ocs_hal_io_type_e  type,
ocs_node_t *  node,
ocs_io_t *  io,
uint32_t  lun,
ocs_scsi_tmf_cmd_e  tmf,
uint8_t *  cdb,
uint32_t  cdb_len,
ocs_scsi_dif_info_t *  dif_info,
ocs_scsi_sgl_t *  sgl,
uint32_t  sgl_count,
uint32_t  wire_len,
uint32_t  first_burst,
ocs_scsi_rsp_io_cb_t  cb,
void *  arg 
)
static

Send an FCP IO.

Description
An FCP read/write IO command, with optional task management flags, is sent to node.
Parameters
typeHAL IO type to send.
nodePointer to the node destination of the IO.
ioPointer to the IO context.
lunLUN value.
tmfTask management command.
cdbPointer to the SCSI CDB.
cdb_lenLength of the CDB, in bytes.
dif_infoPointer to the T10 DIF fields, or NULL if no DIF.
sglPointer to the scatter-gather list.
sgl_countNumber of SGL entries in SGL.
wire_lenPayload length, in bytes, of data on wire.
first_burstNumber of first burst bytes to send.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2549 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 the node.
ioPointer to the IO context.
lunLUN value.
cdbPointer to the CDB.
cdb_lenLength of the CDB.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2445 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  wire_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 the node.
ioPointer to the IO context.
lunLUN value.
cdbPointer to the CDB.
cdb_lenLength of the CDB.
dif_infoPointer to the T10 DIF fields, or NULL if no DIF.
sglPointer to the scatter-gather list.
sgl_countCount of the scatter-gather list elements.
wire_lenLength of the payload.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2332 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 the 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 is invoked. The target-server will generally clean up its IO context resources and call ocs_scsi_io_complete().
Parameters
ioPointer to the IO context.
flagsFlags to control sending of the SCSI response.
rspPointer to the response data populated by the caller.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1688 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 the node.
ioPointer to the IO context.
io_to_abortPointer to the IO context to abort in the case of OCS_SCSI_TMF_ABORT_TASK. Note: this can point to the same the same ocs_io_t as io, provided that io does not have any outstanding work requests.
lunLUN value.
tmfTask management command.
sglPointer to the scatter-gather list.
sgl_countCount of the scatter-gather list elements.
lenLength of the payload.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2482 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[3],
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 is invoked. The target-server will generally clean up its IO context resources and call ocs_scsi_io_complete().
Parameters
ioPointer to the 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 on success, or a negative error code value on failure.

Definition at line 1815 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  wire_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 the node.
ioPointer to IO context.
lunLUN value.
cdbPointer to the CDB.
cdb_lenLength of the CDB.
dif_infoPointer to the T10 DIF fields, or NULL if no DIF.
sglPointer to the scatter-gather list.
sgl_countCount of the scatter-gather list elements.
wire_lenLength of the payload.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2371 of file ocs_scsi.c.

int32_t ocs_scsi_send_wr_io_first_burst ( 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  wire_len,
uint32_t  first_burst,
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 the node.
ioPointer to IO context.
lunLUN value.
cdbPointer to the CDB.
cdb_lenLength of the CDB.
dif_infoPointer to the T10 DIF fields, or NULL if no DIF.
sglPointer to the scatter-gather list.
sgl_countCount of the scatter-gather list elements.
wire_lenLength of the payload.
first_burstNumber of first burst bytes to send.
cbCompletion callback.
argApplication-specified completion callback argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2412 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. It initiates an abort of a previously-issued target data phase or response request.
Parameters
ioIO context.
send_abtsflag to determine ABTS to initiator or not
cbSCSI target server callback.
argSCSI target server supplied callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 1989 of file ocs_scsi.c.

static int32_t ocs_scsi_xfer_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  xwire_len,
ocs_hal_io_type_e  type,
int  enable_ar,
ocs_scsi_io_cb_t  cb,
void *  arg 
)
inlinestatic

Send read/write data.

Description
This call is made by a target-server to initiate a SCSI read or write data phase, transferring data between the target to the remote initiator. The payload is specified by the scatter-gather list sgl of length sgl_count. The wire_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 data phase or response may be sent; that 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 the IO context.
flagsFlags controlling the sending of data.
dif_infoPointer to T10 DIF fields, or NULL if no DIF.
sglPointer to the payload scatter-gather list.
sgl_countCount of the scatter-gather list elements.
xwire_lenLength of the payload on wire, in bytes.
typeHAL IO type.
enable_arEnable auto-response if true.
cbCompletion callback.
argApplication-supplied callback data.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1502 of file ocs_scsi.c.