Skip to content

Commit

Permalink
Extended port operational status with various error status
Browse files Browse the repository at this point in the history
Signed-off-by: Prince George <prgeor@microsoft.com>
  • Loading branch information
prgeor committed Sep 16, 2024
1 parent a0ae84d commit 64ddb55
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
47 changes: 47 additions & 0 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ typedef enum _sai_port_oper_status_t

} sai_port_oper_status_t;

/**
* @brief Attribute data for #SAI_PORT_ATTR_ERROR_STATUS
* Note enum values must be powers of 2 to be used as Bit mask to query multiple errors
*
* @flags free
*/
typedef enum _sai_port_error_status_t
{
/** No errors */
SAI_PORT_ERROR_STATUS_CLEAR = 0,

/** MAC Local fault asserted */
SAI_PORT_ERROR_STATUS_MAC_LOCAL_FAULT = 1 << 0,

/** MAC Remote fault asserted */
SAI_PORT_ERROR_STATUS_MAC_REMOTE_FAULT = 1 << 2,

/** FEC loss of sync asserted */
SAI_PORT_ERROR_STATUS_FEC_SYNC_LOSS = 1 << 3,

/** FEC loss of alignment marker asserted */
SAI_PORT_ERROR_STATUS_FEC_LOSS_ALIGNMENT_MARKER = 1 << 4,

/** High SER asserted */
SAI_PORT_ERROR_STATUS_HIGH_SER = 1 << 5,

/** High BER asserted */
SAI_PORT_ERROR_STATUS_HIGH_BER = 1 << 6,

/** Rate of data units with CRC errors passed its threshold */
SAI_PORT_ERROR_STATUS_CRC_RATE = 1 << 7
} sai_port_error_status_t;

/**
* @brief Defines the operational status of the port
*/
Expand All @@ -89,6 +122,8 @@ typedef struct _sai_port_oper_status_notification_t
/** Port operational status */
sai_port_oper_status_t port_state;

/** Bitmap of various port error or fault status */
sai_port_error_status_t port_error_status;
} sai_port_oper_status_notification_t;

/**
Expand Down Expand Up @@ -2537,6 +2572,18 @@ typedef enum _sai_port_attr_t
*/
SAI_PORT_ATTR_UNRELIABLE_LOS,

/**
* @brief Various port error status
*
* Attribute to query the capability of the Switch to report
* various port error and fault status. The attribute can also
* be used to query the current port error and fault status.
*
* @type sai_port_error_status_t
* @flags READ_ONLY
*/
SAI_PORT_ATTR_ERROR_STATUS,

/**
* @brief End of attributes
*/
Expand Down
1 change: 1 addition & 0 deletions meta/acronyms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ API - Application Program Interface
ARP - Address Resolution Protocol
ARS - Adaptiver Routing and Switching
ASIC - Application Specific Integrated Circuit
BER - Bit Error Rate
BFD - Bidirectional Forwarding Detection
BFDV6 - Bidirectional Forwarding Detection for IPv6
BGP - Border Gateway Protocol
Expand Down
2 changes: 1 addition & 1 deletion meta/saiserializetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ void test_serialize_notifications()
memset(&data1, 0, sizeof(data1));

res = sai_serialize_port_state_change_notification(buf, 1, &data1);
ret = "{\"count\":1,\"data\":[{\"port_id\":\"oid:0x0\",\"port_state\":\"SAI_PORT_OPER_STATUS_UNKNOWN\"}]}";
ret = "{\"count\":1,\"data\":[{\"port_id\":\"oid:0x0\",\"port_state\":\"SAI_PORT_OPER_STATUS_UNKNOWN\",\"port_error_status\":\"SAI_PORT_ERROR_STATUS_CLEAR\"}]}";
ASSERT_STR_EQ(buf, ret , res);

sai_queue_deadlock_notification_data_t data2;
Expand Down
3 changes: 2 additions & 1 deletion meta/structs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ sub BuildCommitHistory
# check is performed by sai sanity check

if ($currCount != $histCount and not $structTypeName =~ /^sai_\w+_api_t$/
and $structTypeName ne "sai_switch_health_data_t")
and $structTypeName ne "sai_switch_health_data_t"
and $structTypeName ne "sai_port_oper_status_notification_t")
{
LogError "FATAL: struct $structTypeName member count differs, was $histCount but is $currCount on commit $commit" if $type eq "struct";
}
Expand Down

0 comments on commit 64ddb55

Please sign in to comment.