From 84aca008479fe678a6264324e57b1dbadda6bdc8 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Mon, 1 Aug 2022 23:59:45 +0800 Subject: [PATCH] [202012]Support different `DSCP_TO_TC_MAP` for T1 in dualtor deployment (#11580) Why I did it This PR is to backport #11569 into 202012 branch. This PR is to apply different DSCP_TO_TC_MAP to downlink and uplink ports on T1 in dualtor deployment. For T1 downlink ports (To T0) The DSCP_TO_TC_MAP is not changed. DSCP2 and DSCP6 are mapped to TC2 and TC6 respectively. For T1 uplink ports (To T1) A new DSCP_TO_TC_MAP|AZURE_UPLINK is defined and applied. DSCP2 and DSCP6 are mapped to TC1 to avoid mixing up lossy and lossless traffic from T2. The extra lossy PG2 and PG6 added in PR #11157 is reverted as well because no traffic from T2 is mapped to PG2 or PG6 now. How I did it Define a new map DSCP_TO_TC_MAP|AZURE_UPLINK for 7260 T1. How to verify it Verified by test case in test_j2files.py. --- .../Arista-7260CX3-C64/buffers_extra_pgs.j2 | 20 ----- .../Arista-7260CX3-Q64/buffers_extra_pgs.j2 | 1 - .../th2/7260/BALANCED/buffers_defaults_t1.j2 | 4 - .../profiles/th2/7260/BALANCED/qos.json.j2 | 67 +++++++++++++++ .../7260/RDMA-CENTRIC/buffers_defaults_t1.j2 | 5 +- .../th2/7260/RDMA-CENTRIC/qos.json.j2 | 66 +++++++++++++++ files/build_templates/buffers_config.j2 | 4 - .../py3/buffer-arista7260-t1.json | 48 ----------- .../sample_output/py3/qos-arista7260-t1.json | 82 +++++++++++++++++-- 9 files changed, 208 insertions(+), 89 deletions(-) delete mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 delete mode 120000 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 deleted file mode 100644 index f827095cd954..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 +++ /dev/null @@ -1,20 +0,0 @@ -{% if DEVICE_METADATA is defined and 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' %} -{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pg) %} - "BUFFER_PG": { -{% for port in port_names.split(',') %} -{% if port not in port_names_require_no_extra_pg.split(',') %} - "{{ port }}|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "{{ port }}|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, -{% endif %} - "{{ port }}|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, -{% endmacro %} -{% endif %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 deleted file mode 120000 index 7dfb03cbc9d0..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 +++ /dev/null @@ -1 +0,0 @@ -../Arista-7260CX3-C64/buffers_extra_pgs.j2 \ No newline at end of file diff --git a/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 index bc1ca774a98e..c2e4292dbd8a 100644 --- a/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 +++ b/device/common/profiles/th2/7260/BALANCED/buffers_defaults_t1.j2 @@ -51,11 +51,7 @@ {%- endmacro %} {% import 'buffers_extra_queues.j2' as defs1 with context %} -{% import 'buffers_extra_pgs.j2' as defs2 with context %} {%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} {{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} {%- endmacro %} -{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} -{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} -{%- endmacro %} diff --git a/device/common/profiles/th2/7260/BALANCED/qos.json.j2 b/device/common/profiles/th2/7260/BALANCED/qos.json.j2 index d760038736a6..68daa8ee92f0 100644 --- a/device/common/profiles/th2/7260/BALANCED/qos.json.j2 +++ b/device/common/profiles/th2/7260/BALANCED/qos.json.j2 @@ -1,4 +1,5 @@ {% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} +{% set different_dscp_to_tc_map = true %} {%- macro generate_dscp_to_tc_map() %} "DSCP_TO_TC_MAP": { "AZURE": { @@ -66,6 +67,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_UPLINK": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "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 %} diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 index bc1ca774a98e..0867c03b2497 100644 --- a/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/buffers_defaults_t1.j2 @@ -51,11 +51,8 @@ {%- endmacro %} {% import 'buffers_extra_queues.j2' as defs1 with context %} -{% import 'buffers_extra_pgs.j2' as defs2 with context %} {%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %} {{ defs1.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }} {%- endmacro %} -{%- macro generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) %} -{{ defs2.generate_pg_buffers_with_extra_lossy_pgs(port_names, port_names_require_no_extra_pgs) }} -{%- endmacro %} + diff --git a/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 b/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 index d760038736a6..faf682d3c176 100644 --- a/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 +++ b/device/common/profiles/th2/7260/RDMA-CENTRIC/qos.json.j2 @@ -66,6 +66,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_UPLINK": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "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 %} diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 2089b0e01ed0..5e6f2a3ca4d1 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -171,10 +171,6 @@ def {{ 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 %} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-t1.json b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-t1.json index 5ae6e6205a2d..ecaa1a88db48 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-t1.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7260-t1.json @@ -112,21 +112,9 @@ "Ethernet0|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet0|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet0|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet4|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet4|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet4|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet144|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, @@ -136,21 +124,9 @@ "Ethernet16|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet16|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet16|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet20|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet20|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet20|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet152|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, @@ -160,21 +136,9 @@ "Ethernet64|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet64|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet64|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet68|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet68|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet68|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet168|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, @@ -184,21 +148,9 @@ "Ethernet80|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet80|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet80|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet84|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet84|2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet84|6": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet180|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json index 7196d22c2f2d..34f745f19624 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json @@ -89,6 +89,72 @@ "61": "1", "62": "1", "63": "1" + }, + "AZURE_UPLINK": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "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" } }, "TC_TO_PRIORITY_GROUP_MAP": { @@ -118,7 +184,7 @@ "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]" }, "Ethernet0": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -126,7 +192,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet4": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -134,7 +200,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet16": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -142,7 +208,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet20": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -150,7 +216,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet64": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -158,7 +224,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet68": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -166,7 +232,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet80": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]", @@ -174,7 +240,7 @@ "pfcwd_sw_enable" : "3,4" }, "Ethernet84": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE_UPLINK]", "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",