Skip to content

Commit

Permalink
Common buffer template to tolerance zero buffer scenario
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Nov 19, 2021
1 parent b064079 commit cacc293
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions files/build_templates/buffers_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,6 @@ def
{%- set switch_role = '' %}
{%- endif -%}

{%- set PORT_ALL = [] %}

{%- if PORT is not defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}

{%- set PORT_ACTIVE = [] %}
{%- set PORT_INACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in PORT_ALL %}
{%- if port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- else %}
{%- if PORT_INACTIVE.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}

{# Import default values from device HWSKU folder #}
{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %}

Expand Down Expand Up @@ -117,6 +93,32 @@ def
{%- endif %}
{%- endmacro %}

{%- set PORT_ALL = [] %}

{%- if PORT is not defined %}
{%- if defs.generate_port_lists is defined %}
{%- if defs.generate_port_lists(PORT_ALL) %} {% endif %}
{%- endif %}
{%- else %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}

{%- set PORT_ACTIVE = [] %}
{%- set PORT_INACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in PORT_ALL %}
{%- if port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- else %}
{%- if PORT_INACTIVE.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}

{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
Expand All @@ -142,8 +144,12 @@ def

{% if defs.generate_buffer_pool_and_profiles is defined %}
{{ defs.generate_buffer_pool_and_profiles() }}
{% elif defs.generate_buffer_pool_and_profiles_with_inactive_ports is defined %}
{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }}
{% endif %}


{%- if port_names_active|length > 0 or port_names_inactive|length > 0 -%}
{%- if defs.generate_profile_lists is defined %}
{{ defs.generate_profile_lists(port_names_active) }},
{% elif defs.generate_profile_lists_with_inactive_ports is defined %}
Expand Down Expand Up @@ -194,8 +200,11 @@ def
{% endfor %}
}
{% endif %}
{% if dynamic_mode is defined %}
{%- if dynamic_mode is defined -%}
,
{%- endif -%}
{%- endif -%}
{% if dynamic_mode is defined %}
"DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"AZURE": {
"default_dynamic_th": "0"
Expand Down

0 comments on commit cacc293

Please sign in to comment.