Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
elxu_commands.c File Reference
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <fcntl.h>
#include "version.h"
#include "elxu_commands.h"
#include "elxu_common.h"
#include "elxu_dwnld.h"
#include "elxu_device.h"
#include "elxu_dump.h"
#include "elxu_mgmt.h"
#include "elx_pt_ioctl.h"
#include <ocs_ioctl.h>

Go to the source code of this file.

Detailed Description

Defines the elxsdkutil command handlers.

Definition in file elxu_commands.c.

Data Structures

struct  elx_sfp_transceiver_data_A0_t
 
struct  elx_dport_sfp_table1_entry
 
struct  elx_dport_sfp_table2_entry
 

Macros

#define PORTSPEED_1GFC   0x00000001 /* 1G FC */
 
#define PORTSPEED_2GFC   0x00000002 /* 2G FC */
 
#define PORTSPEED_4GFC   0x00000008 /* 4G FC */
 
#define PORTSPEED_8GFC   0x00000010 /* 8G FC */
 
#define PORTSPEED_16GFC   0x00000020 /* 16G FC */
 
#define PORTSPEED_32GFC   0x00000040 /* 32G FC */
 
#define PORTSPEED_64GFC   0x00000400 /* 64G FC*/
 
#define PORTSPEED_128GFC   0x00000200 /* 128G FC */
 
#define PORTSPEED_UNKNOWN   0x00008000 /* Unknown*/
 
#define ETH_FC_AUTO   "0"
 
#define ETH_FC_10G   "1000"
 
#define FC_2G   "2000"
 
#define FC_4G   "4000"
 
#define FC_8G   "8000"
 
#define FC_16G   "16000"
 
#define FC_32G   "32000"
 
#define AUTO   "0"
 
#define N_PORT   "1"
 
#define LOOP   "2"
 
#define OCS_MAX_SLI_PORTS_PER_DEVICE   4
 
#define OCS_FC_TRUNK_2_PORT_CONFIG   0x30
 
#define OCS_FC_TRUNK_2_PORT_HI_CONFIG   0xC0
 
#define OCS_FC_TRUNK_4_PORT_CONFIG   0xF0
 
#define OCS_FC_TRUNK_CONFIG_MASK   0xF0
 
#define OCS_FC_TRUNK_LINK_STATE_MASK   0x0F
 
#define DPORT_SFP_TABLE1_LEN   (sizeof(supported_table1) / sizeof(elx_dport_sfp_table1_entry))
 
#define DPORT_SFP_TABLE2_LEN   (sizeof(supported_table2) / sizeof(elx_dport_sfp_table2_entry))
 
#define ELXU_IP_GET_ADDRESS_LIST_SIZE   (4096 * 2)
 

Functions

static void show_examples ()
 Print examples of commands. More...
 
int elxu_cmd_file_info (int argc, char **argv)
 Command handler for the file-info command. More...
 
int elxu_cmd_list (int argc, char **argv)
 Command handler for the list command. More...
 
int elxu_cmd_read (int argc, char **argv)
 Command handler for the read command. More...
 
int elxu_cmd_write (int argc, char **argv)
 Command handler for the write command. More...
 
int elxu_cmd_version (int argc, char **argv)
 Command handler for the version command. More...
 
int elxu_cmd_cmp (int argc, char **argv)
 Command handler for the cmp command. More...
 
int elxu_cmd_dump (int argc, char **argv)
 Command handler for the dump command. More...
 
int elxu_cmd_efdc (int argc, char **argv)
 Command handler for the efdc command. More...
 
int elxu_cmd_objenum (int argc, char **argv)
 Command handler for the objenum command. More...
 
char * elxu_decode_sfp_id (uint32_t value)
 
char * elxu_decode_sfp_connector (uint32_t value)
 
char * elxu_decode_sfp_rate_id (uint32_t value)
 
char * elxu_sfp_encoding_info (uint32_t value)
 
int elxu_device_get_lancer_temp (elxu_device_t *device)
 
int elxu_cmd_board_temp (int argc, char **argv)
 Command handler for the board temperature. More...
 
int elxu_cmd_sfp (int argc, char **argv)
 Command handler for the sfp command. More...
 
int elxu_cmd_gendump (int argc, char **argv)
 Command handler for the gendump command. More...
 
int elxu_cmd_fw_diagnostic_log (int argc, char **argv)
 Command handler for the fw-diag-log command. More...
 
int elxu_cmd_dump_to_host (int argc, char **argv)
 Command handler for the dump command. More...
 
int elxu_cmd_read_status (int argc, char **argv)
 Command handler for the read-status command. More...
 
int elxu_cmd_read_link_status (int argc, char **argv)
 Command handler for the read-link-status command. More...
 
int elxu_check_sfp_dport_support (elxu_device_t *device)
 
int elxu_cmd_get_dport_stats (int argc, char **argv)
 Command handler for the get-dport-stats command. More...
 
int elxu_cmd_set_dport_dynamic_mode (int argc, char **argv)
 
int elxu_cmd_get_dynamic_dport_status (int argc, char **argv)
 
int elxu_cmd_diag_loopback_tests (int argc, char **argv)
 
int elxu_cmd_read_rev (int argc, char **argv)
 Command handler for the read-rev command. More...
 
int elxu_cmd_ack_frequency (int argc, char **argv)
 Command handler for the ack-frequency command. More...
 
int elxu_cmd_delayed_ack_timer (int argc, char **argv)
 Command handler for the delayed-ack-timer command. More...
 
int elxu_cmd_constrain_window (int argc, char **argv)
 Command handler for the constrain-window command. More...
 
int elxu_cmd_driver_dump (int argc, char **argv)
 Command handler for the driver-dump command. More...
 
int elxu_cmd_mgmt_info (int argc, char **argv)
 Command handler for the mgmt-info command. More...
 
int elxu_cmd_connection_info (int argc, char **argv)
 Command handler for the connection-info command. More...
 
int elxu_cmd_iclusttgt_check_args (int argc, char **argv)
 
int elxu_cmd_iclusttgt_show (elxu_device_t *device)
 
int elxu_cmd_iclusttgt (int argc, char **argv)
 
int elxu_cmd_route (int argc, char **argv)
 Command handler for the route command. More...
 
int elxu_cmd_vlan (int argc, char **argv)
 Command handler for the vlan command. More...
 
int elxu_check_ip_address_exists (cmd_options_t *options, char *ipaddr, int *ip_found)
 
int elxu_cmd_add_ip (int argc, char **argv)
 Command handler for the add-ip command. More...
 
int elxu_cmd_remove_ip (int argc, char **argv)
 Command handler for the remove-ip command. More...
 
int elxu_cmd_show_ips (int argc, char **argv)
 Command handler for the show-ips command. More...
 
int elxu_cmd_set_gateway (int argc, char **argv)
 Command handler for the set-gateway command. More...
 
int elxu_cmd_get_gateway (int argc, char **argv)
 Command handler for the get-gateway command. More...
 
int elxu_cmd_add_chap (int argc, char **argv)
 Command handler for the add-chap command. More...
 
int elxu_cmd_remove_chap (int argc, char **argv)
 Command handler for remove-chap. More...
 
int elxu_cmd_show_chap_list (int argc, char **argv)
 Command handler for show-chap. More...
 
int elxu_cmd_set_require_chap (int argc, char **argv)
 Command handler for set-require-chap. More...
 
int elxu_cmd_get_require_chap (int argc, char **argv)
 Command handler for get-require-chap. More...
 
int elxu_cmd_enable_jumbo (int argc, char **argv)
 Command handler for the enable-jumbo command. More...
 
int elxu_cmd_disable_jumbo (int argc, char **argv)
 Command handler for the disable-jumbo command. More...
 
int elxu_cmd_enable_header_digest (int argc, char **argv)
 Command handler for enable-header-digest. More...
 
int elxu_cmd_disable_header_digest (int argc, char **argv)
 Command handler for the disable-header-digest comand. More...
 
int elxu_cmd_enable_data_digest (int argc, char **argv)
 Command handler for enable-data-digest. More...
 
int elxu_cmd_disable_data_digest (int argc, char **argv)
 Command handler for the disable-data-digest command. More...
 
int elxu_cmd_set_tcp_window_size (int argc, char **argv)
 Command handler for the set-tcp-window-size command. More...
 
int elxu_cmd_get_tcp_window_size (int argc, char **argv)
 Command handler for get-tcp-window-size. More...
 
int elxu_cmd_set_tcp_window_scale (int argc, char **argv)
 Command handler for set-tcp-window-scale. More...
 
int elxu_cmd_get_tcp_window_scale (int argc, char **argv)
 Command handler for get-tcp-window-scale. More...
 
int elxu_cmd_set_max_connections (int argc, char **argv)
 Command handler for set-max-connections. More...
 
int elxu_cmd_get_max_connections (int argc, char **argv)
 Command handler for get-max-connections. More...
 
int elxu_cmd_start_listen (int argc, char **argv)
 Command handler for start-listen. More...
 
int elxu_cmd_stop_listen (int argc, char **argv)
 Command handler for stop-listen. More...
 
int elxu_cmd_set_mac_ocs (int argc, char **argv)
 Command handler for the set-mac command. More...
 
int elxu_cmd_set_nv_mac_pt (int argc, char **argv)
 Command handler for the set-nv-mac command. More...
 
int elxu_cmd_show_mac_ocs (int argc, char **argv)
 Command handler for the show-mac command for the OCS drivers. More...
 
int elxu_cmd_show_mac_pt (int argc, char **argv)
 Command handler for the show-mac command for the elx_pt driver. More...
 
int elxu_cmd_show_wwn (int argc, char **argv)
 Command handler for the show-wwn command. More...
 
int elxu_cmd_set_wwn (int argc, char **argv)
 Command handler for the set-wwn command. More...
 
int elxu_cmd_driver_info (int argc, char **argv)
 Command handler for the driver-info command. More...
 
int elxu_cmd_create_vport (int argc, char **argv)
 Command handler for the create-vport command. More...
 
int elxu_cmd_remove_vport (int argc, char **argv)
 Command handler for the remove-vport command. More...
 
int elxu_cmd_get_linkcfg (int argc, char **argv)
 Command handler for the linkcfg-get command. More...
 
int elxu_cmd_get_linkspeed (int argc, char **argv)
 Command handler for the linkspeed-get command. More...
 
int elxu_cmd_get_linktopology (int argc, char **argv)
 Command handler for the linktopology-get command. More...
 
int elxu_cmd_set_linkcfg (int argc, char **argv)
 Command handler for the linkcfg-set command. More...
 
int elxu_cmd_set_linkspeed (int argc, char **argv)
 Command handler for the link-speed-set command. More...
 
int elxu_cmd_set_linktopology (int argc, char **argv)
 Command handler for the linktopology-set command. More...
 
int elxu_cmd_get_profile_list (int argc, char **argv)
 Command handler for the get-profile-list command. More...
 
int elxu_cmd_get_active_profile (int argc, char **argv)
 Command handler for the get-active-profile command. More...
 
int elxu_cmd_set_active_profile (int argc, char **argv)
 Command handler for the set-active-profile command. More...
 
int elxu_cmd_get_profile_list_pt (int argc, char **argv)
 Command handler for the get-profile-list command for the elx_pt driver. More...
 
int elxu_cmd_get_active_profile_pt (int argc, char **argv)
 Command handler for the get-active-profile command for the elx_pt driver. More...
 
int elxu_cmd_set_active_profile_pt (int argc, char **argv)
 Command handler for the set-active-profile command for the elx_pt driver. More...
 
int elxu_cmd_get_port_protocol (int argc, char **argv)
 Command handler for the get-port-protocol command. More...
 
int elxu_cmd_set_port_protocol (int argc, char **argv)
 Command handler for the set-port-protocol command. More...
 
int elxu_cmd_firmware_reset (int argc, char **argv)
 Command handler for the firmware-reset command. More...
 
int elxu_cmd_get_fdmi_hba_list (int argc, char **argv)
 Command handler for the elxu_cmd_get_fdmi_hba_list command. More...
 
int elxu_cmd_get_fdmi_port_list (int argc, char **argv)
 Command handler for the elxu_cmd_get_fdmi_port_list command. More...
 
int elxu_cmd_get_fdmi_hba_info (int argc, char **argv)
 Command handler for the elxu_cmd_get_fdmi_hba_info command. More...
 
void elxu_decode_port_speed (uint32_t port_speed, char *buf)
 
int elxu_cmd_get_fdmi_port_info (int argc, char **argv)
 Command handler for the elxu_cmd_get_fdmi_port_info command. More...
 
int elxu_cmd_set_trunk_mode (int argc, char **argv)
 Command handler for elxu_cmd_set_trunk_mode command. More...
 
static void ocs_fc_report_trunk_links (uint8_t ports_active, char *active_ports_str, size_t max_str_len)
 
int elxu_cmd_get_trunk_config (int argc, char **argv)
 Command handler for elxu_cmd_get_trunk_config command. More...
 
int elxu_cmd_port_migration (int argc, char **argv)
 Command handler for the port-migration command. More...
 
int elxu_cmd_get_parity_stats (int argc, char **argv)
 Command handler for the get-parity-stats command. More...
 
int elxu_cmd_firmware_reset_pt (int argc, char **argv)
 Send a firmware reset via the elx_pt driver. More...
 
int elxu_cmd_unload (int argc, char **argv)
 Command handler for user space driver unload. More...
 
int elxu_cmd_node_abort_cnt (int argc, char **argv)
 Command handler for the node-abort-cnt command. More...
 
int elxu_cmd_help (int argc, char **argv)
 Command handler for the help command. More...
 
void usage ()
 Show program usage. More...
 
int parse_arguments (int argc, char **argv, cmd_options_t *options, int openflag, int expected_nonargs)
 Parse command line arguments. More...
 

Variables

char * supported_linkcfgs []
 
char * supported_linkspeed []
 
char * supported_linktopology []
 

Macro Details

#define AUTO   "0"

Definition at line 98 of file elxu_commands.c.

#define DPORT_SFP_TABLE1_LEN   (sizeof(supported_table1) / sizeof(elx_dport_sfp_table1_entry))
#define DPORT_SFP_TABLE2_LEN   (sizeof(supported_table2) / sizeof(elx_dport_sfp_table2_entry))
#define ELXU_IP_GET_ADDRESS_LIST_SIZE   (4096 * 2)

Definition at line 2044 of file elxu_commands.c.

#define ETH_FC_10G   "1000"

Definition at line 82 of file elxu_commands.c.

#define ETH_FC_AUTO   "0"

Definition at line 81 of file elxu_commands.c.

#define FC_16G   "16000"

Definition at line 86 of file elxu_commands.c.

#define FC_2G   "2000"

Definition at line 83 of file elxu_commands.c.

#define FC_32G   "32000"

Definition at line 87 of file elxu_commands.c.

#define FC_4G   "4000"

Definition at line 84 of file elxu_commands.c.

#define FC_8G   "8000"

Definition at line 85 of file elxu_commands.c.

#define LOOP   "2"

Definition at line 100 of file elxu_commands.c.

#define N_PORT   "1"

Definition at line 99 of file elxu_commands.c.

#define OCS_FC_TRUNK_2_PORT_CONFIG   0x30

Definition at line 109 of file elxu_commands.c.

#define OCS_FC_TRUNK_2_PORT_HI_CONFIG   0xC0

Definition at line 110 of file elxu_commands.c.

#define OCS_FC_TRUNK_4_PORT_CONFIG   0xF0

Definition at line 111 of file elxu_commands.c.

#define OCS_FC_TRUNK_CONFIG_MASK   0xF0

Definition at line 113 of file elxu_commands.c.

#define OCS_FC_TRUNK_LINK_STATE_MASK   0x0F

Definition at line 114 of file elxu_commands.c.

#define OCS_MAX_SLI_PORTS_PER_DEVICE   4

Definition at line 107 of file elxu_commands.c.

#define PORTSPEED_128GFC   0x00000200 /* 128G FC */

Definition at line 70 of file elxu_commands.c.

#define PORTSPEED_16GFC   0x00000020 /* 16G FC */

Definition at line 67 of file elxu_commands.c.

#define PORTSPEED_1GFC   0x00000001 /* 1G FC */

Definition at line 63 of file elxu_commands.c.

#define PORTSPEED_2GFC   0x00000002 /* 2G FC */

Definition at line 64 of file elxu_commands.c.

#define PORTSPEED_32GFC   0x00000040 /* 32G FC */

Definition at line 68 of file elxu_commands.c.

#define PORTSPEED_4GFC   0x00000008 /* 4G FC */

Definition at line 65 of file elxu_commands.c.

#define PORTSPEED_64GFC   0x00000400 /* 64G FC*/

Definition at line 69 of file elxu_commands.c.

#define PORTSPEED_8GFC   0x00000010 /* 8G FC */

Definition at line 66 of file elxu_commands.c.

#define PORTSPEED_UNKNOWN   0x00008000 /* Unknown*/

Definition at line 71 of file elxu_commands.c.

Function Details

int elxu_check_ip_address_exists ( cmd_options_t *  options,
char *  ipaddr,
int *  ip_found 
)

Definition at line 2045 of file elxu_commands.c.

int elxu_check_sfp_dport_support ( elxu_device_t *  device)

Definition at line 1177 of file elxu_commands.c.

int elxu_cmd_diag_loopback_tests ( int  argc,
char **  argv 
)

Definition at line 1352 of file elxu_commands.c.

int elxu_cmd_get_dynamic_dport_status ( int  argc,
char **  argv 
)

Definition at line 1336 of file elxu_commands.c.

int elxu_cmd_iclusttgt ( int  argc,
char **  argv 
)

Definition at line 1752 of file elxu_commands.c.

int elxu_cmd_iclusttgt_check_args ( int  argc,
char **  argv 
)

Definition at line 1673 of file elxu_commands.c.

int elxu_cmd_iclusttgt_show ( elxu_device_t *  device)

Definition at line 1689 of file elxu_commands.c.

int elxu_cmd_set_dport_dynamic_mode ( int  argc,
char **  argv 
)

Definition at line 1306 of file elxu_commands.c.

void elxu_decode_port_speed ( uint32_t  port_speed,
char *  buf 
)

Definition at line 4917 of file elxu_commands.c.

char* elxu_decode_sfp_connector ( uint32_t  value)

Definition at line 600 of file elxu_commands.c.

char* elxu_decode_sfp_id ( uint32_t  value)

Definition at line 566 of file elxu_commands.c.

char* elxu_decode_sfp_rate_id ( uint32_t  value)

Definition at line 636 of file elxu_commands.c.

int elxu_device_get_lancer_temp ( elxu_device_t *  device)

Definition at line 691 of file elxu_commands.c.

char* elxu_sfp_encoding_info ( uint32_t  value)

Definition at line 659 of file elxu_commands.c.

static void ocs_fc_report_trunk_links ( uint8_t  ports_active,
char *  active_ports_str,
size_t  max_str_len 
)
static

Definition at line 5152 of file elxu_commands.c.

int parse_arguments ( int  argc,
char **  argv,
cmd_options_t *  options,
int  openflag,
int  expected_nonargs 
)

Parse command line arguments.

Description
Given the argc and argv parameters from the main program, function parses the command line arguments and stores the results in the cmd_options_t structure.
Parameters
argcCount of arguments.
argvArray of pointers to argument strings.
optionsPointer to array into which the results will be stored.
openflagIf TRUE the device specified by the options should be opened.
expected_nonargsExpected number of extra arguments.
Returns
Returns 0 on success; non-zero on failure.

Definition at line 5572 of file elxu_commands.c.

static void show_examples ( )
static

Print examples of commands.

Description
This function is called as part of the "help" command. It displays examples of command usage.
Returns
Returns nothing.

Definition at line 5821 of file elxu_commands.c.

static void usage ( void  )

Show program usage.

Description
Displays program help text.

Definition at line 5550 of file elxu_commands.c.

Variable Details

char* supported_linkcfgs[]
Initial value:
= {
#define OCS_CONFIG_LINKCFG_4X10G
linkcfg strings
Definition: ocs_ioctl.h:472
#define OCS_CONFIG_LINKCFG_1X40G
Definition: ocs_ioctl.h:473
#define OCS_CONFIG_LINKCFG_4X8G
Definition: ocs_ioctl.h:475
#define OCS_CONFIG_LINKCFG_4X1G
Definition: ocs_ioctl.h:476
#define OCS_CONFIG_LINKCFG_2X16G
Definition: ocs_ioctl.h:474
#define OCS_CONFIG_LINKCFG_2X10G
Definition: ocs_ioctl.h:477
#define OCS_CONFIG_LINKCFG_2X10G_2X8G
Definition: ocs_ioctl.h:478

Definition at line 72 of file elxu_commands.c.

char* supported_linkspeed[]
Initial value:
= {
#define ETH_FC_AUTO
Definition: elxu_commands.c:81
#define FC_32G
Definition: elxu_commands.c:87
#define FC_4G
Definition: elxu_commands.c:84
#define FC_8G
Definition: elxu_commands.c:85
#define FC_2G
Definition: elxu_commands.c:83
#define FC_16G
Definition: elxu_commands.c:86
#define ETH_FC_10G
Definition: elxu_commands.c:82

Definition at line 89 of file elxu_commands.c.

char* supported_linktopology[]
Initial value:
= {
}
#define LOOP
#define N_PORT
Definition: elxu_commands.c:99
#define AUTO
Definition: elxu_commands.c:98

Definition at line 101 of file elxu_commands.c.