Skip to content

Commit

Permalink
Add two extra lossless queues for bounced back traffic (#10496)
Browse files Browse the repository at this point in the history
Signed-off-by: bingwang <bingwang@microsoft.com>

Why I did it
This PR is to add two extra lossless queues for bounced back traffic.
HLD sonic-net/SONiC#950

SKUs include
Arista-7050CX3-32S-C32
Arista-7050CX3-32S-D48C8
Arista-7260CX3-D108C8
Arista-7260CX3-C64
Arista-7260CX3-Q64

How I did it
Update the buffers.json.j2 template and buffers_config.j2 template to generate new BUFFER_QUEUE table.

For T1 devices, queue 2 and queue 6 are set as lossless queues on T0 facing ports.
For T0 devices, queue 2 and queue 6 are set as lossless queues on T1 facing ports.
Queue 7 is added as a new lossy queue as DSCP 48 is mapped to TC 7, and then mapped into Queue 7

How to verify it
Verified by UT
Verified by coping the new template and generate buffer config with sonic-cfggen
  • Loading branch information
bingwang-ms authored and yxieca committed Jun 22, 2022
1 parent 57244dd commit 6f71341
Show file tree
Hide file tree
Showing 20 changed files with 4,124 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% if DEVICE_METADATA is defined and 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}
{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
"BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
{% if port in port_names_require_extra_buffer.split(',') %}
"{{ port }}|0-1": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|2-4": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|5": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|6": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|7": {
"profile" : "egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% else %}
"{{ port }}|0-2": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|5-7": {
"profile" : "egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endif %}
{% endfor %}
}
{% endmacro %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% if DEVICE_METADATA is defined and 'type' in DEVICE_METADATA['localhost'] and
(DEVICE_METADATA['localhost']['type'] == 'LeafRouter' or DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %}
{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
"BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
{% if port in port_names_require_extra_buffer.split(',') %}
"{{ port }}|0-1": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|2-4": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|5": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|6": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|7": {
"profile" : "egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% else %}
"{{ port }}|0-2": {
"profile" : "egress_lossy_profile"
},
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
},
"{{ port }}|5-7": {
"profile" : "egress_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endif %}
{% endfor %}
}
{% endmacro %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,9 @@
}
},
{%- endmacro %}

{% import 'buffers_extra_queues.j2' as defs with context %}

{%- macro generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names, port_names_require_extra_buffer) }}
{%- endmacro %}
14 changes: 14 additions & 0 deletions files/build_templates/buffers_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ def
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') %}

{%- set port_names_list_extra_queues = [] %}
{%- for port in PORT_ACTIVE %}
{%- if ((SYSTEM_DEFAULTS is defined) and ('tunnel_qos_remap' in SYSTEM_DEFAULTS) and (SYSTEM_DEFAULTS['tunnel_qos_remap']['status'] == 'enabled')) and
(('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'ToRRouter') or
('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'LeafRouter')) %}
{%- if port_names_list_extra_queues.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
{%- set port_names_extra_queues = port_names_list_extra_queues | join(',') %}

{%- set port_names_list_inactive = [] %}
{%- for port in PORT_INACTIVE %}
{%- if port_names_list_inactive.append(port) %}{%- endif %}
Expand Down Expand Up @@ -182,6 +192,10 @@ def
{{ defs.generate_queue_buffers(port_names_active) }}
{% elif defs.generate_queue_buffers_with_inactive_ports is defined %}
{{ defs.generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) }}
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues_with_inactive_ports(port_names_active, port_names_extra_queues, port_names_inactive) }}
{% elif (defs.generate_queue_buffers_with_extra_lossless_queues is defined) and (port_names_extra_queues != '') %}
{{ defs.generate_queue_buffers_with_extra_lossless_queues(port_names_active, port_names_extra_queues) }}
{% else %}
"BUFFER_QUEUE": {
{% for port in PORT_ACTIVE %}
Expand Down
Loading

0 comments on commit 6f71341

Please sign in to comment.