From c9a6731881073dcaf4d8ff305a908ee01216b908 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Fri, 11 Sep 2020 12:08:31 +0000 Subject: [PATCH 01/10] [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 b8f7d070919d..3a173c22f13d 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 a8d32205607e..3a173c22f13d 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 959cc8359be4..280f76b00fe2 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 cef78f34b4f4..280f76b00fe2 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 bd8e1c8bb794..280f76b00fe2 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 6e7b6b359189..280f76b00fe2 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 000000000000..8d201517ed62 --- /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 506107f47760..a02972dcc939 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 b025ea275ba8..a02972dcc939 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 8a942d8549c0..4a6c4d2376cd 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 c741c6ea364e..af36100b8f8f 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 477fd897bff5..6d433c83be09 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 8663ee35a509..a841ebdaa665 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 11613b5a8a5c..1c54aefb0c0b 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 000000000000..47e900b2e44f --- /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 000000000000..70e664559bee --- /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 000000000000..d3133a30d812 --- /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 22ff02fdfda1..41a7e976ba6a 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 000000000000..9d94638dd739 --- /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 99c15925d179..9d8150025425 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 000000000000..4a33273c71c0 --- /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 39fb042cc4cb..775f351e6d60 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 02/10] 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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 3a173c22f13d..d0bce94ba51d 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 3a173c22f13d..5514c47a4090 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 000000000000..5954cc77c114 --- /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 000000000000..8c4117c66214 --- /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 f52b369bbbdf..0ad78e08c6b5 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 cd9e4aed3011..82f6a15b33c8 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 000000000000..8c4117c66214 --- /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 012d77dbe479..41afd1f22444 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 de8c3a561919..08e21ba05f75 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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 280f76b00fe2..035a14177705 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 280f76b00fe2..1032b455b8f1 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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 280f76b00fe2..b83e142448d6 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 280f76b00fe2..abcab930c63e 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 000000000000..8c4117c66214 --- /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 33c89f0e8e75..2bc09d9ccc83 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 3347e2abffa5..531f1587ba7a 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 000000000000..8c4117c66214 --- /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 009f1d5ef5cc..26e89cf269ff 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 ae340eb2e6e2..31fd4c7692dd 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 000000000000..8c4117c66214 --- /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 3edc53505912..edccf5e652bc 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 c946d5ae9631..90f626db6a52 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 000000000000..8c4117c66214 --- /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 19df7a7e066f..e732ff1a3d65 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 40768657a4e4..a6556db59587 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 000000000000..8c4117c66214 --- /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 000000000000..8c4117c66214 --- /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 5622c0cbef29..33df493e117e 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 186b965f1ee4..7b6e6fdf3883 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 000000000000..8c4117c66214 --- /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 a02972dcc939..c115d141e152 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 a02972dcc939..0550c6dd3103 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 000000000000..8c4117c66214 --- /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 a5f25d2b78b7..00728c1c127e 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 000000000000..486e3f26d788 --- /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 4a6c4d2376cd..3f2cf1cf8287 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 af36100b8f8f..70842dc11c8e 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 717aa3a00a8e..356da123d71a 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 f8700733c908..1e2ca78a195b 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 eb8e9d7765ce..e818eeed16d9 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 56de7500c1ad..11261da2e1fb 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 775f351e6d60..e6e818142eab 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 03/10] 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 41a7e976ba6a..1baf5d4a1863 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 000000000000..425a6974c309 --- /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 9d8150025425..3d349a4ad12a 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 09f9c34b14b4..3312bad48023 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 04/10] 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 356da123d71a..82f300e00701 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 05/10] 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 3f2cf1cf8287..4d60606a8104 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 06/10] 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 70842dc11c8e..5f6aab7bbfb2 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 11261da2e1fb..4b48f66f2be0 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 e6e818142eab..a67b1ae1f9f2 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 07/10] 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 486e3f26d788..1d09cfc7d6ee 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 425a6974c309..9cdc57434a8f 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" From 5364a112f24cb76e29bbc018c61d8c5b2792d74b Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sat, 12 Dec 2020 12:47:05 +0800 Subject: [PATCH 08/10] Fix review comments Signed-off-by: Stephen Sun --- files/build_templates/buffers_config.j2 | 4 +++- platform/vs/asic_table.j2 | 1 - platform/vs/docker-sonic-vs/asic_table.json | 18 +++++++++--------- platform/vs/peripheral_table.j2 | 1 - .../sample_output/py2/buffers-dell6100.json | 12 ------------ .../sample_output/py3/buffers-dell6100.json | 12 ------------ 6 files changed, 12 insertions(+), 36 deletions(-) delete mode 120000 platform/vs/asic_table.j2 delete mode 120000 platform/vs/peripheral_table.j2 diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 5f6aab7bbfb2..3b11b406c738 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -177,7 +177,8 @@ def {% endfor %} } {% endif %} -, +{% if dynamic_mode is defined %} + , "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { "AZURE": { "default_dynamic_th": "0" @@ -189,4 +190,5 @@ def "small_packet_percentage": "100" } } +{% endif %} } diff --git a/platform/vs/asic_table.j2 b/platform/vs/asic_table.j2 deleted file mode 120000 index d3133a30d812..000000000000 --- a/platform/vs/asic_table.j2 +++ /dev/null @@ -1 +0,0 @@ -../mellanox/asic_table.j2 \ No newline at end of file diff --git a/platform/vs/docker-sonic-vs/asic_table.json b/platform/vs/docker-sonic-vs/asic_table.json index 9d94638dd739..f0ed93864e2f 100644 --- a/platform/vs/docker-sonic-vs/asic_table.json +++ b/platform/vs/docker-sonic-vs/asic_table.json @@ -1,11 +1,11 @@ [ -{ - "ASIC_TABLE:VS-ASIC": { - "cell_size": "128", - "pipeline_latency": "18", - "mac_phy_delay": "0.8", - "peer_response_time": "3.8" - }, - "OP": "SET" -} + { + "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/peripheral_table.j2 b/platform/vs/peripheral_table.j2 deleted file mode 120000 index 4a33273c71c0..000000000000 --- a/platform/vs/peripheral_table.j2 +++ /dev/null @@ -1 +0,0 @@ -../mellanox/peripheral_table.j2 \ No newline at end of file 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 4b48f66f2be0..56de7500c1ad 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,16 +637,4 @@ "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } -, - "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { - "AZURE": { - "default_dynamic_th": "0" - } - }, - "LOSSLESS_TRAFFIC_PATTERN": { - "AZURE": { - "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 a67b1ae1f9f2..39fb042cc4cb 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 @@ -637,16 +637,4 @@ "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } -, - "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { - "AZURE": { - "default_dynamic_th": "0" - } - }, - "LOSSLESS_TRAFFIC_PATTERN": { - "AZURE": { - "mtu": "1024", - "small_packet_percentage": "100" - } - } } From 73431d99bf653f0d6b76e0b22c453ff1e0266ee9 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sat, 12 Dec 2020 12:33:16 +0000 Subject: [PATCH 09/10] Fix comments: - remove vs related stuff from Mellanox specific asic_table.json and peripheral_table.json - fix minor errors Signed-off-by: Stephen Sun --- .../port_peripheral_config.j2 | 2 +- files/build_templates/docker_image_ctl.j2 | 15 ++++++++------- platform/mellanox/asic_table.j2 | 10 ---------- platform/mellanox/peripheral_table.j2 | 14 +++----------- 4 files changed, 12 insertions(+), 29 deletions(-) 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 index 8d201517ed62..c564e14f3169 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 @@ -3,7 +3,7 @@ , { "PORT_PERIPHERAL_TABLE:global": { - "gearbox_model": "MELLANOX-GEARBOX-1" + "gearbox_model": "MELLANOX-GEARBOX-3800" }, "OP": "SET" } diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 6d433c83be09..a1bc07a3ccb3 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -83,13 +83,6 @@ 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 %} @@ -253,6 +246,14 @@ start() { {%- if docker_container_name == "swss" %} # Obtain the vendor name ASIC_VENDOR=`$SONIC_CFGGEN -y /etc/sonic/sonic_version.yml -v asic_type` + + # Generate the asic_table.json and peripheral_table.json + 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 {%- endif %} # In Multi ASIC platforms the global database config file database_global.json will exist. diff --git a/platform/mellanox/asic_table.j2 b/platform/mellanox/asic_table.j2 index 47e900b2e44f..4afc780b0b06 100644 --- a/platform/mellanox/asic_table.j2 +++ b/platform/mellanox/asic_table.j2 @@ -55,15 +55,5 @@ }, "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 index 70e664559bee..718b04b4c78e 100644 --- a/platform/mellanox/peripheral_table.j2 +++ b/platform/mellanox/peripheral_table.j2 @@ -5,21 +5,13 @@ {%- endif -%} {% set platform2gearbox = { - 'x86_64-mlnx_msn3800-r0':'MELLANOX-GEARBOX-1', - 'vs-platform':'VS-GEARBOX' + 'x86_64-mlnx_msn3800-r0':'MELLANOX-GEARBOX-3800' } %} {% set gearbox_type = platform2gearbox[platform] %} -{% if gearbox_type == 'MELLANOX-GEARBOX-1' %} +{% if gearbox_type == 'MELLANOX-GEARBOX-3800' %} { - "PERIPHERAL_TABLE:MELLANOX-GEARBOX-1": { - "gearbox_delay": "400" - }, - "OP": "SET" -} -{% elif gearbox_type == 'VS-GEARBOX' %} -{ - "PERIPHERAL_TABLE:VS-GEARBOX": { + "PERIPHERAL_TABLE:MELLANOX-GEARBOX-3800": { "gearbox_delay": "400" }, "OP": "SET" From a4b8fb2dde87ca6768109d5e9c9b2aea30644e9b Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sun, 13 Dec 2020 01:38:57 +0000 Subject: [PATCH 10/10] Fix review comments: Remove vs stuff from Mellanox related files and fix indent Signed-off-by: Stephen Sun --- .../port_peripheral_config.j2 | 16 ++++++++-------- platform/mellanox/peripheral_table.j2 | 5 +---- 2 files changed, 9 insertions(+), 12 deletions(-) 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 index c564e14f3169..1cad105ed1ee 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 @@ -1,10 +1,10 @@ [ -{%- include 'peripheral_table.j2' %} -, -{ - "PORT_PERIPHERAL_TABLE:global": { - "gearbox_model": "MELLANOX-GEARBOX-3800" - }, - "OP": "SET" -} + {%- include 'peripheral_table.j2' %} + , + { + "PORT_PERIPHERAL_TABLE:global": { + "gearbox_model": "MELLANOX-GEARBOX-3800" + }, + "OP": "SET" + } ] diff --git a/platform/mellanox/peripheral_table.j2 b/platform/mellanox/peripheral_table.j2 index 718b04b4c78e..730fd681bc61 100644 --- a/platform/mellanox/peripheral_table.j2 +++ b/platform/mellanox/peripheral_table.j2 @@ -1,7 +1,5 @@ {%- 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 = { @@ -12,9 +10,8 @@ {% if gearbox_type == 'MELLANOX-GEARBOX-3800' %} { "PERIPHERAL_TABLE:MELLANOX-GEARBOX-3800": { - "gearbox_delay": "400" + "gearbox_delay": "400" }, "OP": "SET" } {% endif %} -