Switchtec Userspace PROJECT_NUMBER = 4.2
Loading...
Searching...
No Matches
diag.c File Reference

Switchtec diagnostic functions. More...

#include "switchtec_priv.h"
#include "switchtec/diag.h"
#include "switchtec/endian.h"
#include "switchtec/switchtec.h"
#include "switchtec/utils.h"
#include <errno.h>
#include <math.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
Include dependency graph for diag.c:

Go to the source code of this file.

Functions

int switchtec_diag_cross_hair_enable (struct switchtec_dev *dev, int lane_id)
 Enable cross hair on specified lane.
int switchtec_diag_cross_hair_disable (struct switchtec_dev *dev)
 Disable active cross hair.
int switchtec_diag_cross_hair_get (struct switchtec_dev *dev, int start_lane_id, int num_lanes, struct switchtec_diag_cross_hair *res)
 Disable active cross hair.
int switchtec_diag_eye_set_mode (struct switchtec_dev *dev, enum switchtec_diag_eye_data_mode mode)
 Set the data mode for the next Eye Capture.
int switchtec_diag_eye_read (struct switchtec_dev *dev, int lane_id, int bin, int *num_phases, double *ber_data)
 Start a PCIe Eye Read Gen5.
int switchtec_diag_eye_start (struct switchtec_dev *dev, int lane_mask[4], struct range *x_range, struct range *y_range, int step_interval, int capture_depth)
 Start a PCIe Eye Capture.
int switchtec_diag_eye_fetch (struct switchtec_dev *dev, double *pixels, size_t pixel_cnt, int *lane_id)
 Start a PCIe Eye Capture.
int switchtec_diag_eye_cancel (struct switchtec_dev *dev)
 Cancel in-progress eye capture.
int switchtec_diag_loopback_set (struct switchtec_dev *dev, int port_id, int enable, int enable_parallel, int enable_external, int enable_ltssm, enum switchtec_diag_ltssm_speed ltssm_speed)
 Setup Loopback Mode.
int switchtec_diag_loopback_get (struct switchtec_dev *dev, int port_id, int *enabled, enum switchtec_diag_ltssm_speed *ltssm_speed)
 Setup Loopback Mode.
int switchtec_diag_pattern_gen_set (struct switchtec_dev *dev, int port_id, enum switchtec_diag_pattern type, enum switchtec_diag_pattern_link_rate link_speed)
 Setup Pattern Generator.
int switchtec_diag_pattern_gen_get (struct switchtec_dev *dev, int port_id, enum switchtec_diag_pattern *type)
 Get Pattern Generator set on port.
int switchtec_diag_pattern_mon_set (struct switchtec_dev *dev, int port_id, enum switchtec_diag_pattern type)
 Setup Pattern Monitor.
int switchtec_diag_pattern_mon_get (struct switchtec_dev *dev, int port_id, int lane_id, enum switchtec_diag_pattern *type, unsigned long long *err_cnt)
 Get Pattern Monitor.
int switchtec_diag_pattern_inject (struct switchtec_dev *dev, int port_id, unsigned int err_cnt)
 Inject error into pattern generator.
int switchtec_diag_rcvr_obj (struct switchtec_dev *dev, int port_id, int lane_id, enum switchtec_diag_link link, struct switchtec_rcvr_obj *res)
 Get the receiver object.
static int switchtec_gen5_diag_port_eq_tx_coeff (struct switchtec_dev *dev, int port_id, int prev_speed, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_coeff *res)
 Get the Gen5 port equalization TX coefficients.
static int switchtec_gen4_diag_port_eq_tx_coeff (struct switchtec_dev *dev, int port_id, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_coeff *res)
 Get the Gen4 port equalization TX coefficients.
int switchtec_diag_port_eq_tx_coeff (struct switchtec_dev *dev, int port_id, int prev_speed, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_coeff *res)
 Get the port equalization TX coefficients.
static int switchtec_gen5_diag_port_eq_tx_table (struct switchtec_dev *dev, int port_id, int prev_speed, enum switchtec_diag_link link, struct switchtec_port_eq_table *res)
 Get the Gen5 far end TX equalization table.
static int switchtec_gen4_diag_port_eq_tx_table (struct switchtec_dev *dev, int port_id, enum switchtec_diag_link link, struct switchtec_port_eq_table *res)
 Get the Gen4 far end TX equalization table.
int switchtec_diag_port_eq_tx_table (struct switchtec_dev *dev, int port_id, int prev_speed, enum switchtec_diag_link link, struct switchtec_port_eq_table *res)
 Get the far end TX equalization table.
static int switchtec_gen5_diag_port_eq_tx_fslf (struct switchtec_dev *dev, int port_id, int prev_speed, int lane_id, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_tx_fslf *res)
 Get the Gen5 equalization FS/LF.
static int switchtec_gen4_diag_port_eq_tx_fslf (struct switchtec_dev *dev, int port_id, int lane_id, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_tx_fslf *res)
 Get the Gen4 equalization FS/LF.
int switchtec_diag_port_eq_tx_fslf (struct switchtec_dev *dev, int port_id, int prev_speed, int lane_id, enum switchtec_diag_end end, enum switchtec_diag_link link, struct switchtec_port_eq_tx_fslf *res)
 Get the equalization FS/LF.
int switchtec_diag_rcvr_ext (struct switchtec_dev *dev, int port_id, int lane_id, enum switchtec_diag_link link, struct switchtec_rcvr_ext *res)
 Get the Extended Receiver Object.
int switchtec_diag_perm_table (struct switchtec_dev *dev, struct switchtec_mrpc table[MRPC_MAX_ID])
 Get the permission table.
int switchtec_diag_refclk_ctl (struct switchtec_dev *dev, int stack_id, bool en)
 Control the refclk output for a stack.
int switchtec_diag_refclk_status (struct switchtec_dev *dev, uint8_t *stack_info)
 Get the status of all stacks of the refclk.
static int switchtec_diag_ltssm_log_gen5 (struct switchtec_dev *dev, int port, int *log_count, struct switchtec_diag_ltssm_log *log_data)
 Get the LTSSM log of a port on a gen5 switchtec device.
static int switchtec_diag_ltssm_log_gen4 (struct switchtec_dev *dev, int port, int *log_count, struct switchtec_diag_ltssm_log *log_data)
 Get the LTSSM log of a port on a gen4 switchtec device.
int switchtec_diag_ltssm_log (struct switchtec_dev *dev, int port, int *log_count, struct switchtec_diag_ltssm_log *log_data)
 Determine the generation and call the related LTSSM log func.
int switchtec_diag_ltssm_clear (struct switchtec_dev *dev, int port)
 Call the LTSSM clear MRPC command.
int switchtec_aer_event_gen (struct switchtec_dev *dev, int port_id, int aer_error_id, int trigger_event)
 Call the aer event gen function to generate AER events.
int switchtec_inject_err_dllp (struct switchtec_dev *dev, int phys_port_id, int data)
 Inject a DLLP into a physical port.
int switchtec_inject_err_dllp_crc (struct switchtec_dev *dev, int phys_port_id, int enable, uint16_t rate)
 Inject a DLLP CRC error into a physical port.
int switchtec_inject_err_tlp_lcrc (struct switchtec_dev *dev, int phy_port, int enable, uint8_t rate)
 Inject a TLP LCRC error into a physical port.
int switchtec_inject_err_tlp_seq_num (struct switchtec_dev *dev, int phys_port_id)
 Inject a TLP Sequence Number error into a physical port.
int switchtec_inject_err_ack_nack (struct switchtec_dev *dev, int phys_port_id, uint16_t seq_num, uint8_t count)
 Inject an ACK to NACK error into a physical port.
int switchtec_inject_err_cto (struct switchtec_dev *dev, int phys_port_id)
 Inject Credit Timeout error into a physical port.

Detailed Description

Switchtec diagnostic functions.

Definition in file diag.c.

Function Documentation

◆ switchtec_aer_event_gen()

int switchtec_aer_event_gen ( struct switchtec_dev * dev,
int port_id,
int aer_error_id,
int trigger_event )

Call the aer event gen function to generate AER events.

Parameters
[in]devSwitchtec device handle
[in]portSwitchtec Port
[in]aer_error_idaer error bit
[out]trigger_eventOne of the trigger events

Definition at line 1786 of file diag.c.

◆ switchtec_diag_cross_hair_disable()

int switchtec_diag_cross_hair_disable ( struct switchtec_dev * dev)

Disable active cross hair.

Parameters
[in]devSwitchtec device handle
Returns
0 on success, error code on failure

Definition at line 70 of file diag.c.

◆ switchtec_diag_cross_hair_enable()

int switchtec_diag_cross_hair_enable ( struct switchtec_dev * dev,
int lane_id )

Enable cross hair on specified lane.

Parameters
[in]devSwitchtec device handle
[in]lane_idLane to enable, or SWITCHTEC_DIAG_CROSS_HAIR_ALL_LANES for all lanes.
Returns
0 on success, error code on failure

Definition at line 53 of file diag.c.

◆ switchtec_diag_cross_hair_get()

int switchtec_diag_cross_hair_get ( struct switchtec_dev * dev,
int start_lane_id,
int num_lanes,
struct switchtec_diag_cross_hair * res )

Disable active cross hair.

Parameters
[in]devSwitchtec device handle
[in]start_lane_idStart lane ID to get
[in]num_lanesNumber of lanes to get
[out]resResulting cross hair data
Returns
0 on success, error code on failure

Definition at line 88 of file diag.c.

◆ switchtec_diag_eye_cancel()

int switchtec_diag_eye_cancel ( struct switchtec_dev * dev)

Cancel in-progress eye capture.

Parameters
[in]devSwitchtec device handle
Returns
0 on success, error code on failure

Definition at line 412 of file diag.c.

◆ switchtec_diag_eye_fetch()

int switchtec_diag_eye_fetch ( struct switchtec_dev * dev,
double * pixels,
size_t pixel_cnt,
int * lane_id )

Start a PCIe Eye Capture.

Parameters
[in]devSwitchtec device handle
[out]pixelsResulting pixel data
[in]pixel_cntSpace in pixel array
[out]lane_idThe lane for the resulting pixels
Returns
number of pixels fetched on success, error code on failure

pixel_cnt needs to be greater than 62 in raw mode or 496 in ratio mode, otherwise data will be lost and the number of pixels fetched will be greater than the space in the pixel buffer.

Definition at line 352 of file diag.c.

◆ switchtec_diag_eye_read()

int switchtec_diag_eye_read ( struct switchtec_dev * dev,
int lane_id,
int bin,
int * num_phases,
double * ber_data )

Start a PCIe Eye Read Gen5.

Parameters
[in]devSwitchtec device handle
[in]lane_idlane_id
[in]binbin
[in]num_phasespointer to the number of phases
[in]ber_datapointer to the Ber data
Returns
0 on success, error code on failure

Definition at line 242 of file diag.c.

◆ switchtec_diag_eye_set_mode()

int switchtec_diag_eye_set_mode ( struct switchtec_dev * dev,
enum switchtec_diag_eye_data_mode mode )

Set the data mode for the next Eye Capture.

Parameters
[in]devSwitchtec device handle
[in]modeMode to use (raw or ratio)
Returns
0 on success, error code on failure

Definition at line 221 of file diag.c.

◆ switchtec_diag_eye_start()

int switchtec_diag_eye_start ( struct switchtec_dev * dev,
int lane_mask[4],
struct range * x_range,
struct range * y_range,
int step_interval,
int capture_depth )

Start a PCIe Eye Capture.

Parameters
[in]devSwitchtec device handle
[in]lane_maskBitmap of the lanes to capture
[in]x_rangeTime range: start should be between 0 and 63, end between start and 63.
[in]y_rangeVoltage range: start should be between -255 and 255, end between start and 255.
[in]step_intervalSampling time in milliseconds for each step
Returns
0 on success, error code on failure

Definition at line 282 of file diag.c.

◆ switchtec_diag_loopback_get()

int switchtec_diag_loopback_get ( struct switchtec_dev * dev,
int port_id,
int * enabled,
enum switchtec_diag_ltssm_speed * ltssm_speed )

Setup Loopback Mode.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]enabledSet of enum switchtec_diag_loopback_enable indicating which loopback modes are enabled
[out]ltssm_speedLTSSM loopback max speed
Returns
0 on succes, error code on failure

Definition at line 568 of file diag.c.

◆ switchtec_diag_loopback_set()

int switchtec_diag_loopback_set ( struct switchtec_dev * dev,
int port_id,
int enable,
int enable_parallel,
int enable_external,
int enable_ltssm,
enum switchtec_diag_ltssm_speed ltssm_speed )

Setup Loopback Mode.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]enableEnable bitmap - Gen 4
[in]enable_parallelEnable the parallel SERDES loopback - Gen 5
[in]enable_externalEnable the external physical loopback - Gen 5
[in]enable_ltssmEnable the ltssm loopback
[in]ltssm_speedLTSSM loopback max speed
Returns
0 on success, error code on failure

Definition at line 534 of file diag.c.

◆ switchtec_diag_ltssm_clear()

int switchtec_diag_ltssm_clear ( struct switchtec_dev * dev,
int port )

Call the LTSSM clear MRPC command.

Parameters
[in]devSwitchtec device handle
[in]portSwitchtec Port

Definition at line 1741 of file diag.c.

◆ switchtec_diag_ltssm_log()

int switchtec_diag_ltssm_log ( struct switchtec_dev * dev,
int port,
int * log_count,
struct switchtec_diag_ltssm_log * log_data )

Determine the generation and call the related LTSSM log func.

Parameters
[in]devSwitchtec device handle
[in]portSwitchtec Port
[in,out]log_countnumber of log entries
[out]logA pointer to an array containing the log

Definition at line 1724 of file diag.c.

◆ switchtec_diag_ltssm_log_gen4()

int switchtec_diag_ltssm_log_gen4 ( struct switchtec_dev * dev,
int port,
int * log_count,
struct switchtec_diag_ltssm_log * log_data )
static

Get the LTSSM log of a port on a gen4 switchtec device.

Parameters
[in]devSwitchtec device handle
[in]portSwitchtec Port
[in,out]log_countnumber of log entries
[out]logA pointer to an array containing the log

Definition at line 1604 of file diag.c.

◆ switchtec_diag_ltssm_log_gen5()

int switchtec_diag_ltssm_log_gen5 ( struct switchtec_dev * dev,
int port,
int * log_count,
struct switchtec_diag_ltssm_log * log_data )
static

Get the LTSSM log of a port on a gen5 switchtec device.

Parameters
[in]devSwitchtec device handle
[in]portSwitchtec Port
[in,out]log_countnumber of log entries
[out]logA pointer to an array containing the log

Definition at line 1466 of file diag.c.

◆ switchtec_diag_pattern_gen_get()

int switchtec_diag_pattern_gen_get ( struct switchtec_dev * dev,
int port_id,
enum switchtec_diag_pattern * type )

Get Pattern Generator set on port.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]typePattern type to enable
Returns
0 on success, error code on failure

Definition at line 659 of file diag.c.

◆ switchtec_diag_pattern_gen_set()

int switchtec_diag_pattern_gen_set ( struct switchtec_dev * dev,
int port_id,
enum switchtec_diag_pattern type,
enum switchtec_diag_pattern_link_rate link_speed )

Setup Pattern Generator.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]typePattern type to enable
Returns
0 on success, error code on failure

Definition at line 635 of file diag.c.

◆ switchtec_diag_pattern_inject()

int switchtec_diag_pattern_inject ( struct switchtec_dev * dev,
int port_id,
unsigned int err_cnt )

Inject error into pattern generator.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]err_cntNumber of errors seen

Injects up to err_cnt errors into each lane of the TX port. It's recommended that the err_cnt be less than 1000, otherwise the firmware runs the risk of consuming too many resources and crashing.

Returns
0 on success, error code on failure

Definition at line 748 of file diag.c.

◆ switchtec_diag_pattern_mon_get()

int switchtec_diag_pattern_mon_get ( struct switchtec_dev * dev,
int port_id,
int lane_id,
enum switchtec_diag_pattern * type,
unsigned long long * err_cnt )

Get Pattern Monitor.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]typePattern type to enable
[out]err_cntNumber of errors seen
Returns
0 on success, error code on failure

Definition at line 709 of file diag.c.

◆ switchtec_diag_pattern_mon_set()

int switchtec_diag_pattern_mon_set ( struct switchtec_dev * dev,
int port_id,
enum switchtec_diag_pattern type )

Setup Pattern Monitor.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]typePattern type to enable
Returns
0 on success, error code on failure

Definition at line 688 of file diag.c.

◆ switchtec_diag_perm_table()

int switchtec_diag_perm_table ( struct switchtec_dev * dev,
struct switchtec_mrpc table[MRPC_MAX_ID] )

Get the permission table.

Parameters
[in]devSwitchtec device handle
[out]tableResulting MRPC permission table
Returns
0 on success, error code on failure

Definition at line 1369 of file diag.c.

◆ switchtec_diag_port_eq_tx_coeff()

int switchtec_diag_port_eq_tx_coeff ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_coeff * res )

Get the port equalization TX coefficients.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting port equalization coefficients
Returns
0 on success, error code on failure

Definition at line 1002 of file diag.c.

◆ switchtec_diag_port_eq_tx_fslf()

int switchtec_diag_port_eq_tx_fslf ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
int lane_id,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_tx_fslf * res )

Get the equalization FS/LF.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]lane_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting FS/LF values
Returns
0 on success, error code on failure

Definition at line 1294 of file diag.c.

◆ switchtec_diag_port_eq_tx_table()

int switchtec_diag_port_eq_tx_table ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
enum switchtec_diag_link link,
struct switchtec_port_eq_table * res )

Get the far end TX equalization table.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]resResulting port equalization table
Returns
0 on success, error code on failure

Definition at line 1144 of file diag.c.

◆ switchtec_diag_rcvr_ext()

int switchtec_diag_rcvr_ext ( struct switchtec_dev * dev,
int port_id,
int lane_id,
enum switchtec_diag_link link,
struct switchtec_rcvr_ext * res )

Get the Extended Receiver Object.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]lane_idLane ID
[in]linkCurrent or previous link-up
[out]resResulting receiver object
Returns
0 on success, error code on failure

Definition at line 1324 of file diag.c.

◆ switchtec_diag_rcvr_obj()

int switchtec_diag_rcvr_obj ( struct switchtec_dev * dev,
int port_id,
int lane_id,
enum switchtec_diag_link link,
struct switchtec_rcvr_obj * res )

Get the receiver object.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]lane_idLane ID
[in]linkCurrent or previous link-up
[out]resResulting receiver object
Returns
0 on success, error code on failure

Definition at line 775 of file diag.c.

◆ switchtec_diag_refclk_ctl()

int switchtec_diag_refclk_ctl ( struct switchtec_dev * dev,
int stack_id,
bool en )

Control the refclk output for a stack.

Parameters
[in]devSwitchtec device handle
[in]stack_idStack ID to control the refclk of
[in]enSet to true to enable, false to disable
Returns
0 on success, error code on failure

Definition at line 1406 of file diag.c.

◆ switchtec_diag_refclk_status()

int switchtec_diag_refclk_status ( struct switchtec_dev * dev,
uint8_t * stack_info )

Get the status of all stacks of the refclk.

Parameters
[in]devSwitchtec device handle
[in]stack_infoPointer to the stack information
Returns
0 on success, error code on failure

Definition at line 1422 of file diag.c.

◆ switchtec_gen4_diag_port_eq_tx_coeff()

int switchtec_gen4_diag_port_eq_tx_coeff ( struct switchtec_dev * dev,
int port_id,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_coeff * res )
static

Get the Gen4 port equalization TX coefficients.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting port equalization coefficients
Returns
0 on success, error code on failure

Definition at line 936 of file diag.c.

◆ switchtec_gen4_diag_port_eq_tx_fslf()

int switchtec_gen4_diag_port_eq_tx_fslf ( struct switchtec_dev * dev,
int port_id,
int lane_id,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_tx_fslf * res )
static

Get the Gen4 equalization FS/LF.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]lane_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting FS/LF values
Returns
0 on success, error code on failure

Definition at line 1230 of file diag.c.

◆ switchtec_gen4_diag_port_eq_tx_table()

int switchtec_gen4_diag_port_eq_tx_table ( struct switchtec_dev * dev,
int port_id,
enum switchtec_diag_link link,
struct switchtec_port_eq_table * res )
static

Get the Gen4 far end TX equalization table.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]resResulting port equalization table
Returns
0 on success, error code on failure

Definition at line 1084 of file diag.c.

◆ switchtec_gen5_diag_port_eq_tx_coeff()

int switchtec_gen5_diag_port_eq_tx_coeff ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_coeff * res )
static

Get the Gen5 port equalization TX coefficients.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting port equalization coefficients
Returns
0 on success, error code on failure

Definition at line 830 of file diag.c.

◆ switchtec_gen5_diag_port_eq_tx_fslf()

int switchtec_gen5_diag_port_eq_tx_fslf ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
int lane_id,
enum switchtec_diag_end end,
enum switchtec_diag_link link,
struct switchtec_port_eq_tx_fslf * res )
static

Get the Gen5 equalization FS/LF.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[in]lane_idPhysical port ID
[in]endGet coefficents for the Local or the Far End
[out]resResulting FS/LF values
Returns
0 on success, error code on failure

Definition at line 1171 of file diag.c.

◆ switchtec_gen5_diag_port_eq_tx_table()

int switchtec_gen5_diag_port_eq_tx_table ( struct switchtec_dev * dev,
int port_id,
int prev_speed,
enum switchtec_diag_link link,
struct switchtec_port_eq_table * res )
static

Get the Gen5 far end TX equalization table.

Parameters
[in]devSwitchtec device handle
[in]port_idPhysical port ID
[out]resResulting port equalization table
Returns
0 on success, error code on failure

Definition at line 1027 of file diag.c.

◆ switchtec_inject_err_ack_nack()

int switchtec_inject_err_ack_nack ( struct switchtec_dev * dev,
int phys_port_id,
uint16_t seq_num,
uint8_t count )

Inject an ACK to NACK error into a physical port.

Parameters
[in]devSwitchtec device handle
[in]phys_port_idPhysical port id
[in]seq_numSequence Number of ACK to be changed to a NACK (0-4095)
[in]countNumber of times to replace ACK with NACK (0-255)
Returns
0 on success, or a negative value on failure

Definition at line 1938 of file diag.c.

◆ switchtec_inject_err_cto()

int switchtec_inject_err_cto ( struct switchtec_dev * dev,
int phys_port_id )

Inject Credit Timeout error into a physical port.

Parameters
[in]devSwitchtec device handle
[in]phys_port_idPhysical port id
Returns
0 on success, or a negative value on failure

Definition at line 1960 of file diag.c.

◆ switchtec_inject_err_dllp()

int switchtec_inject_err_dllp ( struct switchtec_dev * dev,
int phys_port_id,
int data )

Inject a DLLP into a physical port.

Return Link error injection command outputs for DLLP, DLLP_CRC, LCRC, SEQ_NUM, ACK_NACK, CTO.

Parameters
[in]devSwitchtec device handle
[in]phys_port_idPhysical port id
[in]dataDLLP data
Returns
0 on success, or a negative value on failure

Definition at line 1814 of file diag.c.

◆ switchtec_inject_err_dllp_crc()

int switchtec_inject_err_dllp_crc ( struct switchtec_dev * dev,
int phys_port_id,
int enable,
uint16_t rate )

Inject a DLLP CRC error into a physical port.

Parameters
[in]devSwitchtec device handle
[in]phys_port_idPhysical port id
[in]enableEnable DLLP CRC error injection
[in]rateRate of the error injection
Returns
0 on success, or a negative value on failure

Definition at line 1837 of file diag.c.

◆ switchtec_inject_err_tlp_lcrc()

int switchtec_inject_err_tlp_lcrc ( struct switchtec_dev * dev,
int phy_port,
int enable,
uint8_t rate )

Inject a TLP LCRC error into a physical port.

Parameters
[in]devSwitchtec device handle
[in]phy_portPhysical port id
[in]rateRate of the error injection
Returns
0 on success, or a negative value on failure

Definition at line 1896 of file diag.c.

◆ switchtec_inject_err_tlp_seq_num()

int switchtec_inject_err_tlp_seq_num ( struct switchtec_dev * dev,
int phys_port_id )

Inject a TLP Sequence Number error into a physical port.

Parameters
[in]devSwitchtec device handle
[in]phys_port_idPhysical port id
Returns
0 on success, or a negative value on failure

Definition at line 1917 of file diag.c.