From 86b4843271d71c864ddc8c6b461160a87e840842 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 4 Sep 2019 20:51:29 +0000 Subject: [PATCH 1/4] Use dot1p to tc mapping for backend switches Signed-off-by: Wenda Ni --- files/build_templates/qos_config.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index a666367873bd..d1ac3a3e6499 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -29,6 +29,7 @@ {%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%} +{%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%} { @@ -140,6 +141,18 @@ "63": "1" } }, + "DOT1P_TO_TC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, "SCHEDULER": { "scheduler.0": { "type" : "DWRR", @@ -160,7 +173,11 @@ {% endif %} "PORT_QOS_MAP": { "{{ port_names_active }}": { +{% if DEVICE_METADATA['localhost']['type'] in backend_device_types %} + "dot1p_to_tc_map" : "[DOT1P_TO_TC_MAP|AZURE]", +{% else %} "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", +{% endif %} "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]", From 558f5aed3962732b3af9dfbebe23482ef68aaadf Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Wed, 4 Sep 2019 21:55:28 +0000 Subject: [PATCH 2/4] Do not write DSCP to TC mapping into CONFIG_DB or config_db.json for storage switches Signed-off-by: Wenda Ni --- files/build_templates/qos_config.j2 | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index d1ac3a3e6499..054f0db8a11c 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -73,6 +73,20 @@ "7": "7" } }, +{% if DEVICE_METADATA['localhost']['type'] in backend_device_types %} + "DOT1P_TO_TC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, +{% else %} "DSCP_TO_TC_MAP": { "AZURE": { "0" : "1", @@ -141,18 +155,7 @@ "63": "1" } }, - "DOT1P_TO_TC_MAP": { - "AZURE": { - "0": "0", - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "6": "6", - "7": "7" - } - }, +{% endif %} "SCHEDULER": { "scheduler.0": { "type" : "DWRR", From ba5048c482e32784562fe4eb9d3e2772f1c8884e Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Mon, 9 Sep 2019 20:02:41 +0000 Subject: [PATCH 3/4] Deal with the situation when key 'type' is not defined in DEVICE_METADATA['localhost'], such as in the vs case Signed-off-by: Wenda Ni --- files/build_templates/qos_config.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 054f0db8a11c..8fddf800c023 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -73,7 +73,7 @@ "7": "7" } }, -{% if DEVICE_METADATA['localhost']['type'] in backend_device_types %} +{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %} "DOT1P_TO_TC_MAP": { "AZURE": { "0": "0", @@ -176,7 +176,7 @@ {% endif %} "PORT_QOS_MAP": { "{{ port_names_active }}": { -{% if DEVICE_METADATA['localhost']['type'] in backend_device_types %} +{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %} "dot1p_to_tc_map" : "[DOT1P_TO_TC_MAP|AZURE]", {% else %} "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", From 964c5c520518a0e87f761374be0884f28eddda38 Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Tue, 10 Sep 2019 01:01:21 +0000 Subject: [PATCH 4/4] Feed DEVICE_METADATA table to qos config gen in vs start Signed-off-by: Wenda Ni --- platform/vs/docker-sonic-vs/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 3aaefa291fb2..d99047b7bb25 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -18,7 +18,7 @@ if [ -f /etc/sonic/config_db.json ]; then else # generate and merge buffers configuration into config file sonic-cfggen -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json - sonic-cfggen -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json + sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json sonic-cfggen -p /usr/share/sonic/hwsku/port_config.ini -k $HWSKU --print-data > /tmp/ports.json sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/qos.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json fi