Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IO Functions

Functions

ocs_hal_rtn_e ocs_hal_command_bootstrap (ocs_hal_t *hal, uint8_t *cmd)
 Issue a SLI command to the bootstrap mailbox. More...
 
ocs_command_ctx_t * ocs_hal_command_get_ctx (ocs_hal_t *hal)
 Issue a SLI command. More...
 
void ocs_hal_command_free_ctx (ocs_hal_t *hal, ocs_command_ctx_t *ctx)
 Issue a SLI command. More...
 
ocs_hal_rtn_e ocs_hal_command_queue (ocs_hal_t *hal, ocs_command_ctx_t *ctx)
 Issue a SLI command. More...
 
ocs_hal_rtn_e ocs_hal_rxbuffer (ocs_hal_t *hal, ocs_hal_rq_buffer_t *header, ocs_hal_rq_buffer_t *payload)
 Add a receive buffer pair to the Receive Queue. More...
 
ocs_hal_io_t * ocs_hal_io_alloc (ocs_hal_t *hal)
 Allocate a HAL IO object. More...
 
static void ocs_hal_io_check_quarantine_list (ocs_hal_t *hal, uint32_t *quarantine_cnt, ocs_list_t *quarantine_list)
 If there are more than 4 objects on the quarantine list, then free IOs until there are at most 4 left on the list. More...
 
void ocs_hal_io_free (ocs_hal_t *hal, ocs_hal_io_t *io)
 Free a previously allocated HAL IO object. More...
 
static ocs_hal_sgl_info_t * ocs_hal_sgl_info_alloc (ocs_hal_t *hal)
 Allocate a HAL SGL Chaining object. More...
 
static void ocs_hal_sgl_info_free (ocs_hal_t *hal, ocs_hal_sgl_info_t *sgl_info)
 Free a previously allocated HAL SGL Chaining object. More...
 
ocs_hal_rtn_e ocs_hal_io_send (ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, uint32_t len, ocs_hal_io_param_t *iparam, ocs_cxn_t *cxn, io_cb_t cb, void *arg)
 Send a read, write, or response IO. More...
 
ocs_hal_rtn_e ocs_hal_io_init_sges (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_type_e type, uint32_t offset)
 Initialize the Scatter Gather List entries of an IO. More...
 
static ocs_hal_sgl_info_t * ocs_hal_io_get_sgl_info (ocs_hal_t *hal, ocs_hal_io_t *io)
 Find the correct position to add an SGL. This may result in the allocation of a chained SGL List. More...
 
ocs_hal_rtn_e ocs_hal_io_add_sge (ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr, uint32_t length)
 Add a Scatter Gather list Entry to an IO. More...
 
ocs_hal_rtn_e ocs_hal_io_add_seed_sge (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_dif_info_t *dif_info)
 Add a T10 PI seed scatter gather list entry. More...
 
ocs_hal_rtn_e ocs_hal_io_add_dif_sge (ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr)
 Add a T10 DIF scatter gather list entry to an IO. More...
 
static ocs_hal_rtn_e ocs_hal_io_abort_send_cmd (ocs_hal_t *hal, ocs_hal_io_t **ios, uint16_t num_ios, ocs_hal_abort_type_e abort_type)
 Abort a list of IOs. More...
 
static ocs_hal_rtn_e ocs_hal_io_abort_add_entry (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_t **ios, uint16_t *io_index, ocs_hal_abort_type_e abort_type)
 Abort a list of IOs. More...
 
ocs_hal_rtn_e ocs_hal_io_abort (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_abort_scope_e abort_scope, ocs_hal_abort_type_e abort_type)
 Abort a currently running IO. More...
 
ocs_hal_rtn_e ocs_hal_get_profile_list (ocs_hal_t *hal, mgmt_cb_t mgmt_cb, void *ul_arg)
 Get a list of available profiles. More...
 
int32_t ocs_hal_get_active_profile (ocs_hal_t *hal, mgmt_cb_t cb, void *ul_arg)
 Get the currently active profile. More...
 
ocs_hal_rtn_e ocs_hal_set_active_profile (ocs_hal_t *hal, mgmt_cb_t cb, uint32_t profile_id, void *ul_arg)
 Set the currently active profile. More...
 
int32_t ocs_hal_get_linkcfg (ocs_hal_t *hal, mgmt_cb_t cb, void *ul_arg)
 Get the current link configuration. More...
 
ocs_hal_rtn_e ocs_hal_set_linkcfg (ocs_hal_t *hal, mgmt_cb_t cb, ocs_hal_linkcfg_e value, void *ul_arg)
 Set the link configuration (Skyhawk only). More...
 
int32_t ocs_hal_get_port_protocol (ocs_hal_t *hal, uint32_t pci_func, mgmt_cb_t cb, void *ul_arg)
 Get the current port protocol. More...
 
ocs_hal_rtn_e ocs_hal_set_port_protocol (ocs_hal_t *hal, uint32_t pci_func, ocs_hal_port_protocol_e new_protocol, mgmt_cb_t cb, void *ul_arg)
 Set the port protocol. More...
 
ocs_hal_io_t * ocs_hal_io_find_itt (ocs_hal_t *hal, uint32_t itt)
 Find an IO based on the initiator task tag. More...
 

Function Details

ocs_hal_rtn_e ocs_hal_command_bootstrap ( ocs_hal_t *  hal,
uint8_t *  cmd 
)

Issue a SLI command to the bootstrap mailbox.

Description
Send a mailbox command to the hardware and wait for a completion.
Parameters
halHardware context.
cmdBuffer containing a formatted command and results.

Definition at line 2018 of file ocs_hal.c.

void ocs_hal_command_free_ctx ( ocs_hal_t *  hal,
ocs_command_ctx_t *  ctx 
)

Issue a SLI command.

Description
Free a mailbox context.
Parameters
halHardware context.
ctxPointer to the command context.

Definition at line 2089 of file ocs_hal.c.

ocs_command_ctx_t* ocs_hal_command_get_ctx ( ocs_hal_t *  hal)

Issue a SLI command.

Description
Get a mailbox context to send a queued mailbox command.
Parameters
halHardware context.
Returns
Returns a pointer on success, or NULL otherwise.

Definition at line 2065 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_command_queue ( ocs_hal_t *  hal,
ocs_command_ctx_t *  ctx 
)

Issue a SLI command.

Description
Send a mailbox command to the hardware and gets an optional asynchronous completion.

Note: The caller must fill in the call back pointer fields. If the callback function pointer is NULL, the results of the command will be silently discarded. This context is freed automatically if the function fails.
Parameters
halHardware context.
ctxCommand context from ocs_hal_command_get_ctx().
Returns
Returns OCS_HAL_RTN_SUCCESS on success, or OCS_HAL_RTN_ERROR otherwise.

Definition at line 2164 of file ocs_hal.c.

int32_t ocs_hal_get_active_profile ( ocs_hal_t *  hal,
mgmt_cb_t  cb,
void *  ul_arg 
)

Get the currently active profile.

Description
Issues a SLI4 COMMON_GET_ACTIVE_PROFILE mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHAL hardware context.
cbCallback function to be called when the command completes.
ul_argAn argument that is passed to the callback function.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6398 of file ocs_hal.c.

int32_t ocs_hal_get_linkcfg ( ocs_hal_t *  hal,
mgmt_cb_t  cb,
void *  ul_arg 
)

Get the current link configuration.

Description
Issues a SLI4 COMMON_GET_RECONFIG_INFO mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHAL hardware context.
cbCallback function to be called when the command completes.
ul_argArgument that is passed to the callback function.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6628 of file ocs_hal.c.

int32_t ocs_hal_get_port_protocol ( ocs_hal_t *  hal,
uint32_t  pci_func,
mgmt_cb_t  cb,
void *  ul_arg 
)

Get the current port protocol.

Description
Issues a SLI4 COMMON_GET_PROFILE_CONFIG mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHAL hardware context.
pci_funcTBD.
cbCallback function to be called when the command completes.
ul_argArgument that is passed to the callback function.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6846 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_profile_list ( ocs_hal_t *  hal,
mgmt_cb_t  mgmt_cb,
void *  ul_arg 
)

Get a list of available profiles.

Description
Issues a SLI4 COMMON_GET_PROFILE_LIST mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halThe HAL hardware context.
mgmt_cbCallback function to be called when the command completes.
ul_argAn argument that is passed to the callback function.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6304 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_abort ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_hal_abort_scope_e  abort_scope,
ocs_hal_abort_type_e  abort_type 
)

Abort a currently running IO.

Description
This function must set the WQE invalid bit to 1 and post a IOCTL_COMMON_ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS mailbox command. The transport software must send a NOP/TM to force a TCP acknowledgement.
Parameters
halHardware context.
ioPreviously-allocated HAL IO object (only used for SCOPE_IO).
abort_scopeUsed to automatically select IOs to abort.
abort_typeType of abort requested.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 6148 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_io_abort_add_entry ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_hal_io_t **  ios,
uint16_t *  io_index,
ocs_hal_abort_type_e  abort_type 
)
static

Abort a list of IOs.

Description
This function sets the WQE invalid bit to 1 and places the IO in the abort list.
Parameters
halHardware context.
ioPointer to an IO to abort.
iosPointer to an array of IOs to abort.
io_indexIndex to place the next IO in.
abort_typeType of abort requested.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 6098 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_io_abort_send_cmd ( ocs_hal_t *  hal,
ocs_hal_io_t **  ios,
uint16_t  num_ios,
ocs_hal_abort_type_e  abort_type 
)
static

Abort a list of IOs.

Description
This function formats the ISCSI_ERROR_RECOVERY_INVALIDATE_COMMANDS mailbox command for a list of IOs and sends it to the FW.
Parameters
halHardware context.
iosPointer to an array of IOs to abort.
num_iosNumber of IOs to abort.
abort_typeType of abort requested.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 6006 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_add_dif_sge ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
uintptr_t  addr 
)

Add a T10 DIF scatter gather list entry to an IO.

Parameters
halHardware context.
ioPreviously-allocated HAL IO object.
addrDIF physical address.
Returns
Returns 0 on success, or a non-zero on failure.

Definition at line 5880 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_add_seed_sge ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_hal_dif_info_t *  dif_info 
)

Add a T10 PI seed scatter gather list entry.

Parameters
halHardware context.
ioPreviously-allocated HAL IO object.
dif_infoPointer to T10 DIF fields, or NULL if no DIF.
Returns
Returns 0 on success, or a non-zero on failure.

Definition at line 5793 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_add_sge ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
uintptr_t  addr,
uint32_t  length 
)

Add a Scatter Gather list Entry to an IO.

Parameters
halHardware context.
ioPreviously allocated HAL IO object.
addrPhysical address.
lengthLength of memory pointed to be addr.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 5732 of file ocs_hal.c.

ocs_hal_io_t* ocs_hal_io_alloc ( ocs_hal_t *  hal)

Allocate a HAL IO object.

Parameters
halHardware context.
Returns
Returns io pointer, or NULL if out of resources.

Definition at line 5170 of file ocs_hal.c.

static void ocs_hal_io_check_quarantine_list ( ocs_hal_t *  hal,
uint32_t *  quarantine_cnt,
ocs_list_t *  quarantine_list 
)
static

If there are more than 4 objects on the quarantine list, then free IOs until there are at most 4 left on the list.

Description
Note: Assumes that the hal->io_lock is held.
Parameters
halHardware context.
quarantine_cntPointer to the current count of the list elements.
quarantine_listPointer to the quarantine list.

Definition at line 5209 of file ocs_hal.c.

ocs_hal_io_t* ocs_hal_io_find_itt ( ocs_hal_t *  hal,
uint32_t  itt 
)

Find an IO based on the initiator task tag.

Parameters
halHardware context.
ittInitiator task tag to find.
Returns
Pointer to the IO on success, NULL otherwise.

Definition at line 7191 of file ocs_hal.c.

void ocs_hal_io_free ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Free a previously allocated HAL IO object.

Parameters
halHardware context.
ioPointer to the IO object.

Definition at line 5231 of file ocs_hal.c.

static ocs_hal_sgl_info_t* ocs_hal_io_get_sgl_info ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
static

Find the correct position to add an SGL. This may result in the allocation of a chained SGL List.

Parameters
halHardware context.
ioPreviously-allocated HAL IO object.
Returns
Returns pointer to the SGL info structure, or NULL otherwise.

Definition at line 5673 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_init_sges ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_hal_io_type_e  type,
uint32_t  offset 
)

Initialize the Scatter Gather List entries of an IO.

Parameters
halHardware context.
ioPreviously-allocated HAL IO object.
typeType of IO (target read, target response, ...).
offsetOffset used to initialize the phase.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 5562 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_send ( ocs_hal_t *  hal,
ocs_hal_io_type_e  type,
ocs_hal_io_t *  io,
uint32_t  len,
ocs_hal_io_param_t *  iparam,
ocs_cxn_t *  cxn,
io_cb_t  cb,
void *  arg 
)

Send a read, write, or response IO.

Description
This routine supports sending higher level IO (e.g. FCP) between two endpoints as a target or initiator. Examples of this are
  • sending read data and good response (target).
  • sending a response (target with no data or after receiving write data).

    The routine assumes all IOs use the SGL associated with the HAL IO. Prior to calling this routine, the data should be loaded using ocs_hal_io_sgl().
Parameters
halHardware context.
typeType of IO (target read, target response, ...).
ioPreviously-allocated HAL IO object.
lenLength in bytes of data to send.
iparamIO parameters.
cxnPointer to the connection object.
cbFunction call upon completion of sending data (may be NULL).
argArgument to pass to IO completion function.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 5370 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_rxbuffer ( ocs_hal_t *  hal,
ocs_hal_rq_buffer_t *  header,
ocs_hal_rq_buffer_t *  payload 
)

Add a receive buffer pair to the Receive Queue.

Parameters
halHardware context.
headerDMA memory for the unsolicited header.
payloadDMA memory for the unsolicited payload.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 2254 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_active_profile ( ocs_hal_t *  hal,
mgmt_cb_t  cb,
uint32_t  profile_id,
void *  ul_arg 
)

Set the currently active profile.

Description
Issues a SLI4 COMMON_GET_ACTIVE_PROFILE mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHAL hardware context.
cbCallback function to be called when the command completes.
profile_idProfile ID that should be set as the active profile.
ul_argArgument that is passed to the callback function.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6479 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_linkcfg ( ocs_hal_t *  hal,
mgmt_cb_t  cb,
ocs_hal_linkcfg_e  value,
void *  ul_arg 
)

Set the link configuration (Skyhawk only).

Description
Issues a SLI4 COMMON_SET_RECONFIG_LINK_ID mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHAL hardware context.
cbCallback function to be called when the command completes.
ul_argAn argument that is passed to the callback function.
valueTBD.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 6716 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_port_protocol ( ocs_hal_t *  hal,
uint32_t  pci_func,
ocs_hal_port_protocol_e  new_protocol,
mgmt_cb_t  cb,
void *  ul_arg 
)

Set the port protocol.

Description
Setting the port protocol is a read-modify-write operation. This function submits a GET_PROFILE_CONFIG command to read the current settings. The callback function will modify the settings and issue the write.
Parameters
halHAL hardware context.
pci_funcTBD.
cbCallback function to be called when the command completes.
ul_argAn argument that is passed to the callback function.
new_protocolTBD.
Returns
  • OCS_HAL_RTN_SUCCESS on success.
  • OCS_HAL_RTN_NO_MEMORY if a malloc fails.
  • OCS_HAL_RTN_NO_RESOURCES if unable to get a command context.
  • OCS_HAL_RTN_ERROR on any other error.

Definition at line 7116 of file ocs_hal.c.

static ocs_hal_sgl_info_t * ocs_hal_sgl_info_alloc ( ocs_hal_t *  hal)
static

Allocate a HAL SGL Chaining object.

Description
Note: The hal->io_lock should already be locked.
Parameters
halHardware context.
Returns
Returns sgl_info pointer, or NULL if out of resources.

Definition at line 5292 of file ocs_hal.c.

static void ocs_hal_sgl_info_free ( ocs_hal_t *  hal,
ocs_hal_sgl_info_t *  sgl_info 
)
static

Free a previously allocated HAL SGL Chaining object.

Description
Note: The hal->io_lock should already be locked.
Parameters
halHardware context.
sgl_infopointer to the SGL chaining object.

Definition at line 5327 of file ocs_hal.c.