Skip to content

Commit 394b202

Browse files
authored
[Dynamic buffer calc] Support dynamic buffer calculation (sonic-net#973)
**- What I did** Support dynamic buffer calculation **- How I did it** 1. Commands added: • config interface buffer priority-group lossless <add|set|remove> • config interface buffer priority-group lossless add <port> <PG> [headroom-override-profile] for adding the PG for the first time providing option headroom-override-profile means to configure the PG as headroom override otherwise as dynamically calculated headroom • config interface buffer priority-group lossless set <port> <PG> [headroom-override-profile] for modifying an existing PG, the option headroom-override-profile has the same meaning as "add" • config interface buffer priority-group lossless remove <port> [PG] for removing the PG specified by option PG. If the option isn't provided, all lossless PGs on the port will be removed • config buffer-profile <add|set|remove> to add, modify or remove buffer profiles • show buffer <configuration|information> 2. db_migrator: • migrate CONFIG_DB from old approach to the new approach • when system warm starts from old image to the new one, copies related tables from CONFIG_DB to APPL_DB for the purpose that buffermgrd can start smoothly 3. Warm-reboot script: don't clear BUFFER_MAX_PARAM table across warm reboot 4. CLI reference is also provided **- How to verify it** **- Previous command output (if the output of a command-line utility has changed)** **- New command output (if the output of a command-line utility has changed)**
1 parent 6dd5d31 commit 394b202

14 files changed

+1557
-77
lines changed

config/main.py

100755100644
+423-3
Large diffs are not rendered by default.

doc/Command-Reference.md

+330-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
* [Drop Counter show commands](#drop-counters-show-commands)
4343
* [Drop Counter config commands](#drop-counters-config-commands)
4444
* [Drop Counter clear commands](#drop-counters-clear-commands)
45+
* [Dynamic Buffer Management](#dynamic-buffer-management)
46+
* [Configuration commands](#configuration-commands)
47+
* [Show commands](#show-commands)
4548
* [ECN](#ecn)
4649
* [ECN show commands](#ecn-show-commands)
4750
* [ECN config commands](#ecn-config-commands)
@@ -2163,7 +2166,7 @@ This command is used to delete a configured DHCP Relay Destination IP address fr
21632166
Go Back To [Beginning of the document](#) or [Beginning of this section](#dhcp-relay)
21642167
21652168
2166-
# Drop Counters
2169+
## Drop Counters
21672170
21682171
This section explains all the Configurable Drop Counters show commands and configuration options that are supported in SONiC.
21692172
@@ -2345,8 +2348,310 @@ This comnmand is used to clear drop counters. This is done on a per-user basis.
23452348
Cleared drop counters
23462349
```
23472350
2348-
Go Back To [Beginning of the document](#) or [Beginning of this section](#drop-counters)
2351+
Go Back To [Beginning of the document](#) or [Beginning of this section](##drop-counters)
23492352
2353+
## Dynamic Buffer Management
2354+
2355+
This section explains all the show and configuration commands regarding the dynamic buffer management.
2356+
2357+
Dynamic buffer management is responsible for calculating buffer size according to the ports' configured speed and administrative state. In order to enable dynamic buffer management feature, the ports' speed must be configured. For this please refer [Interface naming mode config commands](#interface-naming-mode-config-commands)
2358+
2359+
### Configuration commands
2360+
2361+
**configure a lossless buffer profile**
2362+
2363+
This command is used to configure a lossless buffer profile.
2364+
2365+
- Usage:
2366+
2367+
```
2368+
config buffer_profile add <profile_name> -xon <xon_threshold> -xoff <xoff_threshold> [-size <size>] [-dynamic_th <dynamic_th_value>] [-pool <ingress_lossless_pool_name>]
2369+
config buffer_profile set <profile_name> -xon <xon_threshold> -xoff <xoff_threshold> [-size <size>] [-dynamic_th <dynamic_th_value>] [-pool <ingress_lossless_pool_name>]
2370+
config buffer_profile remove <profile_name>
2371+
```
2372+
2373+
All the parameters are devided to two groups, one for headroom and one for dynamic_th. For any command at lease one group of parameters should be provided.
2374+
For headroom parameters:
2375+
2376+
- At lease one of `xoff` and `size` should be provided and the other will be optional and conducted via the formula `xon + xoff = size`.
2377+
All other parameters are optional.
2378+
- `xon` is madantory.
2379+
- `xon` + `xoff` <= `size`; For Mellanox platform xon + xoff == size
2380+
2381+
If only headroom parameters are provided, the `dynamic_th` will be taken from `CONFIG_DB.DEFAULT_LOSSLESS_BUFFER_PARAMETER.default_dynamic_th`.
2382+
2383+
If only dynamic_th parameter is provided, the `headroom_type` will be set as `dynamic` and `xon`, `xoff` and `size` won't be set. This is only used for non default dynamic_th. In this case, the profile won't be deployed to ASIC directly. It can be configured to a lossless PG and then a dynamic profile will be generated based on the port's speed, cable length, and MTU and deployed to the ASIC.
2384+
2385+
The subcommand `add` is designed for adding a new buffer profile to the system.
2386+
2387+
The subcommand `set` is designed for modifying an existing buffer profile in the system.
2388+
For a profile with dynamically calculated headroom information, only `dynamic_th` can be modified.
2389+
2390+
The subcommand `remove` is designed for removing an existing buffer profile from the system. When removing a profile, it shouldn't be referenced by any entry in `CONFIG_DB.BUFFER_PG`.
2391+
2392+
- Example:
2393+
2394+
```
2395+
admin@sonic:~$ sudo config buffer_profile add profile1 -xon 18432 -xoff 18432
2396+
admin@sonic:~$ sudo config buffer_profile remove profile1
2397+
```
2398+
2399+
**config interface cable_length**
2400+
2401+
This command is used to configure the length of the cable connected to a port. The cable_length is in unit of meters and must be suffixed with "m".
2402+
2403+
- Usage:
2404+
2405+
```
2406+
config interface cable_length <interface_name> <cable_length>
2407+
```
2408+
2409+
- Example:
2410+
2411+
```
2412+
admin@sonic:~$ sudo config interface cable_length Ethernet0 40m
2413+
```
2414+
2415+
Go Back To [Beginning of the document](#) or [Beginning of this section](#dynamic-buffer-management)
2416+
2417+
**config interface buffer priority-group lossless**
2418+
2419+
This command is used to configure the priority groups on which lossless traffic runs.
2420+
2421+
- Usage:
2422+
2423+
```
2424+
config interface buffer priority-group lossless add <interface_name> <pg_map> [profile]
2425+
config interface buffer priority-group lossless set <interface_name> <pg_map> [profile]
2426+
config interface buffer priority-group lossless remove <interface_name> [<pg_map>]
2427+
```
2428+
2429+
The <pg_map> can be in one of the following two forms:
2430+
2431+
- For a range of priorities, the lower bound and upper bound connected by a dash, like `3-4`
2432+
- For a single priority, the number, like `6`
2433+
2434+
The `pg-map` represents the map of priorities for lossless traffic. It should be a string and in form of a bit map like `3-4`. The `-` connects the lower bound and upper bound of a range of priorities.
2435+
2436+
The subcommand `add` is designed for adding a new lossless PG on top of current PGs. The new PG range must be disjoint with all existing PGs.
2437+
2438+
For example, currently the PG range 3-4 exist on port Ethernet4, to add PG range 4-5 will fail because it isn't disjoint with 3-4. To add PG range 5-6 will succeed. After that both range 3-4 and 5-6 will work as lossless PG.
2439+
2440+
The `override-profile` parameter is optional. When provided, it represents the predefined buffer profile for headroom override.
2441+
2442+
The subcommand `set` is designed for modifying an existing PG from dynamic calculation to headroom override or vice versa. The `pg-map` must be an existing PG.
2443+
2444+
The subcommand `remove` is designed for removing an existing PG. The option `pg-map` must be an existing PG. All lossless PGs will be removed in case no `pg-map` provided.
2445+
2446+
- Example:
2447+
2448+
To configure lossless_pg on a port:
2449+
2450+
```
2451+
admin@sonic:~$ sudo config interface buffer priority-group lossless add Ethernet0 3-4
2452+
```
2453+
2454+
To change the profile used for lossless_pg on a port:
2455+
2456+
```
2457+
admin@sonic:~$ sudo config interface buffer priority-group lossless set Ethernet0 3-4 new-profile
2458+
```
2459+
2460+
To remove one lossless priority from a port:
2461+
2462+
```
2463+
admin@sonic:~$ sudo config interface buffer priority-group lossless remove Ethernet0 6
2464+
```
2465+
2466+
To remove all lossless priorities from a port:
2467+
2468+
```
2469+
admin@sonic:~$ sudo config interface buffer priority-group lossless remove Ethernet0
2470+
```
2471+
2472+
Go Back To [Beginning of the document](#) or [Beginning of this section](#dynamic-buffer-management)
2473+
2474+
### Show commands
2475+
2476+
**show buffer information**
2477+
2478+
This command is used to display the status of buffer pools and profiles currently deployed to the ASIC.
2479+
2480+
- Usage:
2481+
2482+
```
2483+
show buffer information
2484+
```
2485+
2486+
- Example:
2487+
2488+
```
2489+
admin@sonic:~$ show buffer information
2490+
Pool: ingress_lossless_pool
2491+
---- --------
2492+
type ingress
2493+
mode dynamic
2494+
size 17170432
2495+
---- --------
2496+
2497+
Pool: egress_lossless_pool
2498+
---- --------
2499+
type egress
2500+
mode dynamic
2501+
size 34340822
2502+
---- --------
2503+
2504+
Pool: ingress_lossy_pool
2505+
---- --------
2506+
type ingress
2507+
mode dynamic
2508+
size 17170432
2509+
---- --------
2510+
2511+
Pool: egress_lossy_pool
2512+
---- --------
2513+
type egress
2514+
mode dynamic
2515+
size 17170432
2516+
---- --------
2517+
2518+
Profile: pg_lossless_100000_5m_profile
2519+
---------- -----------------------------------
2520+
xon 18432
2521+
dynamic_th 0
2522+
xoff 18432
2523+
pool [BUFFER_POOL:ingress_lossless_pool]
2524+
size 36864
2525+
---------- -----------------------------------
2526+
2527+
Profile: q_lossy_profile
2528+
---------- -------------------------------
2529+
dynamic_th 3
2530+
pool [BUFFER_POOL:egress_lossy_pool]
2531+
size 0
2532+
---------- -------------------------------
2533+
2534+
Profile: egress_lossy_profile
2535+
---------- -------------------------------
2536+
dynamic_th 3
2537+
pool [BUFFER_POOL:egress_lossy_pool]
2538+
size 4096
2539+
---------- -------------------------------
2540+
2541+
Profile: egress_lossless_profile
2542+
---------- ----------------------------------
2543+
dynamic_th 7
2544+
pool [BUFFER_POOL:egress_lossless_pool]
2545+
size 0
2546+
---------- ----------------------------------
2547+
2548+
Profile: ingress_lossless_profile
2549+
---------- -----------------------------------
2550+
dynamic_th 0
2551+
pool [BUFFER_POOL:ingress_lossless_pool]
2552+
size 0
2553+
---------- -----------------------------------
2554+
2555+
Profile: pg_lossless_100000_79m_profile
2556+
---------- -----------------------------------
2557+
xon 18432
2558+
dynamic_th 0
2559+
xoff 60416
2560+
pool [BUFFER_POOL:ingress_lossless_pool]
2561+
size 78848
2562+
---------- -----------------------------------
2563+
2564+
Profile: pg_lossless_100000_40m_profile
2565+
---------- -----------------------------------
2566+
xon 18432
2567+
dynamic_th 0
2568+
xoff 38912
2569+
pool [BUFFER_POOL:ingress_lossless_pool]
2570+
size 57344
2571+
---------- -----------------------------------
2572+
2573+
Profile: ingress_lossy_profile
2574+
---------- --------------------------------
2575+
dynamic_th 3
2576+
pool [BUFFER_POOL:ingress_lossy_pool]
2577+
size 0
2578+
---------- --------------------------------
2579+
```
2580+
2581+
**show buffer configuration**
2582+
2583+
This command is used to display the status of buffer pools and profiles currently configured.
2584+
2585+
- Usage:
2586+
2587+
```
2588+
show buffer configuration
2589+
```
2590+
2591+
- Example:
2592+
2593+
```
2594+
admin@sonic:~$ show buffer configuration
2595+
Pool: ingress_lossless_pool
2596+
---- --------
2597+
type ingress
2598+
mode dynamic
2599+
---- --------
2600+
2601+
Pool: egress_lossless_pool
2602+
---- --------
2603+
type egress
2604+
mode dynamic
2605+
size 34340822
2606+
---- --------
2607+
2608+
Pool: ingress_lossy_pool
2609+
---- --------
2610+
type ingress
2611+
mode dynamic
2612+
---- --------
2613+
2614+
Pool: egress_lossy_pool
2615+
---- --------
2616+
type egress
2617+
mode dynamic
2618+
---- --------
2619+
2620+
Profile: q_lossy_profile
2621+
---------- -------------------------------
2622+
dynamic_th 3
2623+
pool [BUFFER_POOL:egress_lossy_pool]
2624+
size 0
2625+
---------- -------------------------------
2626+
2627+
Profile: egress_lossy_profile
2628+
---------- -------------------------------
2629+
dynamic_th 3
2630+
pool [BUFFER_POOL:egress_lossy_pool]
2631+
size 4096
2632+
---------- -------------------------------
2633+
2634+
Profile: egress_lossless_profile
2635+
---------- ----------------------------------
2636+
dynamic_th 7
2637+
pool [BUFFER_POOL:egress_lossless_pool]
2638+
size 0
2639+
---------- ----------------------------------
2640+
2641+
Profile: ingress_lossless_profile
2642+
---------- -----------------------------------
2643+
dynamic_th 0
2644+
pool [BUFFER_POOL:ingress_lossless_pool]
2645+
size 0
2646+
---------- -----------------------------------
2647+
2648+
Profile: ingress_lossy_profile
2649+
---------- --------------------------------
2650+
dynamic_th 3
2651+
pool [BUFFER_POOL:ingress_lossy_pool]
2652+
size 0
2653+
---------- --------------------------------
2654+
```
23502655
23512656
## ECN
23522657
@@ -3259,6 +3564,29 @@ kindly use, double tab i.e. <tab><tab> to see the available breakout option cust
32593564
32603565
Go Back To [Beginning of the document](#) or [Beginning of this section](#interfaces)
32613566
3567+
**config interface cable_length (Versions >= 202006)**
3568+
3569+
This command is used to configure the length of the cable connected to a port. The cable_length is in unit of meters and must be suffixed with "m".
3570+
3571+
For details please refer [dynamic buffer management](#dynamic-buffer-management)
3572+
3573+
Go Back To [Beginning of the document](#) or [Beginning of this section](#interfaces)
3574+
3575+
**config interface lossless_pg (Versions >= 202006)**
3576+
3577+
This command is used to configure the priority groups on which lossless traffic runs.
3578+
3579+
For details please refer [dynamic buffer management](#dynamic-buffer-management)
3580+
3581+
Go Back To [Beginning of the document](#) or [Beginning of this section](#interfaces)
3582+
3583+
**config interface headroom_override (Versions >= 202006)**
3584+
3585+
This command is used to configure a static buffer profile on a port's lossless priorities. There shouldn't be any `lossless_pg` configured on the port when configuring `headroom_override`. The port's headroom won't be updated after `headroom_override` has been configured on the port.
3586+
3587+
For details please refer [dynamic buffer management](#dynamic-buffer-management)
3588+
3589+
Go Back To [Beginning of the document](#) or [Beginning of this section](#interfaces)
32623590
32633591
## Interface Naming Mode
32643592

scripts/buffershow

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mmuconfig

0 commit comments

Comments
 (0)