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

Functions

static void post_one_ua (ocs_node_t *node, uint32_t lun, uint8_t asc, uint8_t ascq)
 Post a Unit Attention condition to a node/LUN (I_T nexus). More...
 
void ocs_ramd_post_ua (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint8_t asc, uint8_t ascq, ocs_node_t *except_node)
 Post a Unit Attention condition to a ramdisc. More...
 
int32_t ocs_ramd_get_ua (ocs_t *ocs, ocs_node_t *node, uint32_t lun, uint8_t *asc, uint8_t *ascq)
 Get a pending Unit Attention, if any. More...
 
void ocs_ramd_clear_ua (ocs_t *ocs, ocs_node_t *node, uint32_t lun, uint8_t asc, uint8_t ascq)
 Clear a Unit Attention condition. More...
 
int32_t ocs_new_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size, uint32_t blocks_per_segment, uint64_t block_count)
 Create a new ramdisc instance (LUN). More...
 
int32_t ocs_del_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc)
 Delete a ramdisc instance. More...
 
int32_t ocs_ramdisc_sgl (ocs_t *ocs, ocs_ramdisc_t *ramdisc, ocs_ramdisc_sgl_t *sgl, uint32_t max_sgl, uint32_t max_sge_size, uint32_t lba, uint32_t *block_count, uint32_t req_flags, uint8_t dump_buffer)
 Build an SGL list for blocks in a ramdisc. More...
 
int32_t ocs_format_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size, uint8_t p_type, uint8_t prot_en, uint8_t dif_separate)
 Reformat an existing ramdisc, possibly the changing block size and/or protection. More...
 
void ocs_set_ramdisc_blocksize (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size)
 Set the ramdisc block size. More...
 
uint32_t ocs_get_ramdisc_blocksize (ocs_t *ocs, ocs_ramdisc_t *ramdisc)
 Get the ramdisc block size. More...
 
uint8_t * ocs_ramdisc_lba_address (ocs_ramdisc_t *ramdisc, uint64_t lba)
 Return the address of a ramdisc logical block. More...
 
dif_t * ocs_ramdisc_dif_address (ocs_ramdisc_t *ramdisc, uint64_t lba)
 Return the address of the DIF block if protection is enabled. More...
 

Function Details

int32_t ocs_del_ramdisc ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc 
)

Delete a ramdisc instance.

Description
The resources associated with a previously-initialized ramdisc instance are freed.
Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc instance to free.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 151 of file ocs_ramdisc.c.

int32_t ocs_format_ramdisc ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
uint32_t  block_size,
uint8_t  p_type,
uint8_t  prot_en,
uint8_t  dif_separate 
)

Reformat an existing ramdisc, possibly the changing block size and/or protection.

Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc instance.
block_sizeRequested block size
p_typeRequested new protection type.
prot_enRequested new protection enabled flag.
dif_separateRequested DIF separates
Returns
Returns a non-zero value if the format changed, or 0 if the format did not change.

Definition at line 359 of file ocs_ramdisc.c.

uint32_t ocs_get_ramdisc_blocksize ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc 
)

Get the ramdisc block size.

Description
Return the block size for a ramdisc instance.
Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc object.
Returns
Returns the block size of the ramdisc.

Definition at line 555 of file ocs_ramdisc.c.

int32_t ocs_new_ramdisc ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
uint32_t  block_size,
uint32_t  blocks_per_segment,
uint64_t  block_count 
)

Create a new ramdisc instance (LUN).

Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc instance to initialize.
block_sizeRamdisc block size.
blocks_per_segmentRamdisc blocks per storage segment.
block_countRamdisc total device block count.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 72 of file ocs_ramdisc.c.

void ocs_ramd_clear_ua ( ocs_t *  ocs,
ocs_node_t *  node,
uint32_t  lun,
uint8_t  asc,
uint8_t  ascq 
)

Clear a Unit Attention condition.

Description
Given a node, LUN, ASC, and ASCQ, this function clears a Unit Attention condition from that node/LUN combination for the given ASC and ASCQ.
Parameters
ocsPointer to the ocs structure.
nodePointer to the node structure.
lunLogical Unit Number.
ascAdditional Sense Code.
ascqAdditional Sense Code Qualifier.
Returns
None.

Definition at line 6945 of file ocs_ramd.c.

int32_t ocs_ramd_get_ua ( ocs_t *  ocs,
ocs_node_t *  node,
uint32_t  lun,
uint8_t *  asc,
uint8_t *  ascq 
)

Get a pending Unit Attention, if any.

Description
Given a node and a LUN, check for a pending Unit Attention condition. If there is a pending Unit Attention, the function fills in the ASC and ASCQ for the UA and returns non-zero. If there are no pending UA conditions, the function returns 0. If there is more than one UA condition pending, the function returns the first one found.

This function is on the performance path. It is called for every command received from the initiator, including I/Os.
Parameters
ocsPointer to the ocs structure.
nodePointer to the node structure.
lunLogical Unit Number.
ascPointer to the location to store the Additional Sense Code.
ascqPointer to the location to store the Additional Sense Code Qualifier.
Returns
Returns 1 if a Unit Attention exists, or 0 if not.

Definition at line 6899 of file ocs_ramd.c.

void ocs_ramd_post_ua ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
uint8_t  asc,
uint8_t  ascq,
ocs_node_t *  except_node 
)

Post a Unit Attention condition to a ramdisc.

Description
Posts a Unit Attention condition to a ramdisc. If use_global_ramd is true, then there is only one ramdisc and all nodes are attached to it. In this case, this function posts the UA to all nodes. If use_global_ramd is false, then there is a ramdisc per sport. In this case, this function posts the UA to all nodes on that sport.

If except_node points to a node structure, then that node does not get the UA posted. This is used when the ramdisc has been formatted so that the UA can be posted to all nodes other than the one that requested the format. See SBC 4.10.
Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc.
ascAdditional Sense Code.
ascqAdditional Sense Code Qualifier.
except_nodeNode which should not get the UA posted. May be NULL.
Returns
None.

Definition at line 6826 of file ocs_ramd.c.

dif_t* ocs_ramdisc_dif_address ( ocs_ramdisc_t *  ramdisc,
uint64_t  lba 
)

Return the address of the DIF block if protection is enabled.

Description
Given a pointer to a ramdisc and a logical block address, return the address in memory of the DIF block if protection is enabled.
Parameters
ramdiscPointer to the ramdisc structure.
lbaLogical Block Address.
Returns
Returns the pointer to the first block of the LBA, or NULL if the LBA is invalid.

Definition at line 605 of file ocs_ramdisc.c.

uint8_t* ocs_ramdisc_lba_address ( ocs_ramdisc_t *  ramdisc,
uint64_t  lba 
)

Return the address of a ramdisc logical block.

Description
Given a pointer to a ramdisc and a logical block address, return the address in memory of the first byte of the block.
Parameters
ramdiscPointer to the ramdisc structure.
lbaLogical Block Address.
Returns
Returns the pointer to the first block of the LBA, or NULL if the LBA is invalid.

Definition at line 577 of file ocs_ramdisc.c.

int32_t ocs_ramdisc_sgl ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
ocs_ramdisc_sgl_t *  sgl,
uint32_t  max_sgl,
uint32_t  max_sge_size,
uint32_t  lba,
uint32_t *  block_count,
uint32_t  req_flags,
uint8_t  dump_buffer 
)

Build an SGL list for blocks in a ramdisc.

Description
A starting block address and count are used to build a generic scatter gather list.
Parameters
ocsPointer to the ocs structure.
ramdiscPointer to a ramdisc instance.
sglPointer to the SGL.
max_sglMaximum number of scatter gather entries in an SGL.
max_sge_sizeMaximum size of an SGE, in bytes.
lbaStarting block address.
block_countThe number of blocks to transfer for the IO. May be updated to contain the number of blocks in the SGLs, which may be less if the max_sgl count or max_xfer_size is reached.
req_flagsSGL flags indicating the type of SGL to be built. If the SGL_REQ_FLAGS_PHYS (1U << 0) bit is set, then the SGL includes the block data and DIF. Otherwise, the SGL builds a DIF or non-DIF SGL.
Note: In the case of a separate DIF, an SGL_REQ_FLAGS_PHYS results in a one block data SGE followed by an 8-byte SGE containing the DIF data, repeating.
dump_bufferIf TRUE and debug is enabled, the memory pointed to by the SGE is dumped to the log.
Returns
Returns the number of SGLs, or a negative error value on failure.

Definition at line 218 of file ocs_ramdisc.c.

void ocs_set_ramdisc_blocksize ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
uint32_t  block_size 
)

Set the ramdisc block size.

Description
The block size is set for a ramdisc instance.
Parameters
ocsPointer to the ocs structure.
ramdiscPointer to the ramdisc object to initialize.
block_sizeRamdisc device block size.
Returns
None.

Definition at line 537 of file ocs_ramdisc.c.

static void post_one_ua ( ocs_node_t *  node,
uint32_t  lun,
uint8_t  asc,
uint8_t  ascq 
)
static

Post a Unit Attention condition to a node/LUN (I_T nexus).

Parameters
nodePointer to a node structure.
lunLUN number.
ascAdditional Sense Code.
ascqAdditional Sense Code Qualifier.
Returns
None.

Definition at line 6758 of file ocs_ramd.c.