Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_hal_rqpair.c File Reference
#include "ocs_os.h"
#include "ocs_hal.h"

Go to the source code of this file.

Detailed Description

This file contains code related to operating in RQ Pair mode.

Definition in file ocs_hal_rqpair.c.

Functions

static int32_t ocs_hal_rqpair_find (ocs_hal_t *hal, uint16_t rq_id)
 Find the RQ index of RQ_ID. More...
 
static ocs_hal_sequence_t * ocs_hal_rqpair_get (ocs_hal_t *hal, uint16_t rqindex, uint16_t bufindex)
 Return pointer to RQ buffer entry. More...
 
static int32_t ocs_hal_rqpair_put (ocs_hal_t *hal, ocs_hal_sequence_t *seq)
 Posts an RQ buffer to a queue and update the verification structures. More...
 
int32_t ocs_hal_rqpair_process_rq (ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
 Process receive queue completions for RQ Pair mode. More...
 
int32_t ocs_hal_rqpair_tow_cmd_process (ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
 Process receive queue completions for RQ Pair mode - Auto xfer rdy. More...
 
int32_t ocs_hal_rqpair_tow_data_process (ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
 Process CQ completions for Auto xfer rdy data phases. More...
 
ocs_hal_rtn_e ocs_hal_rqpair_sequence_free (ocs_hal_t *hal, ocs_hal_sequence_t *seq)
 Return RQ buffers (while in RQ pair mode). More...
 
ocs_hal_rtn_e ocs_hal_rqpair_tow_buffer_alloc (ocs_hal_t *hal, uint32_t num_buffers)
 Allocate tow buffers. More...
 
static void ocs_hal_rqpair_tow_dnrx_check (ocs_hal_t *hal)
 Post Auto xfer rdy buffers to the XRIs posted with DNRX. More...
 
static int32_t ocs_hal_rqpair_auto_xfer_rdy_move_to_port_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the POST_SGL_PAGE command completes. More...
 
ocs_hal_rtn_e ocs_hal_rqpair_tow_move_to_port (ocs_hal_t *hal, ocs_hal_io_t *io)
 Prepares an XRI to move to the chip. More...
 
void ocs_hal_rqpair_tow_move_to_host (ocs_hal_t *hal, ocs_hal_io_t *io)
 Prepares an XRI to move back to the host. More...
 

Attach an TOW XRI buffer to an IO

Description
Puts the data SGL into the SGL list for the IO object
Note: io_lock must be held.
Parameters
halHardware context allocated by the caller.
ioPointer to the IO object.
Returns
Returns the value of DNRX bit in the TRSP and ABORT WQEs.
static ocs_hal_rtn_e ocs_hal_rqpair_tow_buffer_sequence_reset (ocs_hal_t *hal, ocs_hal_sequence_t *seq)
 Return tow buffers (while in RQ pair mode). More...
 
uint8_t ocs_hal_rqpair_tow_xri_buffer_attach (ocs_hal_t *hal, ocs_hal_io_t *io, int32_t reuse_buf)
 
static void ocs_hal_rqpair_tow_buffer_free (ocs_hal_t *hal)
 Free tow buffers. More...
 
ocs_hal_rtn_e ocs_hal_rqpair_init (ocs_hal_t *hal)
 Configure the rq_pair function from ocs_hal_init(). Must be after the IOs are setup and the state is active. More...
 
void ocs_hal_rqpair_teardown (ocs_hal_t *hal)
 Tear down the rq_pair function from ocs_hal_teardown(). More...
 

Function Details

static int32_t ocs_hal_rqpair_auto_xfer_rdy_move_to_port_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the POST_SGL_PAGE command completes.

Description
Free the mailbox command buffer.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done.
Returns
Returns 0.

Definition at line 676 of file ocs_hal_rqpair.c.

static int32_t ocs_hal_rqpair_find ( ocs_hal_t *  hal,
uint16_t  rq_id 
)
inlinestatic

Find the RQ index of RQ_ID.

Parameters
halHardware context.
rq_idRQ ID to find.
Returns
Returns the RQ index, or -1 if not found

Definition at line 570 of file ocs_hal_rqpair.c.

static ocs_hal_sequence_t * ocs_hal_rqpair_get ( ocs_hal_t *  hal,
uint16_t  rqindex,
uint16_t  bufindex 
)
static

Return pointer to RQ buffer entry.

Description
Returns a pointer to the RQ buffer entry given by rqindex and bufindex.
Parameters
halHardware context.
rqindexIndex of the RQ that is being processed.
bufindexIndex into the RQ that is being processed.
Returns
Pointer to the sequence structure, or NULL otherwise.

Definition at line 431 of file ocs_hal_rqpair.c.

int32_t ocs_hal_rqpair_process_rq ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint8_t *  cqe 
)

Process receive queue completions for RQ Pair mode.

Description
RQ completions are processed. In RQ pair mode, a single header and single payload buffer are received, and passed to the function that has registered for unsolicited callbacks.
Parameters
halHardware context.
cqPointer to HAL completion queue.
cqeCompletion queue entry.
Returns
Returns 0 for success, or a negative error code value for failure.

Definition at line 66 of file ocs_hal_rqpair.c.

static int32_t ocs_hal_rqpair_put ( ocs_hal_t *  hal,
ocs_hal_sequence_t *  seq 
)
static

Posts an RQ buffer to a queue and update the verification structures.

Parameters
halhardware context
seqPointer to sequence object.
Returns
Returns 0 on success, or a non-zero value otherwise.

Definition at line 478 of file ocs_hal_rqpair.c.

ocs_hal_rtn_e ocs_hal_rqpair_sequence_free ( ocs_hal_t *  hal,
ocs_hal_sequence_t *  seq 
)

Return RQ buffers (while in RQ pair mode).

Description
The header and payload buffers are returned to the Receive Queue.
Parameters
halHardware context.
seqHeader/payload sequence buffers.
Returns
Returns OCS_HAL_RTN_SUCCESS on success, or an error code value on failure.

Definition at line 540 of file ocs_hal_rqpair.c.

static ocs_hal_rtn_e ocs_hal_rqpair_tow_buffer_sequence_reset ( ocs_hal_t *  hal,
ocs_hal_sequence_t *  seq 
)
static

Return tow buffers (while in RQ pair mode).

Description
The header and payload buffers are returned to the tow pool.
Parameters
halHardware context.
seqHeader/payload sequence buffers.
Returns
Returns OCS_HAL_RTN_SUCCESS for success, an error code value for failure.

Definition at line 844 of file ocs_hal_rqpair.c.

int32_t ocs_hal_rqpair_tow_cmd_process ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint8_t *  cqe 
)

Process receive queue completions for RQ Pair mode - Auto xfer rdy.

Description
RQ completions are processed. In RQ pair mode, a single header and single payload buffer are received, and passed to the function that has registered for unsolicited callbacks.
Parameters
halHardware context.
cqPointer to HAL completion queue.
cqeCompletion queue entry.
Returns
Returns 0 for success, or a negative error code value for failure.

Definition at line 180 of file ocs_hal_rqpair.c.

int32_t ocs_hal_rqpair_tow_data_process ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint8_t *  cqe 
)

Process CQ completions for Auto xfer rdy data phases.

Description
The data is DMA'd into the data buffer posted to the SGL prior to the XRI being assigned to an IO. When the completion is received, All of the data is in the single buffer.
Parameters
halHardware context.
cqPointer to HAL completion queue.
cqeCompletion queue entry.
Returns
Returns 0 for success, or a negative error code value for failure.

Definition at line 344 of file ocs_hal_rqpair.c.

void ocs_hal_rqpair_tow_move_to_host ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Prepares an XRI to move back to the host.

Description
Releases any attached buffer back to the pool.
Parameters
halHardware context allocated by the caller.
ioPointer to the IO object.

Definition at line 741 of file ocs_hal_rqpair.c.

ocs_hal_rtn_e ocs_hal_rqpair_tow_move_to_port ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Prepares an XRI to move to the chip.

Description
Puts the data SGL into the SGL list for the IO object and possibly registers an SGL list for the XRI. Since both the POST_XRI and POST_SGL_PAGES commands are mailbox commands, we don't need to wait for completion before preceding.
Parameters
halHardware context allocated by the caller.
ioPointer to the IO object.
Returns
Returns OCS_HAL_RTN_SUCCESS for success, or an error code value for failure.

Definition at line 695 of file ocs_hal_rqpair.c.

uint8_t ocs_hal_rqpair_tow_xri_buffer_attach ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
int32_t  reuse_buf 
)

Definition at line 775 of file ocs_hal_rqpair.c.