Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_dif.h File Reference

Go to the source code of this file.

Data Structures

struct  ocs_dif_t
 

Functions

uint32_t ocs_scsi_dif_blocksize (ocs_scsi_dif_info_t *dif_info)
 Return blocksize given SCSI API DIF block size. More...
 
int32_t ocs_scsi_dif_set_blocksize (ocs_scsi_dif_info_t *dif_info, uint32_t blocksize)
 Set SCSI API DIF blocksize. More...
 
int32_t ocs_scsi_dif_mem_blocksize (ocs_scsi_dif_info_t *dif_info, int wiretomem)
 Return memory block size given SCSI DIF API. More...
 
int32_t ocs_scsi_dif_wire_blocksize (ocs_scsi_dif_info_t *dif_info, int wiretomem)
 Return wire block size given SCSI DIF API. More...
 
uint32_t ocs_hal_dif_blocksize (ocs_hal_dif_info_t *dif_info)
 Return blocksize given HAL API DIF block size. More...
 
int32_t ocs_hal_dif_mem_blocksize (ocs_hal_dif_info_t *dif_info, int wiretomem)
 Return memory block size given HAL DIF API. More...
 
int32_t ocs_hal_dif_wire_blocksize (ocs_hal_dif_info_t *dif_info, int wiretomem)
 Return wire block size given HAL DIF API. More...
 
uint16_t ocs_scsi_dif_calc_crc (const uint8_t *, uint32_t size, uint16_t crc)
 Calculate the T10 PI CRC guard value for a block. More...
 
uint16_t ocs_scsi_dif_calc_checksum (ocs_scsi_vaddr_len_t addrlen[], uint32_t addrlen_count)
 Calculate the IP-checksum guard value for a block. More...
 

Function Details

uint32_t ocs_hal_dif_blocksize ( ocs_hal_dif_info_t *  dif_info)

Return blocksize given HAL API DIF block size.

Given the DIF block size enumerated value, return the block size value. (e.g. OCS_SCSI_DIF_BLK_SIZE_512 returns 512)

Parameters
dif_infoPointer to HAL API DIF info block
Returns
returns block size, or 0 if HAL API DIF blocksize is invalid

Definition at line 291 of file ocs_dif.c.

int32_t ocs_hal_dif_mem_blocksize ( ocs_hal_dif_info_t *  dif_info,
int  wiretomem 
)

Return memory block size given HAL DIF API.

The blocksize in memory for the DIF transfer is returned, given the HAL DIF info block and the direction of transfer.

Parameters
dif_infoPointer to DIF info block
wiretomemTransfer direction, 1 is wire to memory, 0 is memory to wire
Returns
Memory blocksize, or negative error value

WARNING: the order of initialization of the adj[] arrays MUST match the declarations of OCS_HAL_DIF_OPER_*

Definition at line 325 of file ocs_dif.c.

int32_t ocs_hal_dif_wire_blocksize ( ocs_hal_dif_info_t *  dif_info,
int  wiretomem 
)

Return wire block size given HAL DIF API.

The blocksize on the wire for the DIF transfer is returned, given the HAL DIF info block and the direction of transfer.

Parameters
dif_infoPointer to DIF info block
wiretomemTransfer direction, 1 is wire to memory, 0 is memory to wire
Returns
Wire blocksize or negative error value

WARNING: the order of initialization of the adj[] arrays MUST match the declarations of OCS_HAL_DIF_OPER_*

Definition at line 382 of file ocs_dif.c.

uint32_t ocs_scsi_dif_blocksize ( ocs_scsi_dif_info_t *  dif_info)

Return blocksize given SCSI API DIF block size.

Given the DIF block size enumerated value, return the block size value. (e.g. OCS_SCSI_DIF_BLK_SIZE_512 returns 512)

Parameters
dif_infoPointer to SCSI API DIF info block
Returns
returns block size, or 0 if SCSI API DIF blocksize is invalid

Definition at line 114 of file ocs_dif.c.

uint16_t ocs_scsi_dif_calc_checksum ( ocs_scsi_vaddr_len_t  addrlen[],
uint32_t  addrlen_count 
)

Calculate the IP-checksum guard value for a block.

Parameters
addrlenarray of address length pairs
addrlen_countnumber of entries in the addrlen[] array

Algorithm: Sum all all the 16-byte words in the block Add in the "carry", which is everything in excess of 16-bits Flip all the bits

Returns
Returns the calculated checksum

Definition at line 74 of file ocs_dif.c.

uint16_t ocs_scsi_dif_calc_crc ( const uint8_t *  buffer,
uint32_t  size,
uint16_t  crc 
)

Calculate the T10 PI CRC guard value for a block.

Parameters
bufferPointer to the data buffer.
sizeNumber of bytes.
crcPreviously-calculated CRC, or 0 for a new block.
Returns
Returns the calculated CRC, which may be passed back in for partial blocks.

Definition at line 54 of file ocs_dif.c.

int32_t ocs_scsi_dif_mem_blocksize ( ocs_scsi_dif_info_t *  dif_info,
int  wiretomem 
)

Return memory block size given SCSI DIF API.

The blocksize in memory for the DIF transfer is returned, given the SCSI DIF info block and the direction of transfer.

Parameters
dif_infoPointer to DIF info block
wiretomemTransfer direction, 1 is wire to memory, 0 is memory to wire
Returns
Memory blocksize, or negative error value

WARNING: the order of initialization of the adj[] arrays MUST match the declarations of OCS_SCSI_DIF_OPER_*

Definition at line 180 of file ocs_dif.c.

int32_t ocs_scsi_dif_set_blocksize ( ocs_scsi_dif_info_t *  dif_info,
uint32_t  blocksize 
)

Set SCSI API DIF blocksize.

Given a blocksize value (512, 1024, etc.), set the SCSI API DIF blocksize in the DIF info block

Parameters
dif_infoPointer to the SCSI API DIF info block
blocksizeBlock size
Returns
returns 0 for success, a negative error code value for failure.

Definition at line 145 of file ocs_dif.c.

int32_t ocs_scsi_dif_wire_blocksize ( ocs_scsi_dif_info_t *  dif_info,
int  wiretomem 
)

Return wire block size given SCSI DIF API.

The blocksize on the wire for the DIF transfer is returned, given the SCSI DIF info block and the direction of transfer.

Parameters
dif_infoPointer to DIF info block
wiretomemTransfer direction, 1 is wire to memory, 0 is memory to wire
Returns
Wire blocksize or negative error value

WARNING: the order of initialization of the adj[] arrays MUST match the declarations of OCS_SCSI_DIF_OPER_*

Definition at line 237 of file ocs_dif.c.