Switchtec Userspace
PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
|
Setup and query performance monitors in the switch. More...
Functions | |
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... | |
Setup and query performance monitors in the switch.
switchtec_evcntr_setup() and switchtec_evcntr_get() may be used to setup and query switch event counters which can count errors or TLP packets through different ports.
switchtec_bwcntr_many() and switchtec_bwcntr_all() may be used to retrieve byte counts through one or more ports in the system. When divided by time, these values provide the bandwidth through the switch ports.
switchtec_lat_setup() and switchtec_lat_get() may be used to setup and query latency counter measurements to find out how long packets take to traverse the switch.
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.
[in] | dev | Switchtec device handle |
[in] | clear | If non-zero, clear all the retrieved counters |
[out] | ports | Allocated array of ports retrieved |
[out] | res | Allocated array of bandwidth counter results |
ports
and res
should be freed with free() once they are finished with.
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.
[in] | dev | Switchtec device handle |
[in] | nr_ports | Number of ports to retrieve |
[in] | phys_port_ids | The physical ids for each port to retrieve |
[in] | clear | If non-zero, clear all the retrieved counters o zero |
[out] | res | List of bandwidth counter results structures (at least nr_ports elements) |
int switchtec_bwcntr_set_all | ( | struct switchtec_dev * | dev, |
enum switchtec_bw_type | bw_type | ||
) |
int switchtec_bwcntr_set_many | ( | struct switchtec_dev * | dev, |
int | nr_ports, | ||
int * | phys_port_ids, | ||
enum switchtec_bw_type | bw_type | ||
) |
void switchtec_bwcntr_sub | ( | struct switchtec_bwcntr_res * | new_cntr, |
struct switchtec_bwcntr_res * | old_cntr | ||
) |
uint64_t switchtec_bwcntr_tot | ( | struct switchtec_bwcntr_dir * | d | ) |
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.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack to setup this counter in |
[in] | cntr_id | Counter ID to setup |
[in] | nr_cntrs | Number of counters to retrieve |
[out] | res | List of unsigned values to return the current counts in (at least nr_cntrs elements) |
[in] | clear | If non-zero, clear all the retrieved counters to zero |
Retrieves nr_cntrs
counter values sequentially starting at cntr_id
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.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack to setup this counter in |
[in] | cntr_id | Counter ID to setup |
[in] | nr_cntrs | Number of counters to retrieve |
[out] | setup | List of event counter setup structures (at least nr_cntrs elements) |
[out] | counts | List of unsigned values to return the current counts in (at least nr_cntrs elements) |
[in] | clear | If non-zero, clear all the retrieved counters to zero |
Retrieves nr_cntrs
counter values and setup structures sequentially starting at cntr_id
. This is equivalent to calling switchtec_evcntr_get() and switchtec_evcntr_get_setup().
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.
[in] | dev | Switchtec device handle |
[in] | stack_id | Stack to setup this counter in |
[in] | cntr_id | First counter ID to retrieve |
[in] | nr_cntrs | Number of counters to retrieve |
[out] | res | List of event counter setup structures (at least nr_cntrs elements) |
Retrieves nr_cntrs
setup structures sequentially starting at cntr_id
int switchtec_evcntr_setup | ( | struct switchtec_dev * | dev, |
unsigned | stack_id, | ||
unsigned | cntr_id, | ||
struct switchtec_evcntr_setup * | setup | ||
) |
int switchtec_evcntr_type_count | ( | void | ) |
const char* switchtec_evcntr_type_str | ( | int * | type_mask | ) |
Get a string for the event indicated by lowest bit set in the type_mask.
[in,out] | type_mask | Bitmask of types |
Clears the lowest bit in type_mask
and returns the string corresponding to that type. Thus, this function can be used in a loop to print a list of strings representing a bit mask of types.
int switchtec_evcntr_wait | ( | struct switchtec_dev * | dev, |
int | timeout_ms | ||
) |
Block until any event counter has reached its threshold.
[in] | dev | Switchtec device handle |
[in] | timeout_ms | Stop waiting after the specified number of milliseconds |
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.
[in] | dev | Switchtec device handle |
[in] | clear | If non-zero, clear the latency counter |
[in] | egress_port_ids | The egress port of the latency counter to retrieve |
[out] | cur_ns | The current latency value |
[out] | max_ns | The maximum latency value |
Results are reported in nanoseconds.
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.
[in] | dev | Switchtec device handle |
[in] | nr_ports | Number of latency counters to retrieve |
[in] | clear | If non-zero, clear the latency counters |
[in] | egress_port_ids | A list of port ids for the counters to return |
[out] | cur_ns | A list of current latency values |
[out] | max_ns | A list of maximum latency values |
Results are reported in nanoseconds.
int switchtec_lat_setup | ( | struct switchtec_dev * | dev, |
int | egress_port_id, | ||
int | ingress_port_id, | ||
int | clear | ||
) |
Setup a latency counter.
[in] | dev | Switchtec device handle |
[in] | egress_port_id | The port id for the egress of the TLP |
[in] | ingress_port_id | The port id for the ingress of the TLP (may be SWITCHTEC_LAT_ALL_INGRESS for all ports) |
[in] | clear | If non-zero, clear the latency counter |
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.
[in] | dev | Switchtec device handle |
[in] | nr_ports | Number of latency counters to setup |
[in] | egress_port_ids | A list of port ids for the egress of the TLP |
[in] | ingress_port_ids | A list of port ids for the ingress of the TLP (may be SWITCHTEC_LAT_ALL_INGRESS for all ports) |