You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 0.3 || Dante (Kuo-Jung) Su | Add support for SFPs and operational states|
43
44
44
45
### Scope
45
46
This document is the design document for port auto negotiation feature on SONiC. This includes the requirements, CLI change, DB schema change, DB migrator change, yang model change and swss change.
@@ -51,7 +52,12 @@ N/A
51
52
52
53
The IEEE 802.3 standard defines a set of Ethernet protocols that are comprised of speed rate and interface type. It allows for configuring multiple values at the same time for port provisioning and advertising to the remote side. However, on SONiC, user can configure the speed of port, and user can configure auto negotiation mode via config DB. Port attributes such as interface type, advertised speeds, advertised interface types are not supported.
53
54
54
-
The feature in this document is to address the above issues.
55
+
The feature in this document is to address the above issues, and support the following medium typs
The complexities behind vendor-specific SAI implementation is outside the scope of this document.
55
61
56
62
### Requirements
57
63
@@ -86,6 +92,11 @@ Currently, SAI already defines a few port attributes to support port auto negoti
86
92
3. If autoneg is enabled and adv_speeds is not configured or empty, SAI must advertise it with all supported speeds.
87
93
4. If autoneg is enabled and adv_interface_types is not configured or empty, SAI must advertise it with all supported interface types.
88
94
5. If autoneg is disabled and interface_type is not configured, SAI must use SAI_PORT_INTERFACE_TYPE_NONE.
95
+
6. If autoneg is enabled, the administrative port speed updates should not disable the autoneg. The configured speed should be cached in swss#orchagent and gets replayed when autoneg is transitioned from enabled to disabled.
96
+
7. If autoneg is enabled, while the administrative interface type updates via CONFIG_DB should be blocked, the dynamic interface type updates from pmon#xcvrd via APPL_DB should be delivered to the SAI to update the autoneg advertisement. Please refer to [PMON xcvrd Consideration](#pmon-xcvrd-consideration) for details.
97
+
8. If autoneg is enabled on a SFP/QSFP/QSFPDD port, SAI should also activate the link-training to dynamically tune the TX FIR.
98
+
9. If autoneg is enabled on a SFP/QSFP/QSFPDD port, when it's transitioned to disabled, the port speed, FEC, interface type and TX FIR should be restored with the corresponding values in the APPL_DB. If the individual configuration is not present in the APPL_DB, the SAI driver defaults should be restored. Precisely speaking, default interface type is SAI_PORT_INTERFACE_TYPE_NONE, default fec mode is SAI_PORT_FEC_MODE_NONE and TX FIR is vendor-specific, as it's NOT a set of constants applicable to all switch ASIC.
99
+
10. If autoneg is enabled on a SFP/QSFP/QSFPDD port, the "fec" field of APPL_DB should override the result of autoneg.
89
100
90
101
The related port attributes are listed below:
91
102
```cpp
@@ -234,26 +245,29 @@ This command always replace the advertised interface types instead of append. Fo
234
245
235
246
##### Show interfaces auto negotiation status
236
247
237
-
As command `show interfaces status` already has 11 columns, a new CLI command will be added to display the port auto negotiation status. All data of this command are fetched from **APPL_DB**.
248
+
As command `show interfaces status` already has 11 columns, a new CLI command will be added to display the port auto negotiation status. All data of this command are fetched from **APPL_DB** and **STATE_DB**.
238
249
239
250
```
240
251
Format:
241
-
show interfaces autoneg-status <interface_name>
252
+
show interfaces autonegstatus <interface_name>
242
253
243
254
Arguments:
244
255
interface_name: optional. Name of the interface to be shown. e.g: Ethernet0. If interface_name is not given, this command shows auto negotiation status for all interfaces.
245
256
246
257
Example:
247
-
show interfaces autoneg-status
248
-
show interfaces autoneg-status Ethernet0
258
+
show interfaces autonegstatus
259
+
show interfaces autonegstatus Ethernet0
249
260
250
261
Return:
251
262
error message if interface_name is invalid otherwise:
@@ -390,15 +404,19 @@ Here is the table to map the fields and SAI attributes:
390
404
#### State DB Enhancements
391
405
392
406
To support validate interface speed on CLI side, a new field **supported_speeds** will be added to **PORT_TABLE**.
407
+
To support checking remote advertised speeds, a new field **rmt_adv_speeds** will be added to **PORT_TABLE**.
393
408
394
409
; Defines information for port state
395
410
key = PORT_TABLE:port_name ; state of the port
396
411
; field = value
397
412
...
398
413
supported_speeds = STRING ; supported speed list
399
-
speed = STRING ; operational speed
414
+
speed = STRING ; operational speed
415
+
rmt_adv_speeds = STRING ; advertised speed list of the remote
400
416
401
-
An example value of supported_speeds could be "10000,25000,40000,100000".
417
+
- supported_speeds: A list of supported speeds separated by commas, for example, "10000,25000,40000,100000".
418
+
- speed: Operational speed, for example, "100000".
419
+
- rmt_adv_speeds: A list of supported speeds advertised by the connected remote, for example, "10000,25000,40000,100000".
402
420
403
421
Before this feature, port speed in APP DB indicates both the configured speed and the operational speed. It is OK without this feature because port operational speed must be configured speed or port operational status is down. However, this is not true with this feature. Consider following flow:
404
422
@@ -413,14 +431,21 @@ To overcome this issue, following changes are required:
413
431
1. Put port operational speed to STATE DB PORT_TABLE
414
432
2. intfutil, portstat, voqutil shall be change to get port operational speed from STATE DB first. For backward compatible, intfutil, portstat, voqutil shall still get port operational speed from APP DB if port speed is not available in STATE DB or port operational state is down.
415
433
434
+
Here is the table to map the fields and SAI attributes:
The port yang model needs to update according to DB schema change. The yang model changes of new fields are described below:
419
444
420
445
```
421
446
leaf autoneg {
422
447
type string {
423
-
pattern "0|1";
448
+
pattern "off"|"on";
424
449
}
425
450
}
426
451
@@ -470,6 +495,8 @@ Will be migrated to:
470
495
471
496
#### SWSS Enhancements
472
497
498
+
##### Setting Auto Negotiation
499
+
473
500
The current SONiC speed setting flow in PortsOrch can be described in following pseudo code:
474
501
475
502
```
@@ -511,6 +538,14 @@ else if autoneg == false:
511
538
setInterfaceType(port, interface_type)
512
539
```
513
540
541
+
##### Getting Remote Advertisement
542
+
543
+
A new periodic timer task will be introduced into PortsOrch, it periodically loops through physical ports and update the per-port remote advertisement if autoneg is enabled and the link is down.
544
+
545
+

546
+
547
+
##### Backward Compatibility Considerations
548
+
514
549
SONiC usually does not call SAI interface when there is no related configuration in APPL_DB. In order to keep backward compatible, this feature also apply this rule.
515
550
516
551
swss will do validation for auto negotiation related fields, although it still CANNOT guarantee that all parameters passed to SAI will be accepted by SAI. swss validation for these field are described below:
@@ -520,6 +555,7 @@ swss will do validation for auto negotiation related fields, although it still C
520
555
3. interface_type value from APPL_DB must be able to transfer to a valid interface type value. For invalid value, swss must catch the exception, log the error value and skip the rest configuration of this port.
521
556
4. adv_interface_types value from APPL_DB must be able to transfer to a list of valid interface type values. For invalid value, swss must catch the exception, log the error value and skip the rest configuration of this port.
522
557
558
+
523
559
#### portsyncd and portmgrd Consideration
524
560
525
561
No changes for portsyncd and portmgrd.
@@ -617,18 +653,15 @@ I choose this solution because:
617
653
618
654
Dynamic port breakout feature also introduces a hwsku.json file to describe the port capability. It defines the default dynamic breakout mode for now. As we won't automatically set auto negotiation attributes for a port after port breakout, it is not necessary to change the hwsku.json in this feature.
619
655
620
-
#### xcvrd Consideration
621
-
622
-
It is recommended to use CLI/CONFIG_DB to setting the port auto negotiation attributes. But there is still other way.
623
-
624
-
There is a media_setting.json which is used for setting the default value for some port attributes. This media_setting.json is handled by xcvrd for setting pre-emphasis value for ports. xcvrd process the file this way:
656
+
#### PMON xcvrd Consideration
625
657
626
-
1. When xcvrd start, it reads the media_setting.json and set pre-emphasis values to APPL_DB for each port
627
-
2. When a new cable is inserted, xcvrd uses the value in media_setting.json to set pre-emphasis value to APPL_DB for this port.
658
+
While it is possible to use CLI/CONFIG_DB for setting the port auto negotiation attributes, this feature is also available via [media_settings.json](https://github.com/Azure/SONiC/blob/master/doc/media-settings/Media-based-Port-settings.md)
628
659
629
-
xcvrd just reads the configuration from media_settings.json and set value to APPL_DB. xcvrd does not care what the configuration is. So user could use media_settings.json to specify the default value for autoneg, adv_speeds and other port attributes. **Nothing needs to be changed in xcvrd**.
660
+
-**Interface Type**
661
+
Unfortunately, it's not straightforward for users to identify which interface type is most appropriate to the attached transceivers, and the link will not get up unless the connected devices are both advertising the same interface type. This requires domain knowledge, correct EERPOM information and the individual hardware datasheet review process. Hence it's recommended to use [media_settings.json](https://github.com/Azure/SONiC/blob/master/doc/media-settings/Media-based-Port-settings.md) to automate the while process. A interface type update request from [media_settings.json](https://github.com/Azure/SONiC/blob/master/doc/media-settings/Media-based-Port-settings.md) is triggered by the transceiver detection of pmon#xcvrd, which leverages **APPL_DB** instead of **CONFIG_DB**, hence the requests will not be blocked by **portsyncd**. If the interface type update request arrives when autoneg is enabled, it should alter the advertisement and restart the autoneg. That said, if the user has interface type configured in both CONFIG_DB and media_settings.json, it wouldn't be possible to predict which would take precedence as there is no logic giving one priority over other. Hence please be sure to use either CLI/CONFIG_DB or media_settings.json at a time, never have both of them activated.
630
662
631
-
However, it is worthy mentioning that: if user have port attributes configured both in CONFIG_DB and media_settings.json, the value in media_settings.json will override the value in CONFIG_DB after rebooting, restarting pmon or re-insert cables. Base on that, if user choose to use media_settings.json, they probably should not use CLI or CONFIG_DB to avoid configuration loss after rebooting, restarting pmon or re-insert cables.
663
+
-**Pre-Emphasis**
664
+
Typically, prior to some process, such as transmission over cable, or recording to phonograph record or tape, the input frequency range most susceptible to noise is boosted. This is referred to as "pre-emphasis" - before the process the signal will undergo. While this is rarely necessay to the native RJ45 ports, it's important to SFP/QSFP/QSFPDD ports. For optical arrangements (e.g. SR/LR/DR transceivers), the loss is miniscule. The loss budget allocated for the host PCB board is small, which implies the pre-emphasis calibrated is supposed to work regardless of the fiber cable attached. On the other hand, on passive media, there is a significant amount of frequency dependent loss and the channel loss can range up to the CR/KR loss spec. It is therefore important and useful to activate Link-Training to "train" the TX FIR in both directions to help equalize that loss. IEEE 802.3 Clause 72, Clause 73 and Clause 93 define the auto-negotiation and link-training support for CR/KR transceivers, while the support of opticals (e.g. SR/LR/DR) are never in the scope. On the other hand, when autoneg is enabled, the link-training will also be activated, and the link-training handshake will only get started after negotiation if autoneg is enabled. Furtherly, link-training is to dynamically tune hardware signals at runtime, as a result, the static pre-emphasis parameters in media_setting.json is not necessary and will not be taken into autoneg process.
0 commit comments