Skip to content

Commit

Permalink
Update qos template to support SYSTEM_DEFAULT table (sonic-net#10936)
Browse files Browse the repository at this point in the history
* Update qos template to support SYSTEM_DEFAULT table

Signed-off-by: bingwang <wang.bing@microsoft.com>
  • Loading branch information
bingwang-ms authored Jun 2, 2022
1 parent 0552d6b commit 0c9bbee
Show file tree
Hide file tree
Showing 15 changed files with 13,866 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"30": "1",
"31": "1",
"32": "1",
"33": "2",
"33": "8",
"34": "1",
"35": "1",
"36": "1",
Expand Down Expand Up @@ -101,7 +101,7 @@
"30": "1",
"31": "1",
"32": "1",
"33": "2",
"33": "8",
"34": "1",
"35": "1",
"36": "1",
Expand Down Expand Up @@ -140,12 +140,13 @@
"AZURE": {
"0": "0",
"1": "0",
"2": "0",
"2": "2",
"3": "3",
"4": "4",
"5": "0",
"6": "0",
"7": "7"
"6": "6",
"7": "7",
"8": "0"
},
"AZURE_TUNNEL": {
"0": "0",
Expand All @@ -155,7 +156,8 @@
"4": "6",
"5": "0",
"6": "0",
"7": "0"
"7": "0",
"8": "0"
}
},
{%- endmacro %}
Expand All @@ -164,12 +166,13 @@
"AZURE": {
"0": "0",
"1": "1",
"2": "1",
"2": "1",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
"7": "7",
"8": "1"
},
"AZURE_TUNNEL": {
"0": "0",
Expand All @@ -179,7 +182,8 @@
"4": "6",
"5": "5",
"6": "1",
"7": "7"
"7": "7",
"8": "1"
}
},
{%- endmacro %}
Expand All @@ -188,15 +192,15 @@
"AZURE_TUNNEL": {
"0": "8",
"1": "0",
"2": "33",
"2": "0",
"3": "2",
"4": "6",
"5": "46",
"6": "0",
"7": "48"
"7": "48",
"8": "33"
}
},
{%- endmacro %}
{% endif %}

{%- include 'qos_config.j2' %}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"30": "1",
"31": "1",
"32": "1",
"33": "2",
"33": "8",
"34": "1",
"35": "1",
"36": "1",
Expand Down Expand Up @@ -186,7 +186,7 @@
"30": "1",
"31": "1",
"32": "1",
"33": "2",
"33": "8",
"34": "1",
"35": "1",
"36": "1",
Expand Down Expand Up @@ -225,12 +225,13 @@
"AZURE": {
"0": "0",
"1": "0",
"2": "0",
"2": "2",
"3": "3",
"4": "4",
"5": "0",
"6": "0",
"7": "7"
"6": "6",
"7": "7",
"8": "0"
},
"AZURE_TUNNEL": {
"0": "0",
Expand All @@ -240,7 +241,8 @@
"4": "6",
"5": "0",
"6": "0",
"7": "0"
"7": "0",
"8": "0"
}
},
{%- endmacro %}
Expand All @@ -254,7 +256,8 @@
"4": "4",
"5": "5",
"6": "6",
"7": "7"
"7": "7",
"8": "1"
},
"AZURE_TUNNEL": {
"0": "0",
Expand All @@ -264,7 +267,8 @@
"4": "6",
"5": "5",
"6": "1",
"7": "7"
"7": "7",
"8": "1"
}
},
{%- endmacro %}
Expand All @@ -273,12 +277,13 @@
"AZURE_TUNNEL": {
"0": "8",
"1": "0",
"2": "33",
"2": "0",
"3": "2",
"4": "6",
"5": "46",
"6": "0",
"7": "48"
"7": "48",
"8": "33"
}
},
{%- endmacro %}
Expand Down
34 changes: 20 additions & 14 deletions files/build_templates/qos_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') -%}

{%- set tunnel_qos_remap_enable = false %}
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) %}
{%- set tunnel_qos_remap_enable = true %}
{%- endif %}

{%- set port_names_list_extra_queues = [] %}
{%- for port in PORT_ACTIVE %}
{% if (generate_dscp_to_tc_map is defined) and ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'ToRRouter') or
('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'LeafRouter') %}
{% if ((generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable) and
(('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'ToRRouter') or
('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'LeafRouter')) %}
{%- if port_names_list_extra_queues.append(port) %}{%- endif %}
{% endif %}
{% endif %}
{%- endfor %}

{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%}
Expand All @@ -43,7 +49,7 @@


{
{% if generate_tc_to_pg_map is defined %}
{% if (generate_tc_to_pg_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_pg_map() }}
{% else %}
"TC_TO_PRIORITY_GROUP_MAP": {
Expand Down Expand Up @@ -71,7 +77,7 @@
"7": "7"
}
},
{% if generate_tc_to_queue_map is defined %}
{% if (generate_tc_to_queue_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_queue_map() }}
{% else %}
"TC_TO_QUEUE_MAP": {
Expand Down Expand Up @@ -100,7 +106,7 @@
"7": "7"
}
},
{% elif generate_dscp_to_tc_map is defined %}
{% elif (generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable %}
{{- generate_dscp_to_tc_map() }}
{% else %}
"DSCP_TO_TC_MAP": {
Expand Down Expand Up @@ -172,7 +178,7 @@
}
},
{% endif %}
{% if generate_tc_to_dscp_map is defined %}
{% if (generate_tc_to_dscp_map is defined) and tunnel_qos_remap_enable %}
{{- generate_tc_to_dscp_map() }}
{% endif %}
{% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %}
Expand Down Expand Up @@ -289,12 +295,12 @@
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|2": {
{% if port in port_names_list_extra_queues %}
{% if port in port_names_list_extra_queues %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
{% else %}
"scheduler": "scheduler.0"
{% endif %}
{% endif %}
},
{% endfor %}
{% for port in PORT_ACTIVE %}
Expand All @@ -304,12 +310,12 @@
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|6": {
{% if port in port_names_list_extra_queues %}
{% if port in port_names_list_extra_queues %}
"scheduler" : "scheduler.1",
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"wred_profile": "AZURE_LOSSLESS"
{% else %}
"scheduler": "scheduler.0"
{% endif %}
{% endif %}
}{% if not loop.last %},{% endif %}

{% endfor %}
Expand Down
Loading

0 comments on commit 0c9bbee

Please sign in to comment.