[Dynamic buffer calc] Support dynamic buffer calculation (#6194)

**- Why I did it**
To support dynamic buffer calculation.
This PR also depends on the following PRs for sub modules
- [sonic-swss: [buffermgr/bufferorch] Support dynamic buffer calculation #1338](https://github.com/Azure/sonic-swss/pull/1338)
- [sonic-swss-common: Dynamic buffer calculation #361](https://github.com/Azure/sonic-swss-common/pull/361)
- [sonic-utilities: Support dynamic buffer calculation #973](https://github.com/Azure/sonic-utilities/pull/973)

**- How I did it**
1. Introduce field `buffer_model` in `DEVICE_METADATA|localhost` to represent which buffer model is running in the system currently:
    - `dynamic` for the dynamic buffer calculation model
    - `traditional` for the traditional model in which the `pg_profile_lookup.ini` is used
2. Add the tables required for the feature:
   - ASIC_TABLE in platform/\<vendor\>/asic_table.j2
   - PERIPHERAL_TABLE in platform/\<vendor\>/peripheral_table.j2
   - PORT_PERIPHERAL_TABLE on a per-platform basis in device/\<vendor\>/\<platform\>/port_peripheral_config.j2 for each platform with gearbox installed.
   - 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
3. Copy the newly introduced j2 files into the image and rendering them when the system starts
4. Update the CLI options for buffermgrd so that it can start with dynamic mode
5. Fetches the ASIC vendor name in orchagent:
   - fetch the vendor name when creates the docker and pass it as a docker environment variable
   - `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
This commit is contained in:
Stephen Sun 2020-12-14 03:35:39 +08:00 committed by GitHub
parent 6db01243d9
commit e010d83fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 312 additions and 6 deletions

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -0,0 +1,3 @@
{%- set default_topo = 't0' %}
{%- set dynamic_mode = 'true' %}
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -0,0 +1,10 @@
[
{%- include 'peripheral_table.j2' %}
,
{
"PORT_PERIPHERAL_TABLE:global": {
"gearbox_model": "MELLANOX-GEARBOX-3800"
},
"OP": "SET"
}
]

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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"
}

View File

@ -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"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -14,12 +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"
},
@ -29,7 +33,9 @@
"mode": "dynamic"
},
"egress_lossy_pool": {
{%- if dynamic_mode is not defined %}
"size": "{{ egress_lossy_pool_size }}",
{%- endif %}
"type": "egress",
"mode": "dynamic"
}

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2

View File

@ -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/"]

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model)
if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then
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"
fi
exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS}

View File

@ -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
command=/usr/bin/buffermgrd.sh
priority=11
autostart=false
autorestart=false

View File

@ -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,6 +142,11 @@ def
{% else %}
"BUFFER_PG": {
{% for port in PORT_ACTIVE %}
{% if dynamic_mode is defined %}
"{{ port }}|3-4": {
"profile" : "NULL"
},
{% endif %}
"{{ port }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}{% if not loop.last %},{% endif %}
@ -172,4 +177,18 @@ def
{% endfor %}
}
{% endif %}
{% if dynamic_mode is defined %}
,
"DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"AZURE": {
"default_dynamic_th": "0"
}
},
"LOSSLESS_TRAFFIC_PATTERN": {
"AZURE": {
"mtu": "1024",
"small_packet_percentage": "100"
}
}
{% endif %}
}

View File

@ -247,6 +247,19 @@ 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`
# 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.
# 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.
@ -359,6 +372,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 %}

View File

@ -1,6 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"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 %}
}

View File

@ -400,6 +400,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

View File

@ -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

View File

@ -0,0 +1,59 @@
{%- 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"
}
{% endif %}
]

View File

@ -0,0 +1,17 @@
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %}
{%- set platform = DEVICE_METADATA['localhost']['platform'] %}
{%- endif -%}
{% set platform2gearbox = {
'x86_64-mlnx_msn3800-r0':'MELLANOX-GEARBOX-3800'
}
%}
{% set gearbox_type = platform2gearbox[platform] %}
{% if gearbox_type == 'MELLANOX-GEARBOX-3800' %}
{
"PERIPHERAL_TABLE:MELLANOX-GEARBOX-3800": {
"gearbox_delay": "400"
},
"OP": "SET"
}
{% endif %}

View File

@ -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

View File

@ -157,6 +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.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/"]

View File

@ -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"
}
]

View File

@ -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"
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}

View File

@ -32,7 +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 -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

View File

@ -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

View File

@ -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))"