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 (ocs_hal_t *hal, uint8_t *cmd, uint32_t opts, void *cb, void *arg)
 Issue a SLI command. More...
 
static ocs_hal_io_t * _ocs_hal_io_alloc (ocs_hal_t *hal)
 Lockless allocate a HAL IO object. More...
 
ocs_hal_io_t * ocs_hal_io_alloc (ocs_hal_t *hal)
 Allocate a HAL IO object. More...
 
ocs_hal_io_t * ocs_hal_io_activate_port_owned (ocs_hal_t *hal, ocs_hal_io_t *io)
 Allocate/Activate a port owned HAL IO object. More...
 
static void ocs_hal_io_free_move_correct_list (ocs_hal_t *hal, ocs_hal_io_t *io)
 When an IO is freed, depending on the exchange busy flag, and other workarounds, move it to the correct list. More...
 
static void ocs_hal_io_free_common (ocs_hal_t *hal, ocs_hal_io_t *io)
 Free a HAL IO object. Perform cleanup common to port and host-owned IOs. More...
 
static void ocs_hal_io_free_port_owned (void *arg)
 Free a HAL IO object associated with a port-owned XRI. More...
 
static void ocs_hal_io_free_internal (void *arg)
 Free a previously-allocated HAL IO object. Called when IO refcount goes to zero (host-owned IOs only). More...
 
int32_t ocs_hal_io_free (ocs_hal_t *hal, ocs_hal_io_t *io)
 Free a previously-allocated HAL IO object. More...
 
uint8_t ocs_hal_io_inuse (ocs_hal_t *hal, ocs_hal_io_t *io)
 Check if given HAL IO is in-use. More...
 
ocs_hal_rtn_e ocs_hal_srrs_send (ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, ocs_dma_t *send, uint32_t len, ocs_dma_t *receive, ocs_remote_node_t *rnode, ocs_hal_io_param_t *iparam, ocs_hal_srrs_cb_t cb, void *arg)
 Send a Single Request/Response Sequence (SRRS). 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_remote_node_t *rnode, void *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)
 Initialize the scatter gather list entries of 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_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_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...
 
ocs_hal_rtn_e ocs_hal_io_abort (ocs_hal_t *hal, ocs_hal_io_t *io_to_abort, uint32_t send_abts, void *cb, void *arg)
 Abort a previously-started IO. More...
 
int32_t ocs_hal_io_get_xid (ocs_hal_t *hal, ocs_hal_io_t *io)
 Return the OX_ID/RX_ID of the IO. More...
 
ocs_hal_rtn_e ocs_hal_get_sfp (ocs_hal_t *hal, uint16_t page, ocs_hal_sfp_cb_t cb, void *arg)
 Function to retrieve the SFP information. More...
 
ocs_hal_rtn_e ocs_hal_get_port_protocol (ocs_hal_t *hal, uint32_t pci_func, ocs_get_port_protocol_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, ocs_hal_port_protocol_e new_protocol, uint32_t pci_func, ocs_set_port_protocol_cb_t cb, void *ul_arg)
 Set the port protocol. More...
 
ocs_hal_rtn_e ocs_hal_get_profile_list (ocs_hal_t *hal, ocs_get_profile_list_cb_t cb, void *ul_arg)
 Get a list of available profiles. More...
 
int32_t ocs_hal_get_active_profile (ocs_hal_t *hal, ocs_get_active_profile_cb_t cb, void *ul_arg)
 Get the currently active profile. More...
 
int32_t ocs_hal_get_nvparms (ocs_hal_t *hal, ocs_get_nvparms_cb_t cb, void *ul_arg)
 Read non-volatile parms. More...
 
int32_t ocs_hal_set_nvparms (ocs_hal_t *hal, ocs_set_nvparms_cb_t cb, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *ul_arg)
 Write non-volatile parms. More...
 
int32_t ocs_hal_set_active_profile (ocs_hal_t *hal, ocs_set_active_profile_cb_t cb, uint32_t profile_id, void *ul_arg)
 Set the currently active profile. More...
 

Function Details

static ocs_hal_io_t* _ocs_hal_io_alloc ( ocs_hal_t *  hal)
inlinestatic

Lockless allocate a HAL IO object.

Description
Assume that hal->ocs_lock is held. This function is only used if use_dif_sec_xri workaround is being used.
Parameters
halHardware context.
Returns
Returns a pointer to an object on success, or NULL on failure.

Definition at line 3806 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_command ( ocs_hal_t *  hal,
uint8_t *  cmd,
uint32_t  opts,
void *  cb,
void *  arg 
)

Issue a SLI command.

Description
Send a mailbox command to the hardware, and either wait for a completion (OCS_CMD_POLL) or get an optional asynchronous completion (OCS_CMD_NOWAIT).
Parameters
halHardware context.
cmdBuffer containing a formatted command and results.
optsCommand options:
  • OCS_CMD_POLL - Command executes synchronously and busy-waits for the completion.
  • OCS_CMD_NOWAIT - Command executes asynchronously. Uses callback.
cbFunction callback used for asynchronous mode. May be NULL.
Prototype is (*cb)(void *arg, uint8_t *cmd).

Note: If the callback function pointer is NULL, the results of the command are silently discarded, allowing this pointer to exist solely on the stack.
argArgument passed to an asynchronous callback.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 2731 of file ocs_hal.c.

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

Get the currently active profile.

Description
Issues a SLI-4 COMMON_GET_ACTIVE_PROFILE mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHardware 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 9077 of file ocs_hal.c.

int32_t ocs_hal_get_nvparms ( ocs_hal_t *  hal,
ocs_get_nvparms_cb_t  cb,
void *  ul_arg 
)

Read non-volatile parms.

Description
Issues a SLI-4 READ_NVPARMS mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHardware 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 9178 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_port_protocol ( ocs_hal_t *  hal,
uint32_t  pci_func,
ocs_get_port_protocol_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
halHardware context.
pci_funcPCI function to query for current protocol.
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 8498 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_profile_list ( ocs_hal_t *  hal,
ocs_get_profile_list_cb_t  cb,
void *  ul_arg 
)

Get a list of available profiles.

Description
Issues a SLI-4 COMMON_GET_PROFILE_LIST mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHardware 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 8955 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_sfp ( ocs_hal_t *  hal,
uint16_t  page,
ocs_hal_sfp_cb_t  cb,
void *  arg 
)

Function to retrieve the SFP information.

Parameters
halHardware context.
pageThe page of SFP data to retrieve (0xa0 or 0xa2).
cbFunction call upon completion of sending the data (may be NULL).
argArgument to pass to IO completion function.
Returns
Returns OCS_HAL_RTN_SUCCESS, OCS_HAL_RTN_ERROR, or OCS_HAL_RTN_NO_MEMORY.

Definition at line 5759 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_abort ( ocs_hal_t *  hal,
ocs_hal_io_t *  io_to_abort,
uint32_t  send_abts,
void *  cb,
void *  arg 
)

Abort a previously-started IO.

Parameters
halHardware context.
io_to_abortThe IO to abort.
send_abtsBoolean to have the hardware automatically generate an ABTS.
cbFunction call upon completion of the abort (may be NULL).
argArgument to pass to abort completion function.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 5343 of file ocs_hal.c.

ocs_hal_io_t* ocs_hal_io_activate_port_owned ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Allocate/Activate a port owned HAL IO object.

Description
This function is called by the transport layer when an XRI is allocated by the SLI-Port. This will "activate" the HAL IO associated with the XRI received from the SLI-Port to mirror the state of the XRI.

Note: This function applies to port owned XRIs only.
Parameters
halHardware context.
ioPointer HAL IO to activate/allocate.
Returns
Returns a pointer to an object on success, or NULL on failure.

Definition at line 3867 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 value on failure.

Definition at line 5283 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 value on failure.

Definition at line 5029 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 by addr.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 5214 of file ocs_hal.c.

ocs_hal_io_t* ocs_hal_io_alloc ( ocs_hal_t *  hal)

Allocate a HAL IO object.

Description

Note: This function applies to non-port owned XRIs only.
Parameters
halHardware context.
Returns
Returns a pointer to an object on success, or NULL on failure.

Definition at line 3839 of file ocs_hal.c.

int32_t ocs_hal_io_free ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Free a previously-allocated HAL IO object.

Description

Note: This function applies to port and host owned XRIs.
Parameters
halHardware context.
ioPointer to the HAL IO object.
Returns
Returns a non-zero value if HAL IO was freed, 0 if references on the IO still exist, or a negative value if an error occurred.

Definition at line 4001 of file ocs_hal.c.

static void ocs_hal_io_free_common ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
inlinestatic

Free a HAL IO object. Perform cleanup common to port and host-owned IOs.

Parameters
halHardware context.
ioPointer to the HAL IO object.

Definition at line 3925 of file ocs_hal.c.

static void ocs_hal_io_free_internal ( void *  arg)
static

Free a previously-allocated HAL IO object. Called when IO refcount goes to zero (host-owned IOs only).

Parameters
argPointer to the HAL IO object.

Definition at line 3970 of file ocs_hal.c.

static void ocs_hal_io_free_move_correct_list ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
static

When an IO is freed, depending on the exchange busy flag, and other workarounds, move it to the correct list.

Description

Note: Assumes that the hal->io_lock is held and the item has been removed from the busy or wait_free list.
Parameters
halHardware context.
ioPointer to the IO object to move.

Definition at line 3898 of file ocs_hal.c.

static void ocs_hal_io_free_port_owned ( void *  arg)
static

Free a HAL IO object associated with a port-owned XRI.

Parameters
argPointer to the HAL IO object.

Definition at line 3941 of file ocs_hal.c.

int32_t ocs_hal_io_get_xid ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Return the OX_ID/RX_ID of the IO.

Parameters
halHardware context.
ioHAL IO object.
Returns
Returns X_ID on success, or -1 on failure.

Definition at line 5488 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 
)

Initialize the scatter gather list entries of an IO.

Parameters
halHardware context.
ioPreviously-allocated HAL IO object.
typeType of IO (target read, target response, and so on).
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 4917 of file ocs_hal.c.

uint8_t ocs_hal_io_inuse ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Check if given HAL IO is in-use.

Description
This function returns TRUE if the given HAL IO has been allocated and is in-use, and FALSE otherwise. It applies to port and host owned XRIs.
Parameters
halHardware context.
ioPointer to the HAL IO object.
Returns
TRUE if an IO is in use, or FALSE otherwise.

Definition at line 4029 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_remote_node_t *  rnode,
void *  cb,
void *  arg 
)

Send a read, write, or response IO.

Description
This routine supports sending a higher-level IO (for example, FCP) between two endpoints as a target or initiator. Examples include:
  • Sending read data and good response (target).
  • Sending a response (target with no data or after receiving write data).
This 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_add_sge().
Parameters
halHardware context.
typeType of IO (target read, target response, and so on).
ioPreviously-allocated HAL IO object.
lenLength, in bytes, of data to send.
iparamIO parameters.
rnodeDestination of data (that is, a remote node).
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 on failure.

Definition at line 4507 of file ocs_hal.c.

int32_t ocs_hal_set_active_profile ( ocs_hal_t *  hal,
ocs_set_active_profile_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
halHardware context.
profile_idProfile ID to activate.
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 9484 of file ocs_hal.c.

int32_t ocs_hal_set_nvparms ( ocs_hal_t *  hal,
ocs_set_nvparms_cb_t  cb,
uint8_t *  wwpn,
uint8_t *  wwnn,
uint8_t  hard_alpa,
uint32_t  preferred_d_id,
void *  ul_arg 
)

Write non-volatile parms.

Description
Issues a SLI-4 WRITE_NVPARMS mailbox. When the command completes the provided mgmt callback function is called.
Parameters
halHardware context.
cbCallback function to be called when the command completes.
wwpnPort's WWPN in big-endian order, or NULL to use default.
wwnnPort's WWNN in big-endian order, or NULL to use default.
hard_alpaA hard AL_PA address setting used during loop initialization. If no hard AL_PA is required, set to 0.
preferred_d_idA preferred D_ID address setting that may be overridden with the CONFIG_LINK mailbox command. If there is no preference, set to 0.
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 9280 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_port_protocol ( ocs_hal_t *  hal,
ocs_hal_port_protocol_e  new_protocol,
uint32_t  pci_func,
ocs_set_port_protocol_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.

On successful completion this function will have allocated two regular memory areas and one dma area which will need to get freed later in the callbacks.

Parameters
halHardware context.
new_protocolNew protocol to use.
pci_funcPCI function to configure.
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 8803 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_srrs_send ( ocs_hal_t *  hal,
ocs_hal_io_type_e  type,
ocs_hal_io_t *  io,
ocs_dma_t *  send,
uint32_t  len,
ocs_dma_t *  receive,
ocs_remote_node_t *  rnode,
ocs_hal_io_param_t *  iparam,
ocs_hal_srrs_cb_t  cb,
void *  arg 
)

Send a Single Request/Response Sequence (SRRS).

Description
This routine supports communication sequences consisting of a single request and single response between two endpoints. Examples include:
  • Sending an ELS request.
  • Sending an ELS response - To send an ELS reponse, the caller must provide the OX_ID from the received request.
  • Sending a FC Common Transport (FC-CT) request - To send a FC-CT request, the caller must provide the R_CTL, TYPE, and DF_CTL values to place in the FC frame header.

Note: The caller is expected to provide both send and receive buffers for requests. In the case of sending a response, no receive buffer is necessary and the caller may pass in a NULL pointer.
Parameters
halHardware context.
typeType of sequence (ELS request/response, FC-CT).
ioPreviously-allocated HAL IO object.
sendDMA memory holding data to send (for example, ELS request, BLS response).
lenLength, in bytes, of data to send.
receiveOptional DMA memory to hold a response.
rnodeDestination of data (that is, a remote node).
iparamIO parameters (ELS response and FC-CT).
cbFunction call upon completion of sending the data (may be NULL).
argArgument to pass to IO completion function.
Returns
Returns 0 on success, or a non-zero on failure.

Definition at line 4295 of file ocs_hal.c.