Skip to content

Commit 5cfdfbb

Browse files
dgsudharsanprgeor
andauthored
[FEC] Design for auto-fec (#1416)
This HLD introduces design for auto fec. This document tries to bring in a deterministic approach when FEC and autoneg are configured together which is currently left to vendor implementation. Co-authored-by: Sudharsan Dhamal Gopalarathnam <[email protected]> Co-authored-by: Prince George <[email protected]>
1 parent c9c5636 commit 5cfdfbb

File tree

1 file changed

+211
-0
lines changed

1 file changed

+211
-0
lines changed

doc/port_auto_neg/auto-fec.md

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# SONiC Port Auto FEC Design #
2+
3+
## Table of Content
4+
5+
- [Revision](#revision)
6+
- [Scope](#scope)
7+
- [Definitions/Abbreviations](#definitionsabbreviations)
8+
- [Overview](#overview)
9+
- [Requirements](#requirements)
10+
- [High-Level Design](#high-level-design)
11+
- [SAI API Requirements](#sai-api-requirements)
12+
- [SWSS Enhancements](#swss-enhancements)
13+
- [Configuration and management ](#configuration-and-management)
14+
- [Config command](#config-command)
15+
- [Show command](#show-command)
16+
- [YANG Model changes](#yang-model-changes)
17+
- [Warmboot and Fastboot Considerations](#warmboot-and-fastboot-considerations)
18+
- [Restrictions/Limitations](#restrictionslimitations)
19+
- [Testing Design](#testing-design)
20+
- [VS Test cases](#vs-test-cases)
21+
22+
23+
### Revision
24+
25+
| Rev | Date | Author | Change Description |
26+
|:---:|:-----------:|:-------------------:|--------------------------------------------|
27+
| 0.1 | | Sudharsan | Initial version |
28+
29+
### Scope
30+
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.
31+
32+
### Definitions/Abbreviations
33+
FEC - Forward Error Correction
34+
35+
### Overview
36+
SONiC supports the following FEC settings:
37+
38+
**None**: FEC is disabled.
39+
40+
**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.
41+
42+
**Fire Code (FC)**: IEEE 802.3 Clause 74 (CL74). Base-R provides less protection from bit errors than RS FEC but adds less latency.
43+
44+
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
45+
46+
47+
### Requirements
48+
49+
Primary requirements for configuring FEC are
50+
- Honor the backward compatibility. 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.
51+
- Allow user to enable FEC to be auto negotiated
52+
- Allow user to override the auto-negotiated FEC
53+
54+
55+
### High-Level Design
56+
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.
57+
58+
A new FEC mode called 'auto' is introduced.
59+
- 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
60+
- 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.
61+
- 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.
62+
63+
### SAI API Requirements
64+
65+
The following is an existing attribute which was added to support the FEC override functionality.
66+
```
67+
/**
68+
* @brief FEC mode auto-negotiation override status
69+
*
70+
* If set to true, any auto-negotiated FEC mode will be
71+
* overridden by the value configured in SAI_PORT_ATTR_FEC_MODE
72+
*
73+
* @type bool
74+
* @flags CREATE_AND_SET
75+
* @default false
76+
*/
77+
SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE,
78+
```
79+
Any SAI vendors who want to make use of this deterministic behavior should implement the above attribute.
80+
81+
In order to get operation FEC the following attributes was recently introduced
82+
```
83+
* @brief Operational FEC mode
84+
*
85+
* If port is down or auto negotiation is in progress, the returned value should be SAI_PORT_FEC_MODE_NONE.
86+
* If auto negotiation is on, the returned value should be the negotiated FEC.
87+
* If auto negotiation is off, the returned value should be the set value.
88+
*
89+
* @type sai_port_fec_mode_t
90+
* @flags READ_ONLY
91+
*/
92+
SAI_PORT_ATTR_OPER_PORT_FEC_MODE
93+
```
94+
95+
### SWSS Enhancements
96+
97+
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.
98+
If FEC is configured as 'auto' by the user SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will be set to false. With FEC as 'auto', if AN is set to false, SAI_PORT_ATTR_FEC_MODE will be set to SAI_PORT_FEC_MODE_NONE. Only when autoneg is set to true, FEC mode auto will take effect.
99+
If AN is set to true and FEC is not set, no FEC related attributes will be programmed and existing behavior will continue.
100+
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.
101+
102+
103+
| Idx | Override supported (SAI capability) | Autoneg | FEC | SAI Attributes set by orchagent |
104+
|:---:|:------------------:|:----------:|:----------:|---------------------------------------------------------------------------------|
105+
| 1 | False | False | none/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc |
106+
| 2 | False | False | auto | CLI will throw error. No FEC attributes will be set |
107+
| 3 | False | False | N/A | No FEC attributes will be set |
108+
| 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 |
109+
| 5 | False | True | auto | CLI will throw error. No FEC attributes will be set |
110+
| 6 | False | True | N/A | No FEC attributes will be set |
111+
| 7 | True | True | none/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE=True |
112+
| 8 | True | True | auto | SAI_PORT_ATTR_FEC_MODE=none, SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE=False |
113+
| 9 | True | True | N/A | SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE will not be set |
114+
| 10 | True | False | None/rs/fc | SAI_PORT_ATTR_FEC_MODE=none/rs/fc |
115+
| 11 | True | False | auto | SAI_PORT_ATTR_FEC_MODE=none, SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE=False. However the auto will take effect only when AN is enabled and until then the mode will be none. |
116+
| 12 | True | False | N/A | No FEC attributes will be set |
117+
118+
When auto FEC mode is configured without AN enabled, or the configurations order is first FEC mode auto, followed by autoneg, the below notice log will be seen to notify user that auto FEC will work only with autoneg enabled
119+
120+
```
121+
NOTICE swss#orchagent: :- isFecModeSupported:Autoneg must be enabled for port fec mode auto to work
122+
```
123+
The portsorch will also be responsible to update operational FEC. When oper up is detected, SAI_PORT_ATTR_OPER_FEC will be queried and updated in the STATE_DB PORT_TABLE field 'fec'.
124+
If the vendor SAI does not support SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE, and mode auto is configured through config_db.json the following error log will be thrown
125+
126+
```
127+
ERR #orchagent: :- doPortTask: Unsupported port Ethernet0 FEC mode auto
128+
```
129+
130+
### Configuration and management
131+
132+
#### Config command
133+
134+
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'
135+
136+
```
137+
Format:
138+
config interface fec <interface_name> <mode>
139+
140+
Arguments:
141+
interface_name: name of the interface to be configured. e.g: Ethernet0
142+
mode: none/rs/fc/auto
143+
144+
Example:
145+
config interface fec Ethernet0 auto
146+
147+
Return:
148+
error message if interface_name or mode is invalid otherwise empty
149+
```
150+
151+
If a vendor doesn't support auto mode, an error will be thrown when 'auto' mode is configured.
152+
```
153+
sonic# config interface fec Ethernet0 auto
154+
fec auto is not in ['rs', 'fc', 'none']
155+
```
156+
157+
#### Show command
158+
159+
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. 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".
160+
A new show command is introduced to display the FEC admin and oper status.
161+
The show command will query the state DB and if there is FEC field, it would be displayed.
162+
163+
````
164+
admin@sonic:~$ show interfaces fec status
165+
Interface FEC Oper FEC Admin
166+
----------- ---------- -----------
167+
Ethernet0 N/A rs
168+
Ethernet32 N/A rs
169+
Ethernet36 N/A N/A
170+
Ethernet112 N/A rs
171+
Ethernet116 N/A rs
172+
Ethernet120 N/A rs
173+
Ethernet124 rs auto
174+
````
175+
176+
### YANG model changes
177+
178+
The yang model will be modified to accept additional value 'auto' for FEC
179+
180+
```
181+
leaf fec {
182+
type string {
183+
pattern "rs|fc|none|auto";
184+
}
185+
}
186+
```
187+
188+
### Warmboot and Fastboot Considerations
189+
190+
No impact to warm or fastboot
191+
192+
### Restrictions/Limitations
193+
194+
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 and the attribute is supported by SAI, there will be difference in behavior before and after upgrade.
195+
196+
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 '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.
197+
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.
198+
199+
| Idx | Previous behavior | DB Migrator required |
200+
|:---:|:----------------------------------------------------------:|:-----------------------:|
201+
| 1 | Auto negotiation takes precedence over user configured FEC | Yes |
202+
| 2 | User configured FEC takes precedence over auto negotiation | No |
203+
204+
### Testing Design
205+
206+
#### VS Test cases
207+
208+
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.
209+
2. If SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE is not suppored it should not be set when configuring FEC
210+
3. Set FEC mode to auto and AN=true verify SAI_PORT_ATTR_AUTO_NEG_FEC_MODE_OVERRIDE is set to false
211+
4. Set FEC mode to auto and AN=false verify no FEC mode is programmed

0 commit comments

Comments
 (0)