#include <stdio.h>#include <stdint.h>#include <stdlib.h>#include <stdarg.h>#include <assert.h>#include <string.h>#include <sys/types.h>#include <sys/ioctl.h>#include <fcntl.h>#include <dirent.h>#include <unistd.h>#include <ctype.h>#include <sys/mman.h>#include <ocs_ioctl.h>#include <elxu_device.h>#include <elxu_sli4.h>#include <elxu_mbox.h>#include <elxu_common.h>#include <elxu_mgmt.h>#include <elx_pt_ioctl.h>#include <elxu_dump.h>Go to the source code of this file.
Data Structures | |
| struct | vpdbuf_t |
| struct | mbox_skyhawk_linkcfg_map_t |
| Mapping from mgmt string to Skyhawk config IDs. More... | |
Macros | |
| #define | IOCTL_BUFSIZE 64*1024 |
| #define | DPORT_DYNAMIC_MODE 0x1 |
| #define | DPORT_STATIC_MODE 0x2 |
| #define | DPORT_QUERY_DYNAMIC_MODE 0x3 |
| #define | VPD_LARGE_RESOURCE_TYPE_ID_STRING_TAG 0x82 |
| #define | VPD_LARGE_RESOURCE_TYPE_R_TAG 0x90 |
| #define | VPD_LARGE_RESOURCE_TYPE_W_TAG 0x91 |
| #define | VPD_SMALL_RESOURCE_TYPE_END_TAG 0x78 |
Functions | |
| static char * | format_sli4_ip_address (uint32_t *address) |
| Given a 6-word IP address in the format specified in the SLI4 spec, return a printable IP address. More... | |
| static int | ocs_mbox (elxu_device_t *device, mbox_command_t *mboxcmd, uint32_t mboxcmdLength, void *inbuf, uint32_t inbufLength, void *outbuf, uint32_t outbufLength) |
| static int | pt_mbox (elxu_device_t *device, mbox_command_t *mboxcmd, uint32_t mboxcmdLength, void *inbuf, uint32_t inbufLength, void *outbuf, uint32_t outbufLength) |
| static int | vpddone (vpdbuf_t *vpd) |
| static int | vpdnext (vpdbuf_t *vpd) |
| static uint8_t * | vpdref (vpdbuf_t *vpd) |
| static uint8_t * | elx_find_vpd (uint8_t *vpddata, uint32_t vpddata_length, const char *key) |
| int | mbox_read_rev (elxu_device_t *device) |
| Issue read rev mailbox command. More... | |
| static void | parse_dport_result (mbox_res_fcoe_get_dport_results_t *rsp) |
| static int | mbox_set_link_diag_state (elxu_device_t *device, void *mqe, int enable) |
| static int | mbox_set_dport_mode (elxu_device_t *device, void *mqe, int mode, int enable) |
| int | mbox_query_dynamic_dport_status (elxu_device_t *device) |
| int | mbox_set_dynamic_dport (elxu_device_t *device, char *state_str) |
| int | mbox_get_dport_stats (elxu_device_t *device) |
| Issue Get dport stats mailbox command Create a GET_DPORT_STAT mailbox command. More... | |
| int | mbox_diag_loopback_tests (elxu_device_t *device, int loopback_type, int retry_count) |
| Issue set link diag loopback mailbox command. More... | |
| int | mbox_read_link_status (elxu_device_t *device, int clof, int clrc) |
| Issue read link status mailbox command. More... | |
| int | mbox_read_status (elxu_device_t *device, uint32_t clear_counter) |
| Issue read status mailbox command. More... | |
| int | mbox_ioctl_common_enable_disable_port (elxu_device_t *device, uint32_t port_status) |
| Issue IOCTL_COMMON_ENABLE_DISABLE_PORT command. More... | |
| int | mbox_ioctl_common_set_be_configuration_and_resources (elxu_device_t *device, int *mac_addr) |
| Issue IOCTL_COMMON_SET_BE_CONFIGRATION_AND_RESOURCES command. More... | |
| int | mbox_soft_assign_mac (elxu_device_t *device, int *macaddr) |
| Soft assign MAC. More... | |
| void | mbox_get_mac_pt (elxu_device_t *device, uint8_t *mac_addr) |
| void | mbox_get_wwn_pt (int fd, uint8_t *wwnn, uint8_t *wwpn) |
| int | mbox_get_serialnum_pt (elxu_device_t *device, char *serial_num, int serial_num_size) |
| int | mbox_set_nv_mac_pt (elxu_device_t *device, int *macaddr) |
| int | mbox_set_nv_wwn_pt (elxu_device_t *device, char *wwpn_p, char *wwnn_p) |
| Issue a set non-volatile WWNN/WWPN. More... | |
| int | mbox_read_flashrom (elxu_device_t *device, uint32_t opcode, uint32_t optype, uint32_t offset, void *outbuf, uint32_t outbufLength) |
| Issue read flashrom mailbox command. More... | |
| int | mbox_write_flashrom (elxu_device_t *device, uint32_t opcode, uint32_t optype, uint32_t offset, void *inbuf, uint32_t inbufLength) |
| Issue write flashrom mailbox command. More... | |
| int | mbox_manage_fat (elxu_device_t *device, uint32_t fat_operation, uint32_t read_log_offset, void *buffer, uint32_t bufferLength) |
| Issue COMMON_MANAGE_FAT mailbox commands. More... | |
| int | mbox_ext_fat (elxu_device_t *device, uint32_t opcode, void *mbox, uint32_t mboxLength) |
| Issue EFD mailbox command. More... | |
| int | mbox_tcp_parameters (elxu_device_t *device, uint32_t request_flags, uint32_t ackFrequency, uint32_t delayedAckTimerValue) |
| Issue the Set TCP Parameters mbox command. More... | |
| int | mbox_connection_update (elxu_device_t *device, uint32_t request_flags, uint16_t connectionId, uint32_t constrainWindowValue) |
| int | mbox_get_connection_info (elxu_device_t *device, uint32_t connectionHandle) |
| Get connection info. More... | |
| static const char * | mbox_get_clp_from_mgmt_linkcfg_str (char *mgmt_str) |
| Get the CLP string from the mgmt config string. More... | |
| static char * | mbox_get_mgmt_from_clp_linkcfg_str (char *clp_str) |
| Get the mgmt config string from the CLP string. More... | |
| char * | mbox_get_linkcfg_lancer_pt (elxu_device_t *device) |
| char * | mbox_get_linkcfg_skyhawk_pt (elxu_device_t *device) |
| char * | mbox_get_linkcfg_pt (elxu_device_t *device) |
| Get Link configuration. More... | |
| int | mbox_set_linkcfg_lancer_pt (elxu_device_t *device, char *config) |
| static uint32_t | mbox_get_config_id_from_mgmt_str (char *mgmt_str) |
| Get the config ID from the mgmt config string. More... | |
| int | mbox_set_linkcfg_skyhawk_pt (elxu_device_t *device, char *config) |
| int | mbox_set_linkcfg_pt (elxu_device_t *device, char *config) |
| Set Link configuration. More... | |
| int | create_vport (elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag) |
| int | remove_vport (elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag) |
| int | mbox_common (elxu_device_t *device, mbox_command_t *mboxcmd, uint32_t mboxcmdLength, void *inbuf, uint32_t inbufLength, void *outbuf, uint32_t outbufLength) |
| Send a mailbox command. More... | |
| memref_t * | elx_pt_dma_alloc (elxu_device_t *device, int size) |
| Request a DMA allocation through elx_pt. More... | |
| void | elx_pt_dma_free (memref_t *memref) |
| Free a DMA allocation through elx_pt. More... | |
| int | mbox_fw_reset_pt (elxu_device_t *device, int dd) |
| int | mbox_sli4_init_pt (elxu_device_t *device) |
| int | mbox_get_profile_list_pt (elxu_device_t *device, char *result, int result_len) |
| int | mbox_get_active_profile_pt (elxu_device_t *device, char *result, int result_len) |
| int | mbox_set_active_profile_pt (elxu_device_t *device, char *new_profile_id) |
Variables | |
| static mbox_linkcfg_map_t | mbox_linkcfg_str [] |
| static mbox_skyhawk_linkcfg_map_t | mbox_skyhawk_linkcfg_map [] |
| Mapping from mgmt string to Skyhawk config IDs. More... | |
| #define DPORT_DYNAMIC_MODE 0x1 |
Definition at line 59 of file elxu_mbox.c.
| #define DPORT_QUERY_DYNAMIC_MODE 0x3 |
Definition at line 61 of file elxu_mbox.c.
| #define DPORT_STATIC_MODE 0x2 |
Definition at line 60 of file elxu_mbox.c.
| #define IOCTL_BUFSIZE 64*1024 |
Definition at line 57 of file elxu_mbox.c.
| #define VPD_LARGE_RESOURCE_TYPE_ID_STRING_TAG 0x82 |
Definition at line 68 of file elxu_mbox.c.
| #define VPD_LARGE_RESOURCE_TYPE_R_TAG 0x90 |
Definition at line 69 of file elxu_mbox.c.
| #define VPD_LARGE_RESOURCE_TYPE_W_TAG 0x91 |
Definition at line 70 of file elxu_mbox.c.
| #define VPD_SMALL_RESOURCE_TYPE_END_TAG 0x78 |
Definition at line 71 of file elxu_mbox.c.
| int create_vport | ( | elxu_device_t * | device_p, |
| uint64_t | wwnn, | ||
| uint64_t | wwpn, | ||
| int | targetFlag, | ||
| int | initiatorFlag | ||
| ) |
Definition at line 2319 of file elxu_mbox.c.
|
inlinestatic |
Definition at line 104 of file elxu_mbox.c.
| memref_t* elx_pt_dma_alloc | ( | elxu_device_t * | device, |
| int | size | ||
| ) |
Request a DMA allocation through elx_pt.
| device | device structure |
| size | Size of the requested buffer in bytes |
Definition at line 2549 of file elxu_mbox.c.
| void elx_pt_dma_free | ( | memref_t * | memref | ) |
Free a DMA allocation through elx_pt.
| memref | The memref_t to be freed. |
Definition at line 2602 of file elxu_mbox.c.
|
static |
Given a 6-word IP address in the format specified in the SLI4 spec, return a printable IP address.
| address | A pointer to an IP address in an array of six 32-bit words |
Definition at line 2366 of file elxu_mbox.c.
| int mbox_common | ( | elxu_device_t * | device, |
| mbox_command_t * | mboxcmd, | ||
| uint32_t | mboxcmdLength, | ||
| void * | inbuf, | ||
| uint32_t | inbufLength, | ||
| void * | outbuf, | ||
| uint32_t | outbufLength | ||
| ) |
Send a mailbox command.
Populates a mailbox command passing input and output buffer to the device
For SLI_CONFIG commands with non-embedded command, the command should be put in the inbuf, the mboxcmd will point to just the SLI_CONFIG command + buffer descriptor
| device | device descriptor |
| mboxcmd | pointer to mailbox command data |
| mboxcmdLength | length of mailbox command in bytes |
| inbuf | input buffer |
| inbufLength | length in bytes of input buffer in bytes |
| outbuf | output buffer |
| outbufLength | length in bytes of output buffer in bytes |
| timeout | the mailbox timeout for the command to be carried out |
Definition at line 2418 of file elxu_mbox.c.
| int mbox_connection_update | ( | elxu_device_t * | device, |
| uint32_t | request_flags, | ||
| uint16_t | connectionId, | ||
| uint32_t | constrainWindowValue | ||
| ) |
Definition at line 1719 of file elxu_mbox.c.
| int mbox_diag_loopback_tests | ( | elxu_device_t * | device, |
| int | loopback_type, | ||
| int | retry_count | ||
| ) |
Issue set link diag loopback mailbox command.
Create a SET_LINK_DIAG_LOOPBACK mailbox command
| device | device descriptor |
| mqe | |
| type | loopback test type |
Definition at line 543 of file elxu_mbox.c.
| int mbox_ext_fat | ( | elxu_device_t * | device, |
| uint32_t | opcode, | ||
| void * | mbox, | ||
| uint32_t | mboxLength | ||
| ) |
Issue EFD mailbox command.
Submits the mailbox command given by 'mbox' for 'mboxLength'. Note, that 'mboxLength' will generally include a response payload
| device | device descriptor |
| opcode | common mailbox opcode |
| mbox | pointer to common mailbox command + payload |
| mboxLength | length of mailbox command + payload |
Definition at line 1604 of file elxu_mbox.c.
| int mbox_fw_reset_pt | ( | elxu_device_t * | device, |
| int | dd | ||
| ) |
Definition at line 2625 of file elxu_mbox.c.
| int mbox_get_active_profile_pt | ( | elxu_device_t * | device, |
| char * | result, | ||
| int | result_len | ||
| ) |
Definition at line 2844 of file elxu_mbox.c.
|
static |
Get the CLP string from the mgmt config string.
| mgmt_str | mgmt string. |
Definition at line 1860 of file elxu_mbox.c.
|
static |
Get the config ID from the mgmt config string.
| mgmt_str | mgmt string value. |
Definition at line 2229 of file elxu_mbox.c.
| int mbox_get_connection_info | ( | elxu_device_t * | device, |
| uint32_t | connectionHandle | ||
| ) |
Get connection info.
| device | device descriptor |
| connection | the handle of the connection for which info is requested |
Only supported on Skyhawk
Definition at line 1776 of file elxu_mbox.c.
| int mbox_get_dport_stats | ( | elxu_device_t * | device | ) |
Issue Get dport stats mailbox command Create a GET_DPORT_STAT mailbox command.
Definition at line 408 of file elxu_mbox.c.
| char* mbox_get_linkcfg_lancer_pt | ( | elxu_device_t * | device | ) |
Definition at line 1894 of file elxu_mbox.c.
| char* mbox_get_linkcfg_pt | ( | elxu_device_t * | device | ) |
Get Link configuration.
| device | device descriptor |
Definition at line 2086 of file elxu_mbox.c.
| char* mbox_get_linkcfg_skyhawk_pt | ( | elxu_device_t * | device | ) |
Definition at line 2006 of file elxu_mbox.c.
| void mbox_get_mac_pt | ( | elxu_device_t * | device, |
| uint8_t * | mac_addr | ||
| ) |
Definition at line 950 of file elxu_mbox.c.
|
static |
Get the mgmt config string from the CLP string.
| clp_str | clp string. |
Definition at line 1881 of file elxu_mbox.c.
| int mbox_get_profile_list_pt | ( | elxu_device_t * | device, |
| char * | result, | ||
| int | result_len | ||
| ) |
Definition at line 2771 of file elxu_mbox.c.
| int mbox_get_serialnum_pt | ( | elxu_device_t * | device, |
| char * | serial_num, | ||
| int | serial_num_size | ||
| ) |
Definition at line 1053 of file elxu_mbox.c.
| void mbox_get_wwn_pt | ( | int | fd, |
| uint8_t * | wwnn, | ||
| uint8_t * | wwpn | ||
| ) |
Definition at line 1029 of file elxu_mbox.c.
| int mbox_ioctl_common_enable_disable_port | ( | elxu_device_t * | device, |
| uint32_t | port_status | ||
| ) |
Issue IOCTL_COMMON_ENABLE_DISABLE_PORT command.
create IOCTL_COMMON_ENABLE_DISABLE_PORT mailbox command
| device | device descriptor |
| port_status | ENABLE (1) or DISABLE (0) |
Definition at line 824 of file elxu_mbox.c.
| int mbox_ioctl_common_set_be_configuration_and_resources | ( | elxu_device_t * | device, |
| int * | mac_addr | ||
| ) |
Issue IOCTL_COMMON_SET_BE_CONFIGRATION_AND_RESOURCES command.
create IOCTL_COMMON_SET_BE_CONFIGURATION_AND_RESOURCES mailbox command
| device | device descriptor |
| mac_addr | new MAC address |
Definition at line 875 of file elxu_mbox.c.
| int mbox_manage_fat | ( | elxu_device_t * | device, |
| uint32_t | fat_operation, | ||
| uint32_t | read_log_offset, | ||
| void * | buffer, | ||
| uint32_t | bufferLength | ||
| ) |
Issue COMMON_MANAGE_FAT mailbox commands.
This function issues Manage FAT mailbox commands. There are four supported operations:
FAT_OPERATION_RETRIEVE read the FAT contents FAT_OPERATION_QUERY return the length of the FAT (may be zero) FAT_OPERATION_CLEAR clear the FAT FAT_OPERATION_TRIGGER trigger a UE that will append to FAT
| device | device descriptor |
| fat_opration | requested FAT operation |
| read_log_offset | read offset (for FAT_OPERATION_RETRIEVE) |
| buffer | read buffer (for FAT_OPERATION_RETRIEVE) |
| bufferLength | read buffer length in bytes (for FAT_OPERATION_RETRIEVE) |
Definition at line 1510 of file elxu_mbox.c.
| int mbox_query_dynamic_dport_status | ( | elxu_device_t * | device | ) |
Definition at line 369 of file elxu_mbox.c.
| int mbox_read_flashrom | ( | elxu_device_t * | device, |
| uint32_t | opcode, | ||
| uint32_t | optype, | ||
| uint32_t | offset, | ||
| void * | outbuf, | ||
| uint32_t | outbufLength | ||
| ) |
Issue read flashrom mailbox command.
Create a SLI_CONFIG Read Flashrom mailbox command
| device | device descriptor |
| opcode | READ/WRITE_FLASHROM opcode value |
| optype | READ/WRITE_FLASHROM optype value |
| optype | READ/WRITE_FLASHROM offset value |
| outbuf | output buffer |
| outbufLength | length in bytes of output buffer |
Definition at line 1339 of file elxu_mbox.c.
| int mbox_read_link_status | ( | elxu_device_t * | device, |
| int | clof, | ||
| int | clrc | ||
| ) |
Issue read link status mailbox command.
Create a READ_LNK_STAT mailbox command
| device | device descriptor |
| clof | clear overflow flag |
| clrc | clear all counters floag |
Definition at line 666 of file elxu_mbox.c.
| int mbox_read_rev | ( | elxu_device_t * | device | ) |
Issue read rev mailbox command.
Create a READ_REV mailbox command
| device | device descriptor |
Definition at line 194 of file elxu_mbox.c.
| int mbox_read_status | ( | elxu_device_t * | device, |
| uint32_t | clear_counter | ||
| ) |
Issue read status mailbox command.
Create a READ_STATUS mailbox command
| device | device descriptor |
| clear_counter | clear counter flag |
Definition at line 763 of file elxu_mbox.c.
| int mbox_set_active_profile_pt | ( | elxu_device_t * | device, |
| char * | new_profile_id | ||
| ) |
Definition at line 2940 of file elxu_mbox.c.
|
static |
Definition at line 323 of file elxu_mbox.c.
| int mbox_set_dynamic_dport | ( | elxu_device_t * | device, |
| char * | state_str | ||
| ) |
Definition at line 385 of file elxu_mbox.c.
|
static |
Definition at line 289 of file elxu_mbox.c.
| int mbox_set_linkcfg_lancer_pt | ( | elxu_device_t * | device, |
| char * | config | ||
| ) |
Definition at line 2099 of file elxu_mbox.c.
| int mbox_set_linkcfg_pt | ( | elxu_device_t * | device, |
| char * | config | ||
| ) |
Set Link configuration.
| device | device descriptor |
| config | new link configuration string |
Definition at line 2306 of file elxu_mbox.c.
| int mbox_set_linkcfg_skyhawk_pt | ( | elxu_device_t * | device, |
| char * | config | ||
| ) |
Definition at line 2242 of file elxu_mbox.c.
| int mbox_set_nv_mac_pt | ( | elxu_device_t * | device, |
| int * | macaddr | ||
| ) |
Definition at line 1098 of file elxu_mbox.c.
| int mbox_set_nv_wwn_pt | ( | elxu_device_t * | device, |
| char * | wwpn_p, | ||
| char * | wwnn_p | ||
| ) |
Issue a set non-volatile WWNN/WWPN.
Create a WRITE NVPARAMS mailbox command
| device | device descriptor |
| wwn | world-wide name |
| name | WWNN/WWPN flag to set |
Definition at line 1276 of file elxu_mbox.c.
| int mbox_sli4_init_pt | ( | elxu_device_t * | device | ) |
Definition at line 2738 of file elxu_mbox.c.
| int mbox_soft_assign_mac | ( | elxu_device_t * | device, |
| int * | macaddr | ||
| ) |
Soft assign MAC.
Definition at line 939 of file elxu_mbox.c.
| int mbox_tcp_parameters | ( | elxu_device_t * | device, |
| uint32_t | request_flags, | ||
| uint32_t | ackFrequency, | ||
| uint32_t | delayedAckTimerValue | ||
| ) |
Issue the Set TCP Parameters mbox command.
| device | device descriptor |
| request_flags | flags indicating which values should be updated |
| ackFrequency | ACK frequency |
| delayedAckTimerValue | delayed ACK timer value, in milliseconds |
Definition at line 1663 of file elxu_mbox.c.
| int mbox_write_flashrom | ( | elxu_device_t * | device, |
| uint32_t | opcode, | ||
| uint32_t | optype, | ||
| uint32_t | offset, | ||
| void * | inbuf, | ||
| uint32_t | inbufLength | ||
| ) |
Issue write flashrom mailbox command.
| device | device descriptor |
| opcode | READ/WRITE_FLASHROM opcode value |
| optype | READ/WRITE_FLASHROM optype value |
| optype | READ/WRITE_FLASHROM offset value |
| inbuf | input buffer |
| inbufLength | length in bytes of input buffer |
Definition at line 1421 of file elxu_mbox.c.
|
static |
Definition at line 2489 of file elxu_mbox.c.
|
static |
Definition at line 226 of file elxu_mbox.c.
|
static |
Definition at line 2434 of file elxu_mbox.c.
| int remove_vport | ( | elxu_device_t * | device_p, |
| uint64_t | wwnn, | ||
| uint64_t | wwpn, | ||
| int | targetFlag, | ||
| int | initiatorFlag | ||
| ) |
Definition at line 2339 of file elxu_mbox.c.
|
inlinestatic |
Definition at line 81 of file elxu_mbox.c.
|
inlinestatic |
Definition at line 87 of file elxu_mbox.c.
|
inlinestatic |
Definition at line 98 of file elxu_mbox.c.
|
static |
Definition at line 1842 of file elxu_mbox.c.
|
static |
Mapping from mgmt string to Skyhawk config IDs.
Definition at line 2216 of file elxu_mbox.c.