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

Backport pg_profile_lookup architecture for lossless pgs #2253

Closed
wants to merge 4 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -1,134 +1,3 @@
{# Default values which will be used if no actual configura available #}
{% set default_cable = '300m' %}
{% set default_speed = '100G' %}
{% set default_ports_num = 32 -%}
{%- set default_topo = 't1' %}
{%- include 'buffers_config.j2' %}

{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{% set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
%}

{%- 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] -%}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor_role = neighbor.type -%}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role -%}
{%- set roles1 = roles1 | lower -%}
{%- set roles2 = roles2 | lower -%}
{%- if roles1 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%}
{%- elif roles2 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif -%}
{% endmacro %}

{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- endif -%}

{# Generate list of ports if not defined #}
{% if PORT is not defined %}
{% set PORT = [] %}
{% for port_idx in range(0,default_ports_num) %}
{% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %}
{% endfor %}
{% endif -%}

{% set port_names_list = [] %}
{% for port in PORT %}
{%- if port_names_list.append(port) %}{% endif %}
{% endfor %}
{% set port_names = port_names_list | join(',') -%}

{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT %}
{% set cable = cable_length(port) -%}
"{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %}

{% endfor %}
}
},
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "8072396",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossless_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"xon":"18432",
"xoff":"40560",
"size":"41808",
"dynamic_th":"-3",
"xon_offset":"2496"
},
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"1518",
"dynamic_th":"3"
}
},
"BUFFER_PG": {
"{{ port_names }}|3-4": {
"profile" : "[BUFFER_PROFILE|ingress_lossless_profile]"
},
"{{ port_names }}|0-1": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
},
"{{ port_names }}|5": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}
},
"BUFFER_QUEUE": {
"{{ port_names }}|3-4": {
"profile" : "[BUFFER_PROFILE|egress_lossless_profile]"
},
"{{ port_names }}|0-1": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
},
"{{ port_names }}|5": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{%- set default_cable = '300m' %}

{%- macro generate_port_lists(PORT_ALL) %}
{# Generate list of ports #}
{% for port_idx in range(0,32) %}
{% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %}
{% endfor %}
{%- endmacro %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "7582515",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"[BUFFER_POOL|egress_lossless_pool]",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"1518",
"dynamic_th":"3"
}
},
{%- endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PG lossless profiles.
# speed cable size xon xoff threshold xon_offset
40000 5m 41808 18432 40560 -3 2496
50000 5m 41808 18432 40560 -3 2496
100000 5m 41808 18432 40560 -3 2496
40000 40m 51376 18432 50128 -3 2496
50000 40m 51376 18432 50128 -3 2496
100000 40m 51376 18432 50128 -3 2496
40000 300m 51376 18432 50128 -3 2496
50000 300m 51376 18432 50128 -3 2496
100000 300m 51376 18432 50128 -3 2496
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# name lanes alias index
Ethernet0 9,10,11,12 Ethernet5/1 5
Ethernet4 13,14,15,16 Ethernet6/1 6
Ethernet8 17,18,19,20 Ethernet7/1 7
Ethernet12 21,22,23,24 Ethernet8/1 8
Ethernet16 29,30,31,32 Ethernet9/1 9
Ethernet20 25,26,27,28 Ethernet10/1 10
Ethernet24 33,34,35,36 Ethernet11/1 11
Ethernet28 37,38,39,40 Ethernet12/1 12
Ethernet32 45,46,47,48 Ethernet13/1 13
Ethernet36 41,42,43,44 Ethernet14/1 14
Ethernet40 49,50,51,52 Ethernet15/1 15
Ethernet44 53,54,55,56 Ethernet16/1 16
Ethernet48 69,70,71,72 Ethernet17/1 17
Ethernet52 65,66,67,68 Ethernet18/1 18
Ethernet56 73,74,75,76 Ethernet19/1 19
Ethernet60 77,78,79,80 Ethernet20/1 20
Ethernet64 93,94,95,96 Ethernet21/1 21
Ethernet68 89,90,91,92 Ethernet22/1 22
Ethernet72 97,98,99,100 Ethernet23/1 23
Ethernet76 101,102,103,104 Ethernet24/1 24
Ethernet80 109,110,111,112 Ethernet25/1 25
Ethernet84 105,106,107,108 Ethernet26/1 26
Ethernet88 121,122,123,124 Ethernet27/1 27
Ethernet92 125,126,127,128 Ethernet28/1 28
Ethernet96 61,62,63,64 Ethernet29 29
Ethernet100 57,58,59,60 Ethernet30 30
Ethernet104 81,82,83,84 Ethernet31 31
Ethernet108 85,86,87,88 Ethernet32 32
Ethernet112 117,118,119,120 Ethernet33 33
Ethernet116 113,114,115,116 Ethernet34 34
Ethernet120 1,2,3,4 Ethernet35 35
Ethernet124 5,6,7,8 Ethernet36 36
# name lanes alias index speed
Ethernet0 9,10,11,12 Ethernet5/1 5 40000
Ethernet4 13,14,15,16 Ethernet6/1 6 40000
Ethernet8 17,18,19,20 Ethernet7/1 7 40000
Ethernet12 21,22,23,24 Ethernet8/1 8 40000
Ethernet16 29,30,31,32 Ethernet9/1 9 40000
Ethernet20 25,26,27,28 Ethernet10/1 10 40000
Ethernet24 33,34,35,36 Ethernet11/1 11 40000
Ethernet28 37,38,39,40 Ethernet12/1 12 40000
Ethernet32 45,46,47,48 Ethernet13/1 13 40000
Ethernet36 41,42,43,44 Ethernet14/1 14 40000
Ethernet40 49,50,51,52 Ethernet15/1 15 40000
Ethernet44 53,54,55,56 Ethernet16/1 16 40000
Ethernet48 69,70,71,72 Ethernet17/1 17 40000
Ethernet52 65,66,67,68 Ethernet18/1 18 40000
Ethernet56 73,74,75,76 Ethernet19/1 19 40000
Ethernet60 77,78,79,80 Ethernet20/1 20 40000
Ethernet64 93,94,95,96 Ethernet21/1 21 40000
Ethernet68 89,90,91,92 Ethernet22/1 22 40000
Ethernet72 97,98,99,100 Ethernet23/1 23 40000
Ethernet76 101,102,103,104 Ethernet24/1 24 40000
Ethernet80 109,110,111,112 Ethernet25/1 25 40000
Ethernet84 105,106,107,108 Ethernet26/1 26 40000
Ethernet88 121,122,123,124 Ethernet27/1 27 40000
Ethernet92 125,126,127,128 Ethernet28/1 28 40000
Ethernet96 61,62,63,64 Ethernet29 29 40000
Ethernet100 57,58,59,60 Ethernet30 30 40000
Ethernet104 81,82,83,84 Ethernet31 31 40000
Ethernet108 85,86,87,88 Ethernet32 32 40000
Ethernet112 117,118,119,120 Ethernet33 33 40000
Ethernet116 113,114,115,116 Ethernet34 34 40000
Ethernet120 1,2,3,4 Ethernet35 35 40000
Ethernet124 5,6,7,8 Ethernet36 36 40000