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

Functions

void elxu_build_device_list (int argc, char *argv[])
 Create a list of devices. More...
 
elxu_device_t * elxu_open_device (elxu_device_name_t *devname)
 Open a device file. More...
 
int elxu_ioctl_device (elxu_device_t *device, int req, void *arg)
 Send an ioctl to a device. More...
 
void elxu_close_device (elxu_device_t *device)
 Close a device. More...
 
char * elxu_get_modeldesc (elxu_device_t *device)
 Return the model description for a device. More...
 
char * elxu_get_fwrev (elxu_device_t *device)
 Return the firmware revision for a device. More...
 
char * elxu_get_ipl (elxu_device_t *device)
 Return the IPL version for a device. More...
 
char * elxu_get_serialnumber (elxu_device_t *device)
 Return the serial number for a device. More...
 
uint32_t elxu_get_phy_port_num (elxu_device_t *device)
 Return the physical port number for a device. More...
 
uint32_t elxu_get_sliintf (elxu_device_t *device)
 Return the sli_intf value for a device. More...
 
uint32_t elxu_get_asic_id (elxu_device_t *device)
 Return the ASIC ID value for a device. More...
 
char * elxu_decode_family (uint32_t family)
 Lookup a family name. More...
 
char * elxu_decode_asic_id (uint32_t asic_id)
 Lookup an ASIC ID name. More...
 
const char * elxu_get_vendor_name (elxu_device_t *device)
 Return the vendor name for a device. More...
 
const char * elxu_get_device_name (elxu_device_t *device)
 Return the device name for a device. More...
 
const char * elxu_get_subsystem_device (elxu_device_t *device)
 Return the PCI subsystem device value for a device. More...
 
const char * elxu_get_subsystem_vendor (elxu_device_t *device)
 Return the PCI subsystem vendor value for a device. More...
 
elxu_device_t * elxu_device_from_args (int argc, char *argv[])
 Return a pointer to a device based on command line args. More...
 
elxu_device_t * elxu_device_by_index (int index)
 Return a pointer to a device given an index. More...
 
char * elxu_device_get_value (elxu_device_t *device, char *key)
 Return a property value for a device. More...
 
int elxu_device_exec (elxu_device_t *device, char *name, void *arg_in, int arg_in_len, void *arg_out, int arg_out_len)
 Execute a management function on a device. More...
 
elxu_device_t * os_build_device_list (char *path)
 Build a list of devices. More...
 

Function Details

void elxu_build_device_list ( int  argc,
char *  argv[] 
)

Create a list of devices.

Description
This function creates a global list of devices available to be managed.
Parameters
argcargc from command line
argvargv from command line
Returns
Returns nothing.

Definition at line 131 of file elxu_device.c.

void elxu_close_device ( elxu_device_t *  device)

Close a device.

Description
This function calls the OS-specific function to close a device file, then frees any allocated memory associated with that device.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns nothing.

Definition at line 340 of file elxu_device.c.

char* elxu_decode_asic_id ( uint32_t  asic_id)

Lookup an ASIC ID name.

Description
Given a family number, this function returns a string containing the ASIC ID name.
Parameters
asic_idThe ASIC ID to lookup.
Returns
Returns a static string containing the ASIC ID name.

Definition at line 526 of file elxu_device.c.

char* elxu_decode_family ( uint32_t  family)

Lookup a family name.

Description
Given a family number, this function returns a string containing the family name.
Parameters
familyThe family number.
Returns
Returns a static string containing the family name.

Definition at line 495 of file elxu_device.c.

elxu_device_t* elxu_device_by_index ( int  index)

Return a pointer to a device given an index.

Description
Given a device index, determine which device should be operated on. Assumes that elxu_build_device_list has already been called.
Parameters
indexDevice index to find.
Returns
Returns a pointer to a device structure, or NULL if the device can't be determined.

Definition at line 730 of file elxu_device.c.

int elxu_device_exec ( elxu_device_t *  device,
char *  name,
void *  arg_in,
int  arg_in_len,
void *  arg_out,
int  arg_out_len 
)

Execute a management function on a device.

Description
For the OCS driver this is just a wrapper around calls to mgmt_exec. The driver's mgmt interface will execute the function.

For the elx_pt driver we have to simulate the mgmt_exec function because the driver doesn't have the mgmt interface. For a limited set of key this function will perform the equivalent operation in other ways.

Parameters
deviceDevice to access.
keyName of the property to retrieve.
Returns
Returns a pointer to a static char[] with the result.

Definition at line 952 of file elxu_device.c.

elxu_device_t* elxu_device_from_args ( int  argc,
char *  argv[] 
)

Return a pointer to a device based on command line args.

Description
Given the command line arguments (argc and argv), determine which device should be operated on. Assumes that elxu_build_device_list has already been called.
Parameters
argcArgument count from the command line
argvArguments from the command line
Returns
Returns a pointer to a device structure, or NULL if the device can't be determined.

Definition at line 688 of file elxu_device.c.

char* elxu_device_get_value ( elxu_device_t *  device,
char *  key 
)

Return a property value for a device.

Description
Given a device and a key, return the value for that key. For the OCS driver this is just a wrapper around calls to mgmt_get_value. The driver's mgmt interface will supply the value.

For the elx_pt driver we have to simulate the mgmt_get_value function because the driver doesn't have the mgmt interface. For a limited set of key this function will determine the correct value in other ways.

Parameters
deviceDevice to access.
keyName of the property to retrieve.
Returns
Returns a pointer to a static char[] with the result.

Definition at line 765 of file elxu_device.c.

uint32_t elxu_get_asic_id ( elxu_device_t *  device)

Return the ASIC ID value for a device.

Description
This function returns the ASIC ID value for a device.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a uint32_t containing the ASIC ID value.

Definition at line 478 of file elxu_device.c.

const char* elxu_get_device_name ( elxu_device_t *  device)

Return the device name for a device.

Description
This function returns the device name for a device. This includes both the device name and the protocol. eg: "Lancer FCoE"
Parameters
deviceThe elxu device structure of the device.
Returns
Returns the device name in a static string.

Definition at line 602 of file elxu_device.c.

char* elxu_get_fwrev ( elxu_device_t *  device)

Return the firmware revision for a device.

Description
This function returns the firmware revision for a device. The firmware revision is placed into a newly allocated string. The caller is responsible for freeing the string when it is no longer needed.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a pointer to the allocated string containing the firmware revision. Returns NULL on error.

Definition at line 384 of file elxu_device.c.

char* elxu_get_ipl ( elxu_device_t *  device)

Return the IPL version for a device.

Description
This function returns the IPL version for a device. The IPL version is placed into a newly allocated string.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a pointer to the allocated string containing the IPL version. Returns NULL on error.

Definition at line 404 of file elxu_device.c.

char* elxu_get_modeldesc ( elxu_device_t *  device)

Return the model description for a device.

Description
This function returns the model description for a device. The description is placed into a newly allocated string. The caller is responsible for freeing the string when it is no longer needed.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a pointer to the allocated string containing the desription. Returns NULL on error.

Definition at line 363 of file elxu_device.c.

uint32_t elxu_get_phy_port_num ( elxu_device_t *  device)

Return the physical port number for a device.

Description
This function returns the physical port number for a device. The physical port number is placed into a newly allocated string. The caller is responsible for freeing the string when it is no longer needed.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a pointer to the allocated string containing the serial number. Returns NULL on error.

Definition at line 446 of file elxu_device.c.

char* elxu_get_serialnumber ( elxu_device_t *  device)

Return the serial number for a device.

Description
This function returns the serial number for a device. The serial number is placed into a newly allocated string. The caller is responsible for freeing the string when it is no longer needed.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a pointer to the allocated string containing the serial number. Returns NULL on error.

Definition at line 425 of file elxu_device.c.

uint32_t elxu_get_sliintf ( elxu_device_t *  device)

Return the sli_intf value for a device.

Description
This function returns the sli_intf value for a device.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns a uint32_t containing the sli_intf value.

Definition at line 462 of file elxu_device.c.

const char* elxu_get_subsystem_device ( elxu_device_t *  device)

Return the PCI subsystem device value for a device.

Description
This function returns the PCI subsystem device value for a device. The value returned is a static string containing the hex representation of the 16 bit subsystem device value.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns the PCI subsystem device in a static string.

Definition at line 642 of file elxu_device.c.

const char* elxu_get_subsystem_vendor ( elxu_device_t *  device)

Return the PCI subsystem vendor value for a device.

Description
This function returns the PCI subsystem vendor value for a device. The value returned is a static string containing the hex representation of the 16 bit subsystem vendor value.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns the PCI subsystem vendor in a static string.

Definition at line 664 of file elxu_device.c.

const char* elxu_get_vendor_name ( elxu_device_t *  device)

Return the vendor name for a device.

Description
This function returns the vendor name for a device.
Parameters
deviceThe elxu device structure of the device.
Returns
Returns the vendor name in a static string.

Definition at line 576 of file elxu_device.c.

int elxu_ioctl_device ( elxu_device_t *  device,
int  req,
void *  arg 
)

Send an ioctl to a device.

Description
This function calls the OS-specific function to send an ioctl to a device.
Parameters
deviceThe elxu device structure of the device.
reqThe ioctl request.
argThe ioctl argument.
Returns
Returns zero on success; a non-zero error code on failure.

Definition at line 322 of file elxu_device.c.

elxu_device_t* elxu_open_device ( elxu_device_name_t *  devname)

Open a device file.

Description
This function first calls the OS-specific function to open the device file. Then, if the open is successful, the function will retrieve a variety of information about the device and store it in the elxu_device_t structure.

NOTE: This function requires that the global device list has already been built by elxu_build_device_list.

Parameters
devnameA pointer to a device_name structure. This structure contains a device index and optionally a hostname if the device is accessed through the userspace driver.
Returns
Returns a pointer to an elxu_device_t structure on success; NULL on failure.

Definition at line 212 of file elxu_device.c.

elxu_device_t* os_build_device_list ( char *  path)

Build a list of devices.

Description
This function locates all devices on the system that the utility can manage and builds the device list. It is only concerned with devices accessed directly through the PCI bus, not with user space devices accessed through sockets.

For each Emulex device found on the bus it will determine the driver controlling the device, and will only add the device to the list if the driver is either one of the ocs_* drivers or is elx_pt.

Returns
Returns a pointer to the first device in the list. May be NULL if no devices are found.

Definition at line 194 of file elxu_linux.c.