From f7253f6babb2d872e958d158119a63004691bf47 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Thu, 25 Jun 2020 14:07:47 -0700 Subject: [PATCH 01/31] buildimage: Add gearbox phy device files and a new physyncd docker to support VS gearbox phy feature * scripts and configuration needed to support a second syncd docker (physyncd) * physyncd supports gearbox device and phy SAI APIs and runs multiple instances of syncd, one per phy in the device * support for VS target (sonic-sairedis vslib has been extended to support a virtual BCM81724 gearbox PHY). HLD is located at https://github.com/Azure/SONiC/blob/b817a12fd89520d3fd26bbc5897487928e7f6de7/doc/gearbox/gearbox_mgr_design.md **- Why I did it** This work is part of the gearbox phy joint effort between Microsoft and Broadcom, and is based on multi-switch support in sonic-sairedis. **- How I did it** Overall feature was implemented across several projects. The collective pull requests (some in late stages of review at this point): https://github.com/Azure/sonic-utilities/pull/931 - CLI (merged) https://github.com/Azure/sonic-swss-common/pull/347 - Minor changes (merged) https://github.com/Azure/sonic-swss/pull/1321 - gearsyncd, config parsers, changes to orchargent to create gearbox phy on supported systems https://github.com/Azure/sonic-sairedis/pull/624 - physyncd, virtual BCM81724 gearbox phy added to vslib **- How to verify it** In a vslib build: root@sonic:/home/admin# show gearbox interfaces status PHY Id Interface MAC Lanes MAC Lane Speed PHY Lanes PHY Lane Speed Line Lanes Line Lane Speed Oper Admin -------- ----------- --------------- ---------------- --------------- ---------------- ------------ ----------------- ------ ------- 1 Ethernet48 121,122,123,124 25G 200,201,202,203 25G 204,205 50G down down 1 Ethernet49 125,126,127,128 25G 206,207,208,209 25G 210,211 50G down down 1 Ethernet50 69,70,71,72 25G 212,213,214,215 25G 216 100G down down In addition, docker ps | grep phy should show a physyncd docker running. Signed-off-by: syd.logan@broadcom.com --- .../Force10-S6000/context_config.json | 32 +++ .../Force10-S6000/gearbox_config.json | 38 +++ .../Force10-S6000/phy1_config_1.json | 168 ++++++++++++ .../DellEMC-S5248f-P-25G/context_config.json | 32 +++ .../DellEMC-S5248f-P-25G/gearbox_config.json | 38 +++ .../DellEMC-S5248f-P-25G/sesto-1.json | 256 ++++++++++++++++++ .../docker-database/database_config.json.j2 | 15 + dockers/docker-orchagent/critical_processes | 1 + dockers/docker-orchagent/supervisord.conf | 9 + files/build_templates/physyncd.service.j2 | 31 +++ .../build_templates/sonic_debian_extension.j2 | 3 +- files/scripts/physyncd.sh | 191 +++++++++++++ platform/template/docker-physyncd-base.mk | 30 ++ platform/vs/docker-physyncd-vs.dep | 11 + platform/vs/docker-physyncd-vs.mk | 14 + platform/vs/docker-physyncd-vs/Dockerfile.j2 | 32 +++ platform/vs/docker-physyncd-vs/start.sh | 31 +++ .../vs/docker-physyncd-vs/supervisord.conf | 28 ++ .../vs/docker-sonic-vs/database_config.json | 15 + platform/vs/rules.mk | 1 + src/sonic-device-data/Makefile | 3 + src/sonic-device-data/src/pai.vs_profile | 7 + 22 files changed, 985 insertions(+), 1 deletion(-) create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json create mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json create mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json create mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json create mode 100644 files/build_templates/physyncd.service.j2 create mode 100644 files/scripts/physyncd.sh create mode 100644 platform/template/docker-physyncd-base.mk create mode 100644 platform/vs/docker-physyncd-vs.dep create mode 100644 platform/vs/docker-physyncd-vs.mk create mode 100644 platform/vs/docker-physyncd-vs/Dockerfile.j2 create mode 100644 platform/vs/docker-physyncd-vs/start.sh create mode 100644 platform/vs/docker-physyncd-vs/supervisord.conf create mode 100644 src/sonic-device-data/src/pai.vs_profile diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json new file mode 100644 index 000000000000..9f9f80ba0d36 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json @@ -0,0 +1,32 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "sw0", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "switches": [ + { + "index" : 0, + "hwinfo" : "" + } + ] + }, + { + "guid" : 1, + "name" : "phy1", + "dbAsic" : "GB_ASIC_DB", + "dbCounters" : "GB_COUNTERS_DB", + "dbFlex": "GB_FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "switches": [ + { + "index" : 1, + "hwinfo" : "" + } + ] + } + ] +} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json new file mode 100644 index 000000000000..32d92b7a6453 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json @@ -0,0 +1,38 @@ +{ + "phys": [ + { + "phy_id": 1, + "name": "sesto-1", + "address": "0x1000", + "lib_name": "libsai_phy_sesto-1.so", + "firmware_path": "/tmp/phy-sesto-1.bin", + "config_file": "/usr/share/sonic/hwsku/phy1_config_1.json", + "sai_init_config_file": "/usr/share/sonic/hwsku/sesto-1.bcm", + "phy_access": "mdio", + "bus_id": 0 + } + ], + "interfaces": [ + { + "name": "Ethernet0", + "index": 0, + "phy_id" : 1, + "system_lanes": [200,201], + "line_lanes": [206] + }, + { + "name": "Ethernet4", + "index": 1, + "phy_id" : 1, + "system_lanes": [202,203], + "line_lanes": [207] + }, + { + "name": "Ethernet8", + "index": 2, + "phy_id" : 1, + "system_lanes": [204,205], + "line_lanes": [208] + } + ] +} \ No newline at end of file diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json new file mode 100644 index 000000000000..691acd9f9b8d --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json @@ -0,0 +1,168 @@ +{ + "lanes": [ + { + "index": 200, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0200" + }, + { + "index": 201, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0201" + }, + { + "index": 202, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0202" + }, + { + "index": 203, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0203" + }, + { + "index": 204, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 200, + "mdio_addr": "0x0204" + }, + { + "index": 205, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 202, + "mdio_addr": "0x0205" + }, + { + "index": 206, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0206" + }, + { + "index": 207, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0207" + }, + { + "index": 208, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0208" + } + ], + "ports": [ + { + "index": 0, + "mdio_addr": "0x2000", + "system_speed": 20000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 40000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + }, + { + "index": 1, + "mdio_addr": "0x3000", + "system_speed": 20000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 40000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + }, + { + "index": 2, + "mdio_addr": "0x4000", + "system_speed": 20000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 40000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + } + ] +} diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json new file mode 100644 index 000000000000..9f9f80ba0d36 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json @@ -0,0 +1,32 @@ +{ + "CONTEXTS": [ + { + "guid" : 0, + "name" : "sw0", + "dbAsic" : "ASIC_DB", + "dbCounters" : "COUNTERS_DB", + "dbFlex": "FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "switches": [ + { + "index" : 0, + "hwinfo" : "" + } + ] + }, + { + "guid" : 1, + "name" : "phy1", + "dbAsic" : "GB_ASIC_DB", + "dbCounters" : "GB_COUNTERS_DB", + "dbFlex": "GB_FLEX_COUNTER_DB", + "dbState" : "STATE_DB", + "switches": [ + { + "index" : 1, + "hwinfo" : "" + } + ] + } + ] +} diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json new file mode 100644 index 000000000000..6342bd74b89a --- /dev/null +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json @@ -0,0 +1,38 @@ +{ + "phys": [ + { + "phy_id": 1, + "name": "sesto-1", + "address": "0x1000", + "lib_name": "libsai_phy_sesto-1.so", + "firmware_path": "/tmp/phy-sesto-1.bin", + "config_file": "/usr/share/sonic/hwsku/sesto-1.json", + "sai_init_config_file": "/usr/share/sonic/hwsku/sesto-1.bcm", + "phy_access": "mdio", + "bus_id": 0 + } + ], + "interfaces": [ + { + "name": "Ethernet48", + "index": 49, + "phy_id" : 1, + "system_lanes": [200,201,202,203], + "line_lanes": [204,205] + }, + { + "name": "Ethernet49", + "index": 50, + "phy_id" : 1, + "system_lanes": [206,207,208,209], + "line_lanes": [210,211] + }, + { + "name": "Ethernet50", + "index": 51, + "phy_id" : 1, + "system_lanes": [212,213,214,215], + "line_lanes": [216] + } + ] +} diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json new file mode 100644 index 000000000000..a9c92ba8ebe4 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json @@ -0,0 +1,256 @@ +{ + "lanes": [ + { + "index": 200, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0200" + }, + { + "index": 201, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0201" + }, + { + "index": 202, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0202" + }, + { + "index": 203, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0203" + }, + { + "index": 204, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 200, + "mdio_addr": "0x0204" + }, + { + "index": 205, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 202, + "mdio_addr": "0x0205" + }, + { + "index": 206, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0206" + }, + { + "index": 207, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0207" + }, + { + "index": 208, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0208" + }, + { + "index": 209, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0209" + }, + { + "index": 210, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 206, + "mdio_addr": "0x0210" + }, + { + "index": 211, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 208, + "mdio_addr": "0x0211" + }, + { + "index": 212, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0012" + }, + { + "index": 213, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0013" + }, + { + "index": 214, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0014" + }, + { + "index": 215, + "local_lane_id": 0, + "system_side": true, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 0, + "mdio_addr": "0x0015" + }, + { + "index": 216, + "local_lane_id": 0, + "system_side": false, + "tx_polarity": 0, + "rx_polarity": 0, + "line_tx_lanemap": 0, + "line_rx_lanemap": 0, + "line_to_system_lanemap": 212, + "mdio_addr": "0x0016" + } + ], + "ports": [ + { + "index": 49, + "mdio_addr": "0x2000", + "system_speed": 25000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 50000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + }, + { + "index": 50, + "mdio_addr": "0x3000", + "system_speed": 25000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 50000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + }, + { + "index": 51, + "mdio_addr": "0x4000", + "system_speed": 25000, + "system_fec": "none", + "system_auto_neg": true, + "system_loopback": "none", + "system_training": false, + "line_speed": 100000, + "line_fec": "none", + "line_auto_neg": true, + "line_media_type": "fiber", + "line_intf_type": "none", + "line_loopback": "none", + "line_training": false, + "line_adver_speed": [], + "line_adver_fec": [], + "line_adver_auto_neg": false, + "line_adver_asym_pause": false, + "line_adver_media_type": "fiber" + } + ] +} diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index 3383ec161144..c7e8a0d242d2 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -52,6 +52,21 @@ "id" : 7, "separator": "|", "instance" : "redis" + }, + "GB_ASIC_DB" : { + "id" : 8, + "separator": "|", + "instance" : "redis" + }, + "GB_COUNTERS_DB" : { + "id" : 9, + "separator": "|", + "instance" : "redis" + }, + "GB_FLEX_COUNTER_DB" : { + "id" : 10, + "separator": "|", + "instance" : "redis" } }, "VERSION" : "1.0" diff --git a/dockers/docker-orchagent/critical_processes b/dockers/docker-orchagent/critical_processes index 7fd8a516520c..02a095097474 100644 --- a/dockers/docker-orchagent/critical_processes +++ b/dockers/docker-orchagent/critical_processes @@ -1,4 +1,5 @@ orchagent +gearsyncd portsyncd neighsyncd vlanmgrd diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 3cd192f24ce8..c290ab8a4d9c 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -70,6 +70,15 @@ stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=orchagent:running +[program:gearsyncd] +command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json +priority=4 +autostart=false +autorestart=unexpected +startretries=0 +stdout_logfile=syslog +stderr_logfile=syslog + [program:neighsyncd] command=/usr/bin/neighsyncd priority=7 diff --git a/files/build_templates/physyncd.service.j2 b/files/build_templates/physyncd.service.j2 new file mode 100644 index 000000000000..d5b3d7d3e124 --- /dev/null +++ b/files/build_templates/physyncd.service.j2 @@ -0,0 +1,31 @@ +[Unit] +Description=physyncd service +Requires=database.service updategraph.service +{% if sonic_asic_platform == 'broadcom' %} +Requires=opennsl-modules.service +ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json +{% elif sonic_asic_platform == 'nephos' %} +Requires=nps-modules-4.9.0-9-2-amd64.service +{% endif %} +After=database.service updategraph.service +After=interfaces-config.service +{% if sonic_asic_platform == 'broadcom' %} +After=opennsl-modules.service +{% elif sonic_asic_platform == 'nephos' %} +After=nps-modules-4.9.0-9-2-amd64.service +{% endif %} +After=swss.service +Before=ntp-config.service + +[Service] +User=root +Environment=sonic_asic_platform={{ sonic_asic_platform }} +ExecStartPre=/usr/local/bin/physyncd.sh start +ExecStart=/usr/local/bin/physyncd.sh wait +ExecStop=/usr/local/bin/physyncd.sh stop +{% if sonic_asic_platform == 'mellanox' %} +TimeoutStartSec=150 +{% endif %} + +[Install] +WantedBy=multi-user.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 635084fd5414..bc7d1d4446c7 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -505,9 +505,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} -# Copy swss and syncd service script +# Copy swss syncd, and physyncd service scripts sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh +sudo LANG=C cp $SCRIPTS_DIR/physyncd.sh $FILESYSTEM_ROOT/usr/local/bin/physyncd.sh # Copy sonic-netns-exec script sudo LANG=C cp $SCRIPTS_DIR/sonic-netns-exec $FILESYSTEM_ROOT/usr/bin/sonic-netns-exec diff --git a/files/scripts/physyncd.sh b/files/scripts/physyncd.sh new file mode 100644 index 000000000000..e79a4ab6da15 --- /dev/null +++ b/files/scripts/physyncd.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +SERVICE="physyncd" +PEER="swss" +DEBUGLOG="/tmp/swss-physyncd-debug.log" +LOCKFILE="/tmp/swss-physyncd-lock" + +function debug() +{ + /usr/bin/logger $1 + /bin/echo `date` "- $1" >> ${DEBUGLOG} +} + +function lock_service_state_change() +{ + debug "Locking ${LOCKFILE} from ${SERVICE} service" + + exec {LOCKFD}>${LOCKFILE} + /usr/bin/flock -x ${LOCKFD} + trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 + + debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" +} + +function unlock_service_state_change() +{ + debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" + /usr/bin/flock -u ${LOCKFD} +} + +function check_warm_boot() +{ + SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` + SERVICE_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` + # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. + if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then + WARM_BOOT="true" + else + WARM_BOOT="false" + fi +} + +function wait_for_database_service() +{ + # Wait for redis server start before database clean + until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; + do sleep 1; + done + + # Wait for configDB initialization + until [[ $(/usr/bin/docker exec database redis-cli -n 4 GET "CONFIG_DB_INITIALIZED") ]]; + do sleep 1; + done +} + +function getBootType() +{ + case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in + warm*) + TYPE='warm' + ;; + fastfast) + TYPE='fastfast' + ;; + fast*) + TYPE='fast' + ;; + *) + TYPE='cold' + esac + echo "${TYPE}" +} + +start() { + debug "Starting ${SERVICE} service..." + + lock_service_state_change + + mkdir -p /host/warmboot + + wait_for_database_service + check_warm_boot + + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + if [[ x"$WARM_BOOT" == x"true" ]]; then + # Leave a mark for syncd scripts running inside docker. + touch /host/warmboot/warm-starting + else + rm -f /host/warmboot/warm-starting + fi + + # platform specific tasks + + # start mellanox drivers regardless of + # boot type + if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then + BOOT_TYPE=`getBootType` + if [[ x"$WARM_BOOT" == x"true" || x"$BOOT_TYPE" == x"fast" ]]; then + export FAST_BOOT=1 + fi + + if [[ x"$WARM_BOOT" != x"true" ]]; then + if [[ x"$(/bin/systemctl is-active pmon)" == x"active" ]]; then + /bin/systemctl stop pmon + /usr/bin/hw-management.sh chipdown + /bin/systemctl restart pmon + else + /usr/bin/hw-management.sh chipdown + fi + fi + + if [[ x"$BOOT_TYPE" == x"fast" ]]; then + /usr/bin/hw-management.sh chipupdis + fi + + /usr/bin/mst start + /usr/bin/mlnx-fw-upgrade.sh + /etc/init.d/sxdkernel start + fi + + if [[ x"$WARM_BOOT" != x"true" ]]; then + if [ x$sonic_asic_platform == x'cavium' ]; then + /etc/init.d/xpnet.sh start + fi + fi + + # start service docker + /usr/bin/${SERVICE}.sh start + debug "Started ${SERVICE} service..." + + unlock_service_state_change +} + +wait() { + /usr/bin/${SERVICE}.sh wait +} + +stop() { + debug "Stopping ${SERVICE} service..." + + lock_service_state_change + check_warm_boot + debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." + + if [[ x"$WARM_BOOT" == x"true" ]]; then + TYPE=warm + else + TYPE=cold + fi + + if [[ x$sonic_asic_platform != x"mellanox" ]] || [[ x$TYPE != x"cold" ]]; then + debug "${TYPE} shutdown physyncd process ..." + /usr/bin/docker exec -i physyncd /usr/bin/syncd_request_shutdown --${TYPE} + + # wait until syncd quits gracefully + while docker top physyncd | grep -q /usr/bin/physyncd; do + sleep 0.1 + done + + /usr/bin/docker exec -i physyncd /bin/sync + debug "Finished ${TYPE} shutdown physyncd process ..." + fi + + /usr/bin/${SERVICE}.sh stop + debug "Stopped ${SERVICE} service..." + + # platform specific tasks + + if [[ x"$WARM_BOOT" != x"true" ]]; then + if [ x$sonic_asic_platform == x'mellanox' ]; then + /etc/init.d/sxdkernel stop + /usr/bin/mst stop + elif [ x$sonic_asic_platform == x'cavium' ]; then + /etc/init.d/xpnet.sh stop + /etc/init.d/xpnet.sh start + fi + fi + + unlock_service_state_change +} + +case "$1" in + start|wait|stop) + $1 + ;; + *) + echo "Usage: $0 {start|wait|stop}" + exit 1 + ;; +esac diff --git a/platform/template/docker-physyncd-base.mk b/platform/template/docker-physyncd-base.mk new file mode 100644 index 000000000000..863f3a0b78a5 --- /dev/null +++ b/platform/template/docker-physyncd-base.mk @@ -0,0 +1,30 @@ +# docker image for physyncd + + +DOCKER_PHYSYNCD_BASE_STEM = docker-physyncd-$(DOCKER_PHYSYNCD_PLATFORM_CODE) +DOCKER_PHYSYNCD_BASE = $(DOCKER_PHYSYNCD_BASE_STEM).gz +DOCKER_PHYSYNCD_BASE_DBG = $(DOCKER_PHYSYNCD_BASE_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_PHYSYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-physyncd-$(DOCKER_PHYSYNCD_PLATFORM_CODE) + +$(DOCKER_PHYSYNCD_BASE)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +$(DOCKER_PHYSYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) + +$(DOCKER_PHYSYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) + +$(DOCKER_PHYSYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_PHYSYNCD_BASE) +SONIC_STRETCH_DOCKERS += $(DOCKER_PHYSYNCD_BASE) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PHYSYNCD_BASE) + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PHYSYNCD_BASE_DBG) +SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_PHYSYNCD_BASE_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PHYSYNCD_BASE_DBG) + +$(DOCKER_PHYSYNCD_BASE)_CONTAINER_NAME = physyncd +$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + diff --git a/platform/vs/docker-physyncd-vs.dep b/platform/vs/docker-physyncd-vs.dep new file mode 100644 index 000000000000..1c640339ee70 --- /dev/null +++ b/platform/vs/docker-physyncd-vs.dep @@ -0,0 +1,11 @@ +#DPKG FRK +DPATH := $($(DOCKER_PHYSYNCD_BASE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-physyncd-vs.mk platform/vs/docker-physyncd-vs.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_PHYSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_PHYSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_PHYSYNCD_BASE)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_PHYSYNCD_BASE),$(DOCKER_PHYSYNCD_BASE_DBG))) diff --git a/platform/vs/docker-physyncd-vs.mk b/platform/vs/docker-physyncd-vs.mk new file mode 100644 index 000000000000..3a5bbf7528b1 --- /dev/null +++ b/platform/vs/docker-physyncd-vs.mk @@ -0,0 +1,14 @@ +# docker image for vs physyncd + +DOCKER_PHYSYNCD_PLATFORM_CODE = vs +include $(PLATFORM_PATH)/../template/docker-physyncd-base.mk + +$(DOCKER_PHYSYNCD_BASE)_DEPENDS += $(SYNCD_VS) + +$(DOCKER_PHYSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) \ + $(LIBSAIVS_DBG) + +$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-physyncd-vs/Dockerfile.j2 b/platform/vs/docker-physyncd-vs/Dockerfile.j2 new file mode 100644 index 000000000000..4f06b74e9030 --- /dev/null +++ b/platform/vs/docker-physyncd-vs/Dockerfile.j2 @@ -0,0 +1,32 @@ +FROM docker-config-engine-stretch + +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get install -f -y iproute2=4.20.0-2~bpo9+1 libcap2-bin=1:2.25-1 + +COPY \ +{% for deb in docker_physyncd_vs_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_physyncd_vs_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +COPY ["start.sh", "/usr/bin/"] + +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/vs/docker-physyncd-vs/start.sh b/platform/vs/docker-physyncd-vs/start.sh new file mode 100644 index 000000000000..116bc53c7a57 --- /dev/null +++ b/platform/vs/docker-physyncd-vs/start.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +PLATFORM_DIR=/usr/share/sonic/platform +HWSKU_DIR=/usr/share/sonic/hwsku + + +# Remove stale files if they exist +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +mkdir -p /etc/sai.d/ + +# Create/Copy the sai.profile to /etc/sai.d/sai.profile +if [ -f $HWSKU_DIR/pai.profile.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/pai.profile.j2 > /etc/sai.d/pai.profile +else + if [ -f $HWSKU_DIR/pai.profile ]; then + cp $HWSKU_DIR/pai.profile /etc/sai.d/pai.profile + fi +fi + +# Create/Copy the gearbox configs to /etc/sai.d/sai.profile +if [[ x"$sonic_asic_platform" == x"broadcom" ]]; then + if [ -d $HWSKU_DIR/gearbox ]; then + cp $HWSKU_DIR/gearbox/*.bcm /etc/sai.d/. + fi +fi + +supervisorctl start physyncd + diff --git a/platform/vs/docker-physyncd-vs/supervisord.conf b/platform/vs/docker-physyncd-vs/supervisord.conf new file mode 100644 index 000000000000..10d9bc2c6069 --- /dev/null +++ b/platform/vs/docker-physyncd-vs/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:physyncd] +command=/usr/bin/physyncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/vs/docker-sonic-vs/database_config.json b/platform/vs/docker-sonic-vs/database_config.json index b86ae11bba98..b65d0e794a89 100644 --- a/platform/vs/docker-sonic-vs/database_config.json +++ b/platform/vs/docker-sonic-vs/database_config.json @@ -51,6 +51,21 @@ "id" : 7, "separator": "|", "instance" : "redis" + }, + "GB_ASIC_DB" : { + "id" : 8, + "separator": "|", + "instance" : "redis" + }, + "GB_COUNTERS_DB" : { + "id" : 9, + "separator": "|", + "instance" : "redis" + }, + "GB_FLEX_COUNTER_DB" : { + "id" : 10, + "separator": "|", + "instance" : "redis" } }, "VERSION" : "1.0" diff --git a/platform/vs/rules.mk b/platform/vs/rules.mk index d91f487a5edb..c8f83da775eb 100644 --- a/platform/vs/rules.mk +++ b/platform/vs/rules.mk @@ -2,6 +2,7 @@ include $(PLATFORM_PATH)/syncd-vs.mk include $(PLATFORM_PATH)/sonic-version.mk include $(PLATFORM_PATH)/docker-sonic-vs.mk include $(PLATFORM_PATH)/docker-syncd-vs.mk +include $(PLATFORM_PATH)/docker-physyncd-vs.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/onie.mk include $(PLATFORM_PATH)/kvm-image.mk diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile index ecac92b00e0e..3de9c27c041d 100644 --- a/src/sonic-device-data/Makefile +++ b/src/sonic-device-data/Makefile @@ -19,6 +19,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : cp -Lr $$d device/x86_64-kvm_x86_64-r0/ ; \ cp ./sai.vs_profile device/x86_64-kvm_x86_64-r0/$$(basename $$d)/sai.profile; \ grep -v ^# device/x86_64-kvm_x86_64-r0/$$(basename $$d)/port_config.ini | awk '{i=i+1;print "eth"i":"$$2}' > device/x86_64-kvm_x86_64-r0/$$(basename $$d)/lanemap.ini + cp ./pai.vs_profile device/x86_64-kvm_x86_64-r0/$$(basename $$d)/pai.profile; \ + grep -v ^# device/x86_64-kvm_x86_64-r0/$$(basename $$d)/port_config.ini | awk '{i=i+1;print "eth"i":"$$2}' > device/x86_64-kvm_x86_64-r0/$$(basename $$d)/lanemap.ini + done; # Build the package diff --git a/src/sonic-device-data/src/pai.vs_profile b/src/sonic-device-data/src/pai.vs_profile new file mode 100644 index 000000000000..9c99c42a1627 --- /dev/null +++ b/src/sonic-device-data/src/pai.vs_profile @@ -0,0 +1,7 @@ +SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin +SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM81724 +SAI_VS_SAI_SWITCH_TYPE=SAI_SWITCH_TYPE_PHY +SAI_VS_HOSTIF_USE_TAP_DEVICE=false +SAI_VS_USE_BCMSIM_LINK_MON=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini From 39f20a17d85783f8e9077c09236d1961213192a3 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 26 Jun 2020 05:35:42 -0700 Subject: [PATCH 02/31] remove gearsyncd from critical processes list --- dockers/docker-orchagent/critical_processes | 1 - 1 file changed, 1 deletion(-) diff --git a/dockers/docker-orchagent/critical_processes b/dockers/docker-orchagent/critical_processes index 02a095097474..7fd8a516520c 100644 --- a/dockers/docker-orchagent/critical_processes +++ b/dockers/docker-orchagent/critical_processes @@ -1,5 +1,4 @@ orchagent -gearsyncd portsyncd neighsyncd vlanmgrd From fb2ccb7e5795b549e24cabaab2e002b4b4256169 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Mon, 29 Jun 2020 12:30:15 -0700 Subject: [PATCH 03/31] minor change to comments --- platform/vs/docker-physyncd-vs/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/vs/docker-physyncd-vs/start.sh b/platform/vs/docker-physyncd-vs/start.sh index 116bc53c7a57..758ebe940e63 100644 --- a/platform/vs/docker-physyncd-vs/start.sh +++ b/platform/vs/docker-physyncd-vs/start.sh @@ -11,7 +11,7 @@ supervisorctl start rsyslogd mkdir -p /etc/sai.d/ -# Create/Copy the sai.profile to /etc/sai.d/sai.profile +# Create/Copy the pai.profile to /etc/sai.d/pai.profile if [ -f $HWSKU_DIR/pai.profile.j2 ]; then sonic-cfggen -d -t $HWSKU_DIR/pai.profile.j2 > /etc/sai.d/pai.profile else @@ -20,7 +20,7 @@ else fi fi -# Create/Copy the gearbox configs to /etc/sai.d/sai.profile +# Create/Copy the gearbox configs to /etc/sai.d if [[ x"$sonic_asic_platform" == x"broadcom" ]]; then if [ -d $HWSKU_DIR/gearbox ]; then cp $HWSKU_DIR/gearbox/*.bcm /etc/sai.d/. From 76d0d2dd88fc7975156c5c91b6ed793c85ee3939 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 30 Jun 2020 09:59:35 -0700 Subject: [PATCH 04/31] cleanup startup/shutdown scripts for physyncd, removing platform specific code not relevant --- files/build_templates/physyncd.service.j2 | 7 ---- files/scripts/physyncd.sh | 49 +---------------------- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/files/build_templates/physyncd.service.j2 b/files/build_templates/physyncd.service.j2 index d5b3d7d3e124..6311ba5f494f 100644 --- a/files/build_templates/physyncd.service.j2 +++ b/files/build_templates/physyncd.service.j2 @@ -4,15 +4,11 @@ Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules.service ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json -{% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-9-2-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} After=opennsl-modules.service -{% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-9-2-amd64.service {% endif %} After=swss.service Before=ntp-config.service @@ -23,9 +19,6 @@ Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/physyncd.sh start ExecStart=/usr/local/bin/physyncd.sh wait ExecStop=/usr/local/bin/physyncd.sh stop -{% if sonic_asic_platform == 'mellanox' %} -TimeoutStartSec=150 -{% endif %} [Install] WantedBy=multi-user.target diff --git a/files/scripts/physyncd.sh b/files/scripts/physyncd.sh index e79a4ab6da15..fdcb4cbfde19 100644 --- a/files/scripts/physyncd.sh +++ b/files/scripts/physyncd.sh @@ -90,41 +90,6 @@ start() { rm -f /host/warmboot/warm-starting fi - # platform specific tasks - - # start mellanox drivers regardless of - # boot type - if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then - BOOT_TYPE=`getBootType` - if [[ x"$WARM_BOOT" == x"true" || x"$BOOT_TYPE" == x"fast" ]]; then - export FAST_BOOT=1 - fi - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [[ x"$(/bin/systemctl is-active pmon)" == x"active" ]]; then - /bin/systemctl stop pmon - /usr/bin/hw-management.sh chipdown - /bin/systemctl restart pmon - else - /usr/bin/hw-management.sh chipdown - fi - fi - - if [[ x"$BOOT_TYPE" == x"fast" ]]; then - /usr/bin/hw-management.sh chipupdis - fi - - /usr/bin/mst start - /usr/bin/mlnx-fw-upgrade.sh - /etc/init.d/sxdkernel start - fi - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [ x$sonic_asic_platform == x'cavium' ]; then - /etc/init.d/xpnet.sh start - fi - fi - # start service docker /usr/bin/${SERVICE}.sh start debug "Started ${SERVICE} service..." @@ -149,7 +114,7 @@ stop() { TYPE=cold fi - if [[ x$sonic_asic_platform != x"mellanox" ]] || [[ x$TYPE != x"cold" ]]; then + if [[ x$TYPE != x"cold" ]]; then debug "${TYPE} shutdown physyncd process ..." /usr/bin/docker exec -i physyncd /usr/bin/syncd_request_shutdown --${TYPE} @@ -165,18 +130,6 @@ stop() { /usr/bin/${SERVICE}.sh stop debug "Stopped ${SERVICE} service..." - # platform specific tasks - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/init.d/sxdkernel stop - /usr/bin/mst stop - elif [ x$sonic_asic_platform == x'cavium' ]; then - /etc/init.d/xpnet.sh stop - /etc/init.d/xpnet.sh start - fi - fi - unlock_service_state_change } From 06ce6facda00fec554523671a251ede08333cb14 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 7 Jul 2020 21:06:54 -0700 Subject: [PATCH 05/31] minor cleanups in device configs --- .../Force10-S6000/gearbox_config.json | 2 +- .../x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json index 32d92b7a6453..2de95c4d806d 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json @@ -35,4 +35,4 @@ "line_lanes": [208] } ] -} \ No newline at end of file +} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json index 691acd9f9b8d..1b81394e9936 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json @@ -9,7 +9,7 @@ "line_tx_lanemap": 0, "line_rx_lanemap": 0, "line_to_system_lanemap": 0, - "mdio_addr": "0x0200" + "mdio_addr": "0x0200" }, { "index": 201, From 4e1459100d22add3a1b024e3fefc7382b56ee16f Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 7 Jul 2020 21:13:12 -0700 Subject: [PATCH 06/31] use supervisord dependent startup to start services --- platform/vs/docker-physyncd-vs/start.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/platform/vs/docker-physyncd-vs/start.sh b/platform/vs/docker-physyncd-vs/start.sh index 758ebe940e63..e59a2322bbf8 100644 --- a/platform/vs/docker-physyncd-vs/start.sh +++ b/platform/vs/docker-physyncd-vs/start.sh @@ -1,14 +1,7 @@ #!/usr/bin/env bash -PLATFORM_DIR=/usr/share/sonic/platform HWSKU_DIR=/usr/share/sonic/hwsku - -# Remove stale files if they exist -rm -f /var/run/rsyslogd.pid - -supervisorctl start rsyslogd - mkdir -p /etc/sai.d/ # Create/Copy the pai.profile to /etc/sai.d/pai.profile @@ -26,6 +19,3 @@ if [[ x"$sonic_asic_platform" == x"broadcom" ]]; then cp $HWSKU_DIR/gearbox/*.bcm /etc/sai.d/. fi fi - -supervisorctl start physyncd - From e8958dbc0ac626bd87460355400cd1e07d4d02e1 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Thu, 9 Jul 2020 22:04:45 -0700 Subject: [PATCH 07/31] more physyncd startup fixes --- .../vs/docker-physyncd-vs/critical_processes | 1 + .../vs/docker-physyncd-vs/supervisord.conf | 32 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 platform/vs/docker-physyncd-vs/critical_processes diff --git a/platform/vs/docker-physyncd-vs/critical_processes b/platform/vs/docker-physyncd-vs/critical_processes new file mode 100644 index 000000000000..bdd6903c5690 --- /dev/null +++ b/platform/vs/docker-physyncd-vs/critical_processes @@ -0,0 +1 @@ +program:syncd diff --git a/platform/vs/docker-physyncd-vs/supervisord.conf b/platform/vs/docker-physyncd-vs/supervisord.conf index 10d9bc2c6069..4719b14a5db9 100644 --- a/platform/vs/docker-physyncd-vs/supervisord.conf +++ b/platform/vs/docker-physyncd-vs/supervisord.conf @@ -3,21 +3,39 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true -[program:start.sh] -command=/usr/bin/start.sh -priority=1 +[eventlistener:dependent-startup] +command=python -m supervisord_dependent_startup autostart=true -autorestart=false +autorestart=unexpected +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name physyncd +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n +[program:start] +command=/usr/bin/start.sh priority=2 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running [program:physyncd] command=/usr/bin/physyncd_start.sh @@ -26,3 +44,5 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited From 3aa9f32c2040f2a2d30dd12d8f5a8d36e57e489e Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 10 Jul 2020 10:01:27 -0700 Subject: [PATCH 08/31] Revert "more physyncd startup fixes" This reverts commit e8958dbc0ac626bd87460355400cd1e07d4d02e1. --- .../vs/docker-physyncd-vs/critical_processes | 1 - .../vs/docker-physyncd-vs/supervisord.conf | 32 ++++--------------- 2 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 platform/vs/docker-physyncd-vs/critical_processes diff --git a/platform/vs/docker-physyncd-vs/critical_processes b/platform/vs/docker-physyncd-vs/critical_processes deleted file mode 100644 index bdd6903c5690..000000000000 --- a/platform/vs/docker-physyncd-vs/critical_processes +++ /dev/null @@ -1 +0,0 @@ -program:syncd diff --git a/platform/vs/docker-physyncd-vs/supervisord.conf b/platform/vs/docker-physyncd-vs/supervisord.conf index 4719b14a5db9..10d9bc2c6069 100644 --- a/platform/vs/docker-physyncd-vs/supervisord.conf +++ b/platform/vs/docker-physyncd-vs/supervisord.conf @@ -3,39 +3,21 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true -[eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup -autostart=true -autorestart=unexpected -startretries=0 -exitcodes=0,3 -events=PROCESS_STATE - -[eventlistener:supervisor-proc-exit-listener] -command=/usr/bin/supervisor-proc-exit-listener --container-name physyncd -events=PROCESS_STATE_EXITED -autostart=true -autorestart=unexpected - -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n -iNONE +[program:start.sh] +command=/usr/bin/start.sh priority=1 -autostart=false -autorestart=unexpected +autostart=true +autorestart=false stdout_logfile=syslog stderr_logfile=syslog -dependent_startup=true -[program:start] -command=/usr/bin/start.sh +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n priority=2 autostart=false autorestart=false -startsecs=0 stdout_logfile=syslog stderr_logfile=syslog -dependent_startup=true -dependent_startup_wait_for=rsyslogd:running [program:physyncd] command=/usr/bin/physyncd_start.sh @@ -44,5 +26,3 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog -dependent_startup=true -dependent_startup_wait_for=start:exited From 21af753515be300a7e358e4d2826bd07b9153bdd Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Sat, 11 Jul 2020 00:05:59 -0700 Subject: [PATCH 09/31] changes to support current sonic usage of supervisord in physyncd docker --- platform/vs/docker-physyncd-vs/Dockerfile.j2 | 2 ++ .../vs/docker-physyncd-vs/critical_processes | 1 + .../vs/docker-physyncd-vs/supervisord.conf | 34 +++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 platform/vs/docker-physyncd-vs/critical_processes diff --git a/platform/vs/docker-physyncd-vs/Dockerfile.j2 b/platform/vs/docker-physyncd-vs/Dockerfile.j2 index 4f06b74e9030..12d1a5e6a1e4 100644 --- a/platform/vs/docker-physyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-physyncd-vs/Dockerfile.j2 @@ -24,6 +24,8 @@ debs/{{ deb }}{{' '}} COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["critical_processes", "/etc/supervisor/"] ## Clean up RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/platform/vs/docker-physyncd-vs/critical_processes b/platform/vs/docker-physyncd-vs/critical_processes new file mode 100644 index 000000000000..bdd6903c5690 --- /dev/null +++ b/platform/vs/docker-physyncd-vs/critical_processes @@ -0,0 +1 @@ +program:syncd diff --git a/platform/vs/docker-physyncd-vs/supervisord.conf b/platform/vs/docker-physyncd-vs/supervisord.conf index 10d9bc2c6069..a6c2e6ecf565 100644 --- a/platform/vs/docker-physyncd-vs/supervisord.conf +++ b/platform/vs/docker-physyncd-vs/supervisord.conf @@ -3,26 +3,46 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true -[program:start.sh] -command=/usr/bin/start.sh -priority=1 +[eventlistener:dependent-startup] +command=python -m supervisord_dependent_startup autostart=true -autorestart=false +autorestart=unexpected +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name physyncd +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true -[program:rsyslogd] -command=/usr/sbin/rsyslogd -n +[program:start] +command=/usr/bin/start.sh priority=2 autostart=false autorestart=false +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running -[program:physyncd] +[program:syncd] command=/usr/bin/physyncd_start.sh priority=3 autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited From 26ecb378cb98265a746b1544473848ad3193335e Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Wed, 29 Jul 2020 15:26:59 -0700 Subject: [PATCH 10/31] changes to gearsyncd startup parameters for supervisord --- dockers/docker-orchagent/supervisord.conf | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index c290ab8a4d9c..daf5faf8d9ff 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -26,6 +26,17 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true +[program:gearsyncd] +command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json +priority=3 +autostart=false +autorestart=unexpected +startretries=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=swssconfig:exited + [program:portsyncd] command=/usr/bin/portsyncd priority=3 @@ -70,15 +81,6 @@ stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=orchagent:running -[program:gearsyncd] -command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json -priority=4 -autostart=false -autorestart=unexpected -startretries=0 -stdout_logfile=syslog -stderr_logfile=syslog - [program:neighsyncd] command=/usr/bin/neighsyncd priority=7 From 889a98d82355af427e324be621d2072099f896f5 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 31 Jul 2020 13:47:33 -0700 Subject: [PATCH 11/31] backout 26ecb378cb98265a746b1544473848ad3193335e --- dockers/docker-orchagent/supervisord.conf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index daf5faf8d9ff..b0fd63ad6092 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -28,14 +28,12 @@ dependent_startup=true [program:gearsyncd] command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json -priority=3 +priority=4 autostart=false autorestart=unexpected startretries=0 stdout_logfile=syslog stderr_logfile=syslog -dependent_startup=true -dependent_startup_wait_for=swssconfig:exited [program:portsyncd] command=/usr/bin/portsyncd From 86a0c5cc075c1127741dc2e7c2ac4ad6c1b6ae2f Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Mon, 3 Aug 2020 13:37:16 -0700 Subject: [PATCH 12/31] fix perms on physyncd.sh --- files/scripts/physyncd.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 files/scripts/physyncd.sh diff --git a/files/scripts/physyncd.sh b/files/scripts/physyncd.sh old mode 100644 new mode 100755 From 811536258fa591b99426534cbf1d8880b621535e Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Mon, 3 Aug 2020 14:06:11 -0700 Subject: [PATCH 13/31] duplicate portsyncd startup for gearsyncd, they should share same settings --- dockers/docker-orchagent/supervisord.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index b0fd63ad6092..4eb9300bd869 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -28,12 +28,13 @@ dependent_startup=true [program:gearsyncd] command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json -priority=4 +priority=3 autostart=false -autorestart=unexpected -startretries=0 +autorestart=false stdout_logfile=syslog stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running [program:portsyncd] command=/usr/bin/portsyncd From ba5cd86454d31ed743acdbfc9fe12d46fc552d9a Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 4 Aug 2020 10:29:26 -0700 Subject: [PATCH 14/31] minor changes to orchagent supervisord.conf for gearsyncd --- dockers/docker-orchagent/supervisord.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 4eb9300bd869..f1ae82b4c685 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -31,6 +31,8 @@ command=/usr/bin/gearsyncd -p /usr/share/sonic/hwsku/gearbox_config.json priority=3 autostart=false autorestart=false +startsecs=0 +startretries=0 stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true @@ -72,9 +74,8 @@ dependent_startup_wait_for=orchagent:running command=/usr/bin/swssconfig.sh priority=6 autostart=false -autorestart=unexpected +autorestart=false startretries=0 -startsecs=0 stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true From 79fc081358ac349f0fae355b35e274381f6ea3b5 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 4 Aug 2020 10:31:23 -0700 Subject: [PATCH 15/31] fix permissions on vs physyncd docker start script --- platform/vs/docker-physyncd-vs/start.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 platform/vs/docker-physyncd-vs/start.sh diff --git a/platform/vs/docker-physyncd-vs/start.sh b/platform/vs/docker-physyncd-vs/start.sh old mode 100644 new mode 100755 From 910e23ed548216a6a5fe57cb52e49ed9ba031b8c Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Mon, 24 Aug 2020 14:03:47 -0700 Subject: [PATCH 16/31] resolve merge conflict --- files/build_templates/sonic_debian_extension.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 672a27044fa9..066aef6aac64 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -536,7 +536,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} -# Copy swss syncd, and physyncd service scripts +# Copy service scripts (swss, syncd, bgp, radv) sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh sudo LANG=C cp $SCRIPTS_DIR/physyncd.sh $FILESYSTEM_ROOT/usr/local/bin/physyncd.sh From 7ac845ac77f3a26c97ded67ada361b4316cce0b3 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Mon, 24 Aug 2020 14:16:45 -0700 Subject: [PATCH 17/31] rename physyncd to gbsyncd --- ...physyncd.service.j2 => gbsyncd.service.j2} | 8 ++--- .../build_templates/sonic_debian_extension.j2 | 6 ++-- files/scripts/{physyncd.sh => gbsyncd.sh} | 16 +++++----- platform/template/docker-gbsyncd-base.mk | 30 +++++++++++++++++++ platform/template/docker-physyncd-base.mk | 30 ------------------- platform/vs/docker-gbsyncd-vs.dep | 11 +++++++ platform/vs/docker-gbsyncd-vs.mk | 14 +++++++++ .../Dockerfile.j2 | 4 +-- .../critical_processes | 0 .../start.sh | 0 .../supervisord.conf | 4 +-- platform/vs/docker-physyncd-vs.dep | 11 ------- platform/vs/docker-physyncd-vs.mk | 14 --------- platform/vs/gbsyncd-vs.mk | 14 +++++++++ platform/vs/rules.mk | 2 +- 15 files changed, 89 insertions(+), 75 deletions(-) rename files/build_templates/{physyncd.service.j2 => gbsyncd.service.j2} (76%) rename files/scripts/{physyncd.sh => gbsyncd.sh} (87%) mode change 100644 => 100755 create mode 100644 platform/template/docker-gbsyncd-base.mk delete mode 100644 platform/template/docker-physyncd-base.mk create mode 100644 platform/vs/docker-gbsyncd-vs.dep create mode 100644 platform/vs/docker-gbsyncd-vs.mk rename platform/vs/{docker-physyncd-vs => docker-gbsyncd-vs}/Dockerfile.j2 (87%) rename platform/vs/{docker-physyncd-vs => docker-gbsyncd-vs}/critical_processes (100%) rename platform/vs/{docker-physyncd-vs => docker-gbsyncd-vs}/start.sh (100%) mode change 100644 => 100755 rename platform/vs/{docker-physyncd-vs => docker-gbsyncd-vs}/supervisord.conf (95%) delete mode 100644 platform/vs/docker-physyncd-vs.dep delete mode 100644 platform/vs/docker-physyncd-vs.mk create mode 100644 platform/vs/gbsyncd-vs.mk diff --git a/files/build_templates/physyncd.service.j2 b/files/build_templates/gbsyncd.service.j2 similarity index 76% rename from files/build_templates/physyncd.service.j2 rename to files/build_templates/gbsyncd.service.j2 index 6311ba5f494f..ac51ca0307ef 100644 --- a/files/build_templates/physyncd.service.j2 +++ b/files/build_templates/gbsyncd.service.j2 @@ -1,5 +1,5 @@ [Unit] -Description=physyncd service +Description=gbsyncd service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} Requires=opennsl-modules.service @@ -16,9 +16,9 @@ Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStartPre=/usr/local/bin/physyncd.sh start -ExecStart=/usr/local/bin/physyncd.sh wait -ExecStop=/usr/local/bin/physyncd.sh stop +ExecStartPre=/usr/local/bin/gbsyncd.sh start +ExecStart=/usr/local/bin/gbsyncd.sh wait +ExecStop=/usr/local/bin/gbsyncd.sh stop [Install] WantedBy=multi-user.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f6f036487bca..cfdef263de0e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -1,6 +1,6 @@ #!/bin/bash ## This script is to automate loading of vendor specific docker images -## and instalation of configuration files and vendor specific packages +## and installation of configuration files and vendor specific packages ## to debian file system. ## ## USAGE: @@ -525,10 +525,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys {% endif %} -# Copy swss syncd, and physyncd service scripts +# Copy swss syncd, and gbsyncd service scripts sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh -sudo LANG=C cp $SCRIPTS_DIR/physyncd.sh $FILESYSTEM_ROOT/usr/local/bin/physyncd.sh +sudo LANG=C cp $SCRIPTS_DIR/gbsyncd.sh $FILESYSTEM_ROOT/usr/local/bin/gbsyncd.sh sudo LANG=C cp $SCRIPTS_DIR/bgp.sh $FILESYSTEM_ROOT/usr/local/bin/bgp.sh # Copy sonic-netns-exec script diff --git a/files/scripts/physyncd.sh b/files/scripts/gbsyncd.sh old mode 100644 new mode 100755 similarity index 87% rename from files/scripts/physyncd.sh rename to files/scripts/gbsyncd.sh index fdcb4cbfde19..9eb919329a0a --- a/files/scripts/physyncd.sh +++ b/files/scripts/gbsyncd.sh @@ -1,9 +1,9 @@ #!/bin/bash -SERVICE="physyncd" +SERVICE="gbsyncd" PEER="swss" -DEBUGLOG="/tmp/swss-physyncd-debug.log" -LOCKFILE="/tmp/swss-physyncd-lock" +DEBUGLOG="/tmp/swss-gbsyncd-debug.log" +LOCKFILE="/tmp/swss-gbsyncd-lock" function debug() { @@ -115,16 +115,16 @@ stop() { fi if [[ x$TYPE != x"cold" ]]; then - debug "${TYPE} shutdown physyncd process ..." - /usr/bin/docker exec -i physyncd /usr/bin/syncd_request_shutdown --${TYPE} + debug "${TYPE} shutdown gbsyncd process ..." + /usr/bin/docker exec -i gbsyncd /usr/bin/syncd_request_shutdown --${TYPE} # wait until syncd quits gracefully - while docker top physyncd | grep -q /usr/bin/physyncd; do + while docker top gbsyncd | grep -q /usr/bin/gbsyncd; do sleep 0.1 done - /usr/bin/docker exec -i physyncd /bin/sync - debug "Finished ${TYPE} shutdown physyncd process ..." + /usr/bin/docker exec -i gbsyncd /bin/sync + debug "Finished ${TYPE} shutdown gbsyncd process ..." fi /usr/bin/${SERVICE}.sh stop diff --git a/platform/template/docker-gbsyncd-base.mk b/platform/template/docker-gbsyncd-base.mk new file mode 100644 index 000000000000..891990232f51 --- /dev/null +++ b/platform/template/docker-gbsyncd-base.mk @@ -0,0 +1,30 @@ +# docker image for gbsyncd + + +DOCKER_GBSYNCD_BASE_STEM = docker-gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) +DOCKER_GBSYNCD_BASE = $(DOCKER_GBSYNCD_BASE_STEM).gz +DOCKER_GBSYNCD_BASE_DBG = $(DOCKER_GBSYNCD_BASE_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_GBSYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) + +$(DOCKER_GBSYNCD_BASE)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +$(DOCKER_GBSYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) + +$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) + +$(DOCKER_GBSYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BASE) +SONIC_STRETCH_DOCKERS += $(DOCKER_GBSYNCD_BASE) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BASE) + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BASE_DBG) +SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_GBSYNCD_BASE_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BASE_DBG) + +$(DOCKER_GBSYNCD_BASE)_CONTAINER_NAME = gbsyncd +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + diff --git a/platform/template/docker-physyncd-base.mk b/platform/template/docker-physyncd-base.mk deleted file mode 100644 index 863f3a0b78a5..000000000000 --- a/platform/template/docker-physyncd-base.mk +++ /dev/null @@ -1,30 +0,0 @@ -# docker image for physyncd - - -DOCKER_PHYSYNCD_BASE_STEM = docker-physyncd-$(DOCKER_PHYSYNCD_PLATFORM_CODE) -DOCKER_PHYSYNCD_BASE = $(DOCKER_PHYSYNCD_BASE_STEM).gz -DOCKER_PHYSYNCD_BASE_DBG = $(DOCKER_PHYSYNCD_BASE_STEM)-$(DBG_IMAGE_MARK).gz - -$(DOCKER_PHYSYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-physyncd-$(DOCKER_PHYSYNCD_PLATFORM_CODE) - -$(DOCKER_PHYSYNCD_BASE)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) - -$(DOCKER_PHYSYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) - -$(DOCKER_PHYSYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) - -$(DOCKER_PHYSYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES) - -SONIC_DOCKER_IMAGES += $(DOCKER_PHYSYNCD_BASE) -SONIC_STRETCH_DOCKERS += $(DOCKER_PHYSYNCD_BASE) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PHYSYNCD_BASE) - -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PHYSYNCD_BASE_DBG) -SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_PHYSYNCD_BASE_DBG) -SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PHYSYNCD_BASE_DBG) - -$(DOCKER_PHYSYNCD_BASE)_CONTAINER_NAME = physyncd -$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += --net=host --privileged -t -$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro - diff --git a/platform/vs/docker-gbsyncd-vs.dep b/platform/vs/docker-gbsyncd-vs.dep new file mode 100644 index 000000000000..a3db18642abf --- /dev/null +++ b/platform/vs/docker-gbsyncd-vs.dep @@ -0,0 +1,11 @@ +#DPKG FRK +DPATH := $($(DOCKER_GBSYNCD_BASE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-gbsyncd-vs.mk platform/vs/docker-gbsyncd-vs.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_GBSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_GBSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_GBSYNCD_BASE)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_BASE),$(DOCKER_GBSYNCD_BASE_DBG))) diff --git a/platform/vs/docker-gbsyncd-vs.mk b/platform/vs/docker-gbsyncd-vs.mk new file mode 100644 index 000000000000..2013132d6281 --- /dev/null +++ b/platform/vs/docker-gbsyncd-vs.mk @@ -0,0 +1,14 @@ +# docker image for vs gbsyncd + +DOCKER_GBSYNCD_PLATFORM_CODE = vs +include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk + +$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD_VS) + +$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) \ + $(LIBSAIVS_DBG) + +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-physyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 similarity index 87% rename from platform/vs/docker-physyncd-vs/Dockerfile.j2 rename to platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index 12d1a5e6a1e4..5924b5b0b7ea 100644 --- a/platform/vs/docker-physyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -11,13 +11,13 @@ RUN apt-get update RUN apt-get install -f -y iproute2=4.20.0-2~bpo9+1 libcap2-bin=1:2.25-1 COPY \ -{% for deb in docker_physyncd_vs_debs.split(' ') -%} +{% for deb in docker_gbsyncd_vs_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor -%} debs/ RUN dpkg -i \ -{% for deb in docker_physyncd_vs_debs.split(' ') -%} +{% for deb in docker_gbsyncd_vs_debs.split(' ') -%} debs/{{ deb }}{{' '}} {%- endfor %} diff --git a/platform/vs/docker-physyncd-vs/critical_processes b/platform/vs/docker-gbsyncd-vs/critical_processes similarity index 100% rename from platform/vs/docker-physyncd-vs/critical_processes rename to platform/vs/docker-gbsyncd-vs/critical_processes diff --git a/platform/vs/docker-physyncd-vs/start.sh b/platform/vs/docker-gbsyncd-vs/start.sh old mode 100644 new mode 100755 similarity index 100% rename from platform/vs/docker-physyncd-vs/start.sh rename to platform/vs/docker-gbsyncd-vs/start.sh diff --git a/platform/vs/docker-physyncd-vs/supervisord.conf b/platform/vs/docker-gbsyncd-vs/supervisord.conf similarity index 95% rename from platform/vs/docker-physyncd-vs/supervisord.conf rename to platform/vs/docker-gbsyncd-vs/supervisord.conf index a6c2e6ecf565..6ba7ecbbdda2 100644 --- a/platform/vs/docker-physyncd-vs/supervisord.conf +++ b/platform/vs/docker-gbsyncd-vs/supervisord.conf @@ -12,7 +12,7 @@ exitcodes=0,3 events=PROCESS_STATE [eventlistener:supervisor-proc-exit-listener] -command=/usr/bin/supervisor-proc-exit-listener --container-name physyncd +command=/usr/bin/supervisor-proc-exit-listener --container-name gbsyncd events=PROCESS_STATE_EXITED autostart=true autorestart=unexpected @@ -38,7 +38,7 @@ dependent_startup=true dependent_startup_wait_for=rsyslogd:running [program:syncd] -command=/usr/bin/physyncd_start.sh +command=/usr/bin/gbsyncd_start.sh priority=3 autostart=false autorestart=false diff --git a/platform/vs/docker-physyncd-vs.dep b/platform/vs/docker-physyncd-vs.dep deleted file mode 100644 index 1c640339ee70..000000000000 --- a/platform/vs/docker-physyncd-vs.dep +++ /dev/null @@ -1,11 +0,0 @@ -#DPKG FRK -DPATH := $($(DOCKER_PHYSYNCD_BASE)_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-physyncd-vs.mk platform/vs/docker-physyncd-vs.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(DPATH)) - -$(DOCKER_PHYSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA -$(DOCKER_PHYSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(DOCKER_PHYSYNCD_BASE)_DEP_FILES := $(DEP_FILES) - -$(eval $(call add_dbg_docker,$(DOCKER_PHYSYNCD_BASE),$(DOCKER_PHYSYNCD_BASE_DBG))) diff --git a/platform/vs/docker-physyncd-vs.mk b/platform/vs/docker-physyncd-vs.mk deleted file mode 100644 index 3a5bbf7528b1..000000000000 --- a/platform/vs/docker-physyncd-vs.mk +++ /dev/null @@ -1,14 +0,0 @@ -# docker image for vs physyncd - -DOCKER_PHYSYNCD_PLATFORM_CODE = vs -include $(PLATFORM_PATH)/../template/docker-physyncd-base.mk - -$(DOCKER_PHYSYNCD_BASE)_DEPENDS += $(SYNCD_VS) - -$(DOCKER_PHYSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIMETADATA_DBG) \ - $(LIBSAIREDIS_DBG) \ - $(LIBSAIVS_DBG) - -$(DOCKER_PHYSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/gbsyncd-vs.mk b/platform/vs/gbsyncd-vs.mk new file mode 100644 index 000000000000..2013132d6281 --- /dev/null +++ b/platform/vs/gbsyncd-vs.mk @@ -0,0 +1,14 @@ +# docker image for vs gbsyncd + +DOCKER_GBSYNCD_PLATFORM_CODE = vs +include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk + +$(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD_VS) + +$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) \ + $(LIBSAIVS_DBG) + +$(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/rules.mk b/platform/vs/rules.mk index c8f83da775eb..66e8bad5fe78 100644 --- a/platform/vs/rules.mk +++ b/platform/vs/rules.mk @@ -2,7 +2,7 @@ include $(PLATFORM_PATH)/syncd-vs.mk include $(PLATFORM_PATH)/sonic-version.mk include $(PLATFORM_PATH)/docker-sonic-vs.mk include $(PLATFORM_PATH)/docker-syncd-vs.mk -include $(PLATFORM_PATH)/docker-physyncd-vs.mk +include $(PLATFORM_PATH)/docker-gbsyncd-vs.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/onie.mk include $(PLATFORM_PATH)/kvm-image.mk From 2a6ded4e10a36781bc9e7e03ab3df5b3c4240db0 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 25 Aug 2020 01:19:53 -0700 Subject: [PATCH 18/31] Dell Force 10 S6000 gearbox config with one in device/virtual/x86_64-kvm_x86_64-r0 --- .../DellEMC-S5248f-P-25G/context_config.json | 32 - .../DellEMC-S5248f-P-25G/gearbox_config.json | 38 -- .../DellEMC-S5248f-P-25G/sesto-1.json | 256 ------- device/virtual/x86_64-kvm_x86_64-r0/README.md | 25 + .../brcm_gearbox_vs/buffers.json.j2 | 3 + .../brcm_gearbox_vs/buffers_defaults_def.j2 | 45 ++ .../brcm_gearbox_vs/buffers_defaults_t0.j2 | 45 ++ .../brcm_gearbox_vs/buffers_defaults_t1.j2 | 45 ++ .../brcm_gearbox_vs}/context_config.json | 0 .../brcm_gearbox_vs}/gearbox_config.json | 0 .../brcm_gearbox_vs/lanemap.ini | 32 + .../brcm_gearbox_vs/pg_profile_lookup.ini | 17 + .../brcm_gearbox_vs}/phy1_config_1.json | 0 .../brcm_gearbox_vs/port_config.ini | 33 + .../brcm_gearbox_vs/qos.json.j2 | 1 + .../brcm_gearbox_vs/sai.profile | 5 + .../td2-s6000-32x40G.config.bcm | 646 ++++++++++++++++++ 17 files changed, 897 insertions(+), 326 deletions(-) delete mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json delete mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json delete mode 100644 device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/README.md create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers.json.j2 create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_def.j2 create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t0.j2 create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t1.j2 rename device/{dell/x86_64-dell_s6000_s1220-r0/Force10-S6000 => virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs}/context_config.json (100%) rename device/{dell/x86_64-dell_s6000_s1220-r0/Force10-S6000 => virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs}/gearbox_config.json (100%) create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/lanemap.ini create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/pg_profile_lookup.ini rename device/{dell/x86_64-dell_s6000_s1220-r0/Force10-S6000 => virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs}/phy1_config_1.json (100%) create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/port_config.ini create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/qos.json.j2 create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile create mode 100644 device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/td2-s6000-32x40G.config.bcm diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json deleted file mode 100644 index 9f9f80ba0d36..000000000000 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/context_config.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "CONTEXTS": [ - { - "guid" : 0, - "name" : "sw0", - "dbAsic" : "ASIC_DB", - "dbCounters" : "COUNTERS_DB", - "dbFlex": "FLEX_COUNTER_DB", - "dbState" : "STATE_DB", - "switches": [ - { - "index" : 0, - "hwinfo" : "" - } - ] - }, - { - "guid" : 1, - "name" : "phy1", - "dbAsic" : "GB_ASIC_DB", - "dbCounters" : "GB_COUNTERS_DB", - "dbFlex": "GB_FLEX_COUNTER_DB", - "dbState" : "STATE_DB", - "switches": [ - { - "index" : 1, - "hwinfo" : "" - } - ] - } - ] -} diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json deleted file mode 100644 index 6342bd74b89a..000000000000 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/gearbox_config.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "phys": [ - { - "phy_id": 1, - "name": "sesto-1", - "address": "0x1000", - "lib_name": "libsai_phy_sesto-1.so", - "firmware_path": "/tmp/phy-sesto-1.bin", - "config_file": "/usr/share/sonic/hwsku/sesto-1.json", - "sai_init_config_file": "/usr/share/sonic/hwsku/sesto-1.bcm", - "phy_access": "mdio", - "bus_id": 0 - } - ], - "interfaces": [ - { - "name": "Ethernet48", - "index": 49, - "phy_id" : 1, - "system_lanes": [200,201,202,203], - "line_lanes": [204,205] - }, - { - "name": "Ethernet49", - "index": 50, - "phy_id" : 1, - "system_lanes": [206,207,208,209], - "line_lanes": [210,211] - }, - { - "name": "Ethernet50", - "index": 51, - "phy_id" : 1, - "system_lanes": [212,213,214,215], - "line_lanes": [216] - } - ] -} diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json deleted file mode 100644 index a9c92ba8ebe4..000000000000 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/sesto-1.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "lanes": [ - { - "index": 200, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0200" - }, - { - "index": 201, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0201" - }, - { - "index": 202, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0202" - }, - { - "index": 203, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0203" - }, - { - "index": 204, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 200, - "mdio_addr": "0x0204" - }, - { - "index": 205, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 202, - "mdio_addr": "0x0205" - }, - { - "index": 206, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0206" - }, - { - "index": 207, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0207" - }, - { - "index": 208, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0208" - }, - { - "index": 209, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0209" - }, - { - "index": 210, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 206, - "mdio_addr": "0x0210" - }, - { - "index": 211, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 208, - "mdio_addr": "0x0211" - }, - { - "index": 212, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0012" - }, - { - "index": 213, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0013" - }, - { - "index": 214, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0014" - }, - { - "index": 215, - "local_lane_id": 0, - "system_side": true, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 0, - "mdio_addr": "0x0015" - }, - { - "index": 216, - "local_lane_id": 0, - "system_side": false, - "tx_polarity": 0, - "rx_polarity": 0, - "line_tx_lanemap": 0, - "line_rx_lanemap": 0, - "line_to_system_lanemap": 212, - "mdio_addr": "0x0016" - } - ], - "ports": [ - { - "index": 49, - "mdio_addr": "0x2000", - "system_speed": 25000, - "system_fec": "none", - "system_auto_neg": true, - "system_loopback": "none", - "system_training": false, - "line_speed": 50000, - "line_fec": "none", - "line_auto_neg": true, - "line_media_type": "fiber", - "line_intf_type": "none", - "line_loopback": "none", - "line_training": false, - "line_adver_speed": [], - "line_adver_fec": [], - "line_adver_auto_neg": false, - "line_adver_asym_pause": false, - "line_adver_media_type": "fiber" - }, - { - "index": 50, - "mdio_addr": "0x3000", - "system_speed": 25000, - "system_fec": "none", - "system_auto_neg": true, - "system_loopback": "none", - "system_training": false, - "line_speed": 50000, - "line_fec": "none", - "line_auto_neg": true, - "line_media_type": "fiber", - "line_intf_type": "none", - "line_loopback": "none", - "line_training": false, - "line_adver_speed": [], - "line_adver_fec": [], - "line_adver_auto_neg": false, - "line_adver_asym_pause": false, - "line_adver_media_type": "fiber" - }, - { - "index": 51, - "mdio_addr": "0x4000", - "system_speed": 25000, - "system_fec": "none", - "system_auto_neg": true, - "system_loopback": "none", - "system_training": false, - "line_speed": 100000, - "line_fec": "none", - "line_auto_neg": true, - "line_media_type": "fiber", - "line_intf_type": "none", - "line_loopback": "none", - "line_training": false, - "line_adver_speed": [], - "line_adver_fec": [], - "line_adver_auto_neg": false, - "line_adver_asym_pause": false, - "line_adver_media_type": "fiber" - } - ] -} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md new file mode 100644 index 000000000000..cd10768b8c32 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -0,0 +1,25 @@ +# Changing the virtual device + +You can control the hw sku and default factory configuration for the VS image +by modifying the content of the file default_sku. + +The format of default_sku is a single line: + +``` + +``` + +## Allowable values for hw_key + +| hw_key | Device | +| ------ | ------ | + +| Force10-S6000 | Dell Force10 S6000| +| brcm_gearbox_vs | Similar to Force10-S6000, but implements a virtual BRCM81724 Gearbox Phy | + +## Allowable values for default_preset + +These include "t1", "l2", and "empty". See the file +sonic-buildimage/src/sonic-config-engine/config_samples.py for details on how +each default_preset value is interpreted. + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_def.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t0.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/buffers_defaults_t1.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '300m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/context_config.json similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/context_config.json rename to device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/context_config.json diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/gearbox_config.json rename to device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/gearbox_config.json diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/lanemap.ini new file mode 100644 index 000000000000..36278a01778c --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/lanemap.ini @@ -0,0 +1,32 @@ +eth1:25,26,27,28 +eth2:29,30,31,32 +eth3:33,34,35,36 +eth4:37,38,39,40 +eth5:45,46,47,48 +eth6:41,42,43,44 +eth7:1,2,3,4 +eth8:5,6,7,8 +eth9:13,14,15,16 +eth10:9,10,11,12 +eth11:17,18,19,20 +eth12:21,22,23,24 +eth13:53,54,55,56 +eth14:49,50,51,52 +eth15:57,58,59,60 +eth16:61,62,63,64 +eth17:69,70,71,72 +eth18:65,66,67,68 +eth19:73,74,75,76 +eth20:77,78,79,80 +eth21:109,110,111,112 +eth22:105,106,107,108 +eth23:113,114,115,116 +eth24:117,118,119,120 +eth25:125,126,127,128 +eth26:121,122,123,124 +eth27:81,82,83,84 +eth28:85,86,87,88 +eth29:93,94,95,96 +eth30:89,90,91,92 +eth31:101,102,103,104 +eth32:97,98,99,100 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/phy1_config_1.json similarity index 100% rename from device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/phy1_config_1.json rename to device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/phy1_config_1.json diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/port_config.ini new file mode 100644 index 000000000000..95cf5eec9e4e --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet0 25,26,27,28 fortyGigE0/0 0 40000 +Ethernet4 29,30,31,32 fortyGigE0/4 1 40000 +Ethernet8 33,34,35,36 fortyGigE0/8 2 40000 +Ethernet12 37,38,39,40 fortyGigE0/12 3 40000 +Ethernet16 45,46,47,48 fortyGigE0/16 4 40000 +Ethernet20 41,42,43,44 fortyGigE0/20 5 40000 +Ethernet24 1,2,3,4 fortyGigE0/24 6 40000 +Ethernet28 5,6,7,8 fortyGigE0/28 7 40000 +Ethernet32 13,14,15,16 fortyGigE0/32 8 40000 +Ethernet36 9,10,11,12 fortyGigE0/36 9 40000 +Ethernet40 17,18,19,20 fortyGigE0/40 10 40000 +Ethernet44 21,22,23,24 fortyGigE0/44 11 40000 +Ethernet48 53,54,55,56 fortyGigE0/48 12 40000 +Ethernet52 49,50,51,52 fortyGigE0/52 13 40000 +Ethernet56 57,58,59,60 fortyGigE0/56 14 40000 +Ethernet60 61,62,63,64 fortyGigE0/60 15 40000 +Ethernet64 69,70,71,72 fortyGigE0/64 16 40000 +Ethernet68 65,66,67,68 fortyGigE0/68 17 40000 +Ethernet72 73,74,75,76 fortyGigE0/72 18 40000 +Ethernet76 77,78,79,80 fortyGigE0/76 19 40000 +Ethernet80 109,110,111,112 fortyGigE0/80 20 40000 +Ethernet84 105,106,107,108 fortyGigE0/84 21 40000 +Ethernet88 113,114,115,116 fortyGigE0/88 22 40000 +Ethernet92 117,118,119,120 fortyGigE0/92 23 40000 +Ethernet96 125,126,127,128 fortyGigE0/96 24 40000 +Ethernet100 121,122,123,124 fortyGigE0/100 25 40000 +Ethernet104 81,82,83,84 fortyGigE0/104 26 40000 +Ethernet108 85,86,87,88 fortyGigE0/108 27 40000 +Ethernet112 93,94,95,96 fortyGigE0/112 28 40000 +Ethernet116 89,90,91,92 fortyGigE0/116 29 40000 +Ethernet120 101,102,103,104 fortyGigE0/120 30 40000 +Ethernet124 97,98,99,100 fortyGigE0/124 31 40000 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile new file mode 100644 index 000000000000..bfc466f27e54 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile @@ -0,0 +1,5 @@ +SAI_WARM_BOOT_READ_FILE=/var/cache/sai_warmboot.bin +SAI_WARM_BOOT_WRITE_FILE=/var/cache/sai_warmboot.bin +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..4c94db7107c7 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/td2-s6000-32x40G.config.bcm @@ -0,0 +1,646 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=8 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 From d316ebcf2ab22f37647062c1645bf4fd0a84be4c Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 25 Aug 2020 01:48:25 -0700 Subject: [PATCH 19/31] minor edits --- device/virtual/x86_64-kvm_x86_64-r0/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md index cd10768b8c32..e30d9e37da79 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/README.md +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -13,7 +13,6 @@ The format of default_sku is a single line: | hw_key | Device | | ------ | ------ | - | Force10-S6000 | Dell Force10 S6000| | brcm_gearbox_vs | Similar to Force10-S6000, but implements a virtual BRCM81724 Gearbox Phy | From 387a076999190301ca18e9d53b9b1c6d80456345 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 13:59:20 -0700 Subject: [PATCH 20/31] renumber table numbers to accomodate recent rest addition --- dockers/docker-database/database_config.json.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index 8a9d4777da5f..a24252ed810d 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -53,22 +53,22 @@ "separator": "|", "instance" : "redis" }, - "GB_ASIC_DB" : { + "RESTAPI_DB" : { "id" : 8, "separator": "|", "instance" : "redis" }, - "GB_COUNTERS_DB" : { + "GB_ASIC_DB" : { "id" : 9, "separator": "|", "instance" : "redis" }, - "GB_FLEX_COUNTER_DB" : { + "GB_COUNTERS_DB" : { "id" : 10, "separator": "|", "instance" : "redis" }, - "RESTAPI_DB" : { + "GB_FLEX_COUNTER_DB" : { "id" : 11, "separator": "|", "instance" : "redis" From 9809b8ea38b49fc41ffa0e2e475b57cf8fc62d2f Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 18:51:42 -0700 Subject: [PATCH 21/31] Update docs for virtual x86 KVM to better describe default_sku --- device/virtual/x86_64-kvm_x86_64-r0/README.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md index e30d9e37da79..e9801667a9c2 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/README.md +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -22,3 +22,47 @@ These include "t1", "l2", and "empty". See the file sonic-buildimage/src/sonic-config-engine/config_samples.py for details on how each default_preset value is interpreted. +# Device Specific Documentation + +For general info on building, see https://github.com/Azure/sonic-buildimage/blob/master/README.md + +# Force-10-S6000 + +This is the default VS for SONiC. To enable, set contents of default_sku to: + +``` +Force10-S6000 t1 +``` + +To build: + +``` +make clean +make target/sonic-vs.gz +``` + +# brcm_gearbox_vs + +This sku simulates a device with a Broadcom BRCM81724 gearbox PHY. To enable, +set default_sku to: + + +``` +brcm_gearbox_vs t1 +``` + +To build (same as Force-10-S6000): + +``` +make clean +make target/sonic-vs.gz +``` + +To verify, install and bring up SONiC. There will be a new gbsyncd docker +which is designed to respond to configuration directed towards the gearbox phy +"switch". swss will create that gearbox switch on startup after detecting the +gearbox is present (this is done by a short lived gearsyncd that runs in the +swss docker). + +The commands "show gearbox interfaces status" and "show gearbox phys" can be +used to verify the virtual gearbox phy has been created. See https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md#gearbox for details. From 3cb2055398b4412faef043fa454aba4842735580 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 19:01:23 -0700 Subject: [PATCH 22/31] remove openssl reference, and checks for broadcom platform --- files/build_templates/gbsyncd.service.j2 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/files/build_templates/gbsyncd.service.j2 b/files/build_templates/gbsyncd.service.j2 index ac51ca0307ef..e1080ae7d526 100644 --- a/files/build_templates/gbsyncd.service.j2 +++ b/files/build_templates/gbsyncd.service.j2 @@ -1,15 +1,9 @@ [Unit] Description=gbsyncd service Requires=database.service updategraph.service -{% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules.service ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json -{% endif %} After=database.service updategraph.service After=interfaces-config.service -{% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules.service -{% endif %} After=swss.service Before=ntp-config.service From 26f85d44fd1f4a5eb1ec86da38a1da430ee7f07e Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 19:06:16 -0700 Subject: [PATCH 23/31] remove unintended changes to supervisord.conf for swssconfig --- 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 d911d119a494..2ff6f5e11405 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -75,7 +75,7 @@ dependent_startup_wait_for=orchagent:running command=/usr/bin/swssconfig.sh priority=6 autostart=false -autorestart=false +autorestart=unexpected startretries=0 stdout_logfile=syslog stderr_logfile=syslog From 0b808f398f8b632f3b94ff92a37ed067b23622e5 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 19:11:53 -0700 Subject: [PATCH 24/31] remove more unintended changes to supervisord.conf for swssconfig --- dockers/docker-orchagent/supervisord.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 2ff6f5e11405..8b0bf68e924f 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -77,6 +77,7 @@ priority=6 autostart=false autorestart=unexpected startretries=0 +startsecs=0 stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true From be70bfa8c05c3fef44ca7e911778d2fa59a2fff6 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Fri, 18 Sep 2020 21:20:33 -0700 Subject: [PATCH 25/31] fix build commands in README --- device/virtual/x86_64-kvm_x86_64-r0/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md index e9801667a9c2..fab300d8f58c 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/README.md +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -37,8 +37,9 @@ Force10-S6000 t1 To build: ``` -make clean -make target/sonic-vs.gz +make init +make configure PLATFORM=vs +make target/sonic-vs.img.gz ``` # brcm_gearbox_vs @@ -54,8 +55,9 @@ brcm_gearbox_vs t1 To build (same as Force-10-S6000): ``` -make clean -make target/sonic-vs.gz +make init +make configure PLATFORM=vs +make target/sonic-vs.img.gz ``` To verify, install and bring up SONiC. There will be a new gbsyncd docker From 106de40be3d175a9caaddccf5637fb0b61ee28e3 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Sat, 19 Sep 2020 07:37:05 -0700 Subject: [PATCH 26/31] from stretch to buster --- platform/template/docker-gbsyncd-base.mk | 10 +++++----- platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/template/docker-gbsyncd-base.mk b/platform/template/docker-gbsyncd-base.mk index 891990232f51..aa4f574141b2 100644 --- a/platform/template/docker-gbsyncd-base.mk +++ b/platform/template/docker-gbsyncd-base.mk @@ -9,18 +9,18 @@ $(DOCKER_GBSYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-gbsyncd-$(DOCKER_GBSYNCD_P $(DOCKER_GBSYNCD_BASE)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -$(DOCKER_GBSYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_GBSYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) -$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) +$(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) -$(DOCKER_GBSYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES) +$(DOCKER_GBSYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BASE) -SONIC_STRETCH_DOCKERS += $(DOCKER_GBSYNCD_BASE) +SONIC_BUSTER_DOCKERS += $(DOCKER_GBSYNCD_BASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GBSYNCD_BASE) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BASE_DBG) -SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_GBSYNCD_BASE_DBG) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_GBSYNCD_BASE_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GBSYNCD_BASE_DBG) $(DOCKER_GBSYNCD_BASE)_CONTAINER_NAME = gbsyncd diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index 5924b5b0b7ea..d5fdc496929a 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM docker-config-engine-stretch +FROM docker-config-engine-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf From 2014eead2108324484cb2f08632a4d21ff1ad366 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Sat, 19 Sep 2020 09:55:15 -0700 Subject: [PATCH 27/31] update iproute2 and libcap2 for buster --- platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index d5fdc496929a..316466dfb4ea 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -f -y iproute2=4.20.0-2~bpo9+1 libcap2-bin=1:2.25-1 +RUN apt-get install -f -y iproute2=4.20.0-2 libcap2-bin=1:2.25-2 COPY \ {% for deb in docker_gbsyncd_vs_debs.split(' ') -%} From 6eaf960b4597ec7c725bad3c775c7467a2e04b21 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Tue, 22 Sep 2020 14:35:29 -0700 Subject: [PATCH 28/31] refactor gbsyncd.sh and syncd.sh --- files/scripts/gbsyncd.sh | 145 ++++++---------------------------- files/scripts/syncd.sh | 122 ++-------------------------- files/scripts/syncd_common.sh | 141 +++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 237 deletions(-) create mode 100755 files/scripts/syncd_common.sh diff --git a/files/scripts/gbsyncd.sh b/files/scripts/gbsyncd.sh index 9eb919329a0a..996fbf8cdf31 100755 --- a/files/scripts/gbsyncd.sh +++ b/files/scripts/gbsyncd.sh @@ -1,137 +1,38 @@ #!/bin/bash -SERVICE="gbsyncd" -PEER="swss" -DEBUGLOG="/tmp/swss-gbsyncd-debug.log" -LOCKFILE="/tmp/swss-gbsyncd-lock" +. /usr/local/bin/syncd_common.sh -function debug() -{ - /usr/bin/logger $1 - /bin/echo `date` "- $1" >> ${DEBUGLOG} +function startplatform() { + : } -function lock_service_state_change() -{ - debug "Locking ${LOCKFILE} from ${SERVICE} service" - - exec {LOCKFD}>${LOCKFILE} - /usr/bin/flock -x ${LOCKFD} - trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 - - debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" +function waitplatform() { + : } -function unlock_service_state_change() -{ - debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE} service" - /usr/bin/flock -u ${LOCKFD} +function stopplatform1() { + : } -function check_warm_boot() -{ - SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` - SERVICE_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` - # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. - if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then - WARM_BOOT="true" - else - WARM_BOOT="false" - fi +function stopplatform2() { + : } -function wait_for_database_service() -{ - # Wait for redis server start before database clean - until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; - do sleep 1; - done - - # Wait for configDB initialization - until [[ $(/usr/bin/docker exec database redis-cli -n 4 GET "CONFIG_DB_INITIALIZED") ]]; - do sleep 1; - done -} - -function getBootType() -{ - case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in - warm*) - TYPE='warm' - ;; - fastfast) - TYPE='fastfast' - ;; - fast*) - TYPE='fast' - ;; - *) - TYPE='cold' - esac - echo "${TYPE}" -} - -start() { - debug "Starting ${SERVICE} service..." - - lock_service_state_change - - mkdir -p /host/warmboot - - wait_for_database_service - check_warm_boot - - debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." +OP=$1 +DEV=$2 - if [[ x"$WARM_BOOT" == x"true" ]]; then - # Leave a mark for syncd scripts running inside docker. - touch /host/warmboot/warm-starting - else - rm -f /host/warmboot/warm-starting - fi - - # start service docker - /usr/bin/${SERVICE}.sh start - debug "Started ${SERVICE} service..." - - unlock_service_state_change -} - -wait() { - /usr/bin/${SERVICE}.sh wait -} - -stop() { - debug "Stopping ${SERVICE} service..." - - lock_service_state_change - check_warm_boot - debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." - - if [[ x"$WARM_BOOT" == x"true" ]]; then - TYPE=warm - else - TYPE=cold - fi - - if [[ x$TYPE != x"cold" ]]; then - debug "${TYPE} shutdown gbsyncd process ..." - /usr/bin/docker exec -i gbsyncd /usr/bin/syncd_request_shutdown --${TYPE} - - # wait until syncd quits gracefully - while docker top gbsyncd | grep -q /usr/bin/gbsyncd; do - sleep 0.1 - done - - /usr/bin/docker exec -i gbsyncd /bin/sync - debug "Finished ${TYPE} shutdown gbsyncd process ..." - fi - - /usr/bin/${SERVICE}.sh stop - debug "Stopped ${SERVICE} service..." - - unlock_service_state_change -} +SERVICE="gbsyncd" +PEER="swss" +DEBUGLOG="/tmp/swss-gbsyncd-debug$DEV.log" +LOCKFILE="/tmp/swss-gbsyncd-lock$DEV" +NAMESPACE_PREFIX="asic" +if [ "$DEV" ]; then + NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace + SONIC_DB_CLI="sonic-db-cli -n $NET_NS" +else + NET_NS="" + SONIC_DB_CLI="sonic-db-cli" +fi case "$1" in start|wait|stop) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 87a39b71ae7b..22fa992b8e80 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -1,96 +1,8 @@ #!/bin/bash +. /usr/local/bin/syncd_common.sh -function debug() -{ - /usr/bin/logger $1 - /bin/echo `date` "- $1" >> ${DEBUGLOG} -} - -function lock_service_state_change() -{ - debug "Locking ${LOCKFILE} from ${SERVICE}$DEV service" - - exec {LOCKFD}>${LOCKFILE} - /usr/bin/flock -x ${LOCKFD} - trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 - - debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE}$DEV service" -} - -function unlock_service_state_change() -{ - debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE}$DEV service" - /usr/bin/flock -u ${LOCKFD} -} - -function check_warm_boot() -{ - SYSTEM_WARM_START=`$SONIC_DB_CLI STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable` - SERVICE_WARM_START=`$SONIC_DB_CLI STATE_DB hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` - # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. - if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then - WARM_BOOT="true" - else - WARM_BOOT="false" - fi -} - -function wait_for_database_service() -{ - # Wait for redis server start before database clean - until [[ $($SONIC_DB_CLI PING | grep -c PONG) -gt 0 ]]; do - sleep 1; - done - - # Wait for configDB initialization - until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]]; - do sleep 1; - done -} - -function getBootType() -{ - # same code snippet in files/build_templates/docker_image_ctl.j2 - case "$(cat /proc/cmdline)" in - *SONIC_BOOT_TYPE=warm*) - TYPE='warm' - ;; - *SONIC_BOOT_TYPE=fastfast*) - TYPE='fastfast' - ;; - *SONIC_BOOT_TYPE=fast*|*fast-reboot*) - # check that the key exists - if [[ $($SONIC_DB_CLI STATE_DB GET "FAST_REBOOT|system") == "1" ]]; then - TYPE='fast' - else - TYPE='cold' - fi - ;; - *) - TYPE='cold' - esac - echo "${TYPE}" -} - -start() { - debug "Starting ${SERVICE}$DEV service..." - - lock_service_state_change - - mkdir -p /host/warmboot - - wait_for_database_service - check_warm_boot - - debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." - - if [[ x"$WARM_BOOT" == x"true" ]]; then - # Leave a mark for syncd scripts running inside docker. - touch /host/warmboot/warm-starting - else - rm -f /host/warmboot/warm-starting - fi +function startplatform() { # platform specific tasks @@ -119,35 +31,18 @@ start() { /etc/init.d/xpnet.sh start fi fi - - # start service docker - /usr/bin/${SERVICE}.sh start $DEV - debug "Started ${SERVICE} service..." - - unlock_service_state_change } -wait() { +function waitplatform() { + if [[ x"$sonic_asic_platform" == x"mellanox" ]]; then debug "Starting pmon service..." /bin/systemctl start pmon debug "Started pmon service" fi - /usr/bin/${SERVICE}.sh wait $DEV } -stop() { - debug "Stopping ${SERVICE}$DEV service..." - - lock_service_state_change - check_warm_boot - debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." - - if [[ x"$WARM_BOOT" == x"true" ]]; then - TYPE=warm - else - TYPE=cold - fi +function stopplatform1() { if [[ x$sonic_asic_platform == x"mellanox" ]] && [[ x$TYPE == x"cold" ]]; then debug "Stopping pmon service ahead of syncd..." @@ -177,10 +72,9 @@ stop() { /usr/bin/docker exec -i syncd$DEV /bin/sync debug "Finished ${TYPE} shutdown syncd process ..." fi +} - /usr/bin/${SERVICE}.sh stop $DEV - debug "Stopped ${SERVICE}$DEV service..." - +function stopplatform2() { # platform specific tasks if [[ x"$WARM_BOOT" != x"true" ]]; then @@ -192,8 +86,6 @@ stop() { /etc/init.d/xpnet.sh start fi fi - - unlock_service_state_change } OP=$1 diff --git a/files/scripts/syncd_common.sh b/files/scripts/syncd_common.sh new file mode 100755 index 000000000000..0e9fc8ac2d7a --- /dev/null +++ b/files/scripts/syncd_common.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +# +# common functions used by "syncd" scipts (syncd.sh, gbsyncd.sh, etc..) +# scripts using this must provide implementations of the following functions: +# +# startplatform +# waitplatform +# stopplatform1 and stopplatform2 +# +# For examples of these, see gbsyncd.sh and syncd.sh. +# + +function debug() +{ + /usr/bin/logger $1 + /bin/echo `date` "- $1" >> ${DEBUGLOG} +} + +function lock_service_state_change() +{ + debug "Locking ${LOCKFILE} from ${SERVICE}$DEV service" + + exec {LOCKFD}>${LOCKFILE} + /usr/bin/flock -x ${LOCKFD} + trap "/usr/bin/flock -u ${LOCKFD}" 0 2 3 15 + + debug "Locked ${LOCKFILE} (${LOCKFD}) from ${SERVICE}$DEV service" +} + +function unlock_service_state_change() +{ + debug "Unlocking ${LOCKFILE} (${LOCKFD}) from ${SERVICE}$DEV service" + /usr/bin/flock -u ${LOCKFD} +} + +function check_warm_boot() +{ + SYSTEM_WARM_START=`$SONIC_DB_CLI STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable` + SERVICE_WARM_START=`$SONIC_DB_CLI STATE_DB hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` + # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. + if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then + WARM_BOOT="true" + else + WARM_BOOT="false" + fi +} + +function wait_for_database_service() +{ + # Wait for redis server start before database clean + until [[ $($SONIC_DB_CLI PING | grep -c PONG) -gt 0 ]]; do + sleep 1; + done + + # Wait for configDB initialization + until [[ $($SONIC_DB_CLI CONFIG_DB GET "CONFIG_DB_INITIALIZED") ]]; + do sleep 1; + done +} + +function getBootType() +{ + # same code snippet in files/build_templates/docker_image_ctl.j2 + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) + TYPE='warm' + ;; + *SONIC_BOOT_TYPE=fastfast*) + TYPE='fastfast' + ;; + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) + # check that the key exists + if [[ $($SONIC_DB_CLI STATE_DB GET "FAST_REBOOT|system") == "1" ]]; then + TYPE='fast' + else + TYPE='cold' + fi + ;; + *) + TYPE='cold' + esac + echo "${TYPE}" +} + +start() { + debug "Starting ${SERVICE}$DEV service..." + + lock_service_state_change + + mkdir -p /host/warmboot + + wait_for_database_service + check_warm_boot + + debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." + + if [[ x"$WARM_BOOT" == x"true" ]]; then + # Leave a mark for syncd scripts running inside docker. + touch /host/warmboot/warm-starting + else + rm -f /host/warmboot/warm-starting + fi + + startplatform + + # start service docker + /usr/bin/${SERVICE}.sh start $DEV + debug "Started ${SERVICE} service..." + + unlock_service_state_change +} + +wait() { + waitplatform + + /usr/bin/${SERVICE}.sh wait $DEV +} + +stop() { + debug "Stopping ${SERVICE}$DEV service..." + + lock_service_state_change + check_warm_boot + debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." + + if [[ x"$WARM_BOOT" == x"true" ]]; then + TYPE=warm + else + TYPE=cold + fi + + stopplatform1 + + /usr/bin/${SERVICE}.sh stop $DEV + debug "Stopped ${SERVICE}$DEV service..." + + stopplatform2 + + unlock_service_state_change +} From d63378018daa8707d8608b6b9038bb1bdc6d8232 Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Wed, 23 Sep 2020 11:23:44 -0700 Subject: [PATCH 29/31] docs for how to change hwsku to use something other than default --- device/virtual/x86_64-kvm_x86_64-r0/README.md | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md index fab300d8f58c..d87c1ee88022 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/README.md +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -1,7 +1,7 @@ # Changing the virtual device You can control the hw sku and default factory configuration for the VS image -by modifying the content of the file default_sku. +by modifying the content of the file default_sku in this directory. The format of default_sku is a single line: @@ -22,11 +22,29 @@ These include "t1", "l2", and "empty". See the file sonic-buildimage/src/sonic-config-engine/config_samples.py for details on how each default_preset value is interpreted. +# Changing the hwsku of an existing VS switch + +To change the default hwsku for a VS image that has already been built and installed, follow these steps: + +- Edit /usr/share/sonic/device/x86_64-kvm_x86_64-r0/default_sku. For details, see the section below (Device Specific Documentation) +- Edit /etc/sonic/config_db.json, and change the "hwsku" key in DEVICE_METADATA:localhost to match the hw_key used in default_sku. Example: + + "DEVICE_METADATA": { + "localhost": { + ... + "hwsku": "brcm_gearbox_vs", + ... + } + }, + ... +- Reboot the switch +- Use "show platform summary" to verify, and follow any steps specific to the platform, as needed, such as those described below for the brcm_gearbox_vs hwsku. + # Device Specific Documentation For general info on building, see https://github.com/Azure/sonic-buildimage/blob/master/README.md -# Force-10-S6000 +## Force-10-S6000 This is the default VS for SONiC. To enable, set contents of default_sku to: @@ -42,7 +60,7 @@ make configure PLATFORM=vs make target/sonic-vs.img.gz ``` -# brcm_gearbox_vs +## brcm_gearbox_vs This sku simulates a device with a Broadcom BRCM81724 gearbox PHY. To enable, set default_sku to: From f3fe3c445db83c00b3651fda24a6d348f090c4ab Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Wed, 23 Sep 2020 13:16:41 -0700 Subject: [PATCH 30/31] update build templates for new script --- files/build_templates/sonic_debian_extension.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 1918f4031ff2..9b294bc964cf 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -532,6 +532,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys # Copy service scripts (swss, syncd, bgp, radv) sudo LANG=C cp $SCRIPTS_DIR/swss.sh $FILESYSTEM_ROOT/usr/local/bin/swss.sh sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh +sudo LANG=C cp $SCRIPTS_DIR/syncd_common.sh $FILESYSTEM_ROOT/usr/local/bin/syncd_common.sh sudo LANG=C cp $SCRIPTS_DIR/gbsyncd.sh $FILESYSTEM_ROOT/usr/local/bin/gbsyncd.sh sudo LANG=C cp $SCRIPTS_DIR/bgp.sh $FILESYSTEM_ROOT/usr/local/bin/bgp.sh sudo LANG=C cp $SCRIPTS_DIR/radv.sh $FILESYSTEM_ROOT/usr/local/bin/radv.sh From 9f4cc832903a988cf5d931e3d1e2b2e67fe17b0f Mon Sep 17 00:00:00 2001 From: Syd Logan Date: Thu, 24 Sep 2020 09:16:18 -0700 Subject: [PATCH 31/31] Minor edit to fix "show gearbox phys status" command --- device/virtual/x86_64-kvm_x86_64-r0/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/README.md b/device/virtual/x86_64-kvm_x86_64-r0/README.md index d87c1ee88022..0347432d67b4 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/README.md +++ b/device/virtual/x86_64-kvm_x86_64-r0/README.md @@ -84,5 +84,5 @@ which is designed to respond to configuration directed towards the gearbox phy gearbox is present (this is done by a short lived gearsyncd that runs in the swss docker). -The commands "show gearbox interfaces status" and "show gearbox phys" can be +The commands "show gearbox interfaces status" and "show gearbox phys status" can be used to verify the virtual gearbox phy has been created. See https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md#gearbox for details.