Switchtec Userspace
PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
|
Main Switchtec header. More...
#include "mrpc.h"
#include "bind.h"
#include "portable.h"
#include "registers.h"
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | switchtec_device_info |
Represents a Switchtec device in the switchtec_list() function. More... | |
struct | switchtec_port_id |
Port identification. More... | |
struct | switchtec_status |
Port status structure. More... | |
struct | switchtec_fw_image_info |
Information about a firmware image or partition. More... | |
struct | switchtec_fw_part_summary |
struct | switchtec_fw_part_summary::switchtec_fw_part_type |
struct | switchtec_event_summary |
Event summary bitmaps. More... | |
struct | switchtec_evcntr_type_list |
Null-terminated list of all event counter types with a name and help text. More... | |
struct | switchtec_evcntr_setup |
Structure used to setup an event counter. More... | |
struct | switchtec_bwcntr_res |
Bandwidth counter result struct. More... | |
struct | switchtec_bwcntr_res::switchtec_bwcntr_dir |
Typedefs | |
typedef __gas struct switchtec_gas * | gasptr_t |
Shortform for a pointer to the GAS register space. | |
Enumerations |
Functions | |
struct switchtec_dev * | switchtec_open (const char *device) |
Open a Switchtec device by string. More... | |
void | switchtec_close (struct switchtec_dev *dev) |
Close a Switchtec device handle. More... | |
int | switchtec_get_fw_version (struct switchtec_dev *dev, char *buf, size_t buflen) |
Get the firmware version as a user readable string. More... | |
int | switchtec_cmd (struct switchtec_dev *dev, uint32_t cmd, const void *payload, size_t payload_len, void *resp, size_t resp_len) |
Execute an MRPC command. More... | |
int | switchtec_get_devices (struct switchtec_dev *dev, struct switchtec_status *status, int ports) |
Populate an already retrieved switchtec_status structure list with information about the devices plugged into the switch. 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... | |
int | switchtec_event_summary (struct switchtec_dev *dev, struct switchtec_event_summary *sum) |
Retrieve a summary of all the events that have occurred in the switch. More... | |
int | switchtec_event_check (struct switchtec_dev *dev, struct switchtec_event_summary *check, struct switchtec_event_summary *res) |
Check if one or more events have occurred. More... | |
int | switchtec_event_ctl (struct switchtec_dev *dev, enum switchtec_event_id e, int index, int flags, uint32_t data[5]) |
Enable, disable and clear events or retrieve event data. More... | |
int | switchtec_event_wait (struct switchtec_dev *dev, int timeout_ms) |
Wait for any event to occur (typically just an interrupt) More... | |
_PURE const char * | switchtec_name (struct switchtec_dev *dev) |
Get the string that was used to open the deviec. More... | |
_PURE int | switchtec_partition (struct switchtec_dev *dev) |
Get the partiton number of the device that was opened. More... | |
_PURE int | switchtec_device_id (struct switchtec_dev *dev) |
Get the device id of the device. More... | |
_PURE enum switchtec_gen | switchtec_gen (struct switchtec_dev *dev) |
Get the generation of the device. More... | |
_PURE enum switchtec_variant | switchtec_variant (struct switchtec_dev *dev) |
Get the variant type of the device. More... | |
_PURE enum switchtec_boot_phase | switchtec_boot_phase (struct switchtec_dev *dev) |
Get boot phase of the device. More... | |
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... | |
int | switchtec_status (struct switchtec_dev *dev, struct switchtec_status **status) |
Get the status of all the ports on a switchtec device. More... | |
void | switchtec_status_free (struct switchtec_status *status, int ports) |
Free a list of status structures allocated by switchtec_status() More... | |
int | switchtec_get_device_info (struct switchtec_dev *dev, enum switchtec_boot_phase *phase, enum switchtec_gen *gen, enum switchtec_rev *rev) |
Get device generation, revision, and boot phase info. More... | |
const char * | switchtec_strerror (void) |
Return a message coresponding to the last error. More... | |
void | switchtec_perror (const char *str) |
Print an error string to stdout. More... | |
int | switchtec_log_to_file (struct switchtec_dev *dev, enum switchtec_log_type type, int fd) |
Dump the Switchtec log data to a file. More... | |
float | switchtec_die_temp (struct switchtec_dev *dev) |
Get the die temperature of the switchtec device. More... | |
static int | switchtec_is_gen3 (struct switchtec_dev *dev) |
Return whether a Switchtec device is a Gen 3 device. | |
static int | switchtec_is_gen4 (struct switchtec_dev *dev) |
Return whether a Switchtec device is a Gen 4 device. | |
static int | switchtec_is_pfx (struct switchtec_dev *dev) |
Return whether a Switchtec device is PFX. | |
static int | switchtec_is_pfxl (struct switchtec_dev *dev) |
Return whether a Switchtec device is PFX-L. | |
static int | switchtec_is_pfxi (struct switchtec_dev *dev) |
Return whether a Switchtec device is PFX-I. | |
static int | switchtec_is_pfx_all (struct switchtec_dev *dev) |
Return whether a Switchtec device is PFX(L/I). | |
static int | switchtec_is_psx (struct switchtec_dev *dev) |
Return whether a Switchtec device is PSX. | |
static int | switchtec_is_psx_pfx_all (struct switchtec_dev *dev) |
Return whether a Switchtec device is PFX or PSX. | |
static int | switchtec_is_pax (struct switchtec_dev *dev) |
Return whether a Switchtec device is PAX. | |
static const char * | switchtec_gen_str (struct switchtec_dev *dev) |
Return the generation string of a Switchtec device. | |
static const char * | switchtec_fw_image_gen_str (struct switchtec_fw_image_info *inf) |
Return the generation string of a Switchtec fw image. | |
static const char * | switchtec_variant_str (struct switchtec_dev *dev) |
Return the variant string of a Switchtec device. | |
int | switchtec_event_summary_set (struct switchtec_event_summary *sum, enum switchtec_event_id e, int index) |
Set a bit corresponding to an event in a summary structure. More... | |
int | switchtec_event_summary_test (struct switchtec_event_summary *sum, enum switchtec_event_id e, int index) |
Test if a bit corresponding to an event is set in a summary structure. More... | |
int | switchtec_event_summary_iter (struct switchtec_event_summary *sum, enum switchtec_event_id *e, int *idx) |
Iterate through all set bits in an event summary structure. More... | |
enum switchtec_event_type | switchtec_event_info (enum switchtec_event_id e, const char **name, const char **desc) |
Get the name and description strings as well as the type (global, partition or pff) for a specific event ID. More... | |
int | switchtec_event_wait_for (struct switchtec_dev *dev, enum switchtec_event_id e, int index, struct switchtec_event_summary *res, int timeout_ms) |
Block until a specific event occurs. More... | |
int | switchtec_fw_toggle_active_partition (struct switchtec_dev *dev, int toggle_bl2, int toggle_key, int toggle_fw, int toggle_cfg) |
Toggle the active firmware partition for the main or configuration images. More... | |
int | switchtec_fw_setup_redundancy (struct switchtec_dev *dev, enum switchtec_fw_redundancy redund, enum switchtec_fw_type type) |
Set or clear the redundancy flag of a partition type. More... | |
int | switchtec_fw_write_fd (struct switchtec_dev *dev, int img_fd, int dont_activate, int force, void(*progress_callback)(int cur, int tot)) |
Write a firmware file to the switchtec device. More... | |
int | switchtec_fw_write_file (struct switchtec_dev *dev, FILE *fimg, int dont_activate, int force, void(*progress_callback)(int cur, int tot)) |
Write a firmware file to the switchtec device. More... | |
int | switchtec_fw_read_fd (struct switchtec_dev *dev, int fd, unsigned long addr, size_t len, void(*progress_callback)(int cur, int tot)) |
Read a Switchtec device's flash data into a file. More... | |
int | switchtec_fw_body_read_fd (struct switchtec_dev *dev, int fd, struct switchtec_fw_image_info *info, void(*progress_callback)(int cur, int tot)) |
Read a Switchtec device's flash image body into a file. More... | |
int | switchtec_fw_read (struct switchtec_dev *dev, unsigned long addr, size_t len, void *buf) |
Read a Switchtec device's flash data. More... | |
void | switchtec_fw_perror (const char *s, int ret) |
Print an error string to stdout. More... | |
int | switchtec_fw_file_info (int fd, struct switchtec_fw_image_info *info) |
Retrieve information about a firmware image file. More... | |
int | switchtec_fw_file_secure_version_newer (struct switchtec_dev *dev, int img_fd) |
Check if the secure version of an image file is newer than that of the image on device. More... | |
const char * | switchtec_fw_image_type (const struct switchtec_fw_image_info *info) |
Return a string describing the type of a firmware image. More... | |
struct switchtec_fw_part_summary * | switchtec_fw_part_summary (struct switchtec_dev *dev) |
Return firmware summary information structure for the flash partitfons in the device. More... | |
void | switchtec_fw_part_summary_free (struct switchtec_fw_part_summary *summary) |
Free a firmware part summary data structure. More... | |
int | switchtec_fw_img_write_hdr (int fd, struct switchtec_fw_image_info *info) |
Write the header for a Switchtec firmware image file. More... | |
int | switchtec_fw_is_boot_ro (struct switchtec_dev *dev) |
Check if the boot partition is marked as read-only. More... | |
int | switchtec_fw_set_boot_ro (struct switchtec_dev *dev, enum switchtec_fw_ro ro) |
Set or clear a boot partition's read-only flag. More... | |
int | switchtec_evcntr_type_count (void) |
Get the number of event counter types. More... | |
const char * | switchtec_evcntr_type_str (int *type_mask) |
Get a string for the event indicated by lowest bit set in the type_mask. More... | |
int | switchtec_evcntr_setup (struct switchtec_dev *dev, unsigned stack_id, unsigned cntr_id, struct switchtec_evcntr_setup *setup) |
Setup an event counter performance monitor. More... | |
int | switchtec_evcntr_get_setup (struct switchtec_dev *dev, unsigned stack_id, unsigned cntr_id, unsigned nr_cntrs, struct switchtec_evcntr_setup *res) |
Retrieve the setup information for one or more event counters. More... | |
int | switchtec_evcntr_get (struct switchtec_dev *dev, unsigned stack_id, unsigned cntr_id, unsigned nr_cntrs, unsigned *res, int clear) |
Retrieve the current counts for one or more event counters. More... | |
int | switchtec_evcntr_get_both (struct switchtec_dev *dev, unsigned stack_id, unsigned cntr_id, unsigned nr_cntrs, struct switchtec_evcntr_setup *setup, unsigned *counts, int clear) |
Retrieve the current counts and setup information for one or more event counters. More... | |
int | switchtec_evcntr_wait (struct switchtec_dev *dev, int timeout_ms) |
Block until any event counter has reached its threshold. More... | |
void | switchtec_bwcntr_sub (struct switchtec_bwcntr_res *new_cntr, struct switchtec_bwcntr_res *old_cntr) |
Subtract all the values between two bwcntr result structures. More... | |
int | switchtec_bwcntr_set_many (struct switchtec_dev *dev, int nr_ports, int *phys_port_ids, enum switchtec_bw_type bw_type) |
Set bandwidth type for a number of ports. More... | |
int | switchtec_bwcntr_set_all (struct switchtec_dev *dev, enum switchtec_bw_type bw_type) |
Set bandwidth type for all the ports in the system. More... | |
int | switchtec_bwcntr_many (struct switchtec_dev *dev, int nr_ports, int *phys_port_ids, int clear, struct switchtec_bwcntr_res *res) |
Retrieve the bandwidth counter results for a number of ports. More... | |
int | switchtec_bwcntr_all (struct switchtec_dev *dev, int clear, struct switchtec_port_id **ports, struct switchtec_bwcntr_res **res) |
Retrieve the bandwidth counter results for all the ports in the system. More... | |
uint64_t | switchtec_bwcntr_tot (struct switchtec_bwcntr_dir *d) |
Get the total. More... | |
int | switchtec_lat_setup_many (struct switchtec_dev *dev, int nr_ports, int *egress_port_ids, int *ingress_port_ids) |
Setup a number of latency counters. More... | |
int | switchtec_lat_setup (struct switchtec_dev *dev, int egress_port_id, int ingress_port_id, int clear) |
Setup a latency counter. More... | |
int | switchtec_lat_get_many (struct switchtec_dev *dev, int nr_ports, int clear, int *egress_port_ids, int *cur_ns, int *max_ns) |
Get a number of latency counter results. More... | |
int | switchtec_lat_get (struct switchtec_dev *dev, int clear, int egress_port_ids, int *cur_ns, int *max_ns) |
Get a single latency counter result. More... | |
gasptr_t | switchtec_gas_map (struct switchtec_dev *dev, int writeable, size_t *map_size) |
Map the GAS and return a pointer to access the gas. More... | |
void | switchtec_gas_unmap (struct switchtec_dev *dev, gasptr_t map) |
Unmap the GAS region mapped with. More... | |
Variables | |
static const float | switchtec_gen_transfers [] = {0, 2.5, 5, 8, 16} |
Number of GT/s capable for each PCI generation or link_rate . | |
static const float | switchtec_gen_datarate [] = {0, 250, 500, 985, 1969} |
Number of GB/s capable for each PCI generation or link_rate . | |
Main Switchtec header.
Definition in file switchtec.h.
Event counter type mask (may be or-d together)
Definition at line 721 of file switchtec.h.
Special event indexes numbers.
For specifying the local partition or all partitions/ports.
Definition at line 611 of file switchtec.h.
enum switchtec_log_type |
Describe the type of logs too dump.
Definition at line 187 of file switchtec.h.