Skip to content

Commit

Permalink
[qos]: Adjust 7260 buffer sizes to accomodate extra lossless queues (s…
Browse files Browse the repository at this point in the history
…onic-net#11018)

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

Signed-off-by: Neetha John <nejo@microsoft.com>
  • Loading branch information
neethajohn authored and skbarista committed Aug 17, 2022
1 parent 8ce935a commit 4ed4939
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
{%- endfor %}
{%- endmacro %}

{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33329088",
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic",
"xoff": "7827456"
},
"egress_lossy_pool": {
"size": "26663272",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand Down Expand Up @@ -49,4 +53,4 @@

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@
{%- endfor %}
{%- endmacro %}

{%- import 'buffers_pool_sizes_t1.j2' as defs with context %}
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
{# SS Tab2 Row 71 #}
"size": "33582016",
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic",
{# SS Tab2 Row 68 #}
"xoff": "8965632"
},
"egress_lossy_pool": {
{# SS Tab2 Row 60 #}
"size": "26866112",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{%- set ingress_lossless_pool_size = '33329088' %}
{%- set egress_lossy_pool_size = '26663272' %}

{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) and
((DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('subtype' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['subtype'] == 'DualToR')) %}
{%- set ingress_lossless_pool_size = '33169344' %}
{%- set egress_lossy_pool_size = '26535808' %}
{%- endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{%- set ingress_lossless_pool_size = '33582016' %}
{%- set egress_lossy_pool_size = '26866112' %}

{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) and
((DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('type' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['type'] == 'LeafRouter')) %}
{%- set ingress_lossless_pool_size = '33262528' %}
{%- set egress_lossy_pool_size = '26610688' %}
{%- endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@
{%- endfor %}
{%- endmacro %}

{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33329088",
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic",
"xoff": "7827456"
},
"egress_lossy_pool": {
"size": "26663272",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
{%- endfor %}
{%- endmacro %}

{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33329088",
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic",
"xoff": "7827456"
},
"egress_lossy_pool": {
"size": "26663272",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
{%- endfor %}
{%- endmacro %}

{%- import 'buffers_pool_sizes_t0.j2' as defs with context %}
{%- set ingress_lossless_pool_size = defs.ingress_lossless_pool_size %}
{%- set egress_lossy_pool_size = defs.egress_lossy_pool_size %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33329088",
"size": "{{ ingress_lossless_pool_size }}",
"type": "ingress",
"mode": "dynamic",
"xoff": "7827456"
},
"egress_lossy_pool": {
"size": "26663272",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@

"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33329088",
"size": "33169344",
"type": "ingress",
"mode": "dynamic",
"xoff": "7827456"
},
"egress_lossy_pool": {
"size": "26663272",
"size": "26535808",
"type": "egress",
"mode": "dynamic"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@

"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33582016",
"size": "33262528",
"type": "ingress",
"mode": "dynamic",
"xoff": "8965632"
"xoff": "8965632"
},
"egress_lossy_pool": {
"size": "26866112",
"size": "26610688",
"type": "egress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "43481152",
"size": "43481152",
"type": "egress",
"mode": "static"
}
Expand All @@ -92,12 +92,12 @@
"ingress_lossy_profile": {
"pool":"ingress_lossless_pool",
"size":"0",
"static_th":"44302336"
"static_th":"44302336"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"0",
"static_th":"43481152"
"static_th":"43481152"
},
"egress_lossy_profile": {
"pool":"egress_lossy_pool",
Expand Down
29 changes: 28 additions & 1 deletion src/sonic-config-engine/tests/test_j2files.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@ def run_script(self, argument):
def run_diff(self, file1, file2):
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)

def create_machine_conf(self, platform, vendor):
file_exist = True
dir_exist = True
mode = {'arista': 'aboot',
'dell': 'onie',
'mellanox': 'onie'
}
echo_cmd = "echo '{}_platform={}' | sudo tee -a /host/machine.conf > /dev/null".format(mode[vendor], platform)
if not os.path.exists('/host/machine.conf'):
file_exist = False
if not os.path.isdir('/host'):
dir_exist = False
os.system('sudo mkdir /host')
os.system('sudo touch /host/machine.conf')
os.system(echo_cmd)

return file_exist, dir_exist

def remove_machine_conf(self, file_exist, dir_exist):
if not file_exist:
os.system('sudo rm -f /host/machine.conf')

if not dir_exist:
os.system('sudo rmdir /host')

def test_interfaces(self):
interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2')
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file
Expand Down Expand Up @@ -364,6 +389,7 @@ def test_config_brcm_render_template(self):
os.remove(config_test_output)

def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer_template, expected):
file_exist, dir_exist = self.create_machine_conf(platform, vendor)
dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku)
buffers_file = os.path.join(dir_path, buffer_template)
port_config_ini_file = os.path.join(dir_path, 'port_config.ini')
Expand All @@ -379,6 +405,7 @@ def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer
# cleanup
buffers_config_file_new = os.path.join(dir_path, 'buffers_config.j2')
os.remove(buffers_config_file_new)
self.remove_machine_conf(file_exist, dir_exist)

sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, expected)
assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file)
Expand Down Expand Up @@ -409,7 +436,7 @@ def test_extra_lossless_buffer_for_tunnel_remapping(self):
('arista', 'x86_64-arista_7260cx3_64', 'Arista-7260CX3-C64', 'sample-arista-7260-t1-minigraph.xml', 'buffers.json.j2', 'buffer-arista7260-t1.json'),
('arista', 'x86_64-arista_7260cx3_64', 'Arista-7260CX3-C64', 'sample-arista-7260-t1-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffer-arista7260-t1-remap-disabled.json')
]

for test_data in TEST_DATA:
self._test_buffers_render_template(vendor=test_data[0],
platform=test_data[1],
Expand Down

0 comments on commit 4ed4939

Please sign in to comment.