Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mellanox buffers configuration #1263

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 47 additions & 42 deletions dockers/docker-orchagent/msn27xx.32ports.buffers.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,45 @@
{%- 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"
},
"OP": "SET"
},
{
"BUFFER_POOL_TABLE:egress_lossless_pool": {
"size": "7291456",
"size": "{{ egress_lossless_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
"OP": "SET"
},
{
"BUFFER_POOL_TABLE:egress_lossy_pool": {
"size": "8254464",
"size": "{{ egress_lossy_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
Expand All @@ -32,15 +52,15 @@
"BUFFER_PROFILE_TABLE:ingress_lossless_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
"size":"0",
"dynamic_th":"1"
"dynamic_th":"0"
},
"OP": "SET"
},
{
"BUFFER_PROFILE_TABLE:ingress_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
"size":"0",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
Expand All @@ -56,15 +76,15 @@
"BUFFER_PROFILE_TABLE:egress_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
"size":"4096",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
{
"BUFFER_PROFILE_TABLE:pg_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
"size":"0",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
Expand All @@ -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"
},
Expand All @@ -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] %}
Expand Down Expand Up @@ -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 },
}
-%}

Expand All @@ -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 %}
Expand Down Expand Up @@ -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 -%}
Expand All @@ -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 }}]"
Expand All @@ -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]"
Expand Down
34 changes: 17 additions & 17 deletions src/sonic-config-engine/tests/sample_output/msn27.32ports.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
[
{
"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"
},
"OP": "SET"
},
{
"BUFFER_POOL_TABLE:egress_lossless_pool": {
"size": "7291456",
"size": "16777152",
"type": "egress",
"mode": "dynamic"
},
"OP": "SET"
},
{
"BUFFER_POOL_TABLE:egress_lossy_pool": {
"size": "8254464",
"size": "5242880",
"type": "egress",
"mode": "dynamic"
},
Expand All @@ -27,15 +35,15 @@
"BUFFER_PROFILE_TABLE:ingress_lossless_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
"size":"0",
"dynamic_th":"1"
"dynamic_th":"0"
},
"OP": "SET"
},
{
"BUFFER_PROFILE_TABLE:ingress_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
"size":"0",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
Expand All @@ -51,15 +59,15 @@
"BUFFER_PROFILE_TABLE:egress_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:egress_lossy_pool]",
"size":"4096",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
{
"BUFFER_PROFILE_TABLE:pg_lossy_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossy_pool]",
"size":"0",
"dynamic_th":"7"
"dynamic_th":"3"
},
"OP": "SET"
},
Expand All @@ -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"
},
Expand Down Expand Up @@ -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"
},
Expand Down