-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[FEC] Design for auto-fec #1416
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
Changes from 3 commits
ee4edcc
d8fae6b
b603241
40cf5cb
9dbf98a
a1f4379
6ea8106
da07329
e87422d
ff4eb00
4230d59
c485763
a0bafa3
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 |
---|---|---|
@@ -0,0 +1,191 @@ | ||
# SONiC Port Auto FEC Design # | ||
|
||
## Table of Content | ||
|
||
- [Revision](#revision) | ||
- [Scope](#scope) | ||
- [Definitions/Abbreviations](#definitionsabbreviations) | ||
- [Overview](#overview) | ||
- [Requirements](#requirements) | ||
- [High-Level Design](#high-level-design) | ||
- [SAI API Requirements](#sai-api-requirements) | ||
- [SWSS Enhancements](#swss-enhancements) | ||
- [Configuration and management ](#configuration-and-management) | ||
- [Config command](#config-command) | ||
- [Show command](#show-command) | ||
- [YANG Model changes](#yang-model-changes) | ||
- [Warmboot and Fastboot Considerations](#warmboot-and-fastboot-considerations) | ||
- [Restrictions/Limitations](#restrictionslimitations) | ||
- [Testing Design](#testing-design) | ||
- [VS Test cases](#vs-test-cases) | ||
|
||
|
||
### Revision | ||
|
||
| Rev | Date | Author | Change Description | | ||
|:---:|:-----------:|:-------------------:|--------------------------------------------| | ||
| 0.1 | | Sudharsan | Initial version | | ||
|
||
### Scope | ||
This document is the design document for port auto fec mode on SONiC. This includes the requirements, CLI change, yang model change and swss change. | ||
|
||
### Definitions/Abbreviations | ||
FEC - Forward Error Correction | ||
|
||
### Overview | ||
SONiC supports the following FEC settings: | ||
|
||
**None**: FEC is disabled. | ||
|
||
**Reed Solomon (RS)**: IEEE 802.3 Clause 108 (CL108) on individual 25G channels and Clause 91 on 100G (4channels). This is the highest FEC algorithm, providing the best bit-error correction. | ||
|
||
**Fire Code (FC)**: IEEE 802.3 Clause 74 (CL74). Base-R provides less protection from bit errors than RS FEC but adds less latency. | ||
|
||
The behavior of FEC when autoneg is configured is currently not defined. By introducing a new FEC mode called 'auto' this document brings a deterministic approach in behavior of FEC when autoneg is configured | ||
|
||
|
||
### Requirements | ||
|
||
Primary requirements for configuring FEC are | ||
- Honor the backward compatibility. | ||
- Allow user to enable FEC to be auto negotiated | ||
- Allow user to force set FEC | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
### High-Level Design | ||
In order to facilitate the behavior of FEC when autoneg is enabled, the SAI attribute SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE was introduced. Before this attribute the behavior is not clearly defined and it is dependent on vendor SAI implementation. | ||
|
||
A new FEC mode called 'auto' is introduced. | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- When FEC mode is set to any of the legacy modes (none, rs, FC) SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be set to true. User FEC will take precedence | ||
- When FEC mode is seto 'auto' SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be set to false. Auto negotiated FEC will take precedence. | ||
- To maintain backward compatibility, the SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be queried and will be used only when it is supported. | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### SAI API Requirements | ||
|
||
The following is an existing attribute which was added to support the FEC override functionality. | ||
``` | ||
/** | ||
* @brief FEC mode auto-negotiation override status | ||
* | ||
* If set to true, any auto-negotiated FEC mode will be | ||
* overridden by the value configured in SAI_PORT_ATTR_FEC_MODE | ||
* | ||
* @type bool | ||
* @flags CREATE_AND_SET | ||
* @default false | ||
*/ | ||
SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE, | ||
``` | ||
Any SAI vendors who want to make use of this deterministic behavior should implement the above attribute. | ||
|
||
In order to get operation FEC the following attributes was recently introduced | ||
``` | ||
/** | ||
* @brief Operational FEC mode | ||
* | ||
* If port is down, the returned value should be zero. | ||
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. @dgsudharsan return value zero or none? 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. Updated from latest SAI headers |
||
* If auto negotiation is on, the returned value should be the negotiated fec. | ||
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. @dgsudharsan can we just mention, return value is the operational FEC value as configured in the hw (irrespective of AN enabled) |
||
* | ||
* @type sai_port_fec_mode_t | ||
* @flags READ_ONLY | ||
*/ | ||
SAI_PORT_ATTR_OPER_FEC, | ||
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. @dgsudharsan can you share the SAI PR for this? 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. |
||
``` | ||
|
||
### SWSS Enhancements | ||
|
||
As specified in the high level design, the SAI attribute SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be queried in portsorch. If it is not supported the existing behavior will continue to be in effect. If it is supported and FEC is configured, SAI_PORT_ATTR_FEC_MODE will be set to the configured FEC value followed by SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE set to true. | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
If FEC is configured as 'auto' by the user SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be set to false. If AN is set to false, SAI_PORT_ATTR_FEC_MODE will be set to SAI_PORT_FEC_MODE_NONE. | ||
If AN is set to true and FEC is not set, no FEC related attributes will be programmed and existing behavior will continue. | ||
The below table covers different scenarios of what will be programmed in SAI when override is supported and not supported for various combinations of FEC and autoneg. The override supported column is updated based on querying SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE from SAI , while Autoneg and FEC comes from user configuration. | ||
|
||
|
||
| Idx | Override supported | Autoneg | FEC | SAI Attributes set by orchagent | | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|:---:|:------------------:|:----------:|:----------:|---------------------------------------------------------------------------------| | ||
| 1 | False | False | none/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc | | ||
| 2 | False | False | auto | CLI will throw error. No FEC attributes will be set | | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 3 | False | False | N/A | No FEC attributes will be set | | ||
| 4 | False | True | none/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc. Behavior is undeterministic when AN is enabled and user has configured FEC | | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 5 | False | True | auto | No FEC attributes will be set | | ||
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. @dgsudharsan why not throw the error if the platform does not support auto? 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. Updated |
||
| 6 | False | True | N/A | No FEC attributes will be set | | ||
| 7 | True | True | none/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE=True | | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 8 | True | True | auto | SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE=False | | ||
| 9 | True | True | N/A | SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will not be set | | ||
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. @dgsudharsan why not set override = False. What is the issue? 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 the case when there is no fec config. N/A means not available. FEC override will be set only when FEC is configured. 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. @dgsudharsan FEC override = False or FEC override not set aren't the same? 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. FEC override attribute will be set only in the flow of setting FEC. When FEC itself is not set there will be no override attribute that needs to be programmed. 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 by default the attribute is false, so if not set the default value expected from SAI is false. However the table is to capture what is programmed from orchagent perspective on specific combinations |
||
| 10 | True | False | None/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc | | ||
| 11 | True | False | auto | No FEC attributes will be set | | ||
| 12 | True | False | N/A | No FEC attributes will be set | | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The portsorch will also be responsible to update operational FEC. This operational mode is applicable only when the mode is 'auto'. When the FEC mode is auto and oper up is detected, SAI_PORT_ATTR_OPER_FEC will be queried and updated in the STATE_DB PORT_TABLE field 'fec'. | ||
|
||
### Configuration and management | ||
|
||
#### Config command | ||
|
||
No new CLI commands are introduced to support auto FEC. The existing 'config interface fec' is extended to have additional option called 'auto'. If this option is set without autoneg enabled, it will default to 'none' | ||
|
||
``` | ||
Format: | ||
config interface fec <interface_name> <mode> | ||
|
||
Arguments: | ||
interface_name: name of the interface to be configured. e.g: Ethernet0 | ||
mode: none/rs/fc/auto | ||
|
||
Example: | ||
config interface fec Ethernet0 auto | ||
|
||
Return: | ||
error message if interface_name or mode is invalid otherwise empty | ||
``` | ||
|
||
#### Show command | ||
|
||
Currently the configured FEC mode is displayed in "show interfaces status" command. With the introduction of mode 'auto' it becomes necessary to display operational FEC. For modes other than auto, the config will match the operational FEC. In case of mode 'auto' the operational FEC will be queried from SAI during oper up sequence using SAI_PORT_ATTR_OPER_FEC. This will be updated to state_db PORT_TABLE field "fec". The value will contain the operational FEC and have the config auto in paranthesis as shown below. | ||
The show command will query the state DB and if there is FEC field, it would be displayed. | ||
If the field is not present, the config will be displayed, similar to the legacy behavior. | ||
|
||
```` | ||
show interfaces status | ||
Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC | ||
------------ --------------- ------- ----- --------- ------- ------------ ------ ------- --------------- ---------- | ||
Ethernet0 0,1,2,3 100G 9100 N/A etp1 routed up up QSFP+ or later N/A | ||
Ethernet4 4,5,6,7 100G 9100 rs etp2 PortChannel1 up up QSFP+ or later N/A | ||
Ethernet8 8,9,10,11 100G 9100 rs(auto) etp3 routed up up QSFP+ or later N/A | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
```` | ||
|
||
### YANG model changes | ||
|
||
The yang model will be modified to accept additional value 'auto' for FEC | ||
|
||
``` | ||
leaf fec { | ||
type string { | ||
pattern "rs|fc|none|auto"; | ||
} | ||
} | ||
``` | ||
|
||
### Warmboot and Fastboot Considerations | ||
|
||
No impact to warm or fastboot | ||
|
||
### Restrictions/Limitations | ||
|
||
Since previously the behavior of FEC with autoneg is undefined, if a vendor always gives precedence for auto negotiated FEC over user configured FEC, implementing the new attribute may lead to backward incompatibility issues when SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE is implemented. Since orchagent will always set SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE to true when FEC is explicitly configured, there will be difference in behavior before and after upgrade. | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
In order to mitigate for those platforms, a db migrator plugin can be introduced which will be executed based on platform check. This plugin will change change 'fec' to 'auto' if the attribute exists in port table and 'autoneg' is enabled. This will make sure that previously when autoneg was given precedence over user configuration, it will continue to happen even after the upgrade. | ||
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
dgsudharsan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Below table gives details on when db_migrator will be needed when vendor implements FEC override. The previous behavior details when user has configured FEC as well as autoneg enabled. | ||
|
||
| Idx | Previous behavior | DB Migrator required | | ||
|:---:|:----------------------------------------------------------:|:-----------------------:| | ||
| 1 | Auto negotiation takes precedence over user configured FEC | Yes | | ||
| 2 | User configured FEC takes precedence over auto negotiation | No | | ||
|
||
### Testing Design | ||
|
||
#### VS Test cases | ||
|
||
1. Add SWSS VS test to query SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE and if supported expect SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE to be set to true when FEC is configured. | ||
2. If SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE is not suppored it should not be set when configuring FEC | ||
3. Set FEC mode to auto and AN=true verify SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE is set to false | ||
4. Set FEC mode to auto and AN=false verify no FEC mode is programmed |
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.
@dgsudharsan can you provide more context on the backward compatibility
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.
Backward compatibility means if an image upgrade is done from an image without the feature to image with the feature, there should be no issues. E.g a port with 'rs' fec and AN enabled should work the same before and after the upgrade to image with the feature.
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.
@dgsudharsan thanks. can you capture this in the doc
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.
Done