Velocity Userspace
|
Various functions that fit don't fit into other categories. More...
Functions | |
int | switchtec_echo (struct switchtec_dev *dev, uint32_t input, uint32_t *output) |
Perform an MRPC echo command. More... | |
int | switchtec_hard_reset (struct switchtec_dev *dev) |
Perform an MRPC hard reset command. More... | |
static void | free_log_defs (struct log_defs *defs) |
Free log definition data. More... | |
static int | realloc_log_defs (struct log_defs *defs, int num_modules) |
Allocate / reallocate log definition data. More... | |
static bool | parse_int (char *str, int *val) |
Parse an integer from a string. More... | |
static int | read_app_log_defs (FILE *log_def_file, struct log_defs *defs) |
Read an app log definition file and store the definitions. More... | |
static int | read_mailbox_log_defs (FILE *log_def_file, struct log_defs *defs) |
Read a mailbox log definition file and store the definitions. More... | |
static int | write_parsed_log (struct log_a_data log_data[], size_t count, int init_entry_idx, struct log_defs *defs, enum switchtec_log_parse_type log_type, FILE *log_file, int ts_factor) |
Parse an app log or mailbox log and write the results to a file. More... | |
int | switchtec_log_to_file (struct switchtec_dev *dev, enum switchtec_log_type type, int fd, FILE *log_def_file, struct switchtec_log_file_info *info) |
Dump the Switchtec log data to a file. More... | |
int | switchtec_parse_log (FILE *bin_log_file, FILE *log_def_file, FILE *parsed_log_file, enum switchtec_log_parse_type log_type, enum switchtec_gen gen, struct switchtec_log_file_info *info) |
Parse a binary app log or mailbox log to a text file. More... | |
int | switchtec_log_def_to_file (struct switchtec_dev *dev, enum switchtec_log_def_type type, FILE *file) |
Dump the Switchtec log definition data to a file. More... | |
int | switchtec_get_device_info (struct switchtec_dev *dev, enum switchtec_boot_phase *phase, enum switchtec_gen *gen, enum switchtec_rev *rev, struct ping_dev_info *ping_info) |
Get device generation, revision, and boot phase info. More... | |
float | switchtec_die_temp (struct switchtec_dev *dev) |
Get the die temperature of the switchtec device. More... | |
int | switchtec_calc_lane_id (struct switchtec_dev *dev, int phys_port_id, int lane_id, struct switchtec_status *port) |
Calculate the global lane ID for a lane within a physical port. More... | |
int | switchtec_calc_port_lane (struct switchtec_dev *dev, int lane_id, int *phys_port_id, int *port_lane_id, struct switchtec_status *port) |
Calculate the port and lane within the port from a global lane ID. More... | |
int | switchtec_calc_lane_mask (struct switchtec_dev *dev, int phys_port_id, int lane_id, int num_lanes, int *lane_mask, struct switchtec_status *port) |
Calculate the lane mask for lanes within a physical port. More... | |
bool | switchtec_stack_bif_port_valid (struct switchtec_dev *dev, int stack_id, int port_id) |
Return true if a port within a stack is valid. More... | |
int | switchtec_stack_bif_width (struct switchtec_dev *dev, int stack_id, int port_bif) |
Return the number of stack ports used for a given bifurcation. More... | |
int | switchtec_get_stack_bif (struct switchtec_dev *dev, int stack_id, int port_bif[SWITCHTEC_PORTS_PER_STACK]) |
Get the bifurcation of ports in a stack. More... | |
int | switchtec_set_stack_bif (struct switchtec_dev *dev, int stack_id, int port_bif[SWITCHTEC_PORTS_PER_STACK]) |
Set the bifurcation of ports in a stack. More... | |
int | switchtec_pff_to_port (struct switchtec_dev *dev, int pff, int *partition, int *port) |
Convert a port function index to a partition and port number. More... | |
int | switchtec_port_to_pff (struct switchtec_dev *dev, int partition, int port, int *pff) |
Convert a partition and port number to a port function index. More... | |
Various functions that fit don't fit into other categories.
|
static |
Free log definition data.
[in] | defs | - log definition data to free |
Definition at line 846 of file switchtec.c.
|
static |
Parse an integer from a string.
[in] | str | - string to parse |
[out] | val | - integer |
Definition at line 898 of file switchtec.c.
|
static |
Read an app log definition file and store the definitions.
[in] | log_def_file | - log definition file |
[out] | defs | - log definitions |
Definition at line 917 of file switchtec.c.
|
static |
Read a mailbox log definition file and store the definitions.
[in] | log_def_file | - log definition file |
[out] | defs | - log definitions |
Definition at line 1026 of file switchtec.c.
|
static |
Allocate / reallocate log definition data.
[in] | defs | - log definition data |
[in] | num_modules | - number of modules to allocate for |
Definition at line 871 of file switchtec.c.
int switchtec_calc_lane_id | ( | struct switchtec_dev * | dev, |
int | phys_port_id, | ||
int | lane_id, | ||
struct switchtec_status * | port | ||
) |
Calculate the global lane ID for a lane within a physical port.
[in] | dev | Switchtec device handle |
[in] | phys_port_id | Physical port id |
[in] | lane_id | Lane number within the port |
[out] | status | Optionally return the status of the port |
Definition at line 1997 of file switchtec.c.
int switchtec_calc_lane_mask | ( | struct switchtec_dev * | dev, |
int | phys_port_id, | ||
int | lane_id, | ||
int | num_lanes, | ||
int * | lane_mask, | ||
struct switchtec_status * | port | ||
) |
Calculate the lane mask for lanes within a physical port.
[in] | dev | Switchtec device handle |
[in] | phys_port_id | Physical port id |
[in] | lane_id | Lane number within the port |
[in] | num_lanes | Number of consecutive lanes to set |
[out] | lane_mask | Pointer to array of 4 integers to set the bits of the lanes to |
[out] | status | Optionally, return the status of the port |
Definition at line 2101 of file switchtec.c.
int switchtec_calc_port_lane | ( | struct switchtec_dev * | dev, |
int | lane_id, | ||
int * | phys_port_id, | ||
int * | port_lane_id, | ||
struct switchtec_status * | port | ||
) |
Calculate the port and lane within the port from a global lane ID.
[in] | dev | Switchtec device handle |
[in] | lane_id | Global Lane Number |
[out] | phys_port_id | Physical port id |
[out] | port_lane | Lane number within the port |
[out] | status | Optionally return the status of the port |
Definition at line 2037 of file switchtec.c.
float switchtec_die_temp | ( | struct switchtec_dev * | dev | ) |
Get the die temperature of the switchtec device.
[in] | dev | Switchtec device handle |
Definition at line 1887 of file switchtec.c.
int switchtec_echo | ( | struct switchtec_dev * | dev, |
uint32_t | input, | ||
uint32_t * | output | ||
) |
Perform an MRPC echo command.
[in] | dev | Switchtec device handle |
[in] | input | The input data for the echo command |
[out] | output | The result of the echo command |
The echo command takes 4 bytes and returns the bitwise-not of those bytes.
Definition at line 818 of file switchtec.c.
int switchtec_get_device_info | ( | struct switchtec_dev * | dev, |
enum switchtec_boot_phase * | phase, | ||
enum switchtec_gen * | gen, | ||
enum switchtec_rev * | rev, | ||
struct ping_dev_info * | ping_info | ||
) |
Get device generation, revision, and boot phase info.
[in] | dev | Switchtec device handle |
[out] | phase | The current boot phase |
[out] | gen | Device generation |
[out] | rev | Device revision |
Definition at line 1802 of file switchtec.c.
int switchtec_get_stack_bif | ( | struct switchtec_dev * | dev, |
int | stack_id, | ||
int | port_bif[SWITCHTEC_PORTS_PER_STACK] | ||
) |
Get the bifurcation of ports in a stack.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack ID to get the bifurcation of |
[out] | port_bif | Port bifurcation returned |
Definition at line 2189 of file switchtec.c.
int switchtec_hard_reset | ( | struct switchtec_dev * | dev | ) |
Perform an MRPC hard reset command.
[in] | dev | Switchtec device handle |
Note: if your system does not support hotplug this may leave the Switchtec device in an unusable state. A reboot would be required to fix this.
Definition at line 834 of file switchtec.c.
int switchtec_log_def_to_file | ( | struct switchtec_dev * | dev, |
enum switchtec_log_def_type | type, | ||
FILE * | file | ||
) |
Dump the Switchtec log definition data to a file.
[in] | dev | - Switchtec device handle |
[in] | type | - Type of log definition data to dump |
[in] | file | - File descriptor to dump the data to |
Definition at line 1698 of file switchtec.c.
int switchtec_log_to_file | ( | struct switchtec_dev * | dev, |
enum switchtec_log_type | type, | ||
int | fd, | ||
FILE * | log_def_file, | ||
struct switchtec_log_file_info * | info | ||
) |
Dump the Switchtec log data to a file.
[in] | dev | - Switchtec device handle |
[in] | type | - Type of log data to dump |
[in] | fd | - File descriptor to dump the data to |
[in] | log_def_file | - Log definition file |
[out] | info | - Log file information |
Definition at line 1505 of file switchtec.c.
int switchtec_parse_log | ( | FILE * | bin_log_file, |
FILE * | log_def_file, | ||
FILE * | parsed_log_file, | ||
enum switchtec_log_parse_type | log_type, | ||
enum switchtec_gen | gen, | ||
struct switchtec_log_file_info * | info | ||
) |
Parse a binary app log or mailbox log to a text file.
[in] | bin_log_file | - Binary log input file |
[in] | log_def_file | - Log definition file |
[in] | parsed_log_file | - Parsed output file |
[in] | log_type | - log type |
[in] | gen | - device generation |
[out] | info | - log file information |
Definition at line 1586 of file switchtec.c.
int switchtec_pff_to_port | ( | struct switchtec_dev * | dev, |
int | pff, | ||
int * | partition, | ||
int * | port | ||
) |
Convert a port function index to a partition and port number.
[in] | dev | Switchtec device handle |
[in] | pff | Port function number |
[out] | partition | Partition number |
[out] | port | Port number |
Definition at line 213 of file platform.c.
int switchtec_port_to_pff | ( | struct switchtec_dev * | dev, |
int | partition, | ||
int | port, | ||
int * | pff | ||
) |
Convert a partition and port number to a port function index.
[in] | dev | Switchtec device handle |
[in] | partition | Partition number |
[in] | port | Port number |
[out] | pff | Port function number |
Definition at line 228 of file platform.c.
int switchtec_set_stack_bif | ( | struct switchtec_dev * | dev, |
int | stack_id, | ||
int | port_bif[SWITCHTEC_PORTS_PER_STACK] | ||
) |
Set the bifurcation of ports in a stack.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack ID to get the bifurcation of |
[in] | port_bif | Port bifurcation returned |
Definition at line 2233 of file switchtec.c.
bool switchtec_stack_bif_port_valid | ( | struct switchtec_dev * | dev, |
int | stack_id, | ||
int | port_id | ||
) |
Return true if a port within a stack is valid.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack ID |
[out] | port_id | Port ID within the stack |
Definition at line 2148 of file switchtec.c.
int switchtec_stack_bif_width | ( | struct switchtec_dev * | dev, |
int | stack_id, | ||
int | port_bif | ||
) |
Return the number of stack ports used for a given bifurcation.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack ID |
[in] | port_bif | Port bifurcation |
Definition at line 2164 of file switchtec.c.
|
static |
Parse an app log or mailbox log and write the results to a file.
[in] | log_data | - logging data |
[in] | count | - number of entries |
[in] | init_entry_idx | - index of the initial entry |
[in] | defs | - log definitions |
[in] | log_type | - log type |
[in] | log_file | - log output file |
[in] | ts_factor | - timestamp conversion factor |
Definition at line 1096 of file switchtec.c.