Skip to content

Commit

Permalink
[Mellanox][202012] Support Mellanox-SN4600C-C64 as T1 switch in dual-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
stephenxs committed Jun 21, 2022
1 parent 54de99b commit 307d0e2
Show file tree
Hide file tree
Showing 14 changed files with 13,059 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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"
Expand All @@ -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 -%}
Expand All @@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}

Expand All @@ -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 %}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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' %}
16 changes: 9 additions & 7 deletions files/build_templates/buffers_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -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 %}
Expand Down
12 changes: 12 additions & 0 deletions files/build_templates/qos_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 %}
Expand Down
Loading

0 comments on commit 307d0e2

Please sign in to comment.