Skip to content

Commit

Permalink
Support to read RX_FREQUENCY_OFFSET_PPM, RX_SNR and FEC_CORRECTED_BIT…
Browse files Browse the repository at this point in the history
…S with SAI

Signed-off-by: harshitgulati18 <hgulati@fb.com>
  • Loading branch information
harshitgulati18 committed Aug 24, 2023
1 parent adfe1f9 commit 37182af
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
19 changes: 19 additions & 0 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,22 @@ typedef enum _sai_port_attr_t
*/
SAI_PORT_ATTR_PATH_TRACING_TIMESTAMP_TYPE,

/**
* @brief List of per lane RX Frequency PPM for a port
*
* @type sai_port_frequency_offset_ppm_list_t
* @flags READ_ONLY
*/
SAI_PORT_ATTR_RX_FREQUENCY_OFFSET_PPM,

/**
* @brief List of per lane RX SNR for a port
*
* @type sai_port_snr_list_t
* @flags READ_ONLY
*/
SAI_PORT_ATTR_RX_SNR,

/**
* @brief End of attributes
*/
Expand Down Expand Up @@ -3023,6 +3039,9 @@ typedef enum _sai_port_stat_t
/** Count of FEC codewords with 16 symbol errors. */
SAI_PORT_STAT_IF_IN_FEC_CODEWORD_ERRORS_S16,

/** Count of total bits corrected by FEC. Counter will increment monotonically. */
SAI_PORT_STAT_IF_IN_FEC_CORRECTED_BITS,

/** Port stat in drop reasons range start */
SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,

Expand Down
45 changes: 45 additions & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,45 @@ typedef struct _sai_port_eye_values_list_t
sai_port_lane_eye_values_t *list;
} sai_port_eye_values_list_t;

/**
* @brief Defines a lane with its frequency offset ppm
*/
typedef struct _sai_port_frequency_offset_ppm_values_t
{
uint32_t lane;
sai_int16_t ppm;
} sai_port_frequency_offset_ppm_values_t;

/**
* @brief Defines a port's lanes frequency offset ppm list
*/
typedef struct _sai_port_frequency_offset_ppm_list_t
{
uint32_t count;
sai_port_frequency_offset_ppm_values_t *list;
} sai_port_frequency_offset_ppm_list_t;

/**
* @brief Defines a lane with its SNR
*
* Each SNR value is encoded as U16 in units of 1/256 dB.
* For example, a value of 5248 represents a SNR of 20.5 dB
*/
typedef struct _sai_port_snr_values_t
{
uint32_t lane;
sai_uint16_t snr;
} sai_port_snr_values_t;

/**
* @brief Defines a port's lanes SNR list
*/
typedef struct _sai_port_snr_list_t
{
uint32_t count;
sai_port_snr_values_t *list;
} sai_port_snr_list_t;

/**
* @brief Enum defining MPLS out segment type
*/
Expand Down Expand Up @@ -1473,6 +1512,12 @@ typedef union _sai_attribute_value_t

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_CHAIN_LIST */
sai_acl_chain_list_t aclchainlist;

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST */
sai_port_frequency_offset_ppm_list_t portfrequencyoffsetppmlist;

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST */
sai_port_snr_list_t portsnrlist;
} sai_attribute_value_t;

/**
Expand Down
10 changes: 10 additions & 0 deletions meta/saimetadatatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,16 @@ typedef enum _sai_attr_value_type_t
* @brief Attribute value is IP prefix list.
*/
SAI_ATTR_VALUE_TYPE_ACL_CHAIN_LIST,

/**
* @brief Attribute value is frequency offset ppm list.
*/
SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST,

/**
* @brief Attribute value is SNR list.
*/
SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST,
} sai_attr_value_type_t;

/**
Expand Down
14 changes: 14 additions & 0 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ void check_attr_object_type_provided(
case SAI_ATTR_VALUE_TYPE_SEGMENT_LIST:
case SAI_ATTR_VALUE_TYPE_IP_ADDRESS_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_EYE_VALUES_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_LATCH_STATUS:
case SAI_ATTR_VALUE_TYPE_PORT_LANE_LATCH_STATUS_LIST:
case SAI_ATTR_VALUE_TYPE_TIMESPEC:
Expand Down Expand Up @@ -982,6 +984,8 @@ void check_attr_default_required(
case SAI_ATTR_VALUE_TYPE_MAP_LIST:
case SAI_ATTR_VALUE_TYPE_IP_ADDRESS_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_EYE_VALUES_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_LANE_LATCH_STATUS_LIST:
case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
case SAI_ATTR_VALUE_TYPE_IP_PREFIX_LIST:
Expand Down Expand Up @@ -1192,6 +1196,8 @@ void check_attr_default_value_type(
case SAI_ATTR_VALUE_TYPE_MAP_LIST:
case SAI_ATTR_VALUE_TYPE_IP_ADDRESS_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_EYE_VALUES_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_LANE_LATCH_STATUS_LIST:
case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
case SAI_ATTR_VALUE_TYPE_IP_PREFIX_LIST:
Expand Down Expand Up @@ -1795,6 +1801,8 @@ void check_attr_allow_flags(
case SAI_ATTR_VALUE_TYPE_SEGMENT_LIST:
case SAI_ATTR_VALUE_TYPE_IP_ADDRESS_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_EYE_VALUES_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_LANE_LATCH_STATUS_LIST:
case SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_UINT8_LIST:
case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
Expand Down Expand Up @@ -2662,6 +2670,8 @@ void check_attr_is_primitive(
case SAI_ATTR_VALUE_TYPE_SEGMENT_LIST:
case SAI_ATTR_VALUE_TYPE_IP_ADDRESS_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_EYE_VALUES_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_FREQUENCY_OFFSET_PPM_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_SNR_LIST:
case SAI_ATTR_VALUE_TYPE_SYSTEM_PORT_CONFIG_LIST:
case SAI_ATTR_VALUE_TYPE_PORT_ERR_STATUS_LIST:
case SAI_ATTR_VALUE_TYPE_UINT16_RANGE_LIST:
Expand Down Expand Up @@ -5582,6 +5592,10 @@ void check_struct_and_union_size()
CHECK_STRUCT_SIZE(sai_port_lane_eye_values_t, 20);
CHECK_STRUCT_SIZE(sai_port_lane_latch_status_list_t, 16);
CHECK_STRUCT_SIZE(sai_port_lane_latch_status_t, 8);
CHECK_STRUCT_SIZE(sai_port_frequency_offset_ppm_list_t, 16);
CHECK_STRUCT_SIZE(sai_port_frequency_offset_ppm_values_t, 8);
CHECK_STRUCT_SIZE(sai_port_snr_list_t, 16);
CHECK_STRUCT_SIZE(sai_port_snr_values_t, 8);
CHECK_STRUCT_SIZE(sai_port_oper_status_notification_t, 16);
CHECK_STRUCT_SIZE(sai_prbs_rx_state_t, 8);
CHECK_STRUCT_SIZE(sai_qos_map_list_t, 16);
Expand Down

0 comments on commit 37182af

Please sign in to comment.