Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust 7260 buffer sizes to accomodate extra lossless queues #11018

Merged
merged 7 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = '33182656' %}
{%- set egress_lossy_pool_size = '26546624' %}
{%- 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,13 +72,13 @@

"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "33582016",
neethajohn marked this conversation as resolved.
Show resolved Hide resolved
"size": "33182656",
"type": "ingress",
"mode": "dynamic",
"xoff": "8965632"
},
"egress_lossy_pool": {
"size": "26866112",
"size": "26546624",
"type": "egress",
"mode": "dynamic"
},
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 @@ -333,6 +358,7 @@ def test_qos_dscp_remapping_render_template(self):
os.remove(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 @@ -348,6 +374,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 @@ -378,7 +405,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