From 6f41d9f00c66c8a497ac295a244572f44ddcc71e Mon Sep 17 00:00:00 2001 From: bingwang Date: Thu, 16 Jun 2022 03:08:11 +0000 Subject: [PATCH] Add extra lossy PG profile for ports between T1 and T2 Signed-off-by: bingwang --- .../Arista-7050CX3-32S-D48C8/qos.json.j2 | 2 +- .../Arista-7260CX3-C64/buffers_defaults_t1.j2 | 8 +++- .../Arista-7260CX3-C64/buffers_extra_pgs.j2 | 20 ++++++++ .../Arista-7260CX3-C64/qos.json.j2 | 4 +- .../Arista-7260CX3-Q64/buffers_defaults_t1.j2 | 8 +++- .../Arista-7260CX3-Q64/buffers_extra_pgs.j2 | 1 + files/build_templates/buffers_config.j2 | 4 ++ .../py3/buffer-arista7260-t1.json | 48 +++++++++++++++++++ .../py3/qos-arista7050cx3-dualtor.json | 2 +- .../py3/qos-arista7260-dualtor.json | 2 +- .../sample_output/py3/qos-arista7260-t1.json | 2 +- 11 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 create mode 120000 device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 index e0aca4f8dd8b..6719911b29e5 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 @@ -145,7 +145,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7", + "7": "0", "8": "0" }, "AZURE_TUNNEL": { diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 index c5d390668a33..469f5fc4001a 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_defaults_t1.j2 @@ -55,8 +55,12 @@ }, {%- endmacro %} -{% import 'buffers_extra_queues.j2' as defs with context %} +{% 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) %} -{{ defs.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/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 new file mode 100644 index 000000000000..73c1c1a9b30e --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/buffers_extra_pgs.j2 @@ -0,0 +1,20 @@ +{% 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" : "ingress_lossy_profile" + }, + "{{ port }}|6": { + "profile" : "ingress_lossy_profile" + }, +{% endif %} + "{{ port }}|0": { + "profile" : "ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + }, +{% endmacro %} +{% endif %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 index 4d82382817cb..cb3ad17faa39 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 @@ -79,7 +79,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7" + "7": "0" } }, {%- endmacro %} @@ -230,7 +230,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7", + "7": "0", "8": "0" }, "AZURE_TUNNEL": { diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 index f531b5e208e9..c73fde73562b 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_defaults_t1.j2 @@ -49,8 +49,12 @@ }, {%- endmacro %} -{% import 'buffers_extra_queues.j2' as defs with context %} +{% 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) %} -{{ defs.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/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 new file mode 120000 index 000000000000..7dfb03cbc9d0 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/buffers_extra_pgs.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/buffers_extra_pgs.j2 \ No newline at end of file diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 814e470d0211..f03a7f9f63e3 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -172,6 +172,10 @@ def {{ defs.generate_pg_profils(port_names_active) }} {% 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) }} {% else %} "BUFFER_PG": { {% for port in PORT_ACTIVE %} 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 702076249ac6..1ce8a99e4fb7 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,9 +112,21 @@ "Ethernet0|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet0|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet4|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet4|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet144|0": { "profile" : "ingress_lossy_profile" }, @@ -124,9 +136,21 @@ "Ethernet16|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet16|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet20|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet20|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet152|0": { "profile" : "ingress_lossy_profile" }, @@ -136,9 +160,21 @@ "Ethernet64|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet64|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet68|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet68|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet168|0": { "profile" : "ingress_lossy_profile" }, @@ -148,9 +184,21 @@ "Ethernet80|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet80|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet84|0": { "profile" : "ingress_lossy_profile" }, + "Ethernet84|2": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|6": { + "profile" : "ingress_lossy_profile" + }, "Ethernet180|0": { "profile" : "ingress_lossy_profile" }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json index 843e68a49c7d..d41910da2dbe 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json @@ -178,7 +178,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7", + "7": "0", "8": "0" }, "AZURE_TUNNEL": { diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json index 1d8c2dbdfff6..b685059cc3d8 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json @@ -178,7 +178,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7", + "7": "0", "8": "0" }, "AZURE_TUNNEL": { 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 9db828a759e4..f1d77eb15c52 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 @@ -100,7 +100,7 @@ "4": "4", "5": "0", "6": "6", - "7": "7" + "7": "0" } }, "SCHEDULER": {