From 4ee9565064ae1635c88cb310709e39006d553786 Mon Sep 17 00:00:00 2001 From: Alpesh Patel Date: Thu, 31 Aug 2023 14:30:20 -0400 Subject: [PATCH] qos template change for backend compute-ai deployment (#16150) #### Why I did it To enable qos config for a certain backend deployment mode, for resource-type "Compute-AI". This deployment has the following requirement: - Config below enabled if DEVICE_TYPE as one of backend_device_types - Config below enabled if ResourceType is 'Compute-AI' - 2 lossless TCs' (2, 3) - 2 lossy TCs' (0,1) - DSCP to TC map uses 4 DSCP code points and maps to the TCs' as follows: "DSCP_TO_TC_MAP": { "AZURE": { "48" : "0", "46" : "1", "3" : "3", "4" : "4" } } - WRED profile has green {min/max/mark%} as {2M/10M/5%} This required template change in addition to the vendor qos.json.j2 file (not included here). ### How I did it #### How to verify it - with the above change and the vendor config change, generated the qos.json file and verified that the objective stated in "Why I did it" was met - verified no error ### Description for the changelog Update qos_config.j2 for Comptue-AI deployment on one of backend device type roles --- files/build_templates/qos_config.j2 | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 44b13763632d..9a3741a397db 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -79,6 +79,12 @@ { {% if (generate_tc_to_pg_map is defined) and tunnel_qos_remap_enable %} {{- generate_tc_to_pg_map() }} +{% elif (generate_tc_to_pg_map is defined) and + ('type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['type'] in backend_device_types) and + ('resource_type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %} + {{- generate_tc_to_pg_map() }} {% else %} "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -137,6 +143,12 @@ }, {% elif (generate_dscp_to_tc_map is defined) and tunnel_qos_remap_enable %} {{- generate_dscp_to_tc_map() }} +{% elif (generate_dscp_to_tc_map is defined) and + ('type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['type'] in backend_device_types) and + ('resource_type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %} + {{- generate_dscp_to_tc_map() }} {% else %} "DSCP_TO_TC_MAP": { "AZURE": { @@ -225,6 +237,29 @@ "weight": "100" } }, +{% elif (generate_tc_to_pg_map is defined) and + ('type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['type'] in backend_device_types) and + ('resource_type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %} + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "40" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "30" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "25" + }, + "scheduler.3": { + "type" : "DWRR", + "weight": "5" + } + }, {% else %} "SCHEDULER": { "scheduler.0": { @@ -368,6 +403,27 @@ } {% else %} "QUEUE": { +{% if 'type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['type'] in backend_device_types and + 'resource_type' in DEVICE_METADATA['localhost'] and + DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI' %} +{% for port in PORT_ACTIVE %} + "{{ port }}|0": { + "scheduler": "scheduler.0" + }, + "{{ port }}|1": { + "scheduler": "scheduler.1" + }, + "{{ port }}|3": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "{{ port }}|4": { + "scheduler" : "scheduler.3", + "wred_profile": "AZURE_LOSSLESS" + }{% if not loop.last %},{% endif %} +{% endfor %} +{% else %} {% for port in PORT_ACTIVE %} "{{ port }}|3": { "scheduler" : "scheduler.1", @@ -431,6 +487,7 @@ }{% if not loop.last %},{% endif %} {% endfor %} +{% endif %} } {% endif %} }