ZFCP HBA API Library 1
Supported HBA API Functions

Functions

HBA_UINT32 HBA_GetVersion (void)
 Return the version of the HBA API specification with which this library is compliant.
HBA_STATUS HBA_LoadLibrary (void)
 Perform initialization of library.
HBA_STATUS HBA_FreeLibrary (void)
 Free system resources that library has used.
HBA_UINT32 HBA_GetWrapperLibraryAttributes (HBA_LIBRARYATTRIBUTES *attributes)
 Return attributes of the OS specific HBA API library.
HBA_UINT32 HBA_GetVendorLibraryAttributes (HBA_UINT32 adapter_index, HBA_LIBRARYATTRIBUTES *attributes)
 Return attributes of the vendor specific HBA API library.
HBA_UINT32 HBA_GetNumberOfAdapters (void)
 Return number of adapters.
void HBA_RefreshInformation (HBA_HANDLE handle)
 Refresh information of an adapter.
void HBA_RefreshAdapterConfiguration (void)
 Refresh information about configured adapters.
void HBA_ResetStatistics (HBA_HANDLE handle, HBA_UINT32 portindex)
 According to FC-HBA this function is obsolete.
HBA_STATUS HBA_GetAdapterName (HBA_UINT32 adapterindex, char *pAdaptername)
 Return name that identifies an adapter.
HBA_HANDLE HBA_OpenAdapter (char *pAdaptername)
 Open an adapter.
void HBA_CloseAdapter (HBA_HANDLE handle)
 Close an open adapter.
HBA_STATUS HBA_GetAdapterAttributes (HBA_HANDLE handle, HBA_ADAPTERATTRIBUTES *pAdapterattributes)
 Return attributes for an adapter.
HBA_STATUS HBA_GetAdapterPortAttributes (HBA_HANDLE handle, HBA_UINT32 portindex, HBA_PORTATTRIBUTES *pPortattributes)
 Return attributes for an adapter port.
HBA_STATUS HBA_GetDiscoveredPortAttributes (HBA_HANDLE handle, HBA_UINT32 portindex, HBA_UINT32 discoveredportindex, HBA_PORTATTRIBUTES *pPortattributes)
 Return attributes of an discovered port.
HBA_STATUS HBA_GetPortStatistics (HBA_HANDLE handle, HBA_UINT32 portindex, HBA_PORTSTATISTICS *pPortstatistics)
 Return statistics of an adapter port.
HBA_STATUS HBA_GetFcpTargetMapping (HBA_HANDLE handle, HBA_FCPTARGETMAPPING *pMapping)
 Retrieve mappings between OS SCSI targets/units and FCP targets/units.
HBA_STATUS HBA_GetFcpTargetMappingV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, HBA_FCPTARGETMAPPINGV2 *pMappingV2)
 Retrieve mappings between OS SCSI targets/units and FCP targets/units.
HBA_STATUS HBA_SendScsiInquiry (HBA_HANDLE handle, HBA_WWN PortWWN, HBA_UINT64 fcLUN, HBA_UINT8 EVPD, HBA_UINT32 PageCode, void *pRspBuffer, HBA_UINT32 RspBufferSize, void *pSenseBuffer, HBA_UINT32 SenseBufferSize)
 Send a SCSI INQUIRY command to a FCP LUN.
HBA_STATUS HBA_ScsiInquiryV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, HBA_WWN discoveredPortWWN, HBA_UINT64 fcLUN, HBA_UINT8 CDB_Byte1, HBA_UINT8 CDB_Byte2, void *pRspBuffer, HBA_UINT32 *pRspBufferSize, HBA_UINT8 *pScsiStatus, void *pSenseBuffer, HBA_UINT32 *pSenseBufferSize)
 Send a SCSI INQUIRY command to a FCP LUN.
HBA_STATUS HBA_SendReportLUNs (HBA_HANDLE handle, HBA_WWN portWWN, void *pRspBuffer, HBA_UINT32 RspBufferSize, void *pSenseBuffer, HBA_UINT32 SenseBufferSize)
 Send a SCSI REPORT LUNS command to a target.
HBA_STATUS HBA_ScsiReportLUNsV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, HBA_WWN discoveredPortWWN, void *pRspBuffer, HBA_UINT32 *pRspBufferSize, HBA_UINT8 *pScsiStatus, void *pSenseBuffer, HBA_UINT32 *pSenseBufferSize)
 Send a SCSI REPORT LUNS command to a target.
HBA_STATUS HBA_SendReadCapacity (HBA_HANDLE handle, HBA_WWN portWWN, HBA_UINT64 fcLUN, void *pRspBuffer, HBA_UINT32 RspBufferSize, void *pSenseBuffer, HBA_UINT32 SenseBufferSize)
 Send a SCSI READ CAPACITY command to a FCP LUN.
HBA_STATUS HBA_ScsiReadCapacityV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, HBA_WWN discoveredPortWWN, HBA_UINT64 fcLUN, void *pRspBuffer, HBA_UINT32 *pRspBufferSize, HBA_UINT8 *pScsiStatus, void *pSenseBuffer, HBA_UINT32 *pSenseBufferSize)
 Send a SCSI READ CAPACITY command to a FCP LUN.
HBA_STATUS HBA_SendCTPassThru (HBA_HANDLE handle, void *pReqBuffer, HBA_UINT32 ReqBufferSize, void *pRspBuffer, HBA_UINT32 RspBufferSize)
 Send a CT pass thru - a CT frame constructed in userspace directly to the HBA / SAN.
HBA_STATUS HBA_SendCTPassThruV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, void *pReqBuffer, HBA_UINT32 ReqBufferSize, void *pRspBuffer, HBA_UINT32 *pRspBufferSize)
 Send a CT pass thru - a CT frame constructed in userspace directly to the HBA / SAN.
HBA_STATUS HBA_SendRNID (HBA_HANDLE handle, HBA_WWN wwn, HBA_WWNTYPE wwntype, void *pRspBuffer, HBA_UINT32 *pRspBufferSize)
 Send a RNID ELS to a port.
HBA_STATUS HBA_SendRNIDV2 (HBA_HANDLE handle, HBA_WWN hbaPortWWN, HBA_WWN destWWN, HBA_UINT32 destFCID, HBA_UINT32 NodeIdDataFormat, void *pRspBuffer, HBA_UINT32 *pRspBufferSize)
 Send a RNID ELS to a port.
HBA_STATUS HBA_GetEventBuffer (HBA_HANDLE handle, HBA_EVENTINFO *pEventBuffer, HBA_UINT32 *pEventCount)
 Return events for an adapter from the event queue.

Detailed Description

Function Documentation

◆ HBA_CloseAdapter()

void HBA_CloseAdapter ( HBA_HANDLE handle)

Close an open adapter.

Parameters
handleof adapter to be closed
Locks:
lock/unlock of vlib_data.mutex

The adapter handle is invalidated and the information about the ports and units of this adapter is deleted.

References doCloseAdapter(), getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_FreeLibrary()

HBA_STATUS HBA_FreeLibrary ( void )

Free system resources that library has used.

Returns
  • HBA_STATUS_ERROR_NOT_LOADED if HBA_LoadLibrary was not called before.
  • HBA_STATUS_ERROR if HBA_FreeLibrary is already running.
    • HBA_STATUS_OK on success.
      Locks:
      lock/unlock of vlib_data.mutex
      Note
      This function tries to close the zfcp_hbaapi char device.

References closeAllAdapters(), vlib_data::id, vlib_data::isLoaded, vlib_data::mutex, vlib_data::unloading, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetAdapterAttributes()

HBA_STATUS HBA_GetAdapterAttributes ( HBA_HANDLE handle,
HBA_ADAPTERATTRIBUTES * pAdapterattributes )

Return attributes for an adapter.

Parameters
handleof an opened adapter
pAdapterattributespointer to return atributes
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
ZFCP HBA API does not set the adapter attributes OptionROMVersion and NodeSymbolicName.

References getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, revalidateRepository(), sysfs_getAdapterAttributes(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetAdapterName()

HBA_STATUS HBA_GetAdapterName ( HBA_UINT32 adapterindex,
char * pAdaptername )

Return name that identifies an adapter.

Parameters
adapterindexindex of the HBA
pAdapternameused to return the ASCII string
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_ILLEGAL_INDEX if index is invalid
  • HBA_STATUS_ERROR if any other internal error occurs
  • HBA_STATUS_OK on success
Locks:
lock/unlock of vlib_data.mutex
See also
revalidateRepository()

References getAdapterByIndex(), vlib_adapter::isInvalid, vlib_data::mutex, revalidateRepository(), VLIB_ADAPTERNAME_LEN, VLIB_ADAPTERNAME_PREFIX, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetAdapterPortAttributes()

HBA_STATUS HBA_GetAdapterPortAttributes ( HBA_HANDLE handle,
HBA_UINT32 portindex,
HBA_PORTATTRIBUTES * pPortattributes )

Return attributes for an adapter port.

Parameters
handleto an opened adapter
portindexindex of adapter port
pPortattributespointer to return atributes
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
    • HBA_STATUS_ERROR_ILLEGAL_INDEX if portindex is invalid
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
Parameter portindex must be 0, since we have only one local port on our adapters.
Additionally this function triggers creation of port configuration for this adapter (see revalidatePorts()).
ZFCP HBA API does not set the port attributes FabricName, OSDeviceName and PortSymbolicName for an adapter port.

References getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, revalidatePorts(), revalidateRepository(), sysfs_getAdapterPortAttributes(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetDiscoveredPortAttributes()

HBA_STATUS HBA_GetDiscoveredPortAttributes ( HBA_HANDLE handle,
HBA_UINT32 portindex,
HBA_UINT32 discoveredportindex,
HBA_PORTATTRIBUTES * pPortattributes )

Return attributes of an discovered port.

Parameters
handleto an opened adapter
portindexindex of adapter port
discoveredportindexindex of adapter port
pPortattributespointer to return atributes
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
    • HBA_STATUS_ERROR_ILLEGAL_INDEX if portindex or discoveredindex is invalid
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
Parameter portindex must be 0, since we have only one local port on our adapters.
For discovered ports ZFCP HBA API does not set the port attributes OSDeviceName, PortMaxFrameSize and PortSupportedFc4Types. PortSupportedSpeed, PortSpeed, and PortState are set to values indicating unknwon. NumberofDiscoveredPorts is 0. Most other values are determined using a GA_NXT request on the Name Server Directory Service.
For PortSupportedFc4Types and PortActive Fc4Types we do not follow FC-HBA Rev 10. We do not store them "little-endian" but "big-endian" as it is suggested by Editors Note 1.

References getAdapterByHandle(), getPortByIndex(), vlib_port::isInvalid, vlib_data::mutex, revalidateRepository(), sysfs_getDiscoveredPortAttributes(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetEventBuffer()

HBA_STATUS HBA_GetEventBuffer ( HBA_HANDLE handle,
HBA_EVENTINFO * pEventBuffer,
HBA_UINT32 * pEventCount )

Return events for an adapter from the event queue.

Parameters
handleto an opened adapter
*pEventBufferpointer to return events
*pEventCountpointer to size of event buffer (in event records)
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex

References getAdapterByHandle(), vlib_data::mutex, revalidateRepository(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetFcpTargetMapping()

HBA_STATUS HBA_GetFcpTargetMapping ( HBA_HANDLE handle,
HBA_FCPTARGETMAPPING * pMapping )

Retrieve mappings between OS SCSI targets/units and FCP targets/units.

Parameters
handleto an opened adapter
*pMappingpointer to return target mappings
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pMapping to return complete mapping information
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
An OSDeviceName is not provided for target mappings.
Additionally this function triggers creation of unit configuration for this adapter (see revalidateUnits()).

References vlib_unit::channel, vlib_port::did, vlib_unit::fcLun, getAdapterByHandle(), getPortByIndex(), getUnitByIndex(), vlib_adapter_ident::host, vlib_adapter::ident, vlib_port::isInvalid, vlib_unit::isInvalid, vlib_unit::lun, vlib_data::mutex, vlib_adapter::ports, revalidatePorts(), revalidateRepository(), revalidateUnits(), vlib_unit::target, vlib_port::units, block::used, vlib_FCID_to_hbaFCID(), VLIB_MUTEX_LOCK, VLIB_MUTEX_UNLOCK, vlib_wwn_to_HBA_WWN(), vlib_port::wwnn, and vlib_port::wwpn.

Referenced by HBA_GetFcpTargetMappingV2().

◆ HBA_GetFcpTargetMappingV2()

HBA_STATUS HBA_GetFcpTargetMappingV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
HBA_FCPTARGETMAPPINGV2 * pMappingV2 )

Retrieve mappings between OS SCSI targets/units and FCP targets/units.

Parameters
handleto an opened adapter
*pMappingpointer to return target mappings
*hbaPortWWNwwpn to identify the port on the adapter
Returns
see HBA_GetFcpTargetMapping
Locks:
lock/unlock of vlib_data.mutex
Note
HBA_LUID is not provided for target mappings.
Our "adapters" have only one port, so the WWN parameter is superfluous. We only check if it matches to the adapter handle, if yes, we call HBA_GetFcpTargetMapping

References getAdapterByHandle(), vlib_adapter::handle, HBA_GetFcpTargetMapping(), vlib_adapter::ident, vlib_data::mutex, vlib_HBA_WWN_to_wwn(), VLIB_MUTEX_LOCK, VLIB_MUTEX_UNLOCK, and vlib_adapter_ident::wwpn.

◆ HBA_GetNumberOfAdapters()

HBA_UINT32 HBA_GetNumberOfAdapters ( void )

Return number of adapters.

Returns
  • 0 on error or if no adapters are configured
  • number of adapters on success
Locks:
lock/unlock of vlib_data.mutex

References vlib_data::adapters, vlib_data::mutex, revalidateRepository(), block::used, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetPortStatistics()

HBA_STATUS HBA_GetPortStatistics ( HBA_HANDLE handle,
HBA_UINT32 portindex,
HBA_PORTSTATISTICS * pPortstatistics )

Return statistics of an adapter port.

Parameters
handleto an opened adapter
portindexindex of adapter port
pPortstatisticspointer to return statistics
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
    • HBA_STATUS_ERROR_ILLEGAL_INDEX if portindex is invalid
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
Parameter portindex must be 0, since we have only one local port on our adapters.

References getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, revalidateRepository(), sysfs_getPortStatistics(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_GetVendorLibraryAttributes()

HBA_UINT32 HBA_GetVendorLibraryAttributes ( HBA_UINT32 adapter_index,
HBA_LIBRARYATTRIBUTES * attributes )

Return attributes of the vendor specific HBA API library.

Parameters
adapter_indexnot used
attributesused to return library attributes
Returns
  • 2 (compliant to FC-HBA)
Note
This function is not defined if the library is built as a vendor specific library.
The index of the HBA is ignored, because it is of use only for a wrapper library.
See also
_GetVendorLibraryAttributes()

References _GetVendorLibraryAttributes().

◆ HBA_GetVersion()

HBA_UINT32 HBA_GetVersion ( void )

Return the version of the HBA API specification with which this library is compliant.

Returns
  • 2 (compliant to FC-HBA)
Note
No check if library is loaded has to be performed.

References HBAAPI_LIBRARY_VERSION.

◆ HBA_GetWrapperLibraryAttributes()

HBA_UINT32 HBA_GetWrapperLibraryAttributes ( HBA_LIBRARYATTRIBUTES * attributes)

Return attributes of the OS specific HBA API library.

Parameters
attributesused to return library attributes
Returns
  • 2 (compliant to FC-HBA)
Note
This function is not defined if the library is built as a vendor specific library.
See also
_GetVendorLibraryAttributes()

References _GetVendorLibraryAttributes().

◆ HBA_LoadLibrary()

HBA_STATUS HBA_LoadLibrary ( void )

Perform initialization of library.

Returns
  • HBA_STATUS_ERROR_ALREADY_LOADED if this function was already called before.
  • HBA_STATUS_ERROR if initialization fails.
  • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
This function tries to open the zfcp_hbaapi char device.

References vlib_data::isLoaded, vlib_data::mutex, sysfs_createAndReadConfigAdapter(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_OpenAdapter()

HBA_HANDLE HBA_OpenAdapter ( char * pAdaptername)

Open an adapter.

Parameters
pAdapternamename of adapter to be opened (name was obtained by previous call to HBA_GetAdapterName())
Returns
Locks:
lock/unlock of vlib_data.mutex
Note
Possible (theoretical) overflow of index values.

References findIndexByName(), vlib_adapter::handle, vlib_data::mutex, openAdapterByIndex(), revalidateRepository(), VLIB_INVALID_HANDLE, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_RefreshAdapterConfiguration()

void HBA_RefreshAdapterConfiguration ( void )

Refresh information about configured adapters.

Locks:
lock/unlock of vlib_data.mutex
Note
We do not report HBA_STATUS_ERROR_STALE_DATA, because we use semistatic tables internally. We just make use of HBA_STATUS_ERROR_UNAVAILABLE (e.g. if an adapter is removed).

References vlib_data::mutex, revalidateRepository(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_RefreshInformation()

void HBA_RefreshInformation ( HBA_HANDLE handle)

Refresh information of an adapter.

Parameters
handleof the adapter for which information should be refreshed.
Locks:
lock/unlock of vlib_data.mutex

References getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, updateAdapter(), VLIB_LOG, VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

◆ HBA_ResetStatistics()

void HBA_ResetStatistics ( HBA_HANDLE handle,
HBA_UINT32 portindex )

According to FC-HBA this function is obsolete.

This function has no effect.

◆ HBA_ScsiInquiryV2()

HBA_STATUS HBA_ScsiInquiryV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
HBA_WWN discoveredPortWWN,
HBA_UINT64 fcLUN,
HBA_UINT8 CDB_Byte1,
HBA_UINT8 CDB_Byte2,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize,
HBA_UINT8 * pScsiStatus,
void * pSenseBuffer,
HBA_UINT32 * pSenseBufferSize )

Send a SCSI INQUIRY command to a FCP LUN.

Parameters
handleto an opened adapter
hbaPortWWNWWPN of the local adapter port
discoveredPortWWNWWPN of the target port
fcLUNFCP LUN of the unit
EVPDEnhanced Vital Product Data
PageCodeVital Product Data page code if EVPD is set
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
SenseBufferSizesize of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_INVALID_LUN if there is no unit for the the specified fcLUN configured
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
  • HBA_STATUS_ERROR_NOT_A_TARGET is not returned because zfcp just deals with SCSI target ports.
  • HBA_STATUS_ERROR_TARGET_BUSY is not returned because zfcp cannot detect SCSI command overlap situations in general.

References _HBA_SendScsiInquiry().

◆ HBA_ScsiReadCapacityV2()

HBA_STATUS HBA_ScsiReadCapacityV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
HBA_WWN discoveredPortWWN,
HBA_UINT64 fcLUN,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize,
HBA_UINT8 * pScsiStatus,
void * pSenseBuffer,
HBA_UINT32 * pSenseBufferSize )

Send a SCSI READ CAPACITY command to a FCP LUN.

Parameters
handleto an opened adapter
portWWNWWPN of the target port
fcLUNFCP LUN of the unit
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
SenseBufferSizesize of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_INVALID_LUN if there is no unit for the the specified fcLUN configured
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
  • HBA_STATUS_ERROR_NOT_A_TARGET is not returned because zfcp just deals with SCSI target ports.
  • HBA_STATUS_ERROR_TARGET_BUSY is not returned because zfcp cannot detect SCSI command overlap situations in general.
  • ZFCP HBA API sends READ CAPACITY via libsgutils. Sense date is not supported that way, so the sensebuffer is always NULL

References _HBA_SendReadCapacity().

◆ HBA_ScsiReportLUNsV2()

HBA_STATUS HBA_ScsiReportLUNsV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
HBA_WWN discoveredPortWWN,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize,
HBA_UINT8 * pScsiStatus,
void * pSenseBuffer,
HBA_UINT32 * pSenseBufferSize )

Send a SCSI REPORT LUNS command to a target.

Parameters
handleto an opened adapter
portWWNWWPN of the local port
discoveredPortWWNWWPN of the target port
*pRspBufferpointer to return response data
*RspBufferSizepointer to size of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
*SenseBufferSizepointer to size of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_SCSI_CHECK_CONDITION if a SCSI CHECK_CONDITION occurs
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
Lun Scanning only works if we have at least Lun 0 attached. In all other cases we cannot scan the Luns (yet). In addition, no SCSI sense data will be returned. The only real difference to the V1 function is the additional parameter for the local port. Since our "adapters" have only one port, we can omit it.

References _HBA_SendReportLUNs().

◆ HBA_SendCTPassThru()

HBA_STATUS HBA_SendCTPassThru ( HBA_HANDLE handle,
void * pReqBuffer,
HBA_UINT32 ReqBufferSize,
void * pRspBuffer,
HBA_UINT32 RspBufferSize )

Send a CT pass thru - a CT frame constructed in userspace directly to the HBA / SAN.

Parameters
handleto an opened adapter
*pReqBufferpointer to CT frame
ReqBufferSizesize of the request buffer
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_ERROR if any other internal error occurs
  • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex

References getAdapterByHandle(), vlib_adapter::handle, vlib_data::mutex, revalidateRepository(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

Referenced by HBA_SendCTPassThruV2().

◆ HBA_SendCTPassThruV2()

HBA_STATUS HBA_SendCTPassThruV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
void * pReqBuffer,
HBA_UINT32 ReqBufferSize,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize )

Send a CT pass thru - a CT frame constructed in userspace directly to the HBA / SAN.

Parameters
handleto an opened adapter
hbaPortWWNlocal port of adapter - not necessary in our case
*pReqBufferpointer to CT frame
ReqBufferSizesize of the request buffer
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_ERROR if any other internal error occurs
  • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex

References vlib_adapter::handle, and HBA_SendCTPassThru().

◆ HBA_SendReadCapacity()

HBA_STATUS HBA_SendReadCapacity ( HBA_HANDLE handle,
HBA_WWN portWWN,
HBA_UINT64 fcLUN,
void * pRspBuffer,
HBA_UINT32 RspBufferSize,
void * pSenseBuffer,
HBA_UINT32 SenseBufferSize )

Send a SCSI READ CAPACITY command to a FCP LUN.

Parameters
handleto an opened adapter
portWWNWWPN of the target port
fcLUNFCP LUN of the unit
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
SenseBufferSizesize of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_INVALID_LUN if there is no unit for the the specified fcLUN configured
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
  • HBA_STATUS_ERROR_NOT_A_TARGET is not returned because zfcp just deals with SCSI target ports.
  • HBA_STATUS_ERROR_TARGET_BUSY is not returned because zfcp cannot detect SCSI command overlap situations in general.
  • ZFCP HBA API sends READ CAPACITY via libsgutils. Sense date is not supported that way, so the sensebuffer is always NULL

References _HBA_SendReadCapacity().

◆ HBA_SendReportLUNs()

HBA_STATUS HBA_SendReportLUNs ( HBA_HANDLE handle,
HBA_WWN portWWN,
void * pRspBuffer,
HBA_UINT32 RspBufferSize,
void * pSenseBuffer,
HBA_UINT32 SenseBufferSize )

Send a SCSI REPORT LUNS command to a target.

Parameters
handleto an opened adapter
portWWNWWPN of the target port
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
SenseBufferSizesize of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_SCSI_CHECK_CONDITION if a SCSI CHECK_CONDITION occurs
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
Lun Scanning only works if we have at least Lun 0 attached. In all other cases we cannot scan the Luns (yet). In addition, no SCSI sense data will be returned.

References _HBA_SendReportLUNs().

◆ HBA_SendRNID()

HBA_STATUS HBA_SendRNID ( HBA_HANDLE handle,
HBA_WWN wwn,
HBA_WWNTYPE wwntype,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize )

Send a RNID ELS to a port.

Parameters
handleto an opened adapter
wwnof port to which to send RNID ELS
wwntypedeprecated
*pRspBufferpointer to return response data
*pRspBufferSizepointer to size of response buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer and response data is truncated
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success (LS_ACC or LS_RJT).
Locks:
lock/unlock of vlib_data.mutex

References getAdapterByHandle(), vlib_data::mutex, revalidateRepository(), vlib_HBA_WWN_to_wwn(), VLIB_MUTEX_LOCK, and VLIB_MUTEX_UNLOCK.

Referenced by HBA_SendRNIDV2().

◆ HBA_SendRNIDV2()

HBA_STATUS HBA_SendRNIDV2 ( HBA_HANDLE handle,
HBA_WWN hbaPortWWN,
HBA_WWN destWWN,
HBA_UINT32 destFCID,
HBA_UINT32 NodeIdDataFormat,
void * pRspBuffer,
HBA_UINT32 * pRspBufferSize )

Send a RNID ELS to a port.

Parameters
handleto an opened adapter
hbaPortWWNlocal port of adapter - not necessary in our case
wwnof port to which to send RNID ELS
wwntypedeprecated
*pRspBufferpointer to return response data
*pRspBufferSizepointer to size of response buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer and response data is truncated
  • HBA_STATUS_ERROR if any other internal error occurs
  • HBA_STATUS_OK on success (LS_ACC or LS_RJT).
Locks:
lock/unlock of vlib_data.mutex
Note
this function just calls the V1 version above so the new functionality offered by V2 is not supported

References HBA_SendRNID().

◆ HBA_SendScsiInquiry()

HBA_STATUS HBA_SendScsiInquiry ( HBA_HANDLE handle,
HBA_WWN PortWWN,
HBA_UINT64 fcLUN,
HBA_UINT8 EVPD,
HBA_UINT32 PageCode,
void * pRspBuffer,
HBA_UINT32 RspBufferSize,
void * pSenseBuffer,
HBA_UINT32 SenseBufferSize )

Send a SCSI INQUIRY command to a FCP LUN.

Parameters
handleto an opened adapter
PortWWNWWPN of the target port
fcLUNFCP LUN of the unit
EVPDEnhanced Vital Product Data
PageCodeVital Product Data page code if EVPD is set
*pRspBufferpointer to return response data
RspBufferSizesize of the response buffer
*pSenseBufferpointer to return sense data on SCSI CHECK_CONDITION
SenseBufferSizesize of the sense buffer
Returns
  • HBA_STATUS_NOT_LOADED if library is not loaded
  • HBA_STATUS_ERROR_INVALID_HANDLE if handle is invalid
  • HBA_STATUS_ERROR_UNAVAILABLE if adapter is unavailable
  • HBA_STATUS_ERROR_INVALID_LUN if there is no unit for the the specified fcLUN configured
  • HBA_STATUS_ERROR_MORE_DATA if there is not enough space in pRspBuffer
  • HBA_STATUS_SCSI_CHECK_CONDITION if a SCSI CHECK_CONDITION occurs
  • HBA_STATUS_ERROR_ARG if EVPD is neither 0 nor 1
  • HBA_STATUS_ERROR if any other internal error occurs
    • HBA_STATUS_OK on success.
Locks:
lock/unlock of vlib_data.mutex
Note
  • HBA_STATUS_ERROR_NOT_A_TARGET is not returned because zfcp just deals with SCSI target ports.
  • HBA_STATUS_ERROR_TARGET_BUSY is not returned because zfcp cannot detect SCSI command overlap situations in general.
  • ZFCP HBA API sends INQUIRY as untagged if the unit is not previously registered at the SCSI mid layer. If the device is already registered there, untagged/tagged is chosen as indicated in the associated Scsi_Device structure of the unit.
ZFCP HBA API sends INQUIRY as untagged if the unit is not previously registered at the mid layer. If the device is already registered there, untagged/tagged is chosen as indicated in the associated Scsi_Device structure of the unit.

References _HBA_SendScsiInquiry().