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

[Reclaim buffer] Reclaim unused buffers by applying zero buffer profiles #8768

Merged
merged 27 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6220e13
Support zero buffer profiles
stephenxs Aug 5, 2021
824c4f6
Fix typo and remove unused profiles
stephenxs Aug 11, 2021
e036731
Fix errors
stephenxs Aug 11, 2021
300871a
Remove unused comma
stephenxs Aug 12, 2021
0c292d7
Fix errors
stephenxs Aug 17, 2021
f35ee98
Add template for zero profiles in dynamic model and update buffermgrd…
stephenxs Aug 18, 2021
639071e
Add unit test cases for buffer template
stephenxs Aug 19, 2021
c8f0fc8
Add zero_profiles.j2 for dynamic model
stephenxs Aug 26, 2021
6b79334
Generate separated items of zero profiles for queues
stephenxs Sep 6, 2021
fb75c9b
Remove trailing spaces
stephenxs Sep 6, 2021
c57a674
Update: pgs_to_reclaim => pgs_to_apply_zero_profile
stephenxs Sep 7, 2021
a121fdf
Change field name according to HLD
stephenxs Sep 8, 2021
6e91f49
Make it possible to run vstest for zero profiles
stephenxs Sep 12, 2021
2e286e1
Merge branch 'master' into zero-profiles-master
stephenxs Sep 28, 2021
fd3d328
Adjust files according to QoS key format change
stephenxs Sep 28, 2021
419bcb8
Adjust buffer template for reclaiming buffer for SN3800-D100C12S2
stephenxs Sep 28, 2021
7de7069
Update Mellanox specific files to tolerance the zero port scenario
stephenxs Oct 21, 2021
ceb3ae7
Common buffer template to tolerance zero buffer scenario
stephenxs Oct 21, 2021
805c40b
Update common test cases for buffer template
stephenxs Oct 21, 2021
03d2fc3
Update mellanox specific test cases for buffer template
stephenxs Oct 21, 2021
6ed2df7
Minimize the change in the common code
stephenxs Oct 21, 2021
5b23d14
Adjust Mellanox testcases
stephenxs Oct 21, 2021
520257d
Make j2 minigraph test a fixture
stephenxs Sep 28, 2021
31922f6
Remove redundant testcases
stephenxs Oct 22, 2021
9c812ff
Added missing file
stephenxs Nov 18, 2021
777eb8c
Move common files to another independent PR
stephenxs Nov 1, 2021
5cce936
Merge branch 'Azure:master' into zero-profiles
stephenxs Nov 24, 2021
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
@@ -0,0 +1,229 @@
{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %}
"BUFFER_POOL": {
{% if dynamic_mode is not defined and port_names_inactive|length > 0 -%}
"ingress_zero_pool" : {
"mode": "static",
"type": "ingress",
"size": "0"
},
{% endif -%}
"ingress_lossless_pool": {
{% if dynamic_mode is not defined -%}
"size": "{{ ingress_lossless_pool_size }}",
{% endif -%}
"type": "ingress",
"mode": "dynamic"
},
"ingress_lossy_pool": {
{% if dynamic_mode is not defined -%}
"size": "{{ ingress_lossy_pool_size }}",
{% endif -%}
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "{{ egress_lossless_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
"egress_lossy_pool": {
{% if dynamic_mode is not defined -%}
"size": "{{ egress_lossy_pool_size }}",
{% endif -%}
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
{% if dynamic_mode is not defined and port_names_inactive|length > 0 -%}
"ingress_lossy_pg_zero_profile" : {
"pool":"ingress_zero_pool",
"size":"0",
"static_th":"0"
},
"ingress_lossless_zero_profile" : {
"pool":"ingress_lossless_pool",
"size":"0",
"dynamic_th":"-8"
},
"ingress_lossy_zero_profile" : {
"pool":"ingress_lossy_pool",
"size":"0",
"dynamic_th":"-8"
},
"egress_lossless_zero_profile" : {
"pool":"egress_lossless_pool",
"size":"0",
"dynamic_th":"-8"
},
"egress_lossy_zero_profile" : {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"-8"
},
{% endif -%}
"ingress_lossless_profile": {
"pool":"ingress_lossless_pool",
"size":"0",
"dynamic_th":"7"
},
"ingress_lossy_profile": {
"pool":"ingress_lossy_pool",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"0",
"dynamic_th":"7"
},
"egress_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"9216",
"dynamic_th":"7"
},
"q_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"3"
}
},
{%- endmacro %}

{%- macro generate_profile_lists(port_names_active, port_names_inactive) %}
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
{% for port in port_names_active.split(',') %}
"{{ port }}": {
"profile_list" : "ingress_lossless_profile,ingress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% if port_names_inactive|length > 0 %}
,
{% for port in port_names_inactive.split(',') %}
"{{ port }}": {
{% if dynamic_mode is defined %}
"profile_list" : "ingress_lossless_profile,ingress_lossy_profile"
{% else %}
"profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile"
{% endif %}
}{% if not loop.last %},{% endif %}

{% endfor %}
{% endif %}
},
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
{% for port in port_names_active.split(',') %}
"{{ port }}": {
"profile_list" : "egress_lossless_profile,egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% if port_names_inactive|length > 0 %}
,
{% for port in port_names_inactive.split(',') %}
"{{ port }}": {
{% if dynamic_mode is defined %}
"profile_list" : "egress_lossless_profile,egress_lossy_profile"
{% else %}
"profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile"
{% endif %}
}{% if not loop.last %},{% endif %}

{% endfor %}
{% endif %}
}
{%- endmacro %}

{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %}
"BUFFER_QUEUE": {
{% for port in port_names_active.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
},
{% endfor %}
{% for port in port_names_active.split(',') %}
"{{ port }}|0-2": {
"profile" : "q_lossy_profile"
},
{% endfor %}
{% for port in port_names_active.split(',') %}
"{{ port }}|5-6": {
"profile" : "q_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% if port_names_inactive|length > 0 %}
,
{% if dynamic_mode is defined %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
},
{% endfor %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|0-2": {
"profile" : "q_lossy_profile"
},
{% endfor %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|5-6": {
"profile" : "q_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% else %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_zero_profile"
},
{% endfor %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|0-2": {
"profile" : "egress_lossy_zero_profile"
},
{% endfor %}
{% for port in port_names_inactive.split(',') %}
"{{ port }}|5-6": {
"profile" : "egress_lossy_zero_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% endif %}
{% endif %}
}
{%- endmacro %}

{%- macro generate_pg_profiles(port_names_active, port_names_inactive) %}
"BUFFER_PG": {
{% for port in port_names_active.split(',') %}
{% if dynamic_mode is defined %}
"{{ port }}|3-4": {
"profile" : "NULL"
},
{% endif %}
"{{ port }}|0": {
"profile" : "ingress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% if port_names_inactive|length > 0 %}
{%- for port in port_names_inactive.split(',') %}
{%- if loop.first -%},{%- endif -%}
{% if dynamic_mode is defined %}
"{{ port }}|3-4": {
"profile" : "NULL"
},
{% endif %}
"{{ port }}|0": {
{% if dynamic_mode is defined %}
"profile" : "ingress_lossy_profile"
{% else %}
"profile" : "ingress_lossy_pg_zero_profile"
{% endif %}
}{% if not loop.last %},{% endif %}

{% endfor %}
{% endif %}
}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,109 +4,20 @@
{% set egress_lossless_pool_size = '13945824' %}
{% set egress_lossy_pool_size = '4580864' %}

{%- 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)) %}{%- endif %}
{%- endfor %}
{%- endmacro %}
{% import 'buffers_defaults_objects.j2' as defs with context %}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ ingress_lossless_pool_size }}",
{%- endif %}
"type": "ingress",
"mode": "dynamic"
},
"ingress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ ingress_lossy_pool_size }}",
{%- endif %}
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "{{ egress_lossless_pool_size }}",
"type": "egress",
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossless_profile": {
"pool":"ingress_lossless_pool",
"size":"0",
"dynamic_th":"7"
},
"ingress_lossy_profile": {
"pool":"ingress_lossy_pool",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"0",
"dynamic_th":"7"
},
"egress_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"9216",
"dynamic_th":"7"
},
"q_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"3"
}
},
{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %}
{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }}
{%- endmacro %}

{%- macro generate_profile_lists(port_names) %}
"BUFFER_PORT_INGRESS_PROFILE_LIST": {
{% for port in port_names.split(',') %}
"{{ port }}": {
"profile_list" : "ingress_lossless_profile,ingress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
},
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
{% for port in port_names.split(',') %}
"{{ port }}": {
"profile_list" : "egress_lossless_profile,egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
}
{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %}
{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }}
{%- endmacro %}

{%- macro generate_queue_buffers(port_names) %}
"BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
},
{% endfor %}
{% for port in port_names.split(',') %}
"{{ port }}|0-2": {
"profile" : "q_lossy_profile"
},
{% endfor %}
{% for port in port_names.split(',') %}
"{{ port }}|5-6": {
"profile" : "q_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
}
{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %}
{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }}
{%- endmacro %}


{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %}
{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }}
{%- endmacro %}
Loading