Skip to content

Commit 16763dc

Browse files
andriymoroz-mlnxlguohan
authored andcommitted
[mellanox]: Update Mellanox buffers configuration (#1263)
Signed-off-by: Andriy Moroz <[email protected]>
1 parent 32559d4 commit 16763dc

File tree

2 files changed

+64
-59
lines changed

2 files changed

+64
-59
lines changed

dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,45 @@
44
{%- if port_names_list.append(port) %}{% endif %}
55
{% endfor %}
66
{% set port_names = port_names_list | join(',') %}
7+
{% set switch_role = DEVICE_METADATA['localhost']['type'] %}
8+
{%if switch_role == 'ToRRouter' %}
9+
{% set ingress_lossless_pool_size = '4194304' %}
10+
{% set ingress_lossy_pool_size = '7340032' %}
11+
{% set egress_lossless_pool_size = '16777152' %}
12+
{% set egress_lossy_pool_size = '7340032' %}
13+
{% else %}
14+
{% set ingress_lossless_pool_size = '2097152' %}
15+
{% set ingress_lossy_pool_size = '5242880' %}
16+
{% set egress_lossless_pool_size = '16777152' %}
17+
{% set egress_lossy_pool_size = '5242880' %}
18+
{%endif %}
19+
{
20+
"BUFFER_POOL_TABLE:ingress_lossless_pool": {
21+
"size": "{{ ingress_lossless_pool_size }}",
22+
"type": "ingress",
23+
"mode": "dynamic"
24+
},
25+
"OP": "SET"
26+
},
727
{
828
"BUFFER_POOL_TABLE:ingress_lossy_pool": {
9-
"size": "6422528",
29+
"size": "{{ ingress_lossy_pool_size }}",
1030
"type": "ingress",
1131
"mode": "dynamic"
1232
},
1333
"OP": "SET"
1434
},
1535
{
1636
"BUFFER_POOL_TABLE:egress_lossless_pool": {
17-
"size": "7291456",
37+
"size": "{{ egress_lossless_pool_size }}",
1838
"type": "egress",
1939
"mode": "dynamic"
2040
},
2141
"OP": "SET"
2242
},
2343
{
2444
"BUFFER_POOL_TABLE:egress_lossy_pool": {
25-
"size": "8254464",
45+
"size": "{{ egress_lossy_pool_size }}",
2646
"type": "egress",
2747
"mode": "dynamic"
2848
},
@@ -32,15 +52,15 @@
3252
"BUFFER_PROFILE_TABLE:ingress_lossless_profile": {
3353
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
3454
"size":"0",
35-
"dynamic_th":"1"
55+
"dynamic_th":"0"
3656
},
3757
"OP": "SET"
3858
},
3959
{
4060
"BUFFER_PROFILE_TABLE:ingress_lossy_profile": {
4161
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
4262
"size":"0",
43-
"dynamic_th":"7"
63+
"dynamic_th":"3"
4464
},
4565
"OP": "SET"
4666
},
@@ -56,15 +76,15 @@
5676
"BUFFER_PROFILE_TABLE:egress_lossy_profile": {
5777
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
5878
"size":"4096",
59-
"dynamic_th":"7"
79+
"dynamic_th":"3"
6080
},
6181
"OP": "SET"
6282
},
6383
{
6484
"BUFFER_PROFILE_TABLE:pg_lossy_profile": {
6585
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
6686
"size":"0",
67-
"dynamic_th":"7"
87+
"dynamic_th":"3"
6888
},
6989
"OP": "SET"
7090
},
@@ -80,7 +100,7 @@
80100
"BUFFER_PROFILE_TABLE:q_lossy_profile": {
81101
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
82102
"size":"0",
83-
"dynamic_th":"7"
103+
"dynamic_th":"3"
84104
},
85105
"OP": "SET"
86106
},
@@ -98,7 +118,6 @@
98118
},
99119

100120
{# The following template part is for variable PG profile configuration #}
101-
{% set non_pg_lossless_pool_size = 866726 %}
102121
{% set pg_range = '3-4' %}
103122
{# Lists of supported speed and cable length #}
104123
{% set supported_speed = [10000, 25000, 40000, 50000, 100000] %}
@@ -129,23 +148,23 @@
129148
{# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #}
130149
{# Only those which were actually used will be created in SAI #}
131150
{%- set pg_profiles = {
132-
'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 },
133-
'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 },
134-
'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 },
135-
'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 },
136-
'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 },
151+
'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 },
152+
'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 },
153+
'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 },
154+
'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 },
155+
'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 },
137156

138-
'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 },
139-
'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 1 },
140-
'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 },
141-
'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 },
142-
'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 1 },
157+
'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 },
158+
'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 },
159+
'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 },
160+
'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 },
161+
'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 },
143162

144-
'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 1 },
145-
'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 1 },
146-
'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 },
147-
'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 },
148-
'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 1 },
163+
'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 },
164+
'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 },
165+
'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 },
166+
'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 },
167+
'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 },
149168
}
150169
-%}
151170

@@ -159,13 +178,11 @@
159178
}
160179
%}
161180

162-
{% set switch_role = DEVICE_METADATA['localhost']['type'] %}
163-
164-
{%- macro cable_length(port_name) -%}
181+
{% macro cable_length(port_name) -%}
165182
{%- set cable_len = [] -%}
166183
{%- for local_port in DEVICE_NEIGHBOR -%}
167184
{%- if local_port == port_name -%}
168-
{%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
185+
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
169186
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
170187
{%- set neighbor_role = neighbor.type -%}
171188
{%- set roles1 = switch_role + '_' + neighbor_role %}
@@ -201,7 +218,6 @@
201218
{{ new_speed.0 }}_{{ new_cable.0 }}
202219
{%- endmacro -%}
203220

204-
{% set ingress_lossless_pg_pool_size = [] %}
205221
{% set used_pg_profiles = [] %}
206222
{% for port in PORT %}
207223
{%- if PORT[port].speed -%}
@@ -215,9 +231,8 @@
215231
{% set port_config = find_closest_greater_config(speed, cable) -%}
216232
{%- endif -%}
217233
{% set profile = portconfig2profile[port_config] -%}
218-
{% if ingress_lossless_pg_pool_size.append(pg_profiles[profile]['size']) %}{% endif %}
219234
{# add to list profiles which were actually used #}
220-
{%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%}
235+
{%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %}
221236
{
222237
"BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": {
223238
"profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]"
@@ -240,17 +255,7 @@
240255
},
241256
"OP": "SET"
242257
},
243-
{% endfor -%}
244-
245-
{# Lossless pool declaration #}
246-
{
247-
"BUFFER_POOL_TABLE:ingress_lossless_pool": {
248-
"size": "{{ ingress_lossless_pg_pool_size | sum + non_pg_lossless_pool_size }}",
249-
"type": "ingress",
250-
"mode": "dynamic"
251-
},
252-
"OP": "SET"
253-
},
258+
{% endfor %}
254259
{
255260
"BUFFER_PG_TABLE:{{ port_names }}:0-1": {
256261
"profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]"

src/sonic-config-engine/tests/sample_output/msn27.32ports.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
[
2+
{
3+
"BUFFER_POOL_TABLE:ingress_lossless_pool": {
4+
"size": "2097152",
5+
"type": "ingress",
6+
"mode": "dynamic"
7+
},
8+
"OP": "SET"
9+
},
210
{
311
"BUFFER_POOL_TABLE:ingress_lossy_pool": {
4-
"size": "6422528",
12+
"size": "5242880",
513
"type": "ingress",
614
"mode": "dynamic"
715
},
816
"OP": "SET"
917
},
1018
{
1119
"BUFFER_POOL_TABLE:egress_lossless_pool": {
12-
"size": "7291456",
20+
"size": "16777152",
1321
"type": "egress",
1422
"mode": "dynamic"
1523
},
1624
"OP": "SET"
1725
},
1826
{
1927
"BUFFER_POOL_TABLE:egress_lossy_pool": {
20-
"size": "8254464",
28+
"size": "5242880",
2129
"type": "egress",
2230
"mode": "dynamic"
2331
},
@@ -27,15 +35,15 @@
2735
"BUFFER_PROFILE_TABLE:ingress_lossless_profile": {
2836
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
2937
"size":"0",
30-
"dynamic_th":"1"
38+
"dynamic_th":"0"
3139
},
3240
"OP": "SET"
3341
},
3442
{
3543
"BUFFER_PROFILE_TABLE:ingress_lossy_profile": {
3644
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
3745
"size":"0",
38-
"dynamic_th":"7"
46+
"dynamic_th":"3"
3947
},
4048
"OP": "SET"
4149
},
@@ -51,15 +59,15 @@
5159
"BUFFER_PROFILE_TABLE:egress_lossy_profile": {
5260
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
5361
"size":"4096",
54-
"dynamic_th":"7"
62+
"dynamic_th":"3"
5563
},
5664
"OP": "SET"
5765
},
5866
{
5967
"BUFFER_PROFILE_TABLE:pg_lossy_profile": {
6068
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
6169
"size":"0",
62-
"dynamic_th":"7"
70+
"dynamic_th":"3"
6371
},
6472
"OP": "SET"
6573
},
@@ -75,7 +83,7 @@
7583
"BUFFER_PROFILE_TABLE:q_lossy_profile": {
7684
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
7785
"size":"0",
78-
"dynamic_th":"7"
86+
"dynamic_th":"3"
7987
},
8088
"OP": "SET"
8189
},
@@ -293,15 +301,7 @@
293301
"xon":"18432",
294302
"xoff":"75776",
295303
"size":"94208",
296-
"dynamic_th":"1"
297-
},
298-
"OP": "SET"
299-
},
300-
{
301-
"BUFFER_POOL_TABLE:ingress_lossless_pool": {
302-
"size": "3881382",
303-
"type": "ingress",
304-
"mode": "dynamic"
304+
"dynamic_th":"0"
305305
},
306306
"OP": "SET"
307307
},

0 commit comments

Comments
 (0)