[Mellanox][202012] Support Mellanox-SN4600C-C64 as T1 switch in dual-ToR scenario (#11032)

Why I did it
Support Mellanox-SN4600C-C64 as T1 switch in dual-ToR scenario

1. Support additional queue and PG in buffer templates, including both traditional and dynamic model
2. Support mapping DSCP 2/6 to lossless traffic in the QoS template.
3. Add macros to generate additional lossless PG in the dynamic model
4. Adjust the order in which the generic/dedicated (with additional lossless queues) macros are checked and called to generate buffer tables in common template buffers_config.j2
  - Buffer tables are rendered via using macros.
  - Both generic and dedicated macros are defined on our platform. Currently, the generic one is called as long as it is defined, which causes the generic one always being called on our platform. To avoid it, the dedicated macrio is checked and called first and then the generic ones.
5. Support MAP_PFC_PRIORITY_TO_PRIORITY_GROUP on ports with additional lossless queues.

On Mellanox-SN4600C-C64, buffer configuration for t1 is calculated as:
40 * 100G downlink ports with 4 lossless PGs/queues, 1 lossy PG, and 3 lossy queues
16 * 100G uplink ports with 2 lossless PGs/queues, 1 lossy PG, and 5 lossy queues

Signed-off-by: Stephen Sun stephens@nvidia.com

How to verify it
Run regression test.
This commit is contained in:
Stephen Sun 2022-06-22 01:04:49 +08:00 committed by GitHub
parent 54de99ba23
commit 307d0e2aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 13059 additions and 17 deletions

View File

@ -124,24 +124,55 @@
}
{%- endmacro %}
{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %}
{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) %}
"BUFFER_QUEUE": {
{% set q_loop = namespace(last_valid=false) %}
{% for port in port_names_active.split(',') %}
{% if port not in port_names_extra_queues.split(',') %}
"{{ port }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
{% endif %}
{% endfor %}
{% for port in port_names_active.split(',') %}
{% if port not in port_names_extra_queues.split(',') %}
"{{ port }}|0-2": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
},
{% endif %}
{% endfor %}
{% for port in port_names_active.split(',') %}
{% if port not in port_names_extra_queues.split(',') %}
"{{ port }}|5-6": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% set q_loop.last_valid = true %}
{% else %}
{% set q_loop.last_valid = false %}
{% endif %}
{% endfor %}
{% if port_names_extra_queues|length > 0 %}
{% if q_loop.last_valid %},{% endif %}
{% for port in port_names_extra_queues.split(',') %}
"{{ port }}|0-1": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
},
"{{ port }}|2-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
"{{ port }}|5": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
},
"{{ port }}|6": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
"{{ port }}|7": {
"profile" : "[BUFFER_PROFILE|q_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if port_names_inactive|length > 0 %}
,
{% if dynamic_mode is defined %}
@ -183,9 +214,15 @@
}
{%- endmacro %}
{%- macro generate_pg_profiles(port_names_active, port_names_inactive) %}
{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %}
{{ generate_queue_buffers_with_extra_lossless_queues(port_names_active, "", port_names_inactive) }}
{%- endmacro %}
{%- macro generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) %}
"BUFFER_PG": {
{% set pg_loop = namespace(last_valid=false) %}
{% for port in port_names_active.split(',') %}
{% if port not in port_names_extra_pgs.split(',') %}
{% if dynamic_mode is defined %}
"{{ port }}|3-4": {
"profile" : "NULL"
@ -195,7 +232,28 @@
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% set pg_loop.last_valid = true %}
{% else %}
{% set pg_loop.last_valid = false %}
{% endif %}
{% endfor %}
{% if port_names_extra_pgs|length > 0 %}
{% if pg_loop.last_valid %},{% endif %}
{% for port in port_names_extra_pgs.split(',') %}
{% if dynamic_mode is defined %}
"{{ port }}|2-4": {
"profile" : "NULL"
},
"{{ port }}|6": {
"profile" : "NULL"
},
{% endif %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if port_names_inactive|length > 0 %}
{%- for port in port_names_inactive.split(',') %}
{%- if loop.first -%},{%- endif -%}
@ -216,3 +274,7 @@
{% endif %}
}
{%- endmacro %}
{%- macro generate_pg_profiles(port_names_active, port_names_inactive) %}
{{ generate_pg_profiles_with_extra_lossless_pgs(port_names_active, "", port_names_inactive) }}
{%- endmacro %}

View File

@ -1,8 +1,15 @@
{% set default_cable = '5m' %}
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) -%}
{% set ingress_lossless_pool_size = '44130304' %}
{% set ingress_lossless_pool_xoff = '8790016' %}
{% set egress_lossless_pool_size = '60817392' %}
{% set egress_lossy_pool_size = '44130304' %}
{%- else -%}
{% set ingress_lossless_pool_size = '48332800' %}
{% set ingress_lossless_pool_xoff = '5275648' %}
{% set egress_lossless_pool_size = '60817392' %}
{% set egress_lossy_pool_size = '48332800' %}
{%- endif -%}
{% import 'buffers_defaults_objects.j2' as defs with context %}
@ -14,10 +21,18 @@
{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }}
{%- endmacro %}
{%- macro generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues, port_names_inactive) }}
{%- endmacro %}
{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %}
{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }}
{%- endmacro %}
{%- macro generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_pgs, port_names_inactive) %}
{{ defs.generate_pg_profiles_with_extra_lossless_pgs(port_names_active, port_names_extra_pgs, port_names_inactive) }}
{%- endmacro %}
{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %}
{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }}
{%- endmacro %}

View File

@ -1 +0,0 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2

View File

@ -0,0 +1,92 @@
{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %}
{%- macro generate_dscp_to_tc_map() %}
"DSCP_TO_TC_MAP": {
"AZURE": {
"0" : "1",
"1" : "1",
"2" : "2",
"3" : "3",
"4" : "4",
"5" : "1",
"6" : "6",
"7" : "1",
"8" : "0",
"9" : "1",
"10": "1",
"11": "1",
"12": "1",
"13": "1",
"14": "1",
"15": "1",
"16": "1",
"17": "1",
"18": "1",
"19": "1",
"20": "1",
"21": "1",
"22": "1",
"23": "1",
"24": "1",
"25": "1",
"26": "1",
"27": "1",
"28": "1",
"29": "1",
"30": "1",
"31": "1",
"32": "1",
"33": "1",
"34": "1",
"35": "1",
"36": "1",
"37": "1",
"38": "1",
"39": "1",
"40": "1",
"41": "1",
"42": "1",
"43": "1",
"44": "1",
"45": "1",
"46": "5",
"47": "1",
"48": "7",
"49": "1",
"50": "1",
"51": "1",
"52": "1",
"53": "1",
"54": "1",
"55": "1",
"56": "1",
"57": "1",
"58": "1",
"59": "1",
"60": "1",
"61": "1",
"62": "1",
"63": "1"
}
},
{%- endmacro %}
{%- macro generate_tc_to_pg_map() %}
"TC_TO_PRIORITY_GROUP_MAP": {
"AZURE": {
"0": "0",
"1": "0",
"2": "2",
"3": "3",
"4": "4",
"5": "0",
"6": "6",
"7": "0"
}
},
{%- endmacro %}
{%- macro generate_global_dscp_to_tc_map() %}
{# This is an empty macro since the global DSCP_TO_TC map is not required #}
{%- endmacro %}
{% endif %}
{%- include 'qos_config.j2' %}

View File

@ -167,14 +167,16 @@ def
{{ defs.generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) }},
{% endif %}
{%- if defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% if (defs.generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_pg_profiles_with_extra_lossless_pgs_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }},
{% elif defs.generate_pg_profiles_with_inactive_ports is defined %}
{{ defs.generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) }},
{% elif (defs.generate_pg_buffers_with_extra_lossy_pgs is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_pg_buffers_with_extra_lossy_pgs(port_names_active, port_names_extra_queues) }}
{% elif (defs.generate_pg_buffers_with_extra_lossy_pgs_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_pg_buffers_with_extra_lossy_pgs_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
{% elif defs.generate_pg_profils is defined %}
{{ defs.generate_pg_profils(port_names_active) }}
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
@ -191,14 +193,14 @@ def
},
{% endif %}
{% if defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% elif defs.generate_queue_buffers_with_inactive_ports is defined %}
{{ defs.generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) }}
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{% if (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues) }}
{% elif defs.generate_queue_buffers is defined %}
{{ defs.generate_queue_buffers(port_names_active) }}
{% elif defs.generate_queue_buffers_with_inactive_ports is defined %}
{{ defs.generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}

View File

@ -207,6 +207,14 @@
{% endif %}
{% if asic_type in pfc_to_pg_map_supported_asics %}
"PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": {
{% if port_names_list_extra_queues|length > 0 %}
"AZURE_DUALTOR": {
"2": "2",
"3": "3",
"4": "4",
"6": "6"
},
{% endif %}
"AZURE": {
"3": "3",
"4": "4"
@ -232,8 +240,12 @@
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
{% if asic_type in pfc_to_pg_map_supported_asics %}
{% if port in port_names_list_extra_queues %}
"pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE_DUALTOR]",
{% else %}
"pfc_to_pg_map" : "[PFC_PRIORITY_TO_PRIORITY_GROUP_MAP|AZURE]",
{% endif %}
{% endif %}
{% if port in port_names_list_extra_queues %}
"pfc_enable" : "2,3,4,6",
{% else %}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@ class TestJ2Files(TestCase):
os.remove(buffers_config_file_new)
sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'buffers-mellanox2700.json')
assert filecmp.cmp(sample_output_file, self.output_file)
assert utils.cmp(sample_output_file, self.output_file)
def test_buffers_mellanox2410_render_template(self):
# Mellanox buffer template rendering for double ingress pools mode
@ -348,7 +348,7 @@ class TestJ2Files(TestCase):
os.remove(buffers_config_file_new)
sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'buffers-mellanox2410.json')
assert filecmp.cmp(sample_output_file, self.output_file)
assert utils.cmp(sample_output_file, self.output_file)
def test_config_brcm_render_template(self):
if utils.PYvX_DIR != 'py3':
@ -428,7 +428,11 @@ class TestJ2Files(TestCase):
('arista', 'x86_64-arista_7260cx3_64', 'Arista-7260CX3-D108C8', 'sample-arista-7260-dualtor-minigraph.xml', 'buffers.json.j2', 'buffer-arista7260-dualtor.json'),
('arista', 'x86_64-arista_7260cx3_64', 'Arista-7260CX3-D108C8', 'sample-arista-7260-dualtor-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffer-arista7260-dualtor-remap-disabled.json'),
('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')
('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'),
('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t1-dynamic.json'),
('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t1.json'),
('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox4600c-t1-dynamic-remap-disabled.json'),
('mellanox', 'x86_64-mlnx_msn4600c-r0', 'Mellanox-SN4600C-C64', 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', 'buffers.json.j2', 'buffers-mellanox4600c-t1-remap-disabled.json')
]
for test_data in TEST_DATA:
@ -450,15 +454,19 @@ class TestJ2Files(TestCase):
'../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64',
'../../../device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8',
'../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8',
'../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64'
]
'../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64',
'../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64',
'../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64'
]
sample_outputs = [
'qos-arista7050cx3-dualtor.json',
'qos-arista7260-dualtor.json',
'qos-arista7260-t1.json',
'qos-arista7050cx3-dualtor-remap-disabled.json',
'qos-arista7260-dualtor-remap-disabled.json',
'qos-arista7260-t1-remap-disabled.json'
'qos-arista7260-t1-remap-disabled.json',
'qos-mellanox4600c-c64.json',
'qos-mellanox4600c-c64-remap-disabled.json'
]
sample_minigraph_files = [
'sample-arista-7050cx3-dualtor-minigraph.xml',
@ -466,8 +474,11 @@ class TestJ2Files(TestCase):
'sample-arista-7260-t1-minigraph.xml',
'sample-arista-7050cx3-dualtor-minigraph-remap-disabled.xml',
'sample-arista-7260-dualtor-minigraph-remap-disabled.xml',
'sample-arista-7260-t1-minigraph-remap-disabled.xml'
'sample-arista-7260-t1-minigraph-remap-disabled.xml',
'sample-mellanox-4600c-t1-minigraph.xml',
'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml'
]
for i, path in enumerate(dir_paths):
device_template_path = os.path.join(self.test_dir, path)
sample_output = sample_outputs[i]