diff --git a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 index 0a60f4584a1..579832ecda1 100644 --- a/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 +++ b/dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2 @@ -4,9 +4,29 @@ {%- if port_names_list.append(port) %}{% endif %} {% endfor %} {% set port_names = port_names_list | join(',') %} +{% set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%if switch_role == 'ToRRouter' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} +{% else %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} +{%endif %} + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", + "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -14,7 +34,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", + "size": "{{ egress_lossless_pool_size }}", "type": "egress", "mode": "dynamic" }, @@ -22,7 +42,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", + "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" }, @@ -32,7 +52,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"0" }, "OP": "SET" }, @@ -40,7 +60,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -56,7 +76,7 @@ "BUFFER_PROFILE_TABLE:egress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"4096", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -64,7 +84,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -80,7 +100,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -98,7 +118,6 @@ }, {# The following template part is for variable PG profile configuration #} -{% set non_pg_lossless_pool_size = 866726 %} {% set pg_range = '3-4' %} {# Lists of supported speed and cable length #} {% set supported_speed = [10000, 25000, 40000, 50000, 100000] %} @@ -129,23 +148,23 @@ {# PG profiles. All profiles reffered in portconfig2profile dictionary should be declared here #} {# Only those which were actually used will be created in SAI #} {%- set pg_profiles = { - 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 1 }, - 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, + 'pg_lossless_10G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_25G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_40G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_50G_5m_profile': { 'xon': 18432, 'xoff': 16384, 'size': 34816, 'dynamic_th': 0 }, + 'pg_lossless_100G_5m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, - 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 1 }, - 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 1 }, - 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 1 }, - 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 1 }, + 'pg_lossless_10G_40m_profile': { 'xon': 18432, 'xoff': 18432, 'size': 36864, 'dynamic_th': 0 }, + 'pg_lossless_25G_40m_profile': { 'xon': 18432, 'xoff': 21504, 'size': 39936, 'dynamic_th': 0 }, + 'pg_lossless_40G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_50G_40m_profile': { 'xon': 18432, 'xoff': 23552, 'size': 41984, 'dynamic_th': 0 }, + 'pg_lossless_100G_40m_profile': { 'xon': 18432, 'xoff': 35840, 'size': 54272, 'dynamic_th': 0 }, - 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 1 }, - 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 1 }, - 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 1 }, - 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 1 }, + 'pg_lossless_10G_300m_profile': { 'xon': 18432, 'xoff': 30720, 'size': 49152, 'dynamic_th': 0 }, + 'pg_lossless_25G_300m_profile': { 'xon': 18432, 'xoff': 53248, 'size': 71680, 'dynamic_th': 0 }, + 'pg_lossless_40G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_50G_300m_profile': { 'xon': 18432, 'xoff': 75776, 'size': 94208, 'dynamic_th': 0 }, + 'pg_lossless_100G_300m_profile':{ 'xon': 18432, 'xoff': 165888,'size': 184320,'dynamic_th': 0 }, } -%} @@ -159,13 +178,11 @@ } %} -{% set switch_role = DEVICE_METADATA['localhost']['type'] %} - -{%- macro cable_length(port_name) -%} +{% macro cable_length(port_name) -%} {%- set cable_len = [] -%} {%- for local_port in DEVICE_NEIGHBOR -%} {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} {%- set neighbor_role = neighbor.type -%} {%- set roles1 = switch_role + '_' + neighbor_role %} @@ -201,7 +218,6 @@ {{ new_speed.0 }}_{{ new_cable.0 }} {%- endmacro -%} -{% set ingress_lossless_pg_pool_size = [] %} {% set used_pg_profiles = [] %} {% for port in PORT %} {%- if PORT[port].speed -%} @@ -215,9 +231,8 @@ {% set port_config = find_closest_greater_config(speed, cable) -%} {%- endif -%} {% set profile = portconfig2profile[port_config] -%} - {% if ingress_lossless_pg_pool_size.append(pg_profiles[profile]['size']) %}{% endif %} {# add to list profiles which were actually used #} - {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif -%} + {%- if profile not in used_pg_profiles and used_pg_profiles.append(profile) %}{% endif %} { "BUFFER_PG_TABLE:{{ port }}:{{ pg_range }}": { "profile" : "[BUFFER_PROFILE_TABLE:{{ profile }}]" @@ -240,17 +255,7 @@ }, "OP": "SET" }, -{% endfor -%} - - {# Lossless pool declaration #} - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "{{ ingress_lossless_pg_pool_size | sum + non_pg_lossless_pool_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "OP": "SET" - }, +{% endfor %} { "BUFFER_PG_TABLE:{{ port_names }}:0-1": { "profile" : "[BUFFER_PROFILE_TABLE:pg_lossy_profile]" diff --git a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json index a3cff0f0f0d..a1e8e1486d6 100644 --- a/src/sonic-config-engine/tests/sample_output/msn27.32ports.json +++ b/src/sonic-config-engine/tests/sample_output/msn27.32ports.json @@ -1,7 +1,15 @@ [ + { + "BUFFER_POOL_TABLE:ingress_lossless_pool": { + "size": "2097152", + "type": "ingress", + "mode": "dynamic" + }, + "OP": "SET" + }, { "BUFFER_POOL_TABLE:ingress_lossy_pool": { - "size": "6422528", + "size": "5242880", "type": "ingress", "mode": "dynamic" }, @@ -9,7 +17,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossless_pool": { - "size": "7291456", + "size": "16777152", "type": "egress", "mode": "dynamic" }, @@ -17,7 +25,7 @@ }, { "BUFFER_POOL_TABLE:egress_lossy_pool": { - "size": "8254464", + "size": "5242880", "type": "egress", "mode": "dynamic" }, @@ -27,7 +35,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossless_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]", "size":"0", - "dynamic_th":"1" + "dynamic_th":"0" }, "OP": "SET" }, @@ -35,7 +43,7 @@ "BUFFER_PROFILE_TABLE:ingress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -51,7 +59,7 @@ "BUFFER_PROFILE_TABLE:egress_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"4096", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -59,7 +67,7 @@ "BUFFER_PROFILE_TABLE:pg_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -75,7 +83,7 @@ "BUFFER_PROFILE_TABLE:q_lossy_profile": { "pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]", "size":"0", - "dynamic_th":"7" + "dynamic_th":"3" }, "OP": "SET" }, @@ -293,15 +301,7 @@ "xon":"18432", "xoff":"75776", "size":"94208", - "dynamic_th":"1" - }, - "OP": "SET" - }, - { - "BUFFER_POOL_TABLE:ingress_lossless_pool": { - "size": "3881382", - "type": "ingress", - "mode": "dynamic" + "dynamic_th":"0" }, "OP": "SET" },