-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended port operational status with various error and fault status #2060
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,57 @@ 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are any other values from sai_port_err_status_t needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mikeberesford may I know which one you are interested to be added here? I am not sure if I can duplicate the attributes here but I can try... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm personally mostly interested in local/remote fault, just want to make sure the others are not useful or are covered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In addition to Local/Remote fault, SAI_PORT_ERR_STATUS_CRC_RATE would also be good to include here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @harshitgulati18 added now |
||
{ | ||
/** No errors */ | ||
SAI_PORT_ERROR_STATUS_CLEAR = 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prgeor @lguohan I added exception for that, but i would vote that this flag should be removed, since its not real flag, usually flags are used like this: if (x & FLAG) == FLAG) checks if flag is set, in this case if you use CLEAR value then this condidtion will be always true, and CLEAR is not part of actual flags that can be set, it seems like intention is to do this: if (x == CLEAR) ... but i think that is a bad design, more natural is first code snipper or eventually it could be done like this: if (x) ... // some flags are set do we need a live discussion on this or i can just remove this entry ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kcudnik I can use the enum value like so
In another implementation I can look for only interested errors where flag could be useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's the same as i wrote in my comment, but there eis no need for SAI_PORT_ERROR_STATUS_CLEAR enum value zero, im proposing to remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kcudnik why do you say there is no need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because that enum is not an actual flag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kcudnik as I mentioned I am planning to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CLEAR is not a flag is definition of absence of any flags,, read my first comment in this thread |
||
|
||
/** 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 << 1, | ||
|
||
/** FEC loss of sync asserted */ | ||
SAI_PORT_ERROR_STATUS_FEC_SYNC_LOSS = 1 << 2, | ||
|
||
/** FEC loss of alignment marker asserted */ | ||
SAI_PORT_ERROR_STATUS_FEC_LOSS_ALIGNMENT_MARKER = 1 << 3, | ||
|
||
/** High SER asserted */ | ||
SAI_PORT_ERROR_STATUS_HIGH_SER = 1 << 4, | ||
|
||
/** High BER asserted */ | ||
SAI_PORT_ERROR_STATUS_HIGH_BER = 1 << 5, | ||
|
||
/** Rate of data units with CRC errors passed its threshold */ | ||
SAI_PORT_ERROR_STATUS_CRC_RATE = 1 << 6, | ||
|
||
/** Data Unit CRC Error */ | ||
SAI_PORT_ERROR_STATUS_DATA_UNIT_CRC_ERROR = 1 << 7, | ||
|
||
/** Data Unit Size Error */ | ||
SAI_PORT_ERROR_STATUS_DATA_UNIT_SIZE = 1 << 8, | ||
|
||
/** Data Unit Misalignment Error */ | ||
SAI_PORT_ERROR_STATUS_DATA_UNIT_MISALIGNMENT_ERROR = 1 << 9, | ||
|
||
/** Uncorrectable RS-FEC code word error */ | ||
SAI_PORT_ERROR_STATUS_CODE_GROUP_ERROR = 1 << 10, | ||
|
||
/** SerDes Signal is out of sync */ | ||
SAI_PORT_ERROR_STATUS_SIGNAL_LOCAL_ERROR = 1 << 11, | ||
|
||
/** Port is not accepting reachability data units */ | ||
SAI_PORT_ERROR_STATUS_NO_RX_REACHABILITY = 1 << 12 | ||
} sai_port_error_status_t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add SAI_PORT_ERROR_STATUS_HIGH_SER and SAI_PORT_ERROR_STATUS_HIGH_BER There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eddyk-nvidia added |
||
|
||
/** | ||
* @brief Defines the operational status of the port | ||
*/ | ||
|
@@ -89,6 +140,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; | ||
prgeor marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is breaking change not backward compatible, could cause some issues on sonic when deserialize There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of adding this extra field we should make this RO attribute per port, and if user would be interested in port status, then it could query that attribute in notification using SAI api, then everything would be backward compatible, we can still move this around |
||
} sai_port_oper_status_notification_t; | ||
|
||
/** | ||
|
@@ -1935,6 +1988,7 @@ typedef enum _sai_port_attr_t | |
* | ||
* @type sai_port_err_status_list_t | ||
* @flags READ_ONLY | ||
* @deprecated true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mikeberesford now added here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
*/ | ||
SAI_PORT_ATTR_ERR_STATUS_LIST, | ||
|
||
|
@@ -2537,6 +2591,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 | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be changed to "strict" then it will force validator to chack if all enum are power of 2 to catch user mistakes