Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,59 @@
limitations under the License.
#}

{% import 'traffic_config.j2' as traffic_config %}

{%- set PORT_ALL = [] %}
{%- set PORT_ACTIVE = [] %}
{%- set PORT_UPLINK = [] %}
{%- set PORT_DOWNLINK = [] %}

{# Initialize PORT_ALL and PORT_ACTIVE #}
{%- for port in PORT %}
{%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %}
{%- if PORT_ALL.append(port) %}{% endif %}
{%- endif %}
{%- endfor %}

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

{# Generate uplink and downlink port lists based on router type and neighbors #}
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined %}
{%- if 'type' in DEVICE_METADATA['localhost'] and DEVICE_NEIGHBOR is defined %}
{%- set local_router_type = DEVICE_METADATA['localhost']['type'] %}
{%- for port in PORT_ACTIVE %}
{%- if DEVICE_NEIGHBOR.get(port) and DEVICE_NEIGHBOR[port].name is defined and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA %}
{%- set neighbor_info = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name] %}
{%- if local_router_type == 'LeafRouter' %}
{%- if neighbor_info.type == 'ToRRouter' %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- elif neighbor_info.type == 'SpineRouter' %}
{%- if PORT_UPLINK.append(port) %}{%- endif %}
{%- endif %}
{%- elif local_router_type == 'ToRRouter' %}
{%- if neighbor_info.type == 'LeafRouter' %}
{%- if PORT_UPLINK.append(port) %}{%- endif %}
{%- else %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endif %}
{%- endif %}
{%- else %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endif %}
{%- endfor %}
{%- else %}
{%- for port in PORT_ACTIVE %}
{%- if PORT_DOWNLINK.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- endif %}

{%- 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 -%}
Expand Down Expand Up @@ -57,11 +110,6 @@
"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",
Expand All @@ -73,50 +121,98 @@
"size":"0",
"dynamic_th":"7"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"0",
"dynamic_th":"7"
},
"egress_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"9216",
"dynamic_th":"-6"
},
"queue0_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"0"
"queue0_downlink_lossy_profile": {
"dynamic_th": "0",
"size": "0",
"pool": "egress_lossy_pool"
},
"queue1_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"0"
"queue1_downlink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intended? over trim

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. @kperumalbfn could you please confirm?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep "drop"

{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue2_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"0"
"queue2_downlink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue3_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"0",
"dynamic_th":"0"
"queue3_downlink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue4_downlink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "7"
},
"queue5_downlink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "-3"
},
"queue6_downlink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue0_uplink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue1_uplink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue2_uplink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue3_uplink_lossy_profile": {
{% if traffic_config.traffic_classification_enable %}
"packet_discard_action": "drop",
{% endif %}
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th": "0"
},
"queue4_lossy_profile": {
"queue4_uplink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th" : "7"
"dynamic_th": "7"
},
"queue5_lossy_profile": {
"queue5_uplink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th" : "-3"
"dynamic_th": "-3"
},
"queue6_lossy_profile": {
"queue6_uplink_lossy_profile": {
"pool": "egress_lossy_pool",
"size": "0",
"dynamic_th" : "0"
"dynamic_th": "0"
}
},
{%- endmacro %}
Expand Down Expand Up @@ -146,7 +242,7 @@
"BUFFER_PORT_EGRESS_PROFILE_LIST": {
{% for port in port_names_active.split(',') %}
"{{ port }}": {
"profile_list" : "egress_lossless_profile,egress_lossy_profile"
"profile_list" : "egress_lossy_profile"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only egress_lossy_profile? how about queue[0-6]_lossy_profiles?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is BUFFER_PORT_EGRESS_PROFILE_LIST. it's for port instead of queue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, this is not the list of all the buffer profiles associated with the port.

}{% if not loop.last %},{% endif %}

{% endfor %}
Expand All @@ -155,9 +251,9 @@
{% for port in port_names_inactive.split(',') %}
"{{ port }}": {
{% if dynamic_mode is defined %}
"profile_list" : "egress_lossless_profile,egress_lossy_profile"
"profile_list" : "egress_lossy_profile"
{% else %}
"profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile"
"profile_list" : "egress_lossy_zero_profile"
{% endif %}
}{% if not loop.last %},{% endif %}

Expand All @@ -169,53 +265,54 @@
{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %}
"BUFFER_QUEUE": {
{% for port in port_names_active.split(',') %}
{%- set port_type = 'uplink' if port in PORT_UPLINK else 'downlink' %}
"{{ port }}|0": {
"profile" : "queue0_lossy_profile"
"profile" : "queue0_{{ port_type }}_lossy_profile"
},
"{{ port }}|1": {
"profile" : "queue1_lossy_profile"
"profile" : "queue1_{{ port_type }}_lossy_profile"
},
"{{ port }}|2": {
"profile" : "queue2_lossy_profile"
"profile" : "queue2_{{ port_type }}_lossy_profile"
},
"{{ port }}|3": {
"profile" : "queue3_lossy_profile"
"profile" : "queue3_{{ port_type }}_lossy_profile"
},
"{{ port }}|4": {
"profile" : "queue4_lossy_profile"
"profile" : "queue4_{{ port_type }}_lossy_profile"
},
"{{ port }}|5": {
"profile" : "queue5_lossy_profile"
"profile" : "queue5_{{ port_type }}_lossy_profile"
},
"{{ port }}|6": {
"profile" : "queue6_lossy_profile"
"profile" : "queue6_{{ port_type }}_lossy_profile"
}{% if not loop.last %},{% endif %}

{% endfor %}
{% if port_names_inactive|length > 0 %}
{% if dynamic_mode is defined %}
{% if port_names_active.split(',')|length > 0 %},{% endif %}
{% for port in port_names_inactive.split(',') %}
{%- set port_type = 'uplink' if port in PORT_UPLINK else 'downlink' %}
"{{ port }}|0": {
"profile" : "queue0_lossy_profile"
"profile" : "queue0_{{ port_type }}_lossy_profile"
},
"{{ port }}|1": {
"profile" : "queue1_lossy_profile"
"profile" : "queue1_{{ port_type }}_lossy_profile"
},
"{{ port }}|2": {
"profile" : "queue2_lossy_profile"
"profile" : "queue2_{{ port_type }}_lossy_profile"
},
"{{ port }}|3": {
"profile" : "queue3_lossy_profile"
"profile" : "queue3_{{ port_type }}_lossy_profile"
},
"{{ port }}|4": {
"profile" : "queue4_lossy_profile"
"profile" : "queue4_{{ port_type }}_lossy_profile"
},
"{{ port }}|5": {
"profile" : "queue5_lossy_profile"
"profile" : "queue5_{{ port_type }}_lossy_profile"
},
"{{ port }}|6": {
"profile" : "queue6_lossy_profile"
"profile" : "queue6_{{ port_type }}_lossy_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% else %}
Expand Down
Loading
Loading