Skip to content

Commit 881796f

Browse files
authored
[202012] Adjust 7260 buffer sizes to accomodate extra lossless queues (#11050)
Backport changes from #11018 Signed-off-by: Neetha John <[email protected]> Why I did it As part of PCBB changes, we need to enable 2 extra lossless queues. The changes in this PR are done to adjust only the reserved sizes on Th2 for the additional 2 lossless queues Calculations are done based on 40 downlinks for T1 and 16 uplinks for dual ToR How to verify it Verified that the rendering works fine on Th2 dut Unit tests have been updated to reflect the modified buffer sizes when pcbb is enabled. There are existing testcases that will test the original buffer sizes when pcbb is disabled. With these changes, was able to build sonic-config-engine wheel successfully
1 parent 2faabf4 commit 881796f

File tree

12 files changed

+81
-16
lines changed

12 files changed

+81
-16
lines changed

device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t0.j2

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
{%- endfor %}
88
{%- endmacro %}
99

10+
{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
11+
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
12+
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}
13+
1014
{%- macro generate_buffer_pool_and_profiles() %}
1115
"BUFFER_POOL": {
1216
"ingress_lossless_pool": {
13-
"size": "33329088",
17+
"size": "{{ ingress_lossless_pool_size }}",
1418
"type": "ingress",
1519
"mode": "dynamic",
1620
"xoff": "7827456"
1721
},
1822
"egress_lossy_pool": {
19-
"size": "26663272",
23+
"size": "{{ egress_lossy_pool_size }}",
2024
"type": "egress",
2125
"mode": "dynamic"
2226
},

device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
{%- endfor %}
88
{%- endmacro %}
99

10+
{%- import 'buffers_pool_sizes_t1.j2' as defs with context %}
11+
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
12+
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}
13+
1014
{%- macro generate_buffer_pool_and_profiles() %}
1115
"BUFFER_POOL": {
1216
"ingress_lossless_pool": {
1317
{# SS Tab2 Row 71 #}
14-
"size": "33582016",
18+
"size": "{{ ingress_lossless_pool_size }}",
1519
"type": "ingress",
1620
"mode": "dynamic",
1721
{# SS Tab2 Row 68 #}
1822
"xoff": "8965632"
1923
},
2024
"egress_lossy_pool": {
2125
{# SS Tab2 Row 60 #}
22-
"size": "26866112",
26+
"size": "{{ egress_lossy_pool_size }}",
2327
"type": "egress",
2428
"mode": "dynamic"
2529
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{%- set ingress_lossless_pool_size = '33329088' %}
2+
{%- set egress_lossy_pool_size = '26663272' %}
3+
4+
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) and
5+
((DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('subtype' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %}
6+
{%- set ingress_lossless_pool_size = '33169344' %}
7+
{%- set egress_lossy_pool_size = '26535808' %}
8+
{%- endif %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{%- set ingress_lossless_pool_size = '33582016' %}
2+
{%- set egress_lossy_pool_size = '26866112' %}
3+
4+
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) and
5+
((DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('type' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['type'] == 'LeafRouter')) %}
6+
{%- set ingress_lossless_pool_size = '33262528' %}
7+
{%- set egress_lossy_pool_size = '26610688' %}
8+
{%- endif %}

device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/buffers_defaults_t0.j2

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@
1515
{%- endfor %}
1616
{%- endmacro %}
1717

18+
{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
19+
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
20+
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}
21+
1822
{%- macro generate_buffer_pool_and_profiles() %}
1923
"BUFFER_POOL": {
2024
"ingress_lossless_pool": {
21-
"size": "33329088",
25+
"size": "{{ ingress_lossless_pool_size }}",
2226
"type": "ingress",
2327
"mode": "dynamic",
2428
"xoff": "7827456"
2529
},
2630
"egress_lossy_pool": {
27-
"size": "26663272",
31+
"size": "{{ egress_lossy_pool_size }}",
2832
"type": "egress",
2933
"mode": "dynamic"
3034
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Arista-7260CX3-C64/buffers_pool_sizes_t0.j2

device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t0.j2

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
{%- endfor %}
88
{%- endmacro %}
99

10+
{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
11+
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
12+
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}
13+
1014
{%- macro generate_buffer_pool_and_profiles() %}
1115
"BUFFER_POOL": {
1216
"ingress_lossless_pool": {
13-
"size": "33329088",
17+
"size": "{{ ingress_lossless_pool_size }}",
1418
"type": "ingress",
1519
"mode": "dynamic",
1620
"xoff": "7827456"
1721
},
1822
"egress_lossy_pool": {
19-
"size": "26663272",
23+
"size": "{{ egress_lossy_pool_size }}",
2024
"type": "egress",
2125
"mode": "dynamic"
2226
},

device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
{%- endfor %}
88
{%- endmacro %}
99

10+
{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
11+
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
12+
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}
13+
1014
{%- macro generate_buffer_pool_and_profiles() %}
1115
"BUFFER_POOL": {
1216
"ingress_lossless_pool": {
13-
"size": "33329088",
17+
"size": "{{ ingress_lossless_pool_size }}",
1418
"type": "ingress",
1519
"mode": "dynamic",
1620
"xoff": "7827456"
1721
},
1822
"egress_lossy_pool": {
19-
"size": "26663272",
23+
"size": "{{ egress_lossy_pool_size }}",
2024
"type": "egress",
2125
"mode": "dynamic"
2226
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Arista-7260CX3-C64/buffers_pool_sizes_t0.j2

src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-dualtor.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@
128128

129129
"BUFFER_POOL": {
130130
"ingress_lossless_pool": {
131-
"size": "33329088",
131+
"size": "33169344",
132132
"type": "ingress",
133133
"mode": "dynamic",
134134
"xoff": "7827456"
135135
},
136136
"egress_lossy_pool": {
137-
"size": "26663272",
137+
"size": "26535808",
138138
"type": "egress",
139139
"mode": "dynamic"
140140
},

src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-t1.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@
7272

7373
"BUFFER_POOL": {
7474
"ingress_lossless_pool": {
75-
"size": "33582016",
75+
"size": "33262528",
7676
"type": "ingress",
7777
"mode": "dynamic",
78-
"xoff": "8965632"
78+
"xoff": "8965632"
7979
},
8080
"egress_lossy_pool": {
81-
"size": "26866112",
81+
"size": "26610688",
8282
"type": "egress",
8383
"mode": "dynamic"
8484
},
8585
"egress_lossless_pool": {
86-
"size": "43481152",
86+
"size": "43481152",
8787
"type": "egress",
8888
"mode": "static"
8989
}

src/sonic-config-engine/tests/test_j2files.py

+27
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ def run_script(self, argument):
4444
def run_diff(self, file1, file2):
4545
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)
4646

47+
def create_machine_conf(self, platform, vendor):
48+
file_exist = True
49+
dir_exist = True
50+
mode = {'arista': 'aboot',
51+
'dell': 'onie',
52+
'mellanox': 'onie'
53+
}
54+
echo_cmd = "echo '{}_platform={}' | sudo tee -a /host/machine.conf > /dev/null".format(mode[vendor], platform)
55+
if not os.path.exists('/host/machine.conf'):
56+
file_exist = False
57+
if not os.path.isdir('/host'):
58+
dir_exist = False
59+
os.system('sudo mkdir /host')
60+
os.system('sudo touch /host/machine.conf')
61+
os.system(echo_cmd)
62+
63+
return file_exist, dir_exist
64+
65+
def remove_machine_conf(self, file_exist, dir_exist):
66+
if not file_exist:
67+
os.system('sudo rm -f /host/machine.conf')
68+
69+
if not dir_exist:
70+
os.system('sudo rmdir /host')
71+
4772
def test_interfaces(self):
4873
interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2')
4974
argument = '-m ' + self.t0_minigraph + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file
@@ -312,6 +337,7 @@ def test_buffers_mellanox2410_render_template(self):
312337
assert filecmp.cmp(sample_output_file, self.output_file)
313338

314339
def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer_template, expected):
340+
file_exist, dir_exist = self.create_machine_conf(platform, vendor)
315341
dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku)
316342
buffers_file = os.path.join(dir_path, buffer_template)
317343
port_config_ini_file = os.path.join(dir_path, 'port_config.ini')
@@ -327,6 +353,7 @@ def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer
327353
# cleanup
328354
buffers_config_file_new = os.path.join(dir_path, 'buffers_config.j2')
329355
os.remove(buffers_config_file_new)
356+
self.remove_machine_conf(file_exist, dir_exist)
330357

331358
sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, expected)
332359
assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file)

0 commit comments

Comments
 (0)