Skip to content

Commit 8b29d62

Browse files
authored
Merge pull request sonic-net#199 from michaelli10/master
CoPP Per Platform HLD
2 parents 6e4bc45 + 6d66a09 commit 8b29d62

File tree

1 file changed

+125
-32
lines changed

1 file changed

+125
-32
lines changed

copp/SONiC_CoPP_Per_Platform.md

+125-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SONiC CoPP Per Platform
22

33
# High Level Design Document
4-
#### Rev 0.1
4+
#### Rev 0.2
55

66
# Table of Contents
77
* [List of Tables](#list-of-tables)
@@ -14,14 +14,16 @@
1414
[Table 1: Abbreviations](#table-1-abbreviations)
1515

1616
# Revision
17-
| Rev | Date | Author | Change Description |
18-
|:---:|:-----------:|:------------------:|-----------------------------------|
19-
| 0.1 | 04/12/2021 | Michael Li | Initial version w/ requirements |
17+
| Rev | Date | Author | Change Description |
18+
|:---:|:-----------:|:----------------------------:|-------------------------------------------|
19+
| 0.1 | 04/12/2021 | Michael Li / Aravindu Maneti | Initial version. Add requirements section |
20+
| 0.2 | 05/12/2021 | Michael Li / Aravindu Maneti | Update full HLD |
2021

2122
# About this Manual
2223
This document provides general information about the CoPP per Platform feature implementation in SONiC.
2324
# Scope
24-
This document describes the high level design of the CoPP feature enhancement that adds a CoPP config per platform. Please see the [SONiC CoPP HLD](https://github.com/BRCM-SONIC/sonic_doc_private/blob/master/copp/SONiC_CoPP.md) for more details on the SONiC CoPP feature.
25+
This document describes the high level design of the CoPP feature enhancement that adds a CoPP config per platform. Please see the [SONiC CoPP HLD](https://github.com/project-arlo/SONiC/blob/1d6a3ce682f4ab49a3ad1b0eb7e116b2802292eb/doc/copp/SONiC_CoPP.md
26+
) for more details on general SONiC CoPP feature.
2527

2628
# Definition/Abbreviation
2729

@@ -31,54 +33,108 @@ This document describes the high level design of the CoPP feature enhancement th
3133
| CoPP | Control Plane Policing |
3234

3335
# 1 Feature Overview
34-
The CoPP per Platform feature enables separate CoPP configurations for each SONiC platform which helps enhance CPU packet path protection and prioritization. The default CoPP policer rates and CPU queue scheduling weights can be tuned based on the platform's CPU packet I/O performance. CoPP can be further tuned using the existing CoPP mgmt based on specific application requirements.
36+
The CoPP per Platform feature enables separate CoPP configurations for each SONiC platform which helps enhance CPU packet path protection and prioritization. The default CoPP policer rates and CPU queue scheduling weights can be tuned for the platform's CPU packet I/O performance. CoPP can be further tuned using the existing CoPP mgmt based on specific application requirements.
3537

36-
The feature also allows CoPP configs to be loaded based on platform usage profiles. For example, the SONiC config generator can disable loading L2 related CoPP traps when the platform is configured with an L3 profile.
38+
The feature also allows generation of default CoPP configs based on ASIC capabilities and platform usage profiles. For example, the feature can disable specific traps that are not supported on an ASIC family or variant.
3739

3840
## 1.1 Requirements
39-
The existing default CoPP config tuned for faster platforms will not be as effective in protecting the CPU packet path on platforms with slower CPUs. The existing CoPP management was not designed to tune the CoPP config per platform. A new mechanism is required to provide proper CoPP defaults based on platform performance.
41+
The default CoPP config is tuned for faster platforms and will not be as effective in protecting the CPU packet path on platforms with slower CPUs. CoPP management can change the config but it was not designed to provide tuned CoPP configurations per platform. A new mechanism is required to provide proper CoPP defaults based on platform performance.
4042

4143
### 1.1.1 Functional Requirements
42-
1. Support an optional CoPP config file per SONiC platform that will override the installation of the main CoPP config file on the target.
43-
2. Provide tuned CoPP config defaults on supported Broadcom SONiC platforms based on CPU type.
44-
3. The platform CoPP config file will support Python J2 config template format to allow SONiC config generator to load CoPP configs into CONFIG_DB based on conditional logic.
44+
1. Support an optional CoPP config file per SONiC platform that will override policer rates, queue assignments, scheduler weights in the base CoPP config file.
45+
2. Support an optional CoPP capabilities config file per ASIC variant for disabling unsupported traps across platforms using a common ASIC.
46+
3. Support an optional CoPP capabilities config file per SONiC platform for disabling unsupported traps on a specific platform that will override the ASIC COPP capabilities config.
47+
4. Provide tuned CoPP config defaults on slower Broadcom SONiC platforms as part of the "SONiC on a diet" and "SONiC for Campus" initiatives.
4548

4649
### 1.1.2 Configuration and Management Requirements
4750
The existing SONiC CoPP configuration and management UIs will work with the platform CoPP config files.
4851

4952
### 1.1.3 Scaling and Performance Requirements
50-
CPU Packet I/O performance profiling will be performed on supported Broadcom SONiC platforms based on the CPU type to help understand the control protocol scaling limits of the platform. Platforms that use the same CPU will use the same default CoPP policer rates and queue scheduler weights.
53+
CPU Packet I/O performance profiling will be performed on slower Broadcom SONiC platforms to help understand the protocol scaling limits of the platform. CoPP policer rates and CPU queue scheduling weights will be tuned on slower platforms identified as part of the "SONiC on a diet" and "SONiC for Campus" initiatives.
5154

5255
### 1.1.4 Warm Boot Requirements
5356

54-
## 1.2 Design Overview
55-
### 1.2.1 Basic Approach
56-
Where is the code coming from? Existing Open-source project? Internal Broadcom codebase? New development? Somewhere else? Mixture?
5757

5858
# 2 Functionality
5959
## 2.1 Target Deployment Use Cases
60-
Wordy description, with diagrams if possible
60+
The CoPP per platform feature enables proper protection for the CPU Pkt I/O path on slower platforms identified as part of the "SONiC on a diet" and "SONiC for Campus" initiatives.
61+
6162
## 2.2 Functional Description
62-
Wordy description
63+
SONiC supports a variety of platforms with different combinations of ASIC capabilities and CPU performance but only supports a single CoPP configuration. To provide proper CPU packet path protection, CoPP configs should be customized based on platform capabilities. The CoPP per platform feature provides flexible customization of default CoPP configs for each SONiC platform to enable enhanced CPU packet path protection.
64+
65+
CoPP trap group policer rates can be tuned based on the platform's CPU Pkt IO path performance and protocol scaling requirement. CPU queue assignments can be customized to accomodate for platforms that support fewer number of CPU queues.
66+
67+
A separate CoPP capabilities config is introduced to allow disabling of unsupported CoPP traps based on ASIC type and specific platform. Providing the CoPP capabilities in ConfigDB enables the management infrastructure to provide feedback to users on unsupported configurations. Management infrastructure can check for the existence of CoPP entries in the ConfigDB table to determine if the platform supports the trap (note that CoPP management disables supported traps by setting entries to NULL).
6368

6469
# 3 Design
6570
## 3.1 Overview
66-
big picture view of the actors involved.
71+
## 3.1.1 CoPP Platform Config
72+
An optional CoPP platform config file (copp_platform_config.j2) will be added in the [SONiC device directories](https://github.com/Azure/sonic-buildimage/tree/master/device) where platform specific configuration data is stored ([example for AS7712]((https://github.com/Azure/sonic-buildimage/tree/master/device/accton/x86_64-accton_as7712_32x-r0/Accton-AS7712-32X))). This file will be populated with CoPP trap group entries in json format similar to the CoPP base config file.
73+
74+
A CoPP config generation script will be added to the sonic-cfggen infrastructure to support overriding the CoPP base config entries with CoPP platform config entries when generating the default CoPP config for the platform.
75+
76+
## 3.1.2 CoPP Capabilities Config
77+
To support disabling of unsupported traps on specific ASICs, a CoPP capabilities config file (copp_capabilities_config.j2) will be added in the SONiC device ASIC directory located below:
78+
79+
```
80+
/sonic-buildimage/device/broadcom/x86_64-broadcom_common/
81+
x86_64-broadcom_b37/ H 04-Feb-2021 4 KiB
82+
x86_64-broadcom_b77/ H 02-Mar-2021 4 KiB
83+
x86_64-broadcom_b85/ H 02-Mar-2021 4 KiB
84+
x86_64-broadcom_b87/ H 02-Mar-2021 4 KiB
85+
x86_64-broadcom_b96/ H 02-Mar-2021 4 KiB
86+
x86_64-broadcom_b97/ H 02-Mar-2021 4 KiB
87+
x86_64-broadcom_b98/ H 03-Apr-2021 4 KiB
88+
```
89+
These files will define a set of traps that are unsupported by the ASIC family. By default, all traps from the CoPP base config are supported.
90+
```
91+
{
92+
"copp_feat_ptp": "false"
93+
"copp_feat_nat": "false"
94+
}
95+
```
96+
A similar file can be added in the platform directory where the CoPP platform config file is stored to override specific capabilities from the ASIC CoPP capabilities. For example, by default the copp_feat_nat is supported on all TD3 platforms. However, a specific platform vendor may choose to disable the NAT feature and can add "copp_feat_nat" capability as false in copp_capabilities_config.j2 file for the platform.
97+
98+
### 3.1.2.1 Global CPU Rx Rate Limit
99+
CoPP has a global CPU Rx rate limit implemented in the Pkt IO Driver (BRCM KNET) to limit the aggregate Rx rate to CPU. The default rate is 30Kpps and can be changed dynamically with the following click command:
100+
```
101+
admin@sonic:~$ sudo config copp ?
102+
Usage: config copp [OPTIONS] COMMAND [ARGS]...
103+
104+
Commands:
105+
rx-burst Configure COPP rx-burst <10-10000>
106+
rx-rate Configure COPP rx-rate <100-100000>
107+
```
108+
109+
To reduce the global rate for all traffic to CPU on a lower performance platform, set the cpu rate limit in the platform copp_capabilities_config.j2 file. In the example below, the platform default global CPU rx rate limit is set to 20Kpps.
110+
```
111+
{
112+
"copp_rx_rate": "20000"
113+
}
114+
```
115+
67116
## 3.2 DB Changes
68-
Describe changes to existing DBs or any new DB being added.
69-
### 3.2.1 CONFIG DB
70-
### 3.2.2 APP DB
71-
### 3.2.3 STATE DB
72-
### 3.2.4 ASIC DB
73-
### 3.2.5 COUNTER DB
117+
There are no new changes to SONiC DBs.
74118

75119
## 3.3 Switch State Service Design
76120
### 3.3.1 Orchestration Agent
77-
### 3.3.2 Other Process
78-
Describe changes to other process within SwSS if applicable.
79-
121+
There are no new changes to Orchagent.
80122
## 3.4 SyncD
81-
Describe changes to syncd if applicable.
123+
There are no new changes to SyncD.
124+
125+
## 3.5 Manageability
126+
### 3.5.1 Config Setup
127+
CoPP platform file handling will be added as a user defined extension to the [Config-setup infrastructure](https://github.com/BRCM-SONIC/sonic_doc_private/blob/master/manageability/config-setup.md).
128+
129+
This logic will perform the following functions:
130+
- If a CoPP platform capabilities file exists, use this data with the base CoPP config J2 template to generate a base config file.
131+
- Else if a CoPP ASIC capabilities file exists for this platform, use this data with the base CoPP config J2 template to generate base config file.
132+
- If a copp_platform_config.j2 file exists, merge this data with the generated base config file for the final default CoPP config.
133+
134+
### 3.5.2 Config Save
135+
CoPP management feature introduced [changes in the config save script](https://github.com/BRCM-SONIC/sonic_doc_private/blob/877f06cc40b5829dfc1cc21458702a4130c5b3c3/copp/SONiC_CoPP.md#config-save) to prevent the default CoPP config loaded into ConfigDB from being written into the config_db.json file. The sonic-cfggen was modified to compare the default CoPP config with the CoPP tables in ConfigDB and write only the diff into the config_db.json file. Only the user changes will be replayed back on config reload.
136+
137+
This logic will remain unchanged and still applies for the new CoPP platform config.
82138

83139
# 4 Flow Diagrams
84140
Provide flow diagrams for inter-container and intra-container interactions.
@@ -90,15 +146,52 @@ Provide details about incorporating error handling feature into the design and f
90146
Logging, counters, stats, trace considerations. Please make sure you have incorporated the debugging framework feature. e.g., ensure your code registers with the debugging framework and add your dump routines for any debug info you want to be collected.
91147

92148
# 7 Warm Boot Support
93-
Describe expected behavior and any limitation.
149+
No warmboot support. CoPP functionalities are not expected to work during warm reboot but will be restored after warm reboot. Traffic to CPU will get dropped when CPU is reset until SAI drivers have restored the CPU packet path.
94150

95151
# 8 Scalability
96-
Describe key scaling factor and considerations.
152+
## 8.1 Profiling and Tuning
153+
The CPU packet I/O performance will be profiled on the new platforms targeted for Campus. Linux tools such as iperf and flood ping tests will be performed to gauge the packet I/O performance. Going forward, the packet I/O performance metric will be added to the PDE benchmark list which is used to help compare system performance across SONiC platforms.
154+
155+
The packet I/O performance will be compared with existing platforms to extrapolate CoPP configurations on the new platforms as a starting point for CoPP tuning. Single dimensional tests will be performed to test latency sensitive protocols such as BFD against high rate packets (sFlow, ARP flood, IP2ME) cases to further tune policer rates.
156+
157+
## 8.2 Recommended Scaling and Performance System Test cases
158+
Further tuning may be needed based on the results of recommended multi-dimensional system test cases below.
159+
1. Verify max BFD scale do not flap with high rate multi-dimensional protocol traffic (max sFlow sampling rate + max BGP + max ARP + max IP2ME + max subnet) on slower campus platform
160+
2. Verify max LACP scale (fast timer) does not flap with high rate multi-dimensional protocol traffic on slower campus platform
161+
3. Verify no pkt drops on max STP scale with high rate multi-dimensional protocol traffic on slower campus platform
162+
4. Verify no pkt drops on max UDLD scale with high rate multi-dimensional protocol traffic on slower campus platform
163+
97164

98165
# 9 Unit Test
99-
List unit test cases added for this feature including warm boot.
166+
## 9.1 Functional Test Cases
167+
1. Verify CoPP trap policer rate based on platform CoPP config
168+
2. Verify CoPP trap queue assignment based on platform CoPP config
169+
3. Verify disable of CoPP traps based on ASIC capabilities CoPP config
170+
4. Verify disable of CoPP traps based on platform capabilities CoPP config
171+
5. Verify disable of CoPP traps based on platform capabilities CoPP config overriding ASIC capabilities CoPP config
172+
173+
## 9.2 Install and Config Setup Cases
174+
1. Verify platform CoPP config applied using ONIE image install
175+
2. Verify platform CoPP config applied using sonic-installer
176+
3. Verify platform CoPP config applied using ztp config generation
177+
4. Verify platform CoPP config applied using config-setup factory defaults
178+
5. Verify platform CoPP config changes applied on config-reload
179+
6. Verify platform CoPP config applied using sonic-installer upgrade from image before SONiC 4.0.
180+
7. Verify platform CoPP config is NOT applied when using sonic-installer to downgrade from SONiC 4.0 to previous versions.
181+
8. Verify platform CoPP config applied with config-save before sonic-installer upgrade
182+
9. Verify platform + user defined CoPP config applied with config-save before sonic-installer upgrade
183+
10. Verify platform + user defined CoPP config applied with config-save before sonic-installer downgrade to image before SONiC 4.0
184+
185+
## 9.2 Warm Boot Test Cases
186+
1. Verify platform CoPP config is NOT applied on warm-boot upgrade from pre-SONiC 4.0 to SONiC 4.0
187+
2. Verify platform CoPP config is retained on warm-boot downgrade from SONiC 4.0 to pre-SONiC 4.0 image.
188+
189+
## 9.3 Negative Test Cases
190+
1. Verify graceful handling (use base CoPP config) on config-setup merge failure of CoPP platform config
191+
2. Verify graceful handling of invalid CoPP capabilities data
192+
100193

101194
# 10 Internal Design Information
102-
Internal BRCM information to be removed before sharing with the community.
195+
103196

104197

0 commit comments

Comments
 (0)