From c9a6731881073dcaf4d8ff305a908ee01216b908 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Fri, 11 Sep 2020 12:08:31 +0000 Subject: [PATCH 1/7] [Dynamic buffer calculation] Support dynamic buffer calculation 1. add tables required for the feature: - ASIC_TABLE in platform/mellanox/asic_table.j2 (Mellanox specific) - PERIPHERAL_TABLE in platform/mellanox/peripheral_table.j2 (Mellanox specific) - PORT_PERIPHERAL_TABLE on a per-platform basis in device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 (Mellanox specific) - DEFAULT_LOSSLESS_BUFFER_PARAMETER and LOSSLESS_TRAFFIC_PATTERN in files/build_templates/buffers_config.j2 - Add lossless PGs (3-4) for each port in files/build_templates/buffers_config.j2 2. copy the newly introduced j2 files into image and rendering them when system starts 3. update the CLI options for buffermgrd so that it can start with dynamic mode 4. Adjust the order in which swss daemons start, making buffermgrd start before orchagent. This is to make sure buffermgrd can get everything ready before orchagent starts especially during warm reboot. 5. Optimize the way in which orchagent fetches the asic vendor name: - fetch the vendor name when creates the docker and pass it as a docker environment variable - orchagent and buffermgrd can use this passed-in variable 6. Clear buffer related tables from STATE_DB when swss docker starts 7. Update the src/sonic-config-engine/tests/sample_output/buffers-dell6100.json according to the buffer_config.j2 8. Remove buffer pool sizes for ingress pools and egress_lossy_pool Update the buffer settings for dynamic buffer calculation Signed-off-by: Stephen Sun --- .../ACS-MSN2700/buffers_defaults_t0.j2 | 6 - .../ACS-MSN2700/buffers_defaults_t1.j2 | 6 - .../ACS-MSN3700/buffers_defaults_t0.j2 | 6 - .../ACS-MSN3700/buffers_defaults_t1.j2 | 6 - .../ACS-MSN3800/buffers_defaults_t0.j2 | 6 - .../ACS-MSN3800/buffers_defaults_t1.j2 | 6 - .../port_peripheral_config.j2 | 10 ++ .../ACS-MSN4700/buffers_defaults_t0.j2 | 6 - .../ACS-MSN4700/buffers_defaults_t1.j2 | 6 - dockers/docker-orchagent/supervisord.conf | 4 +- files/build_templates/buffers_config.j2 | 15 ++ files/build_templates/docker_image_ctl.j2 | 15 ++ .../build_templates/sonic_debian_extension.j2 | 13 ++ files/scripts/swss.sh | 2 +- platform/mellanox/asic_table.j2 | 69 +++++++++ platform/mellanox/peripheral_table.j2 | 28 ++++ platform/vs/asic_table.j2 | 1 + platform/vs/docker-sonic-vs/Dockerfile.j2 | 1 + platform/vs/docker-sonic-vs/asic_table.j2 | 11 ++ platform/vs/docker-sonic-vs/start.sh | 2 + platform/vs/peripheral_table.j2 | 1 + .../sample_output/py3/buffers-dell6100.json | 144 ++++++++++++++++++ 22 files changed, 313 insertions(+), 51 deletions(-) create mode 100644 device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 create mode 100644 platform/mellanox/asic_table.j2 create mode 100644 platform/mellanox/peripheral_table.j2 create mode 120000 platform/vs/asic_table.j2 create mode 100644 platform/vs/docker-sonic-vs/asic_table.j2 create mode 120000 platform/vs/peripheral_table.j2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 index b8f7d070919..3a173c22f13 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '4580864' %} -{% set ingress_lossy_pool_size = '4580864' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '4580864' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 index a8d32205607..3a173c22f13 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '3302912' %} -{% set ingress_lossy_pool_size = '3302912' %} {% set egress_lossless_pool_size = '13945824' %} -{% set egress_lossy_pool_size = '3302912' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 index 959cc8359be..280f76b00fe 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '14542848' %} -{% set ingress_lossy_pool_size = '14542848' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '14542848' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 index cef78f34b4f..280f76b00fe 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '11622400' %} -{% set ingress_lossy_pool_size = '11622400' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '11622400' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 index bd8e1c8bb79..280f76b00fe 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '13924352' %} -{% set ingress_lossy_pool_size = '13924352' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '13924352' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 index 6e7b6b35918..280f76b00fe 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '12457984' %} -{% set ingress_lossy_pool_size = '12457984' %} {% set egress_lossless_pool_size = '34287552' %} -{% set egress_lossy_pool_size = '12457984' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 new file mode 100644 index 00000000000..8d201517ed6 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 @@ -0,0 +1,10 @@ +[ +{%- include 'peripheral_table.j2' %} +, +{ + "PORT_PERIPHERAL_TABLE:global": { + "gearbox_model": "MELLANOX-GEARBOX-1" + }, + "OP": "SET" +} +] diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 index 506107f4776..a02972dcc93 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '26451968' %} -{% set ingress_lossy_pool_size = '26451968' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '26451968' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 index b025ea275ba..a02972dcc93 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 @@ -1,8 +1,5 @@ {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '20627456' %} -{% set ingress_lossy_pool_size = '20627456' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '20627456' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -14,12 +11,10 @@ {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", "mode": "dynamic" }, "ingress_lossy_pool": { - "size": "{{ ingress_lossy_pool_size }}", "type": "ingress", "mode": "dynamic" }, @@ -29,7 +24,6 @@ "mode": "dynamic" }, "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", "type": "egress", "mode": "dynamic" } diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 8a942d8549c..4a6c4d2376c 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -136,14 +136,14 @@ dependent_startup=true dependent_startup_wait_for=swssconfig:exited [program:buffermgrd] -command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini +command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini -a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json priority=11 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true -dependent_startup_wait_for=swssconfig:exited +dependent_startup_wait_for=rsyslogd:running [program:vrfmgrd] command=/usr/bin/vrfmgrd diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index c741c6ea364..af36100b8f8 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -144,6 +144,9 @@ def {% for port in PORT_ACTIVE %} "{{ port }}|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port }}|3-4": { + "profile" : "NULL" }{% if not loop.last %},{% endif %} {% endfor %} @@ -172,4 +175,16 @@ def {% endfor %} } {% endif %} +, + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0" + } + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1500", + "small_packet_percentage": "100" + } + } } diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 477fd897bff..6d433c83be0 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -83,6 +83,13 @@ function preStartAction() fi {%- elif docker_container_name == "snmp" %} $SONIC_DB_CLI STATE_DB HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s) +{%- elif docker_container_name == "swss" %} + if [ ! -f /etc/sonic/asic_table.json ] && [ -f /usr/share/sonic/templates/asic_table.j2 ]; then + sonic-cfggen -d -t /usr/share/sonic/templates/asic_table.j2 > /etc/sonic/asic_table.json + fi + if [ ! -f /etc/sonic/peripheral_table.json ] && [ -f /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 ]; then + sonic-cfggen -d -t /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 > /etc/sonic/peripheral_table.json + fi {%- else %} : # nothing {%- endif %} @@ -243,6 +250,11 @@ start() { echo "Creating new ${DOCKERNAME} container with HWSKU $HWSKU" {%- endif %} + {%- if docker_container_name == "swss" %} + # Obtain the vendor name + ASIC_VENDOR=`$SONIC_CFGGEN -y /etc/sonic/sonic_version.yml -v asic_type` + {%- endif %} + # In Multi ASIC platforms the global database config file database_global.json will exist. # Parse the file and get the include path for the database_config.json files used in # various namesapces. The database_config paths are relative to the DIR of SONIC_DB_GLOBAL_JSON. @@ -355,6 +367,9 @@ start() { -v /var/run/docker-syncd$DEV:/var/run/sswsyncd \ {%- endif %} {%- endif %} +{%- if docker_container_name == "swss" %} + -e ASIC_VENDOR=$ASIC_VENDOR \ +{%- endif -%} {%- if docker_container_name == "bgp" %} -v /etc/sonic/frr/$DEV:/etc/frr:rw \ {%- endif %} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8663ee35a50..a841ebdaa66 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -392,6 +392,19 @@ sudo cp $BUILD_TEMPLATES/buffers_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMP # Copy the qos configuration template sudo cp $BUILD_TEMPLATES/qos_config.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +# Copy the templates for dynamically buffer calculation +{% if sonic_asic_platform == "mellanox" or sonic_asic_platform == "vs" %} +if [ -f platform/{{ sonic_asic_platform }}/asic_table.j2 ] +then + sudo cp platform/{{ sonic_asic_platform }}/asic_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/asic_table.j2 +fi + +if [ -f platform/{{ sonic_asic_platform }}/peripheral_table.j2 ] +then + sudo cp platform/{{ sonic_asic_platform }}/peripheral_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/peripheral_table.j2 +fi +{% endif %} + # Copy hostname configuration scripts sudo cp $IMAGE_CONFIGS/hostname/hostname-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM echo "hostname-config.service" | sudo tee -a $GENERATED_SERVICE_FILE diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 11613b5a8a5..1c54aefb0c0 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -147,7 +147,7 @@ start() { $SONIC_DB_CLI ASIC_DB FLUSHDB $SONIC_DB_CLI COUNTERS_DB FLUSHDB $SONIC_DB_CLI FLEX_COUNTER_DB FLUSHDB - clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*'" + clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*'" fi # start service docker diff --git a/platform/mellanox/asic_table.j2 b/platform/mellanox/asic_table.j2 new file mode 100644 index 00000000000..47e900b2e44 --- /dev/null +++ b/platform/mellanox/asic_table.j2 @@ -0,0 +1,69 @@ +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} +{%- set platform = DEVICE_METADATA['localhost']['platform'] %} +{%- else -%} +{%- set platform = "vs-platform" %} +{%- endif -%} + + +[ +{% set platform2asic = { + 'x86_64-mlnx_lssn2700-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2010-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2100-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2410-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2700-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2700_simx-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn2740-r0':'MELLANOX-SPECTRUM', + 'x86_64-mlnx_msn3700c-r0':'MELLANOX-SPECTRUM-2', + 'x86_64-mlnx_msn3700-r0':'MELLANOX-SPECTRUM-2', + 'x86_64-mlnx_msn3700_simx-r0':'MELLANOX-SPECTRUM-2', + 'x86_64-mlnx_msn3800-r0':'MELLANOX-SPECTRUM-2', + 'x86_64-mlnx_msn4700_simx-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-mlnx_msn4700-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-mlnx_msn4600c-r0':'MELLANOX-SPECTRUM-3', + 'vs-platform':'vs' + } +%} +{% set asic_type = platform2asic[platform] %} +{% if asic_type == 'MELLANOX-SPECTRUM' %} + { + "ASIC_TABLE:MELLANOX-SPECTRUM": { + "cell_size": "96", + "pipeline_latency": "19", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" + } +{% elif asic_type == 'MELLANOX-SPECTRUM-2' %} + { + "ASIC_TABLE:MELLANOX-SPECTRUM-2": { + "cell_size": "144", + "pipeline_latency": "19", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" + } +{% elif asic_type == 'MELLANOX-SPECTRUM-3' %} + { + "ASIC_TABLE:MELLANOX-SPECTRUM-3": { + "cell_size": "144", + "pipeline_latency": "19", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" + } +{% elif asic_type == "vs" %} + { + "ASIC_TABLE:VS-ASIC": { + "cell_size": "128", + "pipeline_latency": "19", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" + } +{% endif %} +] diff --git a/platform/mellanox/peripheral_table.j2 b/platform/mellanox/peripheral_table.j2 new file mode 100644 index 00000000000..70e664559be --- /dev/null +++ b/platform/mellanox/peripheral_table.j2 @@ -0,0 +1,28 @@ +{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} +{%- set platform = DEVICE_METADATA['localhost']['platform'] %} +{%- else -%} +{%- set platform = "vs-platform" %} +{%- endif -%} + +{% set platform2gearbox = { + 'x86_64-mlnx_msn3800-r0':'MELLANOX-GEARBOX-1', + 'vs-platform':'VS-GEARBOX' + } +%} +{% set gearbox_type = platform2gearbox[platform] %} +{% if gearbox_type == 'MELLANOX-GEARBOX-1' %} +{ + "PERIPHERAL_TABLE:MELLANOX-GEARBOX-1": { + "gearbox_delay": "400" + }, + "OP": "SET" +} +{% elif gearbox_type == 'VS-GEARBOX' %} +{ + "PERIPHERAL_TABLE:VS-GEARBOX": { + "gearbox_delay": "400" + }, + "OP": "SET" +} +{% endif %} + diff --git a/platform/vs/asic_table.j2 b/platform/vs/asic_table.j2 new file mode 120000 index 00000000000..d3133a30d81 --- /dev/null +++ b/platform/vs/asic_table.j2 @@ -0,0 +1 @@ +../mellanox/asic_table.j2 \ No newline at end of file diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 22ff02fdfda..41a7e976ba6 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -157,6 +157,7 @@ COPY ["port_breakout_config_db.json", "/etc/sonic/"] COPY ["database_config.json", "/etc/default/sonic-db/"] COPY ["hostname.j2", "/usr/share/sonic/templates/"] COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"] +COPY ["asic_table.j2", "/usr/share/sonic/templates/"] COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"] diff --git a/platform/vs/docker-sonic-vs/asic_table.j2 b/platform/vs/docker-sonic-vs/asic_table.j2 new file mode 100644 index 00000000000..9d94638dd73 --- /dev/null +++ b/platform/vs/docker-sonic-vs/asic_table.j2 @@ -0,0 +1,11 @@ +[ +{ + "ASIC_TABLE:VS-ASIC": { + "cell_size": "128", + "pipeline_latency": "18", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" +} +] diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 99c15925d17..9d815002542 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -34,6 +34,8 @@ fi SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json +sonic-cfggen -d -t /usr/share/sonic/templates/asic_table.j2 > /etc/sonic/asic_table.json + if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json mv /tmp/config_db.json /etc/sonic/config_db.json diff --git a/platform/vs/peripheral_table.j2 b/platform/vs/peripheral_table.j2 new file mode 120000 index 00000000000..4a33273c71c --- /dev/null +++ b/platform/vs/peripheral_table.j2 @@ -0,0 +1 @@ +../mellanox/peripheral_table.j2 \ No newline at end of file diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json index 39fb042cc4c..775f351e6d6 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json @@ -108,134 +108,266 @@ "Ethernet0|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet0|3-4": { + "profile" : "NULL" + }, "Ethernet1|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet1|3-4": { + "profile" : "NULL" + }, "Ethernet4|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet4|3-4": { + "profile" : "NULL" + }, "Ethernet5|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet5|3-4": { + "profile" : "NULL" + }, "Ethernet16|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet16|3-4": { + "profile" : "NULL" + }, "Ethernet17|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet17|3-4": { + "profile" : "NULL" + }, "Ethernet20|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet20|3-4": { + "profile" : "NULL" + }, "Ethernet21|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet21|3-4": { + "profile" : "NULL" + }, "Ethernet6|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet6|3-4": { + "profile" : "NULL" + }, "Ethernet7|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet7|3-4": { + "profile" : "NULL" + }, "Ethernet8|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet8|3-4": { + "profile" : "NULL" + }, "Ethernet9|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet9|3-4": { + "profile" : "NULL" + }, "Ethernet10|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet10|3-4": { + "profile" : "NULL" + }, "Ethernet11|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet11|3-4": { + "profile" : "NULL" + }, "Ethernet12|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet12|3-4": { + "profile" : "NULL" + }, "Ethernet13|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet13|3-4": { + "profile" : "NULL" + }, "Ethernet14|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet14|3-4": { + "profile" : "NULL" + }, "Ethernet15|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet15|3-4": { + "profile" : "NULL" + }, "Ethernet32|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet32|3-4": { + "profile" : "NULL" + }, "Ethernet36|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet36|3-4": { + "profile" : "NULL" + }, "Ethernet37|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet37|3-4": { + "profile" : "NULL" + }, "Ethernet38|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet38|3-4": { + "profile" : "NULL" + }, "Ethernet39|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet39|3-4": { + "profile" : "NULL" + }, "Ethernet40|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet40|3-4": { + "profile" : "NULL" + }, "Ethernet41|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet41|3-4": { + "profile" : "NULL" + }, "Ethernet42|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet42|3-4": { + "profile" : "NULL" + }, "Ethernet22|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet22|3-4": { + "profile" : "NULL" + }, "Ethernet23|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet23|3-4": { + "profile" : "NULL" + }, "Ethernet24|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet24|3-4": { + "profile" : "NULL" + }, "Ethernet25|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet25|3-4": { + "profile" : "NULL" + }, "Ethernet26|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet26|3-4": { + "profile" : "NULL" + }, "Ethernet27|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet27|3-4": { + "profile" : "NULL" + }, "Ethernet28|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet28|3-4": { + "profile" : "NULL" + }, "Ethernet29|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet29|3-4": { + "profile" : "NULL" + }, "Ethernet30|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet30|3-4": { + "profile" : "NULL" + }, "Ethernet31|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet31|3-4": { + "profile" : "NULL" + }, "Ethernet48|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet48|3-4": { + "profile" : "NULL" + }, "Ethernet52|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet52|3-4": { + "profile" : "NULL" + }, "Ethernet53|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet53|3-4": { + "profile" : "NULL" + }, "Ethernet54|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet54|3-4": { + "profile" : "NULL" + }, "Ethernet55|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet55|3-4": { + "profile" : "NULL" + }, "Ethernet56|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet56|3-4": { + "profile" : "NULL" + }, "Ethernet57|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, + "Ethernet57|3-4": { + "profile" : "NULL" + }, "Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet58|3-4": { + "profile" : "NULL" } }, @@ -637,4 +769,16 @@ "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } +, + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0" + } + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1500", + "small_packet_percentage": "100" + } + } } From 66fe33a98693cbdb524110d5fbea9d3737eff37d Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Tue, 29 Sep 2020 01:34:32 +0000 Subject: [PATCH 2/7] Update the upgrading behavior according to the discussion with MSFT 1. If all the buffer configuration aligns the default, use dynamic buffer calculation mode. Otherwise, use the traditional mode 2. Dynamic mode is adopted in switches newly installed from scratch and traditional mode in switches installed from ninigraph This is done by: - introducing a wrapper to buffermgrd, which enables it to test which mode is adopted and feed buffermgrd with corresponding CLI arguments - preparing default buffer configuration templates for both dynamic and traditional mode for each SKU - introduce "buffer_model" in DEVICE_METADATA|localhost for mellanox platform Signed-off-by: Stephen Sun --- .../ACS-MSN2010/buffers_dynamic.json.j2 | 1 + .../ACS-MSN2100/buffers_dynamic.json.j2 | 1 + .../ACS-MSN2410/buffers_dynamic.json.j2 | 1 + .../ACS-MSN2700/buffers_defaults_t0.j2 | 12 ++ .../ACS-MSN2700/buffers_defaults_t1.j2 | 12 ++ .../ACS-MSN2700/buffers_dynamic.json.j2 | 3 + .../buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../Mellanox-SN2700/buffers_defaults_t0.j2 | 4 + .../Mellanox-SN2700/buffers_defaults_t1.j2 | 4 + .../Mellanox-SN2700/buffers_dynamic.json.j2 | 1 + .../ACS-MSN2740/buffers_dynamic.json.j2 | 1 + .../ACS-MSN3420/buffers_dynamic.json.j2 | 1 + .../ACS-MSN3700/buffers_defaults_t0.j2 | 12 ++ .../ACS-MSN3700/buffers_defaults_t1.j2 | 12 ++ .../ACS-MSN3700/buffers_dynamic.json.j2 | 1 + .../ACS-MSN3700C/buffers_dynamic.json.j2 | 1 + .../ACS-MSN3800/buffers_defaults_t0.j2 | 12 ++ .../ACS-MSN3800/buffers_defaults_t1.j2 | 12 ++ .../ACS-MSN3800/buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../ACS-MSN4600C/buffers_dynamic.json.j2 | 1 + .../buffers_defaults_t0.j2 | 4 + .../buffers_defaults_t1.j2 | 4 + .../buffers_dynamic.json.j2 | 1 + .../ACS-MSN4700/buffers_defaults_t0.j2 | 12 ++ .../ACS-MSN4700/buffers_defaults_t1.j2 | 12 ++ .../ACS-MSN4700/buffers_dynamic.json.j2 | 1 + dockers/docker-orchagent/Dockerfile.j2 | 2 +- dockers/docker-orchagent/buffermgrd.sh | 12 ++ dockers/docker-orchagent/supervisord.conf | 2 +- files/build_templates/buffers_config.j2 | 10 +- files/build_templates/init_cfg.json.j2 | 1 + platform/mellanox/rules.mk | 2 + slave.mk | 2 + .../sample_output/py2/buffers-dell6100.json | 12 ++ .../sample_output/py3/buffers-dell6100.json | 132 ------------------ 50 files changed, 210 insertions(+), 138 deletions(-) create mode 120000 device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_dynamic.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_dynamic.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_dynamic.json.j2 create mode 100755 dockers/docker-orchagent/buffermgrd.sh diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 index 3a173c22f13..d0bce94ba51 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4580864' %} +{% set ingress_lossy_pool_size = '4580864' %} {% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '4580864' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 index 3a173c22f13..5514c47a409 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '3302912' %} +{% set ingress_lossy_pool_size = '3302912' %} {% set egress_lossless_pool_size = '13945824' %} +{% set egress_lossy_pool_size = '3302912' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 new file mode 100644 index 00000000000..5954cc77c11 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't0' %} +{%- set dynamic_mode = 'true' %} +{%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 index f52b369bbbd..0ad78e08c6b 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 index cd9e4aed301..82f6a15b33c 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 index 012d77dbe47..41afd1f2244 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 index de8c3a56191..08e21ba05f7 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 index 280f76b00fe..035a1417770 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '14542848' %} +{% set ingress_lossy_pool_size = '14542848' %} {% set egress_lossless_pool_size = '34287552' %} +{% set egress_lossy_pool_size = '14542848' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 index 280f76b00fe..1032b455b8f 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '11622400' %} +{% set ingress_lossy_pool_size = '11622400' %} {% set egress_lossless_pool_size = '34287552' %} +{% set egress_lossy_pool_size = '11622400' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 index 280f76b00fe..b83e142448d 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '13924352' %} +{% set ingress_lossy_pool_size = '13924352' %} {% set egress_lossless_pool_size = '34287552' %} +{% set egress_lossy_pool_size = '13924352' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 index 280f76b00fe..abcab930c63 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '12457984' %} +{% set ingress_lossy_pool_size = '12457984' %} {% set egress_lossless_pool_size = '34287552' %} +{% set egress_lossy_pool_size = '12457984' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 index 33c89f0e8e7..2bc09d9ccc8 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 index 3347e2abffa..531f1587ba7 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 index 009f1d5ef5c..26e89cf269f 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 index ae340eb2e6e..31fd4c7692d 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 index 3edc5350591..edccf5e652b 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 index c946d5ae963..90f626db6a5 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 index 19df7a7e066..e732ff1a3d6 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 index 40768657a4e..a6556db5958 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 index 5622c0cbef2..33df493e117 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 index 186b965f1ee..7b6e6fdf388 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 @@ -13,7 +13,9 @@ {%- 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" }, @@ -23,7 +25,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 index a02972dcc93..c115d141e15 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '26451968' %} +{% set ingress_lossy_pool_size = '26451968' %} {% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '26451968' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 index a02972dcc93..0550c6dd310 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 @@ -1,5 +1,8 @@ {% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '20627456' %} +{% set ingress_lossy_pool_size = '20627456' %} {% set egress_lossless_pool_size = '60817392' %} +{% set egress_lossy_pool_size = '20627456' %} {%- macro generate_port_lists(PORT_ALL) %} {# Generate list of ports #} @@ -11,10 +14,16 @@ {%- 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" }, @@ -24,6 +33,9 @@ "mode": "dynamic" }, "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} "type": "egress", "mode": "dynamic" } diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_dynamic.json.j2 new file mode 120000 index 00000000000..8c4117c6621 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index a5f25d2b78b..00728c1c127 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -71,7 +71,7 @@ COPY ["files/arp_update", "/usr/bin"] COPY ["arp_update.conf", "files/arp_update_vars.j2", "/usr/share/sonic/templates/"] COPY ["ndppd.conf", "/usr/share/sonic/templates/"] COPY ["enable_counters.py", "/usr/bin"] -COPY ["docker-init.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] +COPY ["docker-init.sh", "orchagent.sh", "swssconfig.sh", "buffermgrd.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] diff --git a/dockers/docker-orchagent/buffermgrd.sh b/dockers/docker-orchagent/buffermgrd.sh new file mode 100755 index 00000000000..486e3f26d78 --- /dev/null +++ b/dockers/docker-orchagent/buffermgrd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model) + +if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" +else + # Should we use the fallback MAC in case it is not found in Device.Metadata + BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" +fi + +exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 4a6c4d2376c..3f2cf1cf828 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -136,7 +136,7 @@ dependent_startup=true dependent_startup_wait_for=swssconfig:exited [program:buffermgrd] -command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini -a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json +command=/usr/bin/buffermgrd.sh priority=11 autostart=false autorestart=false diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index af36100b8f8..70842dc11c8 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -22,7 +22,7 @@ def {%- endif -%} {# Import default values from device HWSKU folder #} -{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs %} +{%- import 'buffers_defaults_%s.j2' % filename_postfix as defs with context %} {%- set default_cable = defs.default_cable -%} @@ -142,11 +142,13 @@ def {% else %} "BUFFER_PG": { {% for port in PORT_ACTIVE %} - "{{ port }}|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, +{% if dynamic_mode is defined %} "{{ port }}|3-4": { "profile" : "NULL" + }, +{% endif %} + "{{ port }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }{% if not loop.last %},{% endif %} {% endfor %} diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 717aa3a00a8..356da123d71 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -1,6 +1,7 @@ { "DEVICE_METADATA": { "localhost": { + {% if default_buffer_model == "dynamic" %}"buffer_model": "dynamic",{% endif %} "default_bgp_status": {% if shutdown_bgp_on_start == "y" %}"down"{% else %}"up"{% endif %}, "default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %} } diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index f8700733c90..1e2ca78a195 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -31,3 +31,5 @@ $(SYNCD)_RDEPENDS += $(MLNX_SAI) # Inject mlnx sdk libs to platform monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_GEN_UTILS) $(PYTHON_SDK_API) $(APPLIBS_DEV) $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(SX_GEN_UTILS_DEV) + +export SONIC_BUFFER_MODEL=dynamic diff --git a/slave.mk b/slave.mk index eb8e9d7765c..e818eeed16d 100644 --- a/slave.mk +++ b/slave.mk @@ -222,6 +222,7 @@ $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)") $(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)") +$(info "SONIC_BUFFER_MODEL" : "$(SONIC_BUFFER_MODEL)") $(info "INSTALL_DEBUG_TOOLS" : "$(INSTALL_DEBUG_TOOLS)") $(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)") ifeq ($(SONIC_ROUTING_STACK),frr) @@ -865,6 +866,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export include_iccpd="$(INCLUDE_ICCPD)" export pddf_support="$(PDDF_SUPPORT)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" + export default_buffer_model="$(SONIC_BUFFER_MODEL)" export include_kubernetes="$(INCLUDE_KUBERNETES)" export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS))" diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json index 56de7500c1a..11261da2e1f 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json @@ -637,4 +637,16 @@ "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } +, + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0" + } + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1500", + "small_packet_percentage": "100" + } + } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json index 775f351e6d6..e6e818142ea 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json @@ -108,266 +108,134 @@ "Ethernet0|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet0|3-4": { - "profile" : "NULL" - }, "Ethernet1|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet1|3-4": { - "profile" : "NULL" - }, "Ethernet4|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet4|3-4": { - "profile" : "NULL" - }, "Ethernet5|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet5|3-4": { - "profile" : "NULL" - }, "Ethernet16|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet16|3-4": { - "profile" : "NULL" - }, "Ethernet17|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet17|3-4": { - "profile" : "NULL" - }, "Ethernet20|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet20|3-4": { - "profile" : "NULL" - }, "Ethernet21|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet21|3-4": { - "profile" : "NULL" - }, "Ethernet6|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet6|3-4": { - "profile" : "NULL" - }, "Ethernet7|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet7|3-4": { - "profile" : "NULL" - }, "Ethernet8|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet8|3-4": { - "profile" : "NULL" - }, "Ethernet9|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet9|3-4": { - "profile" : "NULL" - }, "Ethernet10|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet10|3-4": { - "profile" : "NULL" - }, "Ethernet11|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet11|3-4": { - "profile" : "NULL" - }, "Ethernet12|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet12|3-4": { - "profile" : "NULL" - }, "Ethernet13|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet13|3-4": { - "profile" : "NULL" - }, "Ethernet14|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet14|3-4": { - "profile" : "NULL" - }, "Ethernet15|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet15|3-4": { - "profile" : "NULL" - }, "Ethernet32|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet32|3-4": { - "profile" : "NULL" - }, "Ethernet36|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet36|3-4": { - "profile" : "NULL" - }, "Ethernet37|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet37|3-4": { - "profile" : "NULL" - }, "Ethernet38|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet38|3-4": { - "profile" : "NULL" - }, "Ethernet39|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet39|3-4": { - "profile" : "NULL" - }, "Ethernet40|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet40|3-4": { - "profile" : "NULL" - }, "Ethernet41|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet41|3-4": { - "profile" : "NULL" - }, "Ethernet42|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet42|3-4": { - "profile" : "NULL" - }, "Ethernet22|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet22|3-4": { - "profile" : "NULL" - }, "Ethernet23|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet23|3-4": { - "profile" : "NULL" - }, "Ethernet24|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet24|3-4": { - "profile" : "NULL" - }, "Ethernet25|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet25|3-4": { - "profile" : "NULL" - }, "Ethernet26|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet26|3-4": { - "profile" : "NULL" - }, "Ethernet27|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet27|3-4": { - "profile" : "NULL" - }, "Ethernet28|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet28|3-4": { - "profile" : "NULL" - }, "Ethernet29|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet29|3-4": { - "profile" : "NULL" - }, "Ethernet30|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet30|3-4": { - "profile" : "NULL" - }, "Ethernet31|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet31|3-4": { - "profile" : "NULL" - }, "Ethernet48|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet48|3-4": { - "profile" : "NULL" - }, "Ethernet52|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet52|3-4": { - "profile" : "NULL" - }, "Ethernet53|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet53|3-4": { - "profile" : "NULL" - }, "Ethernet54|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet54|3-4": { - "profile" : "NULL" - }, "Ethernet55|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet55|3-4": { - "profile" : "NULL" - }, "Ethernet56|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet56|3-4": { - "profile" : "NULL" - }, "Ethernet57|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet57|3-4": { - "profile" : "NULL" - }, "Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet58|3-4": { - "profile" : "NULL" } }, From 2e7a61c38be1beb0d9448f564f629202ac4ab923 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Fri, 30 Oct 2020 22:32:53 +0800 Subject: [PATCH 3/7] Fix vs image building issues Signed-off-by: Stephen Sun --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 3 ++- .../{asic_table.j2 => asic_table.json} | 0 platform/vs/docker-sonic-vs/buffermgrd.sh | 13 +++++++++++++ platform/vs/docker-sonic-vs/start.sh | 4 +--- platform/vs/docker-sonic-vs/supervisord.conf | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) rename platform/vs/docker-sonic-vs/{asic_table.j2 => asic_table.json} (100%) create mode 100755 platform/vs/docker-sonic-vs/buffermgrd.sh diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 41a7e976ba6..1baf5d4a186 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -157,7 +157,8 @@ COPY ["port_breakout_config_db.json", "/etc/sonic/"] COPY ["database_config.json", "/etc/default/sonic-db/"] COPY ["hostname.j2", "/usr/share/sonic/templates/"] COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"] -COPY ["asic_table.j2", "/usr/share/sonic/templates/"] +COPY ["asic_table.json", "/etc/sonic/"] +COPY ["buffermgrd.sh", "/usr/bin/"] COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"] diff --git a/platform/vs/docker-sonic-vs/asic_table.j2 b/platform/vs/docker-sonic-vs/asic_table.json similarity index 100% rename from platform/vs/docker-sonic-vs/asic_table.j2 rename to platform/vs/docker-sonic-vs/asic_table.json diff --git a/platform/vs/docker-sonic-vs/buffermgrd.sh b/platform/vs/docker-sonic-vs/buffermgrd.sh new file mode 100755 index 00000000000..425a6974c30 --- /dev/null +++ b/platform/vs/docker-sonic-vs/buffermgrd.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model) +export ASIC_VENDOR=vs + +if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" +else + # Should we use the fallback MAC in case it is not found in Device.Metadata + BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" +fi + +exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 9d815002542..3d349a4ad12 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -32,9 +32,7 @@ if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then fi SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') -sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json - -sonic-cfggen -d -t /usr/share/sonic/templates/asic_table.j2 > /etc/sonic/asic_table.json +sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"mac": "'$SYSTEM_MAC_ADDRESS'", "buffer_model": "traditional"}}}' $CHASS_CFG --print-data > /etc/sonic/init_cfg.json if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 09f9c34b14b..3312bad4802 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -156,7 +156,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:buffermgrd] -command=/usr/bin/buffermgrd -l /usr/share/sonic/hwsku/pg_profile_lookup.ini +command=/usr/bin/buffermgrd.sh priority=17 autostart=false autorestart=false From ab20f9c8741071370590e1d235c119cbcdd7ed17 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sat, 31 Oct 2020 22:42:50 +0800 Subject: [PATCH 4/7] Always initialize buffer_model - For Mellanox, dynamic by default - For other vendors, traditional mode. Signed-off-by: Stephen Sun --- files/build_templates/init_cfg.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 356da123d71..82f300e0070 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -1,7 +1,7 @@ { "DEVICE_METADATA": { "localhost": { - {% if default_buffer_model == "dynamic" %}"buffer_model": "dynamic",{% endif %} + "buffer_model": {% if default_buffer_model == "dynamic" %}"dynamic"{% else %}"traditional"{% endif %}, "default_bgp_status": {% if shutdown_bgp_on_start == "y" %}"down"{% else %}"up"{% endif %}, "default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %} } From 1aab411c7763e049beaee47222ed6407ca7ea1e9 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Thu, 19 Nov 2020 06:44:48 +0800 Subject: [PATCH 5/7] Fix error in docker-orchagent/supervisor.conf Signed-off-by: Stephen Sun --- dockers/docker-orchagent/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 3f2cf1cf828..4d60606a810 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -143,7 +143,7 @@ autorestart=false stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true -dependent_startup_wait_for=rsyslogd:running +dependent_startup_wait_for=swssconfig:exited [program:vrfmgrd] command=/usr/bin/vrfmgrd From 7e6bc5d51b0132b3ef34639de0a0d58ffd4a2588 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sat, 5 Dec 2020 20:18:22 +0800 Subject: [PATCH 6/7] Correct the peer MTU which should be 1k in LOSSLESS_TRAFFIC_PATTERN table Signed-off-by: Stephen Sun --- files/build_templates/buffers_config.j2 | 2 +- .../tests/sample_output/py2/buffers-dell6100.json | 2 +- .../tests/sample_output/py3/buffers-dell6100.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 70842dc11c8..5f6aab7bbfb 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -185,7 +185,7 @@ def }, "LOSSLESS_TRAFFIC_PATTERN": { "AZURE": { - "mtu": "1500", + "mtu": "1024", "small_packet_percentage": "100" } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json index 11261da2e1f..4b48f66f2be 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json @@ -645,7 +645,7 @@ }, "LOSSLESS_TRAFFIC_PATTERN": { "AZURE": { - "mtu": "1500", + "mtu": "1024", "small_packet_percentage": "100" } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json index e6e818142ea..a67b1ae1f9f 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json @@ -645,7 +645,7 @@ }, "LOSSLESS_TRAFFIC_PATTERN": { "AZURE": { - "mtu": "1500", + "mtu": "1024", "small_packet_percentage": "100" } } From f09e695d653eab0b3100db9ed03f11fb82b6455a Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Tue, 8 Dec 2020 10:26:28 +0800 Subject: [PATCH 7/7] buffermgrd: provide the peripheral_table.json only if it exists Signed-off-by: Stephen Sun --- dockers/docker-orchagent/buffermgrd.sh | 6 +++++- platform/vs/docker-sonic-vs/buffermgrd.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/buffermgrd.sh b/dockers/docker-orchagent/buffermgrd.sh index 486e3f26d78..1d09cfc7d6e 100755 --- a/dockers/docker-orchagent/buffermgrd.sh +++ b/dockers/docker-orchagent/buffermgrd.sh @@ -3,7 +3,11 @@ BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model) if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then - BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" + if [ -f /etc/sonic/peripheral_table.json ]; then + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" + else + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" + fi else # Should we use the fallback MAC in case it is not found in Device.Metadata BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" diff --git a/platform/vs/docker-sonic-vs/buffermgrd.sh b/platform/vs/docker-sonic-vs/buffermgrd.sh index 425a6974c30..9cdc57434a8 100755 --- a/platform/vs/docker-sonic-vs/buffermgrd.sh +++ b/platform/vs/docker-sonic-vs/buffermgrd.sh @@ -4,7 +4,7 @@ BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer export ASIC_VENDOR=vs if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then - BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" else # Should we use the fallback MAC in case it is not found in Device.Metadata BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini"