Fibre Channel SNIA HBA API Programmer's Guide

Output Parameters: port_attributes - Pointer to a structure for returning the adapter
port attributes.
Return Values: Returned after a
successful execution of the
call.
HBA_STATUS_OK
HBA_STATUS_ERROR
Returned when an
internal library or system
error is detected.
HBA_STATUS_ERROR_BUSY
Returned when the library
is busy and cannot
currently process this call.
HBA_STATUS_ERROR_INVALID_HANDLE
Returned when the handle
passed to this function is
invalid.
HBA_STATUS_ERROR_ARG
Returned when the
pointer passed to this
function is NULL.
HBA_STATUS_ERROR_UNAVAILABLE
Returned when the
adapter to which the
handle corresponds is not
available.
HBA_STATUS_ERROR_ILLEGAL_INDEX
Returned when the
port_index is invalid.
Call order sequence: See Appendix A.
Example code:
HBA_STATUS status;
HBA_ADAPTERATTRIBUTES adapter_attributes;
HBA_PORTATTRIBUTES port_attributes;
status = HBA_GetAdapterAttributes(adapter_handle,
&adapter_attributes);
if (status == HBA_STATUS_OK)
{
for (i = 0; i < adapter_attributes.NumberOfPorts;
i++)
{
status=HBA_GetAdapterPortAttributes(adapter_handle,
i,
&port_attributes);
if (status == HBA_STATUS_OK)
{
printf("Port %u has a Port FcID of %u\n", i,
port_attributes.PortFcId);
}
}
}
HBA_GetPortStatistics
Function:
HBA_STATUS HBA_GetPortStatistics(
HBA_HANDLE handle,
HBA_UINT32 port_index,
HBA_PORTSTATISTICS *port_statistics,
);
Purpose: Returns statistics for a given port.
Informational Functions 17