From e5daf216fdfb2b5210e6a54ca64afd8907f143cd Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 16 Feb 2019 02:08:08 +0200 Subject: [PATCH 001/219] [syncd.sh] Don't stop sxdkernel during warm shutdown on Mellanox platform (#2572) /etc/init.d/sxdkernel stop may take up to 15 sec which has impact on control plane downtime Signed-off-by: Stepan Blyschak --- files/scripts/syncd.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 0247c7cd0583..0c80e4521a00 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -155,16 +155,11 @@ stop() { # platform specific tasks - # stop mellanox driver regardless of - # shutdown type - if [ x$sonic_asic_platform == x'mellanox' ]; then - /etc/init.d/sxdkernel stop - /usr/bin/mst stop - fi - - if [[ x"$WARM_BOOT" != x"true" ]]; then - if [ x$sonic_asic_platform == x'cavium' ]; 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 From def2780f1861449e388eb2cbba7f7355af39dee5 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Sat, 16 Feb 2019 10:17:13 -0800 Subject: [PATCH 002/219] [hostcfgd]: Promote logs for update-notifications-from-DB from DEBUG to INFO (#2576) * Add a log message for each notification of add/del TACACS server. Signed-off-by: Renuka Manavalan * Moved another syslog message from DEBUG to INFO to be able to see those notifications. All these changes are to help with a one-time-seen-bug, that hostcfgd did not act upon changes to redis for TACACS servers. We could not repro the bug. Signed-off-by: Renuka Manavalan --- files/image_config/hostcfgd/hostcfgd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index f156f7e9402c..5daebe257260 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -159,14 +159,14 @@ class HostConfigDaemon: log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def tacacs_global_handler(self, key, data): self.aaacfg.tacacs_global_update(key, data) log_data = copy.deepcopy(data) if log_data.has_key('passkey'): log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) def start(self): self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) From fc5512ad8530f0eb76bcccd743c73d6f91fe2860 Mon Sep 17 00:00:00 2001 From: lguohan Date: Sat, 16 Feb 2019 11:08:06 -0800 Subject: [PATCH 003/219] [quagga]: collect quagga-dbg debian package (#2575) Signed-off-by: Guohan Lu --- rules/quagga.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rules/quagga.mk b/rules/quagga.mk index f4ba4f2d0be8..353cd5e3fac2 100644 --- a/rules/quagga.mk +++ b/rules/quagga.mk @@ -1,6 +1,11 @@ # quagga package -QUAGGA = quagga_0.99.24.1-2.1_amd64.deb +QUAGGA_VERSION_FULL = 0.99.24.1-2.1 + +QUAGGA = quagga_$(QUAGGA_VERSION_FULL)_amd64.deb $(QUAGGA)_DEPENDS += $(LIBSNMP_DEV) $(QUAGGA)_SRC_PATH = $(SRC_PATH)/sonic-quagga SONIC_DPKG_DEBS += $(QUAGGA) + +QUAGGA_DBG = quagga-dbg_$(QUAGGA_VERSION_FULL)_amd64.deb +$(eval $(call add_derived_package,$(QUAGGA),$(QUAGGA_DBG))) From 490f47e05972829d61b01fdacf3db0bcdf93c16e Mon Sep 17 00:00:00 2001 From: RAMA CHANDRA REDDY GADDAM <45847882+ramachandrareddygaddam@users.noreply.github.com> Date: Tue, 19 Feb 2019 01:53:08 +0530 Subject: [PATCH 004/219] 'show vlan config' is not displaying the VLAN members, after the clear config and reload with default l2 configuration. (#2536) 'show vlan config' not displaying the VLAN members, after clear config done loaded with default l2 configuration. --- src/sonic-config-engine/config_samples.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py index 6cb417b9a50b..adaea0c4532c 100644 --- a/src/sonic-config-engine/config_samples.py +++ b/src/sonic-config-engine/config_samples.py @@ -47,6 +47,8 @@ def generate_l2_config(data): if not data['DEVICE_METADATA']['localhost'].has_key('type'): data['DEVICE_METADATA']['localhost']['type'] = 'ToRRouter' data['VLAN'] = {'Vlan1000': {'vlanid': '1000'}} + vp = natsorted(data['PORT'].keys()) + data['VLAN']['Vlan1000'].setdefault('members', vp) data['VLAN_MEMBER'] = {} for port in natsorted(data['PORT'].keys()): data['VLAN_MEMBER']['Vlan1000|{}'.format(port)] = {'tagging_mode': 'untagged'} From c5b0c59b78d80b7a00d5caabd1ebba78d86ca87e Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 19 Feb 2019 21:48:43 -0800 Subject: [PATCH 005/219] [swss]: flush asic db in swss.sh for non warm-boot (#2582) need to flush asic db in swss.sh instead of syncd.sh orchagent might already started in swss.sh and put commands into asic db before asic db is flushed in syncd.sh. This causes race condition such as INIT_VIEW not passing to syncd. Signed-off-by: Guohan Lu --- files/scripts/swss.sh | 3 ++- files/scripts/syncd.sh | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index d3e789d53afc..f7f2e53608f4 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -91,8 +91,9 @@ start() { # Don't flush DB during warm boot if [[ x"$WARM_BOOT" != x"true" ]]; then - debug "Flushing databases ..." + debug "Flushing APP, ASIC, COUNTER, CONFIG, and partial STATE databases ..." /usr/bin/docker exec database redis-cli -n 0 FLUSHDB + /usr/bin/docker exec database redis-cli -n 1 FLUSHDB /usr/bin/docker exec database redis-cli -n 2 FLUSHDB /usr/bin/docker exec database redis-cli -n 5 FLUSHDB clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*'" diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 0c80e4521a00..545879b2f7f4 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -88,10 +88,6 @@ start() { touch /host/warmboot/warm-starting else rm -f /host/warmboot/warm-starting - - # Flush ASIC DB during non-warm start - debug "Flushing ASIC database ..." - /usr/bin/docker exec database redis-cli -n 1 FLUSHDB fi # platform specific tasks From 2a12684fbe12ec26e323a58d96143c92501058ba Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Wed, 20 Feb 2019 08:38:09 +0200 Subject: [PATCH 006/219] [minigraph] asymmetric pfc is disabled by default (#2481) Signed-off-by: Mykola Faryma Conflicts: src/sonic-config-engine/tests/sample_output/ports.json src/sonic-config-engine/tests/test_cfggen.py --- src/sonic-config-engine/minigraph.py | 4 ++ src/sonic-config-engine/tests/test_cfggen.py | 68 ++++++++++---------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 461b76acac03..9ab3d0f02be5 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -551,6 +551,10 @@ def parse_xml(filename, platform=None, port_config_file=None): for port in ports.itervalues(): port['mtu'] = '9100' + # asymmetric PFC is disabled by default + for port in ports.itervalues(): + port['pfc_asym'] = 'off' + # set physical port default admin status up for port in phyport_intfs: if port[0] in ports: diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 1141419392c1..8236c71bb166 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -174,48 +174,48 @@ def test_minigraph_deployment_id(self): def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") + self.assertEqual(output.strip(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}") + self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}") def test_minigraph_extra_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) self.assertEqual(output.strip(), \ - "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " - "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, " - "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'speed': '100000', 'fec': 'rs'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") + "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " + "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") def test_metadata_everflow(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "MIRROR_SESSION"' From a57cb1413e38ee233a2f261654f2a95f4ea46bce Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 20 Feb 2019 08:04:12 -0800 Subject: [PATCH 007/219] [ntp] disable ntp time jump (#2589) - removing -g to disable jump when time difference is greater than 1000s - add -x to disable initial jump --- build_debian.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index b8514e78d7a1..6bac523b5d4e 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -263,6 +263,10 @@ sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64- ## Disable kexec supported reboot which was installed by default sudo sed -i 's/LOAD_KEXEC=true/LOAD_KEXEC=false/' $FILESYSTEM_ROOT/etc/default/kexec +## Modifty ntp default configuration: disable initial jump (add -x), and disable +## jump when time difference is greater than 1000 seconds (remove -g). +sudo sed -i "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/" $FILESYSTEM_ROOT/etc/default/ntp + ## Fix ping tools permission so non root user can directly use them ## Note: this is a workaround since aufs doesn't support extended attributes ## Ref: https://github.com/moby/moby/issues/5650#issuecomment-303499489 From d5250ad4b49f4f3a9fd6115d0b923205c1b6bac4 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 21 Feb 2019 10:04:54 -0800 Subject: [PATCH 008/219] Revert "[baseimage] Delay ntp-config service to start after 5 minutes (#2494)" (#2590) This reverts commit 33fe8d298ecc9ec380b2bae96604216ccc4cbfd4. --- files/build_templates/ntp-config.timer | 9 --------- files/build_templates/sonic_debian_extension.j2 | 2 -- 2 files changed, 11 deletions(-) delete mode 100644 files/build_templates/ntp-config.timer diff --git a/files/build_templates/ntp-config.timer b/files/build_templates/ntp-config.timer deleted file mode 100644 index ab2d2e755ab2..000000000000 --- a/files/build_templates/ntp-config.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Delays NTP configuration service until SONiC has started - -[Timer] -OnBootSec=5min -Unit=ntp-config.service - -[Install] -WantedBy=timers.target diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8064b2d71b04..4ef014a30e4b 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -302,9 +302,7 @@ sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh # Copy systemd timer configuration # It implements delayed start of services sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ -sudo cp $BUILD_TEMPLATES/ntp-config.timer $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer -sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.timer sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y From 797b21e5da093d24c4524b06b4f0632befc19499 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Thu, 21 Feb 2019 17:00:45 +0200 Subject: [PATCH 009/219] [config engine] update test_cfggen test_port_description test (#2593) Signed-off-by: Mykola Faryma --- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 8236c71bb166..efaf686253f5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -154,7 +154,7 @@ def test_minigraph_extra_neighbors(self): def test_minigraph_port_description(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/124', 'admin_status': 'up', 'lanes': '101,102,103,104', 'description': 'ARISTA04T1:Ethernet1/1', 'mtu': '9100'}") + self.assertEqual(output.strip(), "{'lanes': '101,102,103,104', 'description': 'ARISTA04T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up'}") def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' From 1d11b95f878adc28d63aef7b6a87c22f99b5349c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 21 Feb 2019 16:30:04 -0800 Subject: [PATCH 010/219] [201811 submodules] advance sairedis, swss, swss-common, utilities (#2594) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [201811 submodules] advance sairedis, swss, swss-common, utilities Submodule src/sonic-sairedis d57222a..54b02a1: > Add support for fdb_event MOVE and check fdb event oids (#420) > [vslib] add missing port attributes for virtual switch (#419) Submodule src/sonic-swss 584490c..62e2a20: > [fdborch] Store vlan id of FDB entry instead of port pvid into stateD… (#759) > [portsorch] Change speed set flow (#764) > Create egress ACL table group during the PFCWD stats list installment (#787) Submodule src/sonic-swss-common 286ef34..2592b0c: > Add support for WarmStart::setDataCheckState() (#242) Submodule src/sonic-utilities b44b462..d409987: > [sonic_installer] Improve error handling (#460) > [clock] sync os time to CMOS before rebooting (#465) > [intfstat] add intfstat script to output RIF counters (#439) Signed-off-by: Ying Xie * [201811 utilties] add 201811 branch for sonic-utilities repo Submodule src/sonic-utilities d409987...ff1448c: > [sonic_installer] Improve error handling (#460) > [clock] sync os time to CMOS before rebooting (#465) < [sonic_installer] Improve error handling (#460) < [clock] sync os time to CMOS before rebooting (#465) < [intfstat] add intfstat script to output RIF counters (#439) Signed-off-by: Ying Xie --- .gitmodules | 1 + src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 7076a352e506..6ed1a06a700c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -38,6 +38,7 @@ [submodule "src/sonic-utilities"] path = src/sonic-utilities url = https://github.com/Azure/sonic-utilities + branch = 201811 [submodule "platform/broadcom/sonic-platform-modules-arista"] path = platform/broadcom/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d57222a9879b..54b02a1acb39 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d57222a9879b9ee28738d05b769b7e0ca5d50cd1 +Subproject commit 54b02a1acb39b529c3fe24fcb6e24241bddf5824 diff --git a/src/sonic-swss b/src/sonic-swss index 584490c319be..62e2a20796d2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 584490c319be8e74444504538156e30ffadb8c4d +Subproject commit 62e2a20796d2913640252f618b4dd0c6e997fa75 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 286ef34f18ed..2592b0c98bb4 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 286ef34f18ed105532c6b5e0d5fcbc7e1bbd9073 +Subproject commit 2592b0c98bb47742646c7eea55ea38221330741c diff --git a/src/sonic-utilities b/src/sonic-utilities index b44b462a14b9..ff1448cd3741 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b44b462a14b9a4b7c2d6091b5355c046acd9dac8 +Subproject commit ff1448cd374126f03ac19feb5a047be8a030ca25 From fbdb256a04e7c232667a1c222200543d3ed32bcb Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Fri, 22 Feb 2019 16:54:55 +0200 Subject: [PATCH 011/219] [submodule] update mellanox hw-mgmgt pointer (V.2.0.0061) (#2592) Signed-off-by: Mykola Faryma --- platform/mellanox/hw-management/hw-mgmt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index 344e81942c02..498002ba528e 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit 344e81942c02c279db03c3aba40db4142dc6817d +Subproject commit 498002ba528e5633bf1e9b8e488979ed731ca0f6 From 9f0ccbb0ab79129cdf3f36b3da67fc454355cf9b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 22 Feb 2019 21:48:13 -0800 Subject: [PATCH 012/219] [201811 sub module] advance sonic-swss sub module (#2599) Submodule src/sonic-swss 62e2a20..4b489ce: > Fix incorrect ACL CRM increment, resulting orchagent crash (#800) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 62e2a20796d2..4b489cee5b05 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 62e2a20796d2913640252f618b4dd0c6e997fa75 +Subproject commit 4b489cee5b055818cb51055b9591204f448aae06 From a06f5901d0032d29d90ccda63e6cfd94082b41dd Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 28 Feb 2019 20:47:33 +0200 Subject: [PATCH 013/219] [Mellanox] Update SAI, SDK/FW (v4.3.0136/13.1910.0920) (#2616) Signed-off-by: Andriy Moroz --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/sdk.mk | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 99414ff9459a..48f86cc05e78 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1910.0906 +MLNX_FW_VERSION = 13.1910.0920 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d5d3d53830a4..38402dfd1811 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.13.3-master -MLNX_SAI_REVISION = 7cc737246fce514372cf8fd447360c5f11e7c8b9 +MLNX_SAI_REVISION = f3e389f1ba9535fdd6afb134897683b65d1ad4e7 export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 3d5d949fa798..c9aed71fdc57 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/9248a185b7da775b11daa5cb79ea22195c0b99f1/sdk -MLNX_SDK_VERSION = 4.3.0134 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/f3e389f1ba9535fdd6afb134897683b65d1ad4e7/sdk +MLNX_SDK_VERSION = 4.3.0136 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) From 8617923cd10b5458a74e842ae58355b6c08ed9d5 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 28 Feb 2019 15:11:14 -0800 Subject: [PATCH 014/219] [sub module] advance sonic-utilities sub module for 201811 branch (#2619) Submodule src/sonic-utilities ff1448c..f95da07: > [fast/warm reboot] set default reboot method to "kexec -e" (#473) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index ff1448cd3741..f95da07de0cc 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ff1448cd374126f03ac19feb5a047be8a030ca25 +Subproject commit f95da07de0ccd38cf71e1ffe57124b70a5bcfa72 From 83c645d69f39a6c19e0fe3288b75c56d0d998419 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 1 Mar 2019 20:27:17 +0200 Subject: [PATCH 015/219] [Mellanox] Fix SAI version (#2628) Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 38402dfd1811..f969719b8458 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.13.3-master +MLNX_SAI_VERSION = SAIRel1.13.4-master MLNX_SAI_REVISION = f3e389f1ba9535fdd6afb134897683b65d1ad4e7 export MLNX_SAI_VERSION MLNX_SAI_REVISION From c6ccb80803551ab3439dbba4361c249f1c25f5c0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 2 Mar 2019 15:28:34 -0800 Subject: [PATCH 016/219] [services] Ensure swss and syncd services start before dependent services (#2634) * [services] Ensure swss and syncd services start before dependent services * Add 'attach' functions to scripts which get installed to /usr/local/bin so that services only reference the one script each * Add 'After=swss.service' to syncd.service --- files/build_templates/swss.service.j2 | 3 ++- files/build_templates/syncd.service.j2 | 4 +++- files/scripts/swss.sh | 7 +++++-- files/scripts/syncd.sh | 7 +++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 906bae7c11c2..36858b30b60a 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -13,7 +13,8 @@ Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/swss.sh start +ExecStartPre=/usr/local/bin/swss.sh start +ExecStart=/usr/local/bin/swss.sh attach ExecStop=/usr/local/bin/swss.sh stop [Install] diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 70759f7c6b0d..ddb51232426b 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -13,12 +13,14 @@ After=opennsl-modules-4.9.0-8-amd64.service {% elif sonic_asic_platform == 'nephos' %} After=nps-modules-4.9.0-8-amd64.service {% endif %} +After=swss.service Before=ntp-config.service [Service] User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} -ExecStart=/usr/local/bin/syncd.sh start +ExecStartPre=/usr/local/bin/syncd.sh start +ExecStart=/usr/local/bin/syncd.sh attach ExecStop=/usr/local/bin/syncd.sh stop [Install] diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index f7f2e53608f4..cdd2de332e38 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -109,6 +109,9 @@ start() { if [[ x"$WARM_BOOT" != x"true" ]]; then /bin/systemctl start ${PEER} fi +} + +attach() { /usr/bin/${SERVICE}.sh attach } @@ -134,11 +137,11 @@ stop() { } case "$1" in - start|stop) + start|attach|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|attach|stop}" exit 1 ;; esac diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 545879b2f7f4..7e5ce780e072 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -117,6 +117,9 @@ start() { debug "Started ${SERVICE} service..." unlock_service_state_change +} + +attach() { /usr/bin/${SERVICE}.sh attach } @@ -165,11 +168,11 @@ stop() { } case "$1" in - start|stop) + start|attach|stop) $1 ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|attach|stop}" exit 1 ;; esac From ece0050acf4a9efa08d005b72908ffecdd70fddd Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 7 Mar 2019 03:26:41 +0000 Subject: [PATCH 017/219] [router-advertiser] Add templated script to wait for pertinent interfaces to be ready before starting radvd (#2558) --- .../docker-router-advertiser/Dockerfile.j2 | 2 +- dockers/docker-router-advertiser/start.sh | 7 ++++ .../wait_for_intf.sh.j2 | 32 +++++++++++++++++++ rules/docker-router-advertiser.mk | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 dockers/docker-router-advertiser/wait_for_intf.sh.j2 diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 1385e1ebec63..9e56515fc1e6 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -30,6 +30,6 @@ RUN rm -rf /debs COPY ["start.sh", "/usr/bin/"] COPY ["docker-router-advertiser.supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["radvd.conf.j2", "/usr/share/sonic/templates/"] +COPY ["radvd.conf.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-router-advertiser/start.sh b/dockers/docker-router-advertiser/start.sh index 159006a176bd..8d5f73a8bcb0 100755 --- a/dockers/docker-router-advertiser/start.sh +++ b/dockers/docker-router-advertiser/start.sh @@ -21,5 +21,12 @@ if [ $NUM_IFACES -eq 0 ]; then exit 0 fi +# Generate the script that waits for pertinent interfaces to come up and make it executable +sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh +chmod +x /usr/bin/wait_for_intf.sh + +# Wait for pertinent interfaces to come up +/usr/bin/wait_for_intf.sh + # Start the router advertiser supervisorctl start radvd diff --git a/dockers/docker-router-advertiser/wait_for_intf.sh.j2 b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 new file mode 100644 index 000000000000..856c47678f23 --- /dev/null +++ b/dockers/docker-router-advertiser/wait_for_intf.sh.j2 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +STATE_DB_IDX="6" + +VLAN_TABLE_PREFIX="VLAN_TABLE" + +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 + + echo "Waiting until interface $IFACE is ready..." + + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") + while true; do + RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then + break + fi + + sleep 1 + done + + echo "Interface ${IFACE} is ready!" +} + + +# Wait for all interfaces to be up and ready +{% for (name, prefix) in VLAN_INTERFACE %} +wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} +{% endfor %} diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 129246d8fa2d..c77ce03d6520 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -2,6 +2,7 @@ DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser +$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(REDIS_TOOLS) $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) From daf45c5179b233bc2f0b47fb0859f10d0a6777e0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 4 Mar 2019 09:15:11 -0800 Subject: [PATCH 018/219] [supervisor] Fix crash if system clock rolls back within startsecs; Refactor patch (#2624) --- ...-hanging-and-crashes-if-system-cloc.patch} | 140 ++++++++++++++++-- ...e-hanging-delays-in-process-state-tr.patch | 83 ----------- src/supervisor/patch/series | 4 +- 3 files changed, 132 insertions(+), 95 deletions(-) rename src/supervisor/patch/{0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch => 0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch} (54%) delete mode 100644 src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch diff --git a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch similarity index 54% rename from src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch rename to src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch index cb01665ba80b..6c4a6b7c2a4c 100644 --- a/src/supervisor/patch/0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +++ b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch @@ -1,15 +1,91 @@ -From 43b6f3ee93593f666af2c6a7af897bf3b5ee762d Mon Sep 17 00:00:00 2001 +From 5b56519e68e866662d9fd9a6681b6b47d6b5fcdb Mon Sep 17 00:00:00 2001 From: Joe LeVeque -Date: Wed, 17 Jan 2018 22:27:56 +0000 -Subject: [PATCH 2/2] Add unit test cases to ensure state transitions work if - system time has rolled backward +Date: Thu, 28 Feb 2019 01:43:54 +0000 +Subject: [PATCH] Prevent excessive hanging and crashes if system clock rolls + backward --- - supervisor/tests/test_process.py | 146 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 146 insertions(+) + supervisor/process.py | 36 ++++++ + supervisor/tests/test_process.py | 183 +++++++++++++++++++++++++++++++ + 2 files changed, 219 insertions(+) +diff --git a/supervisor/process.py b/supervisor/process.py +index f9ddcd9..5f73e6b 100644 +--- a/supervisor/process.py ++++ b/supervisor/process.py +@@ -347,6 +347,28 @@ class Subprocess: + options.write(2, "supervisor: child process was not spawned\n") + options._exit(127) # exit process with code for spawn failure + ++ def _check_and_adjust_for_system_clock_rollback(self, test_time): ++ """ ++ Check if system clock has rolled backward beyond test_time. If so, set ++ affected timestamps to test_time. ++ """ ++ if self.state == ProcessStates.STARTING: ++ if test_time < self.laststart: ++ self.laststart = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.startsecs): ++ self.delay = test_time + self.config.startsecs ++ elif self.state == ProcessStates.RUNNING: ++ if test_time > self.laststart and test_time < (self.laststart + self.config.startsecs): ++ self.laststart = test_time - self.config.startsecs ++ elif self.state == ProcessStates.STOPPING: ++ if test_time < self.laststopreport: ++ self.laststopreport = test_time; ++ if self.delay > 0 and test_time < (self.delay - self.config.stopwaitsecs): ++ self.delay = test_time + self.config.stopwaitsecs ++ elif self.state == ProcessStates.BACKOFF: ++ if self.delay > 0 and test_time < (self.delay - self.backoff): ++ self.delay = test_time + self.backoff ++ + def stop(self): + """ Administrative stop """ + self.administrative_stop = True +@@ -357,6 +379,9 @@ class Subprocess: + """ Log a 'waiting for x to stop' message with throttling. """ + if self.state == ProcessStates.STOPPING: + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + if now > (self.laststopreport + 2): # every 2 seconds + self.config.options.logger.info( + 'waiting for %s to stop' % self.config.name) +@@ -487,6 +512,9 @@ class Subprocess: + es, msg = decode_wait_status(sts) + + now = time.time() ++ ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + self.laststop = now + processname = self.config.name + +@@ -586,6 +614,8 @@ class Subprocess: + now = time.time() + state = self.state + ++ self._check_and_adjust_for_system_clock_rollback(now) ++ + logger = self.config.options.logger + + if self.config.options.mood > SupervisorStates.RESTARTING: +@@ -805,6 +835,12 @@ class EventListenerPool(ProcessGroupBase): + if dispatch_capable: + if self.dispatch_throttle: + now = time.time() ++ ++ if now < self.last_dispatch: ++ # The system clock appears to have moved backward ++ # Reset self.last_dispatch accordingly ++ self.last_dispatch = now; ++ + if now - self.last_dispatch < self.dispatch_throttle: + return + self.dispatch() diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py -index 7f9bab2..ea16315 100644 +index 7f9bab2..6808f60 100644 --- a/supervisor/tests/test_process.py +++ b/supervisor/tests/test_process.py @@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): @@ -53,7 +129,51 @@ index 7f9bab2..ea16315 100644 def test_give_up(self): options = DummyOptions() config = DummyPConfig(options, 'test', '/test') -@@ -1402,6 +1436,92 @@ class SubprocessTests(unittest.TestCase): +@@ -1105,6 +1139,43 @@ class SubprocessTests(unittest.TestCase): + self.assertEqual(event.__class__, events.ProcessStateBackoffEvent) + self.assertEqual(event.from_state, ProcessStates.STARTING) + ++ # This tests the case where the process has stayed alive longer than ++ # startsecs (i.e., long enough to enter the RUNNING state), however the ++ # system clock has since rolled backward such that the current time is ++ # greater than laststart but less than startsecs. ++ def test_finish_running_state_exited_too_quickly_due_to_clock_rollback(self): ++ options = DummyOptions() ++ config = DummyPConfig(options, 'notthere', '/notthere', ++ stdout_logfile='/tmp/foo', startsecs=10) ++ instance = self._makeOne(config) ++ instance.config.options.pidhistory[123] = instance ++ pipes = {'stdout':'','stderr':''} ++ instance.pipes = pipes ++ instance.config.exitcodes =[-1] ++ instance.laststart = time.time() ++ from supervisor.states import ProcessStates ++ from supervisor import events ++ instance.state = ProcessStates.RUNNING ++ L = [] ++ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) ++ instance.pid = 123 ++ instance.finish(123, 1) ++ self.assertFalse(instance.killing) ++ self.assertEqual(instance.pid, 0) ++ self.assertEqual(options.parent_pipes_closed, pipes) ++ self.assertEqual(instance.pipes, {}) ++ self.assertEqual(instance.dispatchers, {}) ++ self.assertEqual(options.logger.data[0], ++ 'exited: notthere (terminated by SIGHUP; expected)') ++ self.assertEqual(instance.exitstatus, -1) ++ self.assertEqual(len(L), 1) ++ event = L[0] ++ self.assertEqual(event.__class__, ++ events.ProcessStateExitedEvent) ++ self.assertEqual(event.expected, True) ++ self.assertEqual(event.extra_values, [('expected', True), ('pid', 123)]) ++ self.assertEqual(event.from_state, ProcessStates.RUNNING) ++ + def test_finish_running_state_laststart_in_future(self): + options = DummyOptions() + config = DummyPConfig(options, 'notthere', '/notthere', +@@ -1402,6 +1473,92 @@ class SubprocessTests(unittest.TestCase): event = L[0] self.assertEqual(event.__class__, events.ProcessStateRunningEvent) @@ -146,7 +266,7 @@ index 7f9bab2..ea16315 100644 def test_transition_backoff_to_fatal(self): from supervisor import events L = [] -@@ -2033,6 +2153,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): +@@ -2033,6 +2190,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): self.assertEqual(process1.listener_state, EventListenerStates.BUSY) self.assertEqual(process1.event, event) @@ -180,5 +300,5 @@ index 7f9bab2..ea16315 100644 options = DummyOptions() from supervisor.states import ProcessStates -- -2.1.4 +2.17.1 diff --git a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch deleted file mode 100644 index c0263e9baf10..000000000000 --- a/src/supervisor/patch/0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch +++ /dev/null @@ -1,83 +0,0 @@ -From bac496af4c2051b3c15038e06533f9094b1c3604 Mon Sep 17 00:00:00 2001 -From: Joe LeVeque -Date: Tue, 16 Jan 2018 20:42:13 +0000 -Subject: [PATCH 1/2] Prevent excessive hanging/delays in process state - transitions if the system time rolls backward - ---- - supervisor/process.py | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/supervisor/process.py b/supervisor/process.py -index f9ddcd9..216372f 100644 ---- a/supervisor/process.py -+++ b/supervisor/process.py -@@ -357,6 +357,12 @@ class Subprocess: - """ Log a 'waiting for x to stop' message with throttling. """ - if self.state == ProcessStates.STOPPING: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.laststopreport to current system time -+ if now < self.laststopreport: -+ self.laststopreport = now; -+ - if now > (self.laststopreport + 2): # every 2 seconds - self.config.options.logger.info( - 'waiting for %s to stop' % self.config.name) -@@ -604,12 +610,27 @@ class Subprocess: - # STOPPED -> STARTING - self.spawn() - elif state == ProcessStates.BACKOFF: -+ if self.delay > 0 and now < self.delay - self.backoff: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.backoff -+ - if self.backoff <= self.config.startretries: - if now > self.delay: - # BACKOFF -> STARTING - self.spawn() - - if state == ProcessStates.STARTING: -+ if now < self.laststart: -+ # The system clock appears to have moved backward -+ # Reset self.laststart to current system time -+ self.laststart = now; -+ -+ if self.delay > 0 and now < self.delay - self.config.startsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.startsecs -+ - if now - self.laststart > self.config.startsecs: - # STARTING -> RUNNING if the proc has started - # successfully and it has stayed up for at least -@@ -633,6 +654,11 @@ class Subprocess: - logger.info('gave up: %s %s' % (self.config.name, msg)) - - elif state == ProcessStates.STOPPING: -+ if self.delay > 0 and now < self.delay - self.config.stopwaitsecs: -+ # The system clock appears to have moved backward -+ # Reset self.delay accordingly -+ self.delay = now + self.config.stopwaitsecs -+ - time_left = self.delay - now - if time_left <= 0: - # kill processes which are taking too long to stop with a final -@@ -805,6 +831,12 @@ class EventListenerPool(ProcessGroupBase): - if dispatch_capable: - if self.dispatch_throttle: - now = time.time() -+ -+ # If the system clock has moved backward, reset -+ # self.last_dispatch to current system time -+ if now < self.last_dispatch: -+ self.last_dispatch = now; -+ - if now - self.last_dispatch < self.dispatch_throttle: - return - self.dispatch() --- -2.1.4 - diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series index d141fddf3301..9d87dccfa780 100644 --- a/src/supervisor/patch/series +++ b/src/supervisor/patch/series @@ -1,2 +1,2 @@ -0001-Prevent-excessive-hanging-delays-in-process-state-tr.patch -0002-Add-unit-test-cases-to-ensure-state-transitions-work.patch +# This series applies on GIT commit 34b690aea8cf7572d73765c95c54a83261d69aad +0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch From e5b8302feec071d74a2495d706d0cc77e0dba25f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 4 Mar 2019 11:46:48 -0800 Subject: [PATCH 019/219] Set a rate limit on syslog messages from all Docker containers (#2573) Rate limiting at 20,000 messages per 5-minute interval --- dockers/docker-base/etc/rsyslog.conf | 7 +++++++ platform/p4/docker-sonic-p4/rsyslog.conf | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/dockers/docker-base/etc/rsyslog.conf b/dockers/docker-base/etc/rsyslog.conf index cf5509a3e8b3..1af66c6e61c0 100644 --- a/dockers/docker-base/etc/rsyslog.conf +++ b/dockers/docker-base/etc/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability diff --git a/platform/p4/docker-sonic-p4/rsyslog.conf b/platform/p4/docker-sonic-p4/rsyslog.conf index 79926a8b30c7..27e046257e18 100644 --- a/platform/p4/docker-sonic-p4/rsyslog.conf +++ b/platform/p4/docker-sonic-p4/rsyslog.conf @@ -14,6 +14,13 @@ ################# $ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + #$ModLoad imklog # provides kernel logging support #$ModLoad immark # provides --MARK-- message capability From deab95cff6543aa77a6e2aa8f538e96e32cd3d11 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 4 Mar 2019 16:46:55 -0800 Subject: [PATCH 020/219] [swss/syncd] cold start syncd service in swss in attach method (#2639) start() is called by service startPre method, which is blocking. Starting syncd service here is causing deadlock. attach() is called by service start method, which is non-blocking. Signed-off-by: Ying Xie --- files/scripts/swss.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index cdd2de332e38..107a2e81b4b2 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -78,6 +78,14 @@ function clean_up_tables() end" 0 } +startPeerService() { + check_warm_boot + + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl start ${PEER} + fi +} + start() { debug "Starting ${SERVICE} service..." @@ -105,13 +113,10 @@ start() { # Unlock has to happen before reaching out to peer service unlock_service_state_change - - if [[ x"$WARM_BOOT" != x"true" ]]; then - /bin/systemctl start ${PEER} - fi } attach() { + startPeerService /usr/bin/${SERVICE}.sh attach } From 0b13c457744e9ea66f9fdc63b2f5a8348dea223f Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Tue, 5 Mar 2019 22:06:00 +0000 Subject: [PATCH 021/219] Add hook to allow customizing link cable lengths Signed-off-by: Wenda Ni --- files/build_templates/buffers_config.j2 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 9a26a8b1492c..4ee777a352e2 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -29,12 +29,16 @@ def {# Port configuration to cable length look-up table #} {# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} {# Roles described in the minigraph #} -{%- set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } --%} +{%- if defs.ports2cable is defined %} + {%- set ports2cable = defs.ports2cable %} +{%- else %} + {%- set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } + -%} +{%- endif %} {%- macro cable_length(port_name) %} {%- set cable_len = [] %} From 4f3a5e863dd5b85ac0afe72dbb9d587d77d729a8 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 7 Mar 2019 03:34:18 +0000 Subject: [PATCH 022/219] [devices]: sfputil support more mellanox sku (#2645) --- device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index e4f9f05d41ff..531e06f13205 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -22,7 +22,7 @@ # magic code defnition for port number, qsfp port position of each hwsku # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, } +hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1),(0, 18, 21, 22, 1)] class SfpUtil(SfpUtilBase): From 898a5ac609fd9d85da2a2873f750f095a64612a7 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 7 Mar 2019 08:54:53 -0800 Subject: [PATCH 023/219] [201811 sub module] update swss, swss-common sub modules (#2652) Submodule src/sonic-swss 4b489ce..90eb25d: > [portsorch] fix bug in speed set (#806) Submodule src/sonic-swss-common 2592b0c..c674e64: > Add multiple fields hdel support (#267) > Update PFC_WD table name in CONFIG_DB (#266) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 4b489cee5b05..90eb25d74fb7 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 4b489cee5b055818cb51055b9591204f448aae06 +Subproject commit 90eb25d74fb7bd8693d0a6227442d50bde6bc618 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2592b0c98bb4..c674e6495f19 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2592b0c98bb47742646c7eea55ea38221330741c +Subproject commit c674e6495f19fa8cf80a2b23069d02bdc1b0cead From 8a602c67f9ab18a714ddc9e12c146297b05487ac Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Sun, 3 Mar 2019 01:48:28 +0200 Subject: [PATCH 024/219] [mellanox]: Remove MAC alignment WA for Mellanox platforms. (#2632) Signed-off-by: Nazarii Hnydyn --- src/sonic-config-engine/sonic_platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index 20890d765cab..370f6e3a42ee 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -56,7 +56,7 @@ def get_system_mac(): mac = mac.strip() # Align last byte of MAC if necessary - if version_info and (version_info['asic_type'] == 'mellanox' or version_info['asic_type'] == 'centec'): + if version_info and version_info['asic_type'] == 'centec': last_byte = mac[-2:] aligned_last_byte = format(int(int(last_byte, 16) & 0b11000000), '02x') mac = mac[:-2] + aligned_last_byte From 23aa759d7ad0b05ed7746812a0dd56a161fd72c3 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 7 Mar 2019 11:07:59 -0800 Subject: [PATCH 025/219] [201811 sub module] advance sairedis sub module (#2657) Submodule src/sonic-sairedis 54b02a1..8182916: > Add pre match to comparison logic and unittests (#423) > Drop FDB notifications if they contain invalid OIDs (#428) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 54b02a1acb39..818291652f85 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 54b02a1acb39b529c3fe24fcb6e24241bddf5824 +Subproject commit 818291652f85b8d799d47701df741d1054619304 From 6341b87d1b0580e6d520c44a5bebec9028b8743a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 8 Mar 2019 22:30:30 -0800 Subject: [PATCH 026/219] [sub module] remove changes not ready yet (#2662) PFC_WD table naming change is not ready to be included yet. Submodule src/sonic-swss-common c674e64..2592b0c (rewind): < Add multiple fields hdel support (#267) < Update PFC_WD table name in CONFIG_DB (#266) Signed-off-by: Ying Xie --- src/sonic-swss-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index c674e6495f19..2592b0c98bb4 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit c674e6495f19fa8cf80a2b23069d02bdc1b0cead +Subproject commit 2592b0c98bb47742646c7eea55ea38221330741c From 1ddf4b75c9a9724873d7e506b412847abcd6fee5 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Mon, 18 Mar 2019 17:52:32 +0200 Subject: [PATCH 027/219] revert 'Remove MAC alignment WA for Mellanox platforms.' (#2677) Signed-off-by: Mykola Faryma --- src/sonic-config-engine/sonic_platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_platform.py index 370f6e3a42ee..20890d765cab 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_platform.py @@ -56,7 +56,7 @@ def get_system_mac(): mac = mac.strip() # Align last byte of MAC if necessary - if version_info and version_info['asic_type'] == 'centec': + if version_info and (version_info['asic_type'] == 'mellanox' or version_info['asic_type'] == 'centec'): last_byte = mac[-2:] aligned_last_byte = format(int(int(last_byte, 16) & 0b11000000), '02x') mac = mac[:-2] + aligned_last_byte From 4998609c2fdff19fe624d47df7ba842c50768fdd Mon Sep 17 00:00:00 2001 From: Nadiia Stetskovych Date: Tue, 5 Feb 2019 08:43:08 +0200 Subject: [PATCH 028/219] [minigraph]: Do not fail for minigraphs which do not have neighbors listed in section (#2522) Signed-off-by: Nadiya.Stetskovych --- files/build_templates/buffers_config.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 4ee777a352e2..88899e37680b 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -44,7 +44,7 @@ def {%- set cable_len = [] %} {%- for local_port in DEVICE_NEIGHBOR %} {%- if local_port == port_name %} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} {%- set neighbor_role = neighbor.type %} {%- set roles1 = switch_role + '_' + neighbor_role %} From f720c2a9a33bd7f70c4af80390eaf04d7e01950d Mon Sep 17 00:00:00 2001 From: Wenda Ni Date: Fri, 8 Mar 2019 02:23:32 -0800 Subject: [PATCH 029/219] [qos]: Map tc 1, 2, 5, and 6 back to pg 0 (#2650) Lossy traffic does not need to be mapped to different ingress PGs. They can all share the same ingress PG. Signed-off-by: Wenda Ni --- files/build_templates/buffers_config.j2 | 5 +---- files/build_templates/qos_config.j2 | 8 ++++---- .../tests/sample_output/buffers-dell6100.json | 5 +---- .../tests/sample_output/qos-dell6100.json | 8 ++++---- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 88899e37680b..2db9372340c4 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -131,10 +131,7 @@ def {{ defs.generate_pg_profils(port_names_active) }} {% else %} "BUFFER_PG": { - "{{ port_names_active }}|0-2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "{{ port_names_active }}|5-6": { + "{{ port_names_active }}|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 18d12d473941..a666367873bd 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -38,12 +38,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json index 269c155d68f3..0b6c8cbe19a3 100644 --- a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -105,10 +105,7 @@ } }, "BUFFER_PG": { - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0-2": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|5-6": { + "Ethernet0,Ethernet1,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet48,Ethernet52,Ethernet53,Ethernet54,Ethernet55,Ethernet56,Ethernet57,Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, diff --git a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json index d1eced032f0d..0387e10dc2f2 100644 --- a/src/sonic-config-engine/tests/sample_output/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/qos-dell6100.json @@ -2,12 +2,12 @@ "TC_TO_PRIORITY_GROUP_MAP": { "AZURE": { "0": "0", - "1": "1", - "2": "2", + "1": "0", + "2": "0", "3": "3", "4": "4", - "5": "5", - "6": "6", + "5": "0", + "6": "0", "7": "7" } }, From 638724f49f7f2b85de6c06cbec64f42c48ade134 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 8 Mar 2019 02:22:00 -0800 Subject: [PATCH 030/219] Update bcmcmd binary: fix crash issue when long line >= 1023 chars (#2659) Signed-off-by: Qi Luo --- platform/broadcom/rules.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index 85eb0df51870..b8fb9ff4ac96 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -22,10 +22,10 @@ include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/docker-ptf-brcm.mk BCMCMD = bcmcmd -$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/bcmcmd?sv=2015-04-05&sr=b&sig=OCW4mfmbQ6D0BH8nllpAWrS8XL9uczrw32w3XgL4jws%3D&se=2030-03-31T23%3A06%3A15Z&sp=r" +$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/bcmcmd?sv=2015-04-05&sr=b&sig=sUdbU7oVbh5exbXXHVL5TDFBTWDDBASHeJ8Cp0B0TIc%3D&se=2038-05-06T22%3A34%3A19Z&sp=r" DSSERVE = dsserve -$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/dsserve?sv=2015-04-05&sr=b&sig=gyNbgSL%2FvpMXDdpboVkIJcTKMRdGgEaOR9OukHhEsu8%3D&se=2030-03-31T23%3A06%3A35Z&sp=r" +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/dsserve?sv=2015-04-05&sr=b&sig=lk7BH3DtW%2F5ehc0Rkqfga%2BUCABI0UzQmDamBsZH9K6w%3D&se=2038-05-06T22%3A34%3A45Z&sp=r" SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE) From ecec5799336b612d058d1292fa890db5fe5ba76f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 8 Mar 2019 10:59:41 -0800 Subject: [PATCH 031/219] [services] Services which start containers now use 'docker wait' instead of 'docker attach' (#2661) --- files/build_templates/bgp.service.j2 | 2 +- files/build_templates/database.service.j2 | 2 +- files/build_templates/dhcp_relay.service.j2 | 2 +- files/build_templates/docker_image_ctl.j2 | 8 ++++---- files/build_templates/lldp.service.j2 | 2 +- files/build_templates/pmon.service.j2 | 2 +- files/build_templates/radv.service.j2 | 2 +- files/build_templates/snmp.service.j2 | 2 +- files/build_templates/swss.service.j2 | 2 +- files/build_templates/syncd.service.j2 | 2 +- files/build_templates/teamd.service.j2 | 2 +- files/build_templates/telemetry.service.j2 | 2 +- files/scripts/swss.sh | 8 ++++---- files/scripts/syncd.sh | 8 ++++---- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/files/build_templates/bgp.service.j2 b/files/build_templates/bgp.service.j2 index bc023b7d714d..7200a0e3ecf2 100644 --- a/files/build_templates/bgp.service.j2 +++ b/files/build_templates/bgp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/database.service.j2 b/files/build_templates/database.service.j2 index b248dfc7fecd..efa98b168beb 100644 --- a/files/build_templates/database.service.j2 +++ b/files/build_templates/database.service.j2 @@ -6,7 +6,7 @@ After=docker.service [Service] User=root ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index b4d9ceb38f0c..5a462e53973d 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index a3cbf5adbae7..ca25ac2b43e4 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -150,8 +150,8 @@ start() { postStartAction } -attach() { - docker attach --no-stdin {{docker_container_name}} +wait() { + docker wait {{docker_container_name}} } stop() { @@ -159,11 +159,11 @@ stop() { } case "$1" in - start|stop|attach) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|stop|attach}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/build_templates/lldp.service.j2 b/files/build_templates/lldp.service.j2 index d294a08900f4..c317e18efc5c 100644 --- a/files/build_templates/lldp.service.j2 +++ b/files/build_templates/lldp.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/pmon.service.j2 b/files/build_templates/pmon.service.j2 index de4e62df5e10..33f3173b4887 100644 --- a/files/build_templates/pmon.service.j2 +++ b/files/build_templates/pmon.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 065f01906076..8cda2fdd0afb 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{ docker_container_name }}.sh start -ExecStart=/usr/bin/{{ docker_container_name }}.sh attach +ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index f344f2e805ea..b00c2107702c 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -6,5 +6,5 @@ Before=ntp-config.service [Service] ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 36858b30b60a..abf57b7bc89f 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -14,7 +14,7 @@ Before=ntp-config.service User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/swss.sh start -ExecStart=/usr/local/bin/swss.sh attach +ExecStart=/usr/local/bin/swss.sh wait ExecStop=/usr/local/bin/swss.sh stop [Install] diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index ddb51232426b..0c61b3193877 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -20,7 +20,7 @@ Before=ntp-config.service User=root Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/syncd.sh start -ExecStart=/usr/local/bin/syncd.sh attach +ExecStart=/usr/local/bin/syncd.sh wait ExecStop=/usr/local/bin/syncd.sh stop [Install] diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 5cd36c6748b9..792b8247119f 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/build_templates/telemetry.service.j2 b/files/build_templates/telemetry.service.j2 index 132924b04193..d6f70a13206e 100644 --- a/files/build_templates/telemetry.service.j2 +++ b/files/build_templates/telemetry.service.j2 @@ -7,7 +7,7 @@ Before=ntp-config.service [Service] User={{ sonicadmin_user }} ExecStartPre=/usr/bin/{{docker_container_name}}.sh start -ExecStart=/usr/bin/{{docker_container_name}}.sh attach +ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 107a2e81b4b2..780051def9e6 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -115,9 +115,9 @@ start() { unlock_service_state_change } -attach() { +wait() { startPeerService - /usr/bin/${SERVICE}.sh attach + /usr/bin/${SERVICE}.sh wait } stop() { @@ -142,11 +142,11 @@ stop() { } case "$1" in - start|attach|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|attach|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 7e5ce780e072..0a2b9aefd0df 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -119,8 +119,8 @@ start() { unlock_service_state_change } -attach() { - /usr/bin/${SERVICE}.sh attach +wait() { + /usr/bin/${SERVICE}.sh wait } stop() { @@ -168,11 +168,11 @@ stop() { } case "$1" in - start|attach|stop) + start|wait|stop) $1 ;; *) - echo "Usage: $0 {start|attach|stop}" + echo "Usage: $0 {start|wait|stop}" exit 1 ;; esac From ba5accda3275b0813ebbb84b6d657ed61a1476cb Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 18 Mar 2019 17:53:35 +0200 Subject: [PATCH 032/219] [mellanox] Fix in mlnx-ffb.sh (#2676) Fixes "No ISSU version file found /etc/mlnx/issu-version" when rebooting to different image; Add aditional check condition. Signed-off-by: Stepan Blyschak --- platform/mellanox/mlnx-ffb.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-ffb.sh b/platform/mellanox/mlnx-ffb.sh index 72187b94f858..1488bb2c6b97 100755 --- a/platform/mellanox/mlnx-ffb.sh +++ b/platform/mellanox/mlnx-ffb.sh @@ -42,11 +42,16 @@ check_sdk_upgrade() ISSU_VERSION_FILE_PATH="/etc/mlnx/issu-version" - [ -f "${SDK_VERSION_FILE_PATH}" ] || { + [ -f "${ISSU_VERSION_FILE_PATH}" ] || { >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH}" break } + [ -f "${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH}" ] || { + >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH} in ${NEXT_SONIC_IMAGE}" + break + } + CURRENT_ISSU_VERSION="$(cat ${ISSU_VERSION_FILE_PATH})" NEXT_ISSU_VERSION="$(cat ${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH})" From bbfe094ecb8209f6a4cc35d8fa11a7a3218f12e1 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 19 Mar 2019 03:10:56 +0000 Subject: [PATCH 033/219] [docker] Update docker package version for CVE-2019-5736 fix (#2663) --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 6bac523b5d4e..c9fc5313c664 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -29,7 +29,7 @@ set -x -e ## docker engine version (with platform) -DOCKER_VERSION=5:18.09.0~3-0~debian-stretch +DOCKER_VERSION=5:18.09.2~3-0~debian-stretch LINUX_KERNEL_VERSION=4.9.0-8 ## Working directory to prepare the file system From 4c61c0e958cfbf32360dd7d5f3b9ad8dbac96dfc Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 19 Mar 2019 08:44:33 -0700 Subject: [PATCH 034/219] [201811 sub-module] advance sub-modules: utilities, swss, swss-common (#2679) Submodule src/sonic-utilities f95da07..2fe01fe: > neighbor advertiser script (#469) > [aclshow] restore PRIO column and sort entries by priority (#476) > Update watermark default polling interval to 10s (#470) > show interface status throws error (fixes #427) (#440) Submodule src/sonic-swss 90eb25d..91171b6: > fix a unstable swss egress acl test (#776) > [aclorch] Remove L4 port range support limitation on egress ACL table and add new SWSS virtual test. (#741) > Fix orchagent SEGV when PortConfigDone not set (#803) Submodule src/sonic-swss-common 2592b0c..5f4abd9: > Force only supported commands on consumer table (#261) > Add multiple fields hdel support (#267) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 90eb25d74fb7..91171b687ece 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 90eb25d74fb7bd8693d0a6227442d50bde6bc618 +Subproject commit 91171b687ece0cbacb38d6065a6045613b1bf537 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2592b0c98bb4..5f4abd9f579d 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2592b0c98bb47742646c7eea55ea38221330741c +Subproject commit 5f4abd9f579d5a7b26225d67a74f2740c5c05e53 diff --git a/src/sonic-utilities b/src/sonic-utilities index f95da07de0cc..2fe01fe5bb0d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f95da07de0ccd38cf71e1ffe57124b70a5bcfa72 +Subproject commit 2fe01fe5bb0d2b44a1e5b4f0b30df931c71a52a8 From 21ea29a23f1f1b4a3ce294e6cbdaee4388047231 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 21 Mar 2019 19:42:13 +0200 Subject: [PATCH 035/219] [Mellanox] Update SAI (#2686) New SAI fixes getting of queue buffer profile Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index f969719b8458..d5f242728d3b 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.13.4-master -MLNX_SAI_REVISION = f3e389f1ba9535fdd6afb134897683b65d1ad4e7 +MLNX_SAI_REVISION = 783d040465fb31771bcb9ec3d655d053e88b1bf0 export MLNX_SAI_VERSION MLNX_SAI_REVISION From d80ea027829d8fd7b4e135c0bfe888e9dc6c413a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 22 Mar 2019 15:52:34 +0000 Subject: [PATCH 036/219] [sonic-py-swsssdk] Update submodule (#2660) --- src/sonic-py-swsssdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index cb4fec9d078f..4cee38534919 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit cb4fec9d078f72ca378ecba5e6a112e3028c2221 +Subproject commit 4cee38534919e34f407363ac3ab5f31b4d09be6d From ed8e29cb6f9184d2adf1e5c2a539bab4642f9b58 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Wed, 20 Mar 2019 02:43:25 +0800 Subject: [PATCH 037/219] [Mellanox] fix sfp lpmode set failure caused by extra nv port (#2671) * fix lpmode set failure issue by skipping nvport --- .../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py index 9713873ed264..c11675766d3f 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py @@ -18,7 +18,15 @@ PMAOS_ENABLE = 1 PMAOS_DISABLE = 2 -def get_port_admin_status_by_log_port(log_port): +PORT_TYPE_NVE = 8 +PORT_TYPE_OFFSET = 28 +PORT_TYPE_MASK = 0xF0000000 +NVE_MASK = PORT_TYPE_MASK & (PORT_TYPE_NVE << PORT_TYPE_OFFSET) + +def is_nve(port): + return (port & NVE_MASK) != 0 + +def is_port_admin_status_up(log_port): oper_state_p = new_sx_port_oper_state_t_p() admin_state_p = new_sx_port_admin_state_t_p() module_state_p = new_sx_port_module_state_t_p() @@ -48,9 +56,10 @@ def get_log_ports(handle, sfp_module): log_port_list = [] for i in range(0, port_cnt): port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list, i) - if port_attributes.port_mapping.module_port == sfp_module: - if get_port_admin_status_by_log_port(port_attributes.log_port): - log_port_list.append(port_attributes.log_port) + if is_nve(int(port_attributes.log_port)) == False \ + and port_attributes.port_mapping.module_port == sfp_module \ + and is_port_admin_status_up(port_attributes.log_port): + log_port_list.append(port_attributes.log_port) return log_port_list From f29e6230e529663ef212c83da1b48cff7e0f0bb7 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 19 Mar 2019 20:14:07 -0700 Subject: [PATCH 038/219] [docker script] skip docker mount point checking for database container (#2683) database container doesn't mount hwsku folder. Signed-off-by: Ying Xie --- files/build_templates/docker_image_ctl.j2 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index ca25ac2b43e4..92c3f69c8a8d 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -103,9 +103,17 @@ start() { DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null` if [ "$?" -eq "0" ]; then + {%- if docker_container_name == "database" %} + DOCKERMOUNT="" + {%- else %} DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"` - if [ "$DOCKERMOUNT" == "$HWSKU" ]; then + {%- endif %} + if [ x"$DOCKERMOUNT" == x"$HWSKU" ]; then + {%- if docker_container_name == "database" %} + echo "Starting existing {{docker_container_name}} container" + {%- else %} echo "Starting existing {{docker_container_name}} container with HWSKU $HWSKU" + {%- endif %} preStartAction docker start {{docker_container_name}} postStartAction From 00081c5f6175e95287008e32afa93edb118f309c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 21 Mar 2019 18:11:57 -0700 Subject: [PATCH 039/219] [make file] managing teamd patches with stg (#2689) Just so that the folder will be clean and make working on new patches much easier. Signed-off-by: Ying Xie --- src/libteam/Makefile | 12 ++++-------- src/libteam/series | 6 ++++++ 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 src/libteam/series diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 5dfa757f094d..256680d34943 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -12,15 +12,11 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./libteam git clone https://github.com/jpirko/libteam.git pushd ./libteam - git checkout -f v1.26 + git checkout -b teamd -f v1.26 - # Apply patch - git apply ../0001-libteam-Add-team_get_port_enabled-function.patch - git apply ../0002-libteam-Temporarily-remove-redundant-debug-mes.patch - git apply ../0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch - git apply ../0004-libteam-Add-lacp-fallback-support-for-single-member-.patch - git apply ../0005-libteam-Add-warm_reboot-mode.patch - git apply ../0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch + # Apply patch series + stg init + stg import -s ../series popd # Obtain debian packaging diff --git a/src/libteam/series b/src/libteam/series new file mode 100644 index 000000000000..af8cc1b440c6 --- /dev/null +++ b/src/libteam/series @@ -0,0 +1,6 @@ +0001-libteam-Add-team_get_port_enabled-function.patch +0002-libteam-Temporarily-remove-redundant-debug-mes.patch +0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +0004-libteam-Add-lacp-fallback-support-for-single-member-.patch +0005-libteam-Add-warm_reboot-mode.patch +0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch From 14e3c60ae4810892c75726bbe3629c76ddab17f5 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 22 Mar 2019 13:58:53 -0700 Subject: [PATCH 040/219] [201811 sub module] advance utilitie sub module (#2695) Submodule src/sonic-utilities 2fe01fe..9d9aaa0: > [warm/fast reboot] setup control plane assistant when available (#487) > [reboot script] add -h, -? options (#484) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 2fe01fe5bb0d..9d9aaa00acbf 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 2fe01fe5bb0d2b44a1e5b4f0b30df931c71a52a8 +Subproject commit 9d9aaa00acbf4c0341969ee54aa2e84ff45d947d From 5043e229eb6ee55e808ad8975d1ef5c8a94a7178 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 26 Mar 2019 23:46:39 -0700 Subject: [PATCH 041/219] [jessie based docker] remove dependency on some retired jessie repos (#2707) * [jessie repo] remove one dependency on jessie-backport repo Signed-off-by: Ying Xie * [build] remove dependency on retried jessie-backports repo The downloaded Jessie docker image still reference jessie-updates. Removing it from the list. Signed-off-by: Ying Xie * fix typo * move chunk * [docker-ptf] avoid using retired Jessie repos Signed-off-by: Ying Xie --- dockers/docker-base/Dockerfile.j2 | 8 ++++---- dockers/docker-base/sources.list | 1 - dockers/docker-ptf/Dockerfile.j2 | 3 +++ sonic-slave/Dockerfile | 6 ++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 2aef59241b13..c622e6a59843 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM debian:jessie +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + # Clean documentation in FROM image RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true @@ -28,12 +31,9 @@ RUN apt-get -y install \ vim-tiny \ perl \ python \ + rsyslog \ less -# Install a newer version of rsyslog from jessie-backports in hopes of -# eliminating memory leaks -RUN apt-get -y -t jessie-backports install rsyslog - COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list index 7121d6fd8c2d..2ed195cff416 100644 --- a/dockers/docker-base/sources.list +++ b/dockers/docker-base/sources.list @@ -5,4 +5,3 @@ deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-fre deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free -deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index 2d9b1544d95a..7512627e9923 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -2,6 +2,9 @@ FROM debian:jessie MAINTAINER Pavel Shirshov +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + ## Copy dependencies COPY \ {% for deb in docker_ptf_debs.split(' ') -%} diff --git a/sonic-slave/Dockerfile b/sonic-slave/Dockerfile index dc37d7947a1f..368f1bdfe3b1 100644 --- a/sonic-slave/Dockerfile +++ b/sonic-slave/Dockerfile @@ -2,11 +2,13 @@ FROM debian:jessie MAINTAINER johnar@microsoft.com +## Remove retired jessie-updates repo +RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list + RUN echo "deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list && \ echo "deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb http://debian-archive.trafficmanager.net/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list + echo "deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive From dc2317a6971cd8891a5ac96198b4ea1dbf5ec411 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Sat, 23 Mar 2019 12:20:22 -0700 Subject: [PATCH 042/219] =?UTF-8?q?[libteam]:=20Skip=20setting=20the=20sam?= =?UTF-8?q?e=20hwaddr=20to=20lag=20port=20to=20avoid=20disrupting=20neighb?= =?UTF-8?q?or=E2=80=A6=20(#2602)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Skip setting the same hwaddr to lag port to avoid disrupting neighbor entries Signed-off-by: Jipan Yang --- ...-same-hwaddr-to-lag-port-to-avoid-di.patch | 36 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 37 insertions(+) create mode 100644 src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch new file mode 100644 index 000000000000..8a59756bb02b --- /dev/null +++ b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -0,0 +1,36 @@ +From 43e512b114176feb1828ff0a75f0224f2b219a2d Mon Sep 17 00:00:00 2001 +From: Jipan Yang +Date: Sun, 24 Feb 2019 00:04:15 -0800 +Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting + neighbor entries + +Signed-off-by: Jipan Yang +--- + teamd/teamd.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index 225b8c8..e28aa7d 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -866,7 +866,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) + err = -EINVAL; + goto free_hwaddr; + } +- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ ++ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) ++ { ++ err = 0; ++ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); ++ } ++ else ++ { ++ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ } + if (!err) + ctx->hwaddr_explicit = true; + free_hwaddr: +-- +2.9.2 + diff --git a/src/libteam/series b/src/libteam/series index af8cc1b440c6..8ac5ac8085e7 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -4,3 +4,4 @@ 0004-libteam-Add-lacp-fallback-support-for-single-member-.patch 0005-libteam-Add-warm_reboot-mode.patch 0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch +0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch From 378fa08da6dfae02e2b075cd84c03c3a8121a44b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 28 Mar 2019 09:57:06 -0700 Subject: [PATCH 043/219] [teamd] retry creating team_port after interface info changed (#2699) Race condition has been noticed after warm reboot: sometimes when port_changed notification was received, the link message didn't have the device name. Without device name, creating team port would fail. Registering to the interface information change notification, so later when device name becomes available, retry creating team port. Signed-off-by: Ying Xie --- ...hange-handler-for-TEAM_IFINFO_CHANGE.patch | 34 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 35 insertions(+) create mode 100644 src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch diff --git a/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch new file mode 100644 index 000000000000..a603f91f62fe --- /dev/null +++ b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch @@ -0,0 +1,34 @@ +From 7dff9798c2c92eb75b0120737efb81febcdb80c1 Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Sun, 24 Mar 2019 21:49:59 +0000 +Subject: [PATCH] [teamd] register change handler for TEAM_IFINFO_CHANGE as + well + +There has been a race condition in the libnal/teamd interation, causing +TEAM_PORT_CHANGE to report a port with empty device name. Which then +causes the teamd unable to add the lag members into the lag. + +Registering to the TEAM_IFINFO_CHANGE would give teamd another chance to +add member again. + +Signed-off-by: Ying Xie +--- + teamd/teamd_per_port.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 09d1dc7..137da57 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -274,7 +274,7 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + + static const struct team_change_handler port_priv_change_handler = { + .func = port_priv_change_handler_func, +- .type_mask = TEAM_PORT_CHANGE, ++ .type_mask = TEAM_PORT_CHANGE | TEAM_IFINFO_CHANGE, + }; + + int teamd_per_port_init(struct teamd_context *ctx) +-- +2.7.4 + diff --git a/src/libteam/series b/src/libteam/series index 8ac5ac8085e7..51b43ca14885 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -5,3 +5,4 @@ 0005-libteam-Add-warm_reboot-mode.patch 0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch From e985372108589f3fb2f71235158308be42a9b1d2 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Thu, 28 Mar 2019 03:36:52 +0200 Subject: [PATCH 044/219] [devices]: Add support of HwSKU Mellanox-SN2700-C28D8 (#2700) Signed-off-by: Andriy Moroz --- .../Mellanox-SN2700-C28D8/buffers.json.j2 | 1 + .../buffers_defaults_t0.j2 | 1 + .../buffers_defaults_t1.j2 | 1 + .../pg_profile_lookup.ini | 1 + .../Mellanox-SN2700-C28D8/port_config.ini | 37 +++ .../Mellanox-SN2700-C28D8/qos.json.j2 | 1 + .../Mellanox-SN2700-C28D8/sai.profile | 1 + .../sai_2700_8x50g_28x100g.xml | 250 ++++++++++++++++++ 8 files changed, 293 insertions(+) create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini create mode 120000 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile create mode 100644 device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 new file mode 120000 index 000000000000..30c4e1d5bfdd --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..a722094938f8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..b02d5e0194ac --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini new file mode 120000 index 000000000000..229a556f88a8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/pg_profile_lookup.ini @@ -0,0 +1 @@ +../ACS-MSN2700/pg_profile_lookup.ini \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini new file mode 100644 index 000000000000..345e6a206731 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini @@ -0,0 +1,37 @@ +# name lanes speed alias index +Ethernet0 0,1,2,3 100000 etp1 1 +Ethernet4 4,5,6,7 100000 etp2 2 +Ethernet8 8,9,10,11 100000 etp3 3 +Ethernet12 12,13,14,15 100000 etp4 4 +Ethernet16 16,17,18,19 100000 etp5 5 +Ethernet20 20,21,22,23 100000 etp6 6 +Ethernet24 24,25,26,27 100000 etp7 7 +Ethernet28 28,29,30,31 100000 etp8 8 +Ethernet32 32,33,34,35 100000 etp9 9 +Ethernet36 36,37,38,39 100000 etp10 10 +Ethernet40 40,41,42,43 100000 etp11 11 +Ethernet44 44,45,46,47 100000 etp12 12 +Ethernet48 48,49,50,51 100000 etp13 13 +Ethernet52 52,53,54,55 100000 etp14 14 +Ethernet56 56,57,58,59 100000 etp15 15 +Ethernet60 60,61,62,63 100000 etp16 16 +Ethernet64 64,65,66,67 100000 etp17 17 +Ethernet68 68,69,70,71 100000 etp18 18 +Ethernet72 72,73,74,75 100000 etp19 19 +Ethernet76 76,77,78,79 100000 etp20 20 +Ethernet80 80,81,82,83 100000 etp21 21 +Ethernet84 84,85,86,87 100000 etp22 22 +Ethernet88 88,89,90,91 100000 etp23 23 +Ethernet92 92,93,94,95 100000 etp24 24 +Ethernet96 96,97,98,99 100000 etp25 25 +Ethernet100 100,101,102,103 100000 etp26 26 +Ethernet104 104,105,106,107 100000 etp27 27 +Ethernet108 108,109,110,111 100000 etp28 28 +Ethernet112 112,113 50000 etp29a 29 +Ethernet114 114,115 50000 etp29b 29 +Ethernet116 116,117 50000 etp30a 30 +Ethernet118 118,119 50000 etp30b 30 +Ethernet120 120,121 50000 etp31a 31 +Ethernet122 122,123 50000 etp31b 31 +Ethernet124 124,125 50000 etp32a 32 +Ethernet126 126,127 50000 etp32b 32 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 new file mode 120000 index 000000000000..8bd2d26567b8 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/qos.json.j2 @@ -0,0 +1 @@ +../ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile new file mode 100644 index 000000000000..cfeb4a5fa4ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_8x50g_28x100g.xml diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml new file mode 100644 index 000000000000..ee20db3e5dde --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml @@ -0,0 +1,250 @@ + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 11534336 + + + 3 + 4 + 17 + 1 + 11534336 + + + 5 + 4 + 18 + 3 + 11534336 + + + 7 + 4 + 19 + 1 + 11534336 + + + 9 + 4 + 20 + 3 + 11534336 + + + 11 + 4 + 21 + 1 + 11534336 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 4 + 26 + 3 + 11534336 + + + 23 + 4 + 27 + 1 + 11534336 + + + 25 + 4 + 28 + 3 + 3221225472 + 2 + + + 27 + 4 + 29 + 1 + 3221225472 + 2 + + + 29 + 4 + 30 + 3 + 3221225472 + 2 + + + 31 + 4 + 31 + 1 + 3221225472 + 2 + + + 33 + 4 + 14 + 3 + 11534336 + + + 35 + 4 + 15 + 1 + 11534336 + + + 37 + 4 + 12 + 3 + 11534336 + + + 39 + 4 + 13 + 1 + 11534336 + + + 41 + 4 + 10 + 3 + 11534336 + + + 43 + 4 + 11 + 1 + 11534336 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 4 + 6 + 3 + 11534336 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 4 + 4 + 3 + 11534336 + + + 55 + 4 + 5 + 1 + 11534336 + + + 57 + 4 + 2 + 3 + 11534336 + + + 59 + 4 + 3 + 1 + 11534336 + + + 61 + 4 + 0 + 3 + 11534336 + + + 63 + 4 + 1 + 1 + 11534336 + + + + From 3d8d4aeef096e400116d8a65b1812ab1c559a4f5 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 29 Mar 2019 15:27:33 -0700 Subject: [PATCH 045/219] [security] Do not generate ssh server keys for non RSA protocols (#2718) --- files/sshd/host-ssh-keygen.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/files/sshd/host-ssh-keygen.sh b/files/sshd/host-ssh-keygen.sh index ade24e6383de..d4ea5bd431c1 100755 --- a/files/sshd/host-ssh-keygen.sh +++ b/files/sshd/host-ssh-keygen.sh @@ -1,10 +1,8 @@ #!/bin/bash +set -e + [ -r /etc/ssh/ssh_host_rsa_key ] || { rm -f /etc/ssh/ssh_host_*_key* /usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key - /usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key - /usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key - /usr/bin/ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key - /usr/bin/ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key } From 1b07437205a9cf75eea200559324dbb98baa206b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sat, 30 Mar 2019 17:18:57 -0700 Subject: [PATCH 046/219] [201811][snmpagent][swss-common] advance sub module head to include overlay SNMP (#2721) * [snmpagent][swss-common] advance sub module head to include overlay SNMP Submodule src/sonic-snmpagent 0f2bbd7..26f0495: > Remove verbose feature missing logs (#102) > Enable overriding interface counters OIDs (#98) Submodule src/sonic-swss-common 5f4abd9..36fd5e9: > Add new DB index for SNMP_OVERLAY_DB (#262) Note: overlay DB also requires change in swss-common, which has been moved ahead. Signed-off-by: Ying Xie * [utilities] advance utilities sub-module head Submodule src/sonic-utilities 9d9aaa0..d1070b2: > [warm-reboot] initialize warm reboot state table before warm rebooting (#492) > Allow config shutdown and startup operations on valid PortChannel interface names (#474) --- src/sonic-snmpagent | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 0f2bbd772704..26f04959a205 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 0f2bbd77270404e829815f95bf20b7d29af67930 +Subproject commit 26f04959a205d6493da8e3f989ae3803338aa2d7 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 5f4abd9f579d..36fd5e957959 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 5f4abd9f579d5a7b26225d67a74f2740c5c05e53 +Subproject commit 36fd5e9579593b2e64126dc61b045bbb9f9dab3f diff --git a/src/sonic-utilities b/src/sonic-utilities index 9d9aaa00acbf..d1070b23ed90 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9d9aaa00acbf4c0341969ee54aa2e84ff45d947d +Subproject commit d1070b23ed9016646172bf8436a8159564132534 From 681e34a2b19e644d150549d8dd919f590783f83a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Apr 2019 14:16:31 -0700 Subject: [PATCH 047/219] [service] add warmboot finializer service (#2725) After warm reboot is done, we need to disable warm reboot flag and tear down anything setup for warm reboot and persisted across. Signed-off-by: Ying Xie --- .../build_templates/sonic_debian_extension.j2 | 5 + .../warmboot-finalizer/finalize-warmboot.sh | 96 +++++++++++++++++++ .../warmboot-finalizer.service | 11 +++ 3 files changed, 112 insertions(+) create mode 100755 files/image_config/warmboot-finalizer/finalize-warmboot.sh create mode 100644 files/image_config/warmboot-finalizer/warmboot-finalizer.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 4ef014a30e4b..0eeba7bad965 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -144,6 +144,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +# Copy warmboot-finalizer files +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/finalize-warmboot.sh $FILESYSTEM_ROOT/usr/local/bin/finalize-warmboot.sh +sudo LANG=C cp $IMAGE_CONFIGS/warmboot-finalizer/warmboot-finalizer.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable warmboot-finalizer.service + # Copy rsyslog configuration files and templates sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable rsyslog-config.service diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh new file mode 100755 index 000000000000..653a00291f72 --- /dev/null +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -0,0 +1,96 @@ +#! /bin/bash + +VERBOSE=no + +# Check components +COMP_LIST="orchagent neighsyncd bgp" +EXP_STATE="reconciled" + +ASSISTANT_SCRIPT="/usr/bin/neighbor_advertiser" + + +function debug() +{ + /usr/bin/logger "WARMBOOT_FINALIZER : $1" + if [[ x"${VERBOSE}" == x"yes" ]]; then + echo `date` "- $1" + fi +} + + +function check_warm_boot() +{ + WARM_BOOT=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` +} + + +function wait_for_database_service() +{ + debug "Wait for database to become ready..." + + # 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 + + debug "Database is ready..." +} + + +function get_component_state() +{ + /usr/bin/redis-cli -n 6 hget "WARM_RESTART_TABLE|$1" state +} + + +function check_list() +{ + RET_LIST='' + for comp in $@; do + state=`get_component_state ${comp}` + if [[ x"${state}" != x"${EXP_STATE}" ]]; then + RET_LIST="${RET_LIST} ${comp}" + fi + done + + echo ${RET_LIST} +} + + +function finalize_warm_boot() +{ + debug "Finalizing warmboot..." + sudo config warm_restart disable +} + + +wait_for_database_service + +check_warm_boot + +if [[ x"${WARM_BOOT}" != x"true" ]]; then + debug "warmboot is not enabled ..." + exit 0 +fi + +list=${COMP_LIST} + +# Wait up to 5 minutes +for i in `seq 60`; do + list=`check_list ${list}` + if [[ -z "${list}" ]]; then + break + fi + sleep 5 +done + +if [[ -n "${list}" ]]; then + debug "Some components didn't finish reconcile: ${list} ..." +fi + +finalize_warm_boot diff --git a/files/image_config/warmboot-finalizer/warmboot-finalizer.service b/files/image_config/warmboot-finalizer/warmboot-finalizer.service new file mode 100644 index 000000000000..72cc6e338982 --- /dev/null +++ b/files/image_config/warmboot-finalizer/warmboot-finalizer.service @@ -0,0 +1,11 @@ +[Unit] +Description=Monitor warm recovery and disable warmboot when done +Requires=database.service +After=database.service + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/finalize-warmboot.sh + +[Install] +WantedBy=multi-user.target From 021b3788d5791865eb8e8b83bcff0d424e1dfc9e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Apr 2019 22:47:23 +0000 Subject: [PATCH 048/219] [build] force Linux to drop cache before calling kvm (#2717) * [vm build] force Linux to drop cache before calling kvm KVM need to allocate 2G memory for this build. The system memory might be occupied by cache at the moment and doesn't have 2G chunk to give out. Forcing Kernel to drop cache to boost the chance of getting 2G memory. Signed-off-by: Ying Xie * [make] add option to enable/disable VS build memory preparation Signed-off-by: Ying Xie --- Makefile.work | 4 ++++ build_kvm_image.sh | 11 ++++++++++- rules/config | 3 +++ slave.mk | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 6c4828134a8a..eb71a774cab2 100644 --- a/Makefile.work +++ b/Makefile.work @@ -27,6 +27,9 @@ # * make NOSTRETCH=1 KEEP_SLAVE_ON=yes # * SOURCE_FOLDER: host path to be mount as /var/$(USER)/src, only effective when KEEP_SLAVE_ON=yes # * SONIC_BUILD_JOBS: Specifying number of concurrent build job(s) to run +# * VS_PREPARE_MEM: Prepare memory in VS build (drop cache and compact). +# * Default: yes +# * Values: yes, no # * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build # ############################################################################### @@ -114,6 +117,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + VS_PREPARE_MEM=$(VS_PREPARE_MEM) \ KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ diff --git a/build_kvm_image.sh b/build_kvm_image.sh index b08db96f573c..bc0f54e12d5c 100755 --- a/build_kvm_image.sh +++ b/build_kvm_image.sh @@ -1,4 +1,4 @@ -#!/bin/sh -ex +#!/bin/bash -ex # Copyright (C) 2014 Curt Brune # @@ -47,6 +47,15 @@ prepare_installer_disk() create_disk prepare_installer_disk +echo "Prepare memory for KVM build: $vs_build_prepare_mem" +free -m +if [[ "$vs_build_prepare_mem" == "yes" ]]; then + # Force o.s. to drop cache and compact memory so that KVM can get 2G memory + sudo bash -c 'echo 1 > /proc/sys/vm/drop_caches' + sudo bash -c 'echo 1 > /proc/sys/vm/compact_memory' + free -m +fi + /usr/bin/kvm -m $MEM \ -name "onie" \ -boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \ diff --git a/rules/config b/rules/config index 86139c71540f..674280a3ca2c 100644 --- a/rules/config +++ b/rules/config @@ -84,3 +84,6 @@ DEFAULT_KERNEL_PROCURE_METHOD = build # group during installation. FRR_USER_UID = 1000 FRR_USER_GID = 1000 + +# Default VS build memory preparation +DEFAULT_VS_PREPARE_MEM = yes diff --git a/slave.mk b/slave.mk index 93811b43371c..b4b7f8de1f92 100644 --- a/slave.mk +++ b/slave.mk @@ -109,6 +109,10 @@ ifeq ($(SONIC_BUILD_JOBS),) override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS) endif +ifeq ($(VS_PREPARE_MEM),) +override VS_PREPARE_MEM := $(DEFAULT_VS_PREPARE_MEM) +endif + ifeq ($(KERNEL_PROCURE_METHOD),) override KERNEL_PROCURE_METHOD := $(DEFAULT_KERNEL_PROCURE_METHOD) endif @@ -155,6 +159,7 @@ $(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)") $(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)") $(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)") $(info "BUILD_TIMESTAMP" : "$(BUILD_TIMESTAMP)") +$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)") $(info ) ############################################################################### @@ -163,6 +168,7 @@ $(info ) ############################################################################### export kernel_procure_method=$(KERNEL_PROCURE_METHOD) +export vs_build_prepare_mem=$(VS_PREPARE_MEM) ############################################################################### ## Local targets From 13a643bb3e7aa046e30c37438d91c6a3b85503b3 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Apr 2019 15:40:22 -0700 Subject: [PATCH 049/219] [teamd service] teamd service should start after syncd (#2724) * [teamd service] teamd service should start after syncd Signed-off-by: Ying Xie * combine after lines --- files/build_templates/teamd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 792b8247119f..6f3803657522 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=TEAMD container Requires=updategraph.service -After=updategraph.service +After=updategraph.service syncd.service Before=ntp-config.service [Service] From bc98f9fe6421a21b5dac0113e01f0c773f9ad91f Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Apr 2019 16:51:30 -0700 Subject: [PATCH 050/219] [teamd] prevent re-entrance of port priv change handler (#2723) When adding a lag member dynamically after system boots up, teamd port priv change handler could re-entrant itself and causing adding operation to fail. While handling PORT_CHANGE event, teamd_per_port.c port priv change handler was called, it will then call runner_lacp to add port to lag, the later causes IFINFO_CHANGE to be notified and calls the priv change handler again, this re-entrance would cause runner_lacp port_added to be called again and messes up with the previous adding sequence. Then fails the lag member adding operation. Prevent per port priv change handler re-entrance solves the problem. Signed-off-by: Ying Xie --- ...nt-private-change-handler-reentrance.patch | 90 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 91 insertions(+) create mode 100644 src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch diff --git a/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch new file mode 100644 index 000000000000..dad10a4c1ae9 --- /dev/null +++ b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch @@ -0,0 +1,90 @@ +From fb00b070482dc587eec7b4e34acec094be1af00d Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Fri, 29 Mar 2019 20:54:49 +0000 +Subject: [PATCH 10/11] [teamd] prevent private change handler reentrance + +While handling PORT_CHANGE, teamd could casue an INTERFACE_CHANGE in the +same context. Which will interfere with the PORT_CHANGE handling and +causing it to fail. + +Lock is not needed because the re-entrance happened in the same thread +context. + +This issue was noticed while dynamically adding a port into a lag. + +Signed-off-by: Ying Xie +--- + teamd/teamd.c | 2 ++ + teamd/teamd.h | 2 ++ + teamd/teamd_per_port.c | 13 +++++++++++-- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index e28aa7d..140b98b 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -1255,6 +1255,8 @@ static int teamd_init(struct teamd_context *ctx) + { + int err; + ++ ctx->reentrant = false; ++ + ctx->th = team_alloc(); + if (!ctx->th) { + teamd_log_err("Team alloc failed."); +diff --git a/teamd/teamd.h b/teamd/teamd.h +index 622c365..7cd3266 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -160,6 +160,8 @@ struct teamd_context { + int pipe_r; + int pipe_w; + } workq; ++ ++ bool reentrant; + }; + + struct teamd_port { +diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c +index 137da57..8b4a457 100644 +--- a/teamd/teamd_per_port.c ++++ b/teamd/teamd_per_port.c +@@ -250,6 +250,10 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + struct port_obj *port_obj; + int err; + ++ if (ctx->reentrant) { ++ return 0; ++ } ++ ctx->reentrant = true; + team_for_each_port(port, th) { + uint32_t ifindex = team_get_port_ifindex(port); + +@@ -258,17 +262,22 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, + if (team_is_port_removed(port)) + continue; + err = port_obj_create(ctx, &port_obj, ifindex, port); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_changed(port)) { + err = teamd_event_port_changed(ctx, _port(port_obj)); +- if (err) ++ if (err) { ++ ctx->reentrant = false; + return err; ++ } + } + if (team_is_port_removed(port)) + port_obj_remove(ctx, port_obj); + } ++ ctx->reentrant = false; + return 0; + } + +-- +2.7.4 + diff --git a/src/libteam/series b/src/libteam/series index 51b43ca14885..a6c4893d021a 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -6,3 +6,4 @@ 0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch 0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch +0009-teamd-prevent-private-change-handler-reentrance.patch From 502ddb09781ba53da4e283401ac34942875fe581 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 1 Apr 2019 16:58:39 -0700 Subject: [PATCH 051/219] [201811][sairedis][swss] advance sub module head of sairedis and swss (#2728) Submodule src/sonic-sairedis 8182916..483c89e: > Notify OA about exception and process only restart query events (#437) Submodule src/sonic-swss 91171b6..d22b2de: > Allow ACL entry creation without ACL counter (#818) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 818291652f85..483c89e42625 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 818291652f85b8d799d47701df741d1054619304 +Subproject commit 483c89e42625d5ce2c522988e94e5a2e71c950b8 diff --git a/src/sonic-swss b/src/sonic-swss index 91171b687ece..d22b2ded6254 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 91171b687ece0cbacb38d6065a6045613b1bf537 +Subproject commit d22b2ded6254d751ed1da14162d01a3c58d22b7f From 1a4bac7e27f9dfade80ee2410ff1090bec52c112 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 4 Apr 2019 08:12:54 -0700 Subject: [PATCH 052/219] [201811][platform-common] add platform-common 201811 branch (#2743) - Cherry-picked one change: Submodule src/sonic-platform-common d4bf78c..42119e1: > remove gang port parsing (#24) Signed-off-by: Ying Xie --- .gitmodules | 1 + src/sonic-platform-common | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 6ed1a06a700c..c214cefecb5b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -45,6 +45,7 @@ [submodule "src/sonic-platform-common"] path = src/sonic-platform-common url = https://github.com/Azure/sonic-platform-common + branch = 201811 [submodule "src/sonic-platform-daemons"] path = src/sonic-platform-daemons url = https://github.com/Azure/sonic-platform-daemons diff --git a/src/sonic-platform-common b/src/sonic-platform-common index d4bf78c9db4d..42119e19030e 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit d4bf78c9db4daf21497274a778748da4d8301866 +Subproject commit 42119e19030e33e8857f31f7a88d079fbe8edea9 From 27f1aa7e09bc2db485258652e94d50c9a936c0f8 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 3 Apr 2019 04:18:04 +0530 Subject: [PATCH 053/219] removing dhcp- turn- off option from initrd (#2555) * removing dhcp changes from initrd * removing mgmt-intf-dhcp file --- build_debian.sh | 4 ++-- files/initramfs-tools/mgmt-intf-dhcp | 36 ---------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 files/initramfs-tools/mgmt-intf-dhcp diff --git a/build_debian.sh b/build_debian.sh index c9fc5313c664..aa8c6b04eb70 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -150,8 +150,8 @@ sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mou sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog # Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC) -sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp -sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp +#sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp sudo cp files/initramfs-tools/union-fsck $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/union-fsck pushd $FILESYSTEM_ROOT/usr/share/initramfs-tools/scripts/init-bottom && sudo patch -p1 < $OLDPWD/files/initramfs-tools/udev.patch; popd diff --git a/files/initramfs-tools/mgmt-intf-dhcp b/files/initramfs-tools/mgmt-intf-dhcp deleted file mode 100644 index 52f7ff5f495c..000000000000 --- a/files/initramfs-tools/mgmt-intf-dhcp +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -PREREQS="union-mount" - -prereqs() { echo "$PREREQS"; } - -case $1 in - prereqs) - prereqs - exit 0 - ;; -esac - -# Extract kernel parameters -set -- $(cat /proc/cmdline) -for x in "$@"; do - case "$x" in - mgmt-intf-dhcp=*) - val="${x#mgmt-intf-dhcp=}" - - if [ -z "$val" ]; then - echo "ERROR: mgmt-intf-dhcp value (on/off) not specified !" - exit 0 - fi - - if [ -e "${rootmnt}/etc/network/interfaces" ]; then - if [ "$val" = "off" ]; then - sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces - elif [ "$val" = "on" ]; then - sed -i 's/iface eth0 inet static/iface eth0 inet dhcp/g' ${rootmnt}/etc/network/interfaces - fi - fi - - ;; - esac -done From 4eaa4dabff0ac10d995c527bdf863c1ccccac0a9 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 3 Apr 2019 08:20:44 -0700 Subject: [PATCH 054/219] Revert "[teamd service] teamd service should start after syncd (#2724)" (#2733) This reverts commit 0d1efb131c9c686176118da98a37094528ef0f72. --- files/build_templates/teamd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 6f3803657522..792b8247119f 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=TEAMD container Requires=updategraph.service -After=updategraph.service syncd.service +After=updategraph.service Before=ntp-config.service [Service] From 5c663ca7bb8eb6d8f7df27073377aec550a8a782 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 4 Apr 2019 08:34:44 -0700 Subject: [PATCH 055/219] [201811][utilities] advance submodule head (#2748) Submodule src/sonic-utilities d1070b2..bae21e7: > Update neighbor advertiser (#498) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index d1070b23ed90..bae21e77fc03 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d1070b23ed9016646172bf8436a8159564132534 +Subproject commit bae21e77fc03aa0824dd2907a073441b0cf6f78b From 6c1a0ce58c253e77bce6880538d00996c1719ce7 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan Date: Wed, 3 Apr 2019 23:07:42 +0000 Subject: [PATCH 056/219] [hostcfgd] -- Fix the default for failthrough as false. This implies that by default, if TACACS is configured properly and it reported auth_err, then don't try fail through to traditional unix authentication through /etc/passwd. If this failthrough is intended, make it explicit through "sudo config aaa authentication failthrough enable" Removed an unused variable "aaa.fallback" Tested manually. Note the presence of 'auth_err=die' in all cases except when failthrough is explicitly enabled. admin@str-s6000-acs-13:~$ sudo config aaa authentication failthrough default; date Wed Apr 3 23:05:18 UTC 2019 admin@str-s6000-acs-13:~$ ls -lrt /etc/pam.d/common-auth-sonic ; grep 123 /etc/pam.d/common-auth-sonic -rw-r--r-- 1 root root 1316 Apr 3 23:05 /etc/pam.d/common-auth-sonic auth [success=done new_authtok_reqd=done default=ignore auth_err=die] pam_tacplus.so server=100.127.20.22:49 secret=testing123 login=login timeout=5 try_first_pass auth [success=done new_authtok_reqd=done default=ignore auth_err=die] pam_tacplus.so server=100.127.20.21:49 secret=testing123 login=login timeout=5 try_first_pass admin@str-s6000-acs-13:~$ sudo config aaa authentication failthrough enable; date ; h4 "AAA|authentication" Wed Apr 3 23:06:37 UTC 2019 admin@str-s6000-acs-13:~$ ls -lrt /etc/pam.d/common-auth-sonic ; grep 123 /etc/pam.d/common-auth-sonic -rw-r--r-- 1 root root 1294 Apr 3 23:06 /etc/pam.d/common-auth-sonic auth [success=done new_authtok_reqd=done default=ignore] pam_tacplus.so server=100.127.20.22:49 secret=testing123 login=login timeout=5 try_first_pass auth [success=done new_authtok_reqd=done default=ignore] pam_tacplus.so server=100.127.20.21:49 secret=testing123 login=login timeout=5 try_first_pass admin@str-s6000-acs-13:~$ sudo config aaa authentication failthrough disable; date ; h4 "AAA|authentication" Wed Apr 3 23:07:09 UTC 2019 admin@str-s6000-acs-13:~$ ls -lrt /etc/pam.d/common-auth-sonic ; grep 123 /etc/pam.d/common-auth-sonic -rw-r--r-- 1 root root 1321 Apr 3 23:07 /etc/pam.d/common-auth-sonic auth [success=done new_authtok_reqd=done default=ignore auth_err=die] pam_tacplus.so server=100.127.20.22:49 secret=testing123 login=login timeout=5 try_first_pass auth [success=done new_authtok_reqd=done default=ignore auth_err=die] pam_tacplus.so server=100.127.20.21:49 secret=testing123 login=login timeout=5 try_first_pass --- files/image_config/hostcfgd/hostcfgd | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 5daebe257260..ae51af5cc8e4 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -44,8 +44,6 @@ class AaaCfg(object): def __init__(self): self.auth_default = { 'login': 'local', - 'failthrough': True, - 'fallback': True } self.tacplus_global_default = { 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, From 9ae11035d7a4a1e8b418407c59ab16c735e78291 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 9 Apr 2019 14:20:35 -0700 Subject: [PATCH 057/219] [20181][sub-modules] advance sairedis, swss, swss-common and utilities (#2759) Submodule src/sonic-sairedis 483c89e..97dd2a8: > Fix compilation issues in stretch docker with gcc-6.3 (#426) > Make object list deterministic when iterating (#438) > Ignore ACL_COUNTER bytes and packets during comparison logic (#443) Submodule src/sonic-swss d22b2de..ae74a27: > Survive pfc watchdog storm action across warm-reboot (#794) Submodule src/sonic-swss-common 36fd5e9..24c0ff7: > Update PFC_WD table name in CONFIG_DB (#266) Submodule src/sonic-utilities bae21e7..6aee909: > [neighbor advertiser] convert int to string before concatenating (#505) > [config]: Change the order of interface commands (#504) > Change PFC watchdog CONFIG_DB table name from PFC_WD_TABLE to PFC_WD (#475) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 483c89e42625..74f0f44bd790 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 483c89e42625d5ce2c522988e94e5a2e71c950b8 +Subproject commit 74f0f44bd7906b27d6e080614784919079afb66b diff --git a/src/sonic-swss b/src/sonic-swss index d22b2ded6254..ae74a27df766 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d22b2ded6254d751ed1da14162d01a3c58d22b7f +Subproject commit ae74a27df766321e0802f8bb38e9fa41dadffd88 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 36fd5e957959..24c0ff7215e0 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 36fd5e9579593b2e64126dc61b045bbb9f9dab3f +Subproject commit 24c0ff7215e0fd13e9247bda6a4f92862b8519da diff --git a/src/sonic-utilities b/src/sonic-utilities index bae21e77fc03..6aee909259e4 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit bae21e77fc03aa0824dd2907a073441b0cf6f78b +Subproject commit 6aee909259e4539c9d0a811fce8533a867f45090 From 97e996f87e0ba0a67711d432b6cc95ef9a08e38a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 10 Apr 2019 19:12:29 -0700 Subject: [PATCH 058/219] [bcm SAI] upgrade Broadcom SAI to version 3.3.5.4-1 (#2764) - Broadcom SAI GA drop 20190402 Signed-off-by: Ying Xie --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index 61fcc34549b8..b563703efa9c 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.3.4.3-2_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.4.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=GO2B4zoVJi0j0%2FZKbf8yhRL0oQ3clJEZFiy2AC14xSc%3D&se=2032-10-20T20%3A38%3A13Z&sp=r" +BRCM_SAI = libsaibcm_3.3.5.4-1_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.5.4-1_amd64.deb?sv=2015-04-05&sr=b&sig=fjyImKBuCbR8x48tzRhx32tfnDq1kk1VsCJblaXh8U4%3D&se=2032-12-10T01%3A43%3A35Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.3.4.3-2_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.3.5.4-1_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.4.3-2_amd64.deb?sv=2015-04-05&sr=b&sig=aYEpjYMEIqfMnAiraXr9K%2FspEb8d2qGdwcIBxO3%2BjjY%3D&se=2032-10-20T20%3A37%3A51Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.5.4-1_amd64.deb?sv=2015-04-05&sr=b&sig=91u8Og2PHD2ig%2BlIyi6UlXQ8rMSxz%2FUeJdyy%2BhecvrE%3D&se=2032-12-10T01%3A43%3A16Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From bed716edfea18d005a9b5104a9a8ca0ba75125de Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Sun, 14 Apr 2019 20:59:26 +0300 Subject: [PATCH 059/219] [Mellanox] Update SAI (#2778) New SAI version is not going to flood our log with unnecessary log messages. Signed-off-by: Mykola Faryma --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index d5f242728d3b..71d93a142e94 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.13.4-master -MLNX_SAI_REVISION = 783d040465fb31771bcb9ec3d655d053e88b1bf0 +MLNX_SAI_REVISION = 07a104bf1f00ff8ada39056c0dc23bd895cf1a62 export MLNX_SAI_VERSION MLNX_SAI_REVISION From f62d2b0df27f9f043036510bb9d2fb3f5e479a45 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 9 Apr 2019 09:03:25 -0700 Subject: [PATCH 060/219] [vstest]: Test for quagga livelock fix (#2751) * Test for quagga livelock fix * Create /usr/local/etc for the test * Add more debug info * Install specific version of exabgp * Update sonic-quagga --- .../vs/tests/bgp/files/gr_livelock/bgpd.conf | 14 ++ .../tests/bgp/files/gr_livelock/exabgp1.conf | 21 +++ .../files/gr_livelock/exabgp1.graceful.conf | 26 ++++ .../tests/bgp/files/gr_livelock/exabgp2.conf | 11 ++ platform/vs/tests/bgp/test_gr_livelock.py | 143 ++++++++++++++++++ src/sonic-quagga | 2 +- 6 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 platform/vs/tests/bgp/files/gr_livelock/bgpd.conf create mode 100644 platform/vs/tests/bgp/files/gr_livelock/exabgp1.conf create mode 100644 platform/vs/tests/bgp/files/gr_livelock/exabgp1.graceful.conf create mode 100644 platform/vs/tests/bgp/files/gr_livelock/exabgp2.conf create mode 100644 platform/vs/tests/bgp/test_gr_livelock.py diff --git a/platform/vs/tests/bgp/files/gr_livelock/bgpd.conf b/platform/vs/tests/bgp/files/gr_livelock/bgpd.conf new file mode 100644 index 000000000000..a26d1d93daf3 --- /dev/null +++ b/platform/vs/tests/bgp/files/gr_livelock/bgpd.conf @@ -0,0 +1,14 @@ +router bgp 65501 + bgp router-id 1.1.1.1 + bgp graceful-restart restart-time 180 + bgp graceful-restart + neighbor 10.0.0.1 remote-as 65502 + address-family ipv4 + neighbor 10.0.0.1 activate + maximum-paths 64 + exit-address-family + neighbor 10.0.0.3 remote-as 65503 + address-family ipv4 + neighbor 10.0.0.3 activate + maximum-paths 64 + exit-address-family diff --git a/platform/vs/tests/bgp/files/gr_livelock/exabgp1.conf b/platform/vs/tests/bgp/files/gr_livelock/exabgp1.conf new file mode 100644 index 000000000000..0e78bd61db42 --- /dev/null +++ b/platform/vs/tests/bgp/files/gr_livelock/exabgp1.conf @@ -0,0 +1,21 @@ +neighbor 10.0.0.0 { + router-id 1.1.1.2; + local-address 10.0.0.1; + local-as 65502; + peer-as 65501; + group-updates false; + + family{ + ipv4 unicast; + } + + static { + route 1.1.1.1/32{ + next-hop 10.0.0.1; + community no-export; + } + route 2.2.2.2/32{ + next-hop 10.0.0.1; + } + } +} diff --git a/platform/vs/tests/bgp/files/gr_livelock/exabgp1.graceful.conf b/platform/vs/tests/bgp/files/gr_livelock/exabgp1.graceful.conf new file mode 100644 index 000000000000..377ed024d09e --- /dev/null +++ b/platform/vs/tests/bgp/files/gr_livelock/exabgp1.graceful.conf @@ -0,0 +1,26 @@ +neighbor 10.0.0.0 { + router-id 1.1.1.2; + local-address 10.0.0.1; + local-as 65502; + peer-as 65501; + group-updates false; + manual-eor true; + + family{ + ipv4 unicast; + } + + capability { + graceful-restart 360; + } + + static { + route 1.1.1.1/32{ + next-hop 10.0.0.1; + community no-export; + } + route 2.2.2.2/32{ + next-hop 10.0.0.1; + } + } +} diff --git a/platform/vs/tests/bgp/files/gr_livelock/exabgp2.conf b/platform/vs/tests/bgp/files/gr_livelock/exabgp2.conf new file mode 100644 index 000000000000..3e67c18a82f6 --- /dev/null +++ b/platform/vs/tests/bgp/files/gr_livelock/exabgp2.conf @@ -0,0 +1,11 @@ +neighbor 10.0.0.2 { + router-id 1.1.1.3; + local-address 10.0.0.3; + local-as 65503; + peer-as 65501; + group-updates false; + + family { + ipv4 unicast; + } +} diff --git a/platform/vs/tests/bgp/test_gr_livelock.py b/platform/vs/tests/bgp/test_gr_livelock.py new file mode 100644 index 000000000000..8ba2b4cc7214 --- /dev/null +++ b/platform/vs/tests/bgp/test_gr_livelock.py @@ -0,0 +1,143 @@ +from swsscommon import swsscommon +import os +import re +import time +import json +import random + +def output(dvs, title): + print "=========================== %s ===========================" % title + exit_cod, sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) + exit_code, all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) + exit_code, neig_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1"]) + exit_code, announce_route_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1 advertised-routes"]) + exit_code, received_route_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1 routes"]) + exit_code, announce_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + exit_code, received_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 routes"]) + print "Summary:" + print sum_res + print "Received routes:" + print "10.0.0.1" + print received_route_1 + print "10.0.0.3" + print received_route_3 + print "Announces routes:" + print "10.0.0.1" + print announce_route_1 + print "10.0.0.3" + print announce_route_3 + print "Neighbors" + print "10.0.0.1" + print neig_1 + print "======================================================" + +def mkdir(path): + if not os.path.exists(path): + os.makedirs(path) + +def remove(path): + if os.path.exists(path): + os.unlink(path) + +def get_target_env(idx): + return '/usr/local/etc/exabgp/exabgp_%d.env' % idx + +def prepare_exa_env(dvs, idx): + mkdir('/usr/local/etc') + mkdir('/usr/local/etc/exabgp') + tmp_name = '/tmp/env.%d.%d' % (random.randint(0, 10000000), os.getpid()) + dvs.servers[idx].runcmd("exabgp --fi > %s" % tmp_name) + with open(tmp_name) as r_fp: + with open(get_target_env(idx), 'w') as w_fp: + for line in r_fp: + if line.startswith('pipename'): + line = "pipename = 'exabgp.%d'\n" % idx + w_fp.write(line) + os.unlink(tmp_name) + + +def run_exa(dvs, idx, cfg): + prepare_exa_env(dvs, idx) + run_dir = "/var/run/exabgp" + mkdir(run_dir) + fifo_in_path = "%s/exabgp.%d.in" % (run_dir, idx) + fifo_out_path = "%s/exabgp.%d.out" % (run_dir, idx) + remove(fifo_in_path) + remove(fifo_out_path) + os.mkfifo(fifo_in_path) + os.mkfifo(fifo_out_path) + os.chmod(fifo_in_path, 0666) + os.chmod(fifo_out_path, 0666) + print "!!! Start exabgp instance %d" % idx + cmd = "exabgp -d --env %s %s" % (get_target_env(idx), cfg) + print "Cmd is ___ %s ___" % cmd + return dvs.servers[idx].runcmd_async(cmd) + +def run_exacli(dvs, idx, cmd): + return dvs.servers[idx].runcmd('exabgpcli --env %s %s' % (get_target_env(idx), cmd)) + +def test_gr_livelock(dvs, testlog): + # update exabgp to version 4.0.10 + dvs.servers[0].runcmd("pip install 'exabgp==4.0.10' --force-reinstall ") + # + dvs.copy_file("/etc/quagga/", "bgp/files/gr_livelock/bgpd.conf") + dvs.servers[0].runcmd("pkill exabgp") # In case previous test didn't stop exa + dvs.runcmd("supervisorctl stop bgpd") + time.sleep(5) + dvs.runcmd("supervisorctl start bgpd") + dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") + dvs.runcmd("ifconfig Ethernet0 up") + + dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") + dvs.runcmd("ifconfig Ethernet4 up") + + dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") + dvs.servers[0].runcmd("ifconfig eth0 up") + + dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") + dvs.servers[1].runcmd("ifconfig eth0 up") + + time.sleep(5) + + # Run two bgp neighbors + p1 = run_exa(dvs, 0, "bgp/files/gr_livelock/exabgp1.conf") + p2 = run_exa(dvs, 1, "bgp/files/gr_livelock/exabgp2.conf") + + time.sleep(30) + + output(dvs, "First neighbor doesn't have GR enabled") + + # Check that we announce routes from the 1st neigbbor to 2nd, if 1st neighbor doesn't support graceful restart + _, announced_routes = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + assert '2.2.2.2/32' in announced_routes + + # Stop 1st neighbor + run_exacli(dvs, 0, 'shutdown') + p1 = p1.wait() + + # Wait until quagga thinks that 1st neighbor was shut down + time.sleep(300) + + # Start the 1st neighbor again with graceful restart enabled + p1 = run_exa(dvs, 0, "bgp/files/gr_livelock/exabgp1.graceful.conf") + + time.sleep(60) + + output(dvs, "First neighbor has GR enalbed") + + run_exacli(dvs, 0, 'announce route 1.10.0.0/24 next-hop self') + + time.sleep(60) + + output(dvs, "Announced a new route from the first neighbor") + + # Check that we announce all routes from the 1st neighbor + _, announced_routes = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) + assert '2.2.2.2/32' in announced_routes + assert '1.10.0.0/24' in announced_routes + + run_exacli(dvs, 0, 'shutdown') + p1 = p1.wait() + + run_exacli(dvs, 1, 'shutdown') + p2 = p2.wait() diff --git a/src/sonic-quagga b/src/sonic-quagga index 4b7825c2ee71..e5ede97424ad 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 4b7825c2ee71c9e8603d1ade3aaf76982f7dbf49 +Subproject commit e5ede97424ad764b10af768d2e99cb4357177b7a From 19813c2924977780d5d41a18284a7cff0f43b3a1 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 10 Apr 2019 19:13:03 -0700 Subject: [PATCH 061/219] [bgp quagga] increase BGP graceful restart timeout to 240 seconds (#2754) There are some platforms with less powerful CPU/hard-drive could take longer to get ready for BGP. For these platforms, 240 seconds would be a safer threshold. Signed-off-by: Ying Xie --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 2 +- src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index f00cea64577d..2d9d03e73fe8 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -27,7 +27,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp log-neighbor-changes bgp bestpath as-path multipath-relax no bgp default ipv4-unicast - bgp graceful-restart restart-time 180 + bgp graceful-restart restart-time 240 bgp graceful-restart {% for (name, prefix) in LOOPBACK_INTERFACE %} {% if prefix | ipv4 and name == 'Loopback0' %} diff --git a/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf b/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf index 5c4d0eabc1f3..ebffcaa7c24d 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf @@ -20,7 +20,7 @@ router bgp 65100 bgp log-neighbor-changes bgp bestpath as-path multipath-relax no bgp default ipv4-unicast - bgp graceful-restart restart-time 180 + bgp graceful-restart restart-time 240 bgp graceful-restart bgp router-id 10.1.0.32 network 10.1.0.32/32 From 144fe975e518d52dbdda6a44fdb90b327dc2296b Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 10 Apr 2019 21:50:36 -0700 Subject: [PATCH 062/219] [docker-fpm-quagga]: Add support for PeerAsn and UpdateAddress (#2766) --- dockers/docker-fpm-quagga/bgpd.conf.j2 | 8 ++++++++ src/sonic-config-engine/minigraph.py | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dockers/docker-fpm-quagga/bgpd.conf.j2 b/dockers/docker-fpm-quagga/bgpd.conf.j2 index 2d9d03e73fe8..4879736437bc 100644 --- a/dockers/docker-fpm-quagga/bgpd.conf.j2 +++ b/dockers/docker-fpm-quagga/bgpd.conf.j2 @@ -98,14 +98,22 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for bgp_peer in BGP_PEER_RANGE.values() %} neighbor {{ bgp_peer['name'] }} peer-group neighbor {{ bgp_peer['name'] }} passive +{% if bgp_peer['peer_asn'] is defined %} + neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }} +{% else %} neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }} +{% endif %} neighbor {{ bgp_peer['name'] }} ebgp-multihop 255 neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound +{% if bgp_peer['src_address'] is defined %} + neighbor {{ bgp_peer['name'] }} update-source {{ bgp_peer['src_address'] | ip }} +{% else %} {% for (name, prefix) in LOOPBACK_INTERFACE %} {% if name == 'Loopback1' %} neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }} {% endif %} {% endfor %} +{% endif %} neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out {% for ip_range in bgp_peer['ip_range'] %} diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 9ab3d0f02be5..5ff350bc8965 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -336,7 +336,7 @@ def parse_cpg(cpg, hname): peers = router.find(str(QName(ns1, "Peers"))) for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))): addr = bgpPeer.find(str(QName(ns, "Address"))).text - if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: + if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None: # FIXME: is better to check for type BGPPeerPassive name = bgpPeer.find(str(QName(ns1, "Name"))).text ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text ip_range_group = ip_range.split(';') if ip_range and ip_range != "" else [] @@ -344,6 +344,10 @@ def parse_cpg(cpg, hname): 'name': name, 'ip_range': ip_range_group } + if bgpPeer.find(str(QName(ns1, "Address"))) is not None: + bgp_peers_with_range[name]['src_address'] = bgpPeer.find(str(QName(ns1, "Address"))).text + if bgpPeer.find(str(QName(ns1, "PeerAsn"))) is not None: + bgp_peers_with_range[name]['peer_asn'] = bgpPeer.find(str(QName(ns1, "PeerAsn"))).text else: for peer in bgp_sessions: bgp_session = bgp_sessions[peer] From fde3a4f035767b9a4ea7154bae22bd55ad5dd93f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Wed, 10 Apr 2019 22:55:54 -0700 Subject: [PATCH 063/219] [sonic-cfggen]: Output differences for bgp configurations (#2768) --- src/sonic-config-engine/tests/test_j2files.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index d6066b628e61..ce7f56eccff6 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -23,8 +23,8 @@ def run_script(self, argument): print 'CMD: sonic-cfggen ' + argument return subprocess.check_output(self.script_file + ' ' + argument, shell=True) - def run_diff(self, file1, file2, diff): - return subprocess.check_output('diff {} {} >{}'.format(file1, file2, diff), shell=True) + def run_diff(self, file1, file2): + return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True) def test_interfaces(self): interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') @@ -61,7 +61,10 @@ def test_bgpd_quagga(self): conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'bgpd.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + conf_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf'), self.output_file)) + original_filename = os.path.join(self.test_dir, 'sample_output', 'bgpd_quagga.conf') + r = filecmp.cmp(original_filename, self.output_file) + diff_output = self.run_diff(original_filename, self.output_file) if not r else "" + self.assertTrue(r, "Diff:\n" + diff_output) def test_zebra_quagga(self): conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-quagga', 'zebra.conf.j2') From 227bc32594ee55b07e608be03d33b184a3987de0 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Mon, 15 Apr 2019 20:39:43 -0700 Subject: [PATCH 064/219] Install python3.6 smbus module in snmp (#2772) --- dockers/docker-snmp-sv2/Dockerfile.j2 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index ec50a4c8c2a2..1063f6d24b4d 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -17,7 +17,7 @@ RUN apt-get update RUN apt-get install -y curl ca-certificates # Install gcc which is required for installing hiredis -RUN apt-get install -y gcc +RUN apt-get install -y gcc make {% if docker_snmp_sv2_debs.strip() -%} # Copy locally-built Debian package dependencies @@ -38,6 +38,9 @@ RUN python3.6 -m pip install --no-cache-dir hiredis # Install pyyaml dependency for use by some plugins RUN python3.6 -m pip install --no-cache-dir pyyaml +# Install smbus dependency for use by some plugins +RUN python3.6 -m pip install --no-cache-dir smbus + {% if docker_snmp_sv2_whls.strip() -%} # Copy locally-built Python wheel dependencies {%- for whl in docker_snmp_sv2_whls.split(' ') %} @@ -53,7 +56,7 @@ RUN pip install /python-wheels/{{ whl }} RUN python3.6 -m sonic_ax_impl install # Clean up -RUN apt-get -y purge libpython3.6-dev curl gcc +RUN apt-get -y purge libpython3.6-dev curl gcc make RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge RUN find / | grep -E "__pycache__" | xargs rm -rf RUN rm -rf /debs /python-wheels ~/.cache From 5578e3d1bd9f104ca432aef15583f843f0f78575 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Sat, 13 Apr 2019 09:48:56 -0700 Subject: [PATCH 065/219] [mgmt] Install passlib in sonic-mgmt docker to support ansible `no_log` option (#2782) --- dockers/docker-sonic-mgmt/Dockerfile.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index aa02a701f510..9d07f668b595 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -45,7 +45,8 @@ RUN pip install ipaddr \ pysnmp==4.2.5 \ jinja2==2.7.2 \ cffi==1.10.0 \ - paramiko==2.1.2 + paramiko==2.1.2 \ + passlib # Install Microsoft Azure Kusto Library for Python RUN pip install azure-kusto-data==0.0.13 \ From 543aec6a1886252d72dadb5f292f6ded3f2d00bb Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 16 Apr 2019 11:51:04 -0700 Subject: [PATCH 066/219] [201811][utilities] advance sonic-utilities submodule (#2792) Submodule src/sonic-utilities 6aee909..79a0185: > [fast/warm reboot] add some sanity check before warm reboot (#510) > In sync with our latest change, where we default failthrough to be False. (#507) > [generate_dump] system dump improvements (#503) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 6aee909259e4..79a0185e7e6d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6aee909259e4539c9d0a811fce8533a867f45090 +Subproject commit 79a0185e7e6d23421e5d476e91c9c452f93295ba From d210f86b249edadcede4ffcd02fc95d11e874d76 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 17 Apr 2019 16:40:40 -0700 Subject: [PATCH 067/219] [201811] [radvd] Build radvd from source; Patch so as not to treat out-of-range MTU as an error (#2796) --- .gitignore | 3 ++ .../docker-router-advertiser/Dockerfile.j2 | 3 -- rules/docker-router-advertiser.mk | 2 +- rules/radvd.mk | 9 +++++ src/radvd/Makefile | 30 +++++++++++++++++ ...t-treat-out-of-range-MTU-as-an-error.patch | 33 +++++++++++++++++++ src/radvd/patch/series | 2 ++ 7 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 rules/radvd.mk create mode 100644 src/radvd/Makefile create mode 100644 src/radvd/patch/0001-Don-t-treat-out-of-range-MTU-as-an-error.patch create mode 100644 src/radvd/patch/series diff --git a/.gitignore b/.gitignore index fb7ccac93dc4..1d926f3507c9 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,9 @@ src/python-click/* !src/python-click/Makefile src/python3/* !src/python3/Makefile +src/radvd/* +!src/radvd/Makefile +!src/radvd/patch/ src/redis/* !src/redis/Makefile src/snmpd/* diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 9e56515fc1e6..d314a3f262d6 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -9,9 +9,6 @@ ENV DEBIAN_FRONTEND=noninteractive # Update apt's cache of available packages RUN apt-get update -# Install radvd Debian package -RUN apt-get -y install radvd - {% if docker_router_advertiser_debs.strip() -%} # Copy built Debian packages {%- for deb in docker_router_advertiser_debs.split(' ') %} diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index c77ce03d6520..59e0e25ca9e2 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -2,7 +2,7 @@ DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser -$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(REDIS_TOOLS) +$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(RADVD) $(REDIS_TOOLS) $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/radvd.mk b/rules/radvd.mk new file mode 100644 index 000000000000..682f1d5e7595 --- /dev/null +++ b/rules/radvd.mk @@ -0,0 +1,9 @@ +# radvd package + +RADVD_VERSION = 1.9.1-1.3 + +export RADVD_VERSION + +RADVD = radvd_$(RADVD_VERSION)_amd64.deb +$(RADVD)_SRC_PATH = $(SRC_PATH)/radvd +SONIC_MAKE_DEBS += $(RADVD) diff --git a/src/radvd/Makefile b/src/radvd/Makefile new file mode 100644 index 000000000000..9064a43c25c1 --- /dev/null +++ b/src/radvd/Makefile @@ -0,0 +1,30 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = radvd_$(RADVD_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./radvd + + # Clone radvd repo + git clone https://salsa.debian.org/debian/radvd.git + pushd ./radvd + + # Reset HEAD to the commit of the proper tag + # NOTE: Using "git checkout " here detaches our HEAD, + # which stg doesn't like, so we use this method instead + # NOTE: For some reason, tags in the Debian radvd repo are prefixed with "1%" + git reset --hard debian/1\%$(RADVD_VERSION) + + # Apply patches + stg init + stg import -s ../patch/series + + # Build source and Debian packages + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb packages to the destination directory + mv $* $(DERIVED_TARGETS) $(DEST)/ diff --git a/src/radvd/patch/0001-Don-t-treat-out-of-range-MTU-as-an-error.patch b/src/radvd/patch/0001-Don-t-treat-out-of-range-MTU-as-an-error.patch new file mode 100644 index 000000000000..bb77d57814b2 --- /dev/null +++ b/src/radvd/patch/0001-Don-t-treat-out-of-range-MTU-as-an-error.patch @@ -0,0 +1,33 @@ +From e5af09b187bcce4e48ea3f1f71b81329e2d91ea4 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Tue, 12 Feb 2019 19:13:45 +0000 +Subject: [PATCH] Don't treat out-of-range MTU as an error + +--- + interface.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/interface.c b/interface.c +index d17267e..b59c6e8 100644 +--- a/interface.c ++++ b/interface.c +@@ -158,9 +158,14 @@ check_iface(struct Interface *iface) + ((iface->AdvLinkMTU < MIN_AdvLinkMTU) || + (iface->if_maxmtu != -1 && (iface->AdvLinkMTU > iface->if_maxmtu)))) + { +- flog(LOG_ERR, "AdvLinkMTU for %s (%u) must be zero or between %u and %u", ++ // FIXME: Temporary workaround for SONiC. Currently, when interfaces are added ++ // or removed from VLANs, the kernel sets the MTU size for the VLAN to the ++ // default value of 1500. Here, we prevent radvd from treating a larger value ++ // in its configuration as an error. Instead of logging an error and setting ++ // res to -1, we simply log a warning and continue on. Once the aforementioned ++ // behavior is addressed, this patch should be removed. ++ flog(LOG_WARNING, "AdvLinkMTU for %s (%u) must be zero or between %u and %u", + iface->Name, iface->AdvLinkMTU, MIN_AdvLinkMTU, iface->if_maxmtu); +- res = -1; + } + + if (iface->AdvReachableTime > MAX_AdvReachableTime) +-- +2.17.1 + diff --git a/src/radvd/patch/series b/src/radvd/patch/series new file mode 100644 index 000000000000..2892590bfcdb --- /dev/null +++ b/src/radvd/patch/series @@ -0,0 +1,2 @@ +# This series applies on GIT commit 3ab9ce1f298cec3600fdad0a4000c1b1351562fd +0001-Don-t-treat-out-of-range-MTU-as-an-error.patch From 397b552a76ed5348fddceab0f62c4a09d9e3714f Mon Sep 17 00:00:00 2001 From: michealylj1 <46735287+michealylj1@users.noreply.github.com> Date: Thu, 18 Apr 2019 17:27:39 +0800 Subject: [PATCH 068/219] [Devices] Add new device CIG CS6436-56P (#2587) * Add new device CIG CS6436-56P * Delete minigraph.xml It isn't necessary in the current system, just delete it * Update qos.json.j2 * Update port_config.ini Add the speed column. The cmd to show interface status as: root@switch1:~# show interface status Interface Lanes Speed MTU Alias Oper Admin Type Asym PFC ----------- --------------- ------- ----- ------------ ------ ------- ------ ---------- Ethernet0 8 25G 9100 Ethernet1/1 up up SFP N/A Ethernet1 9 25G 9100 Ethernet2/1 up up SFP N/A Ethernet2 10 25G 9100 Ethernet3/1 down down N/A N/A Ethernet3 11 25G 9100 Ethernet4/1 down down N/A N/A Ethernet4 12 25G 9100 Ethernet5/1 down down N/A N/A Ethernet5 13 25G 9100 Ethernet6/1 down down N/A N/A Ethernet6 14 25G 9100 Ethernet7/1 down down N/A N/A Ethernet7 15 25G 9100 Ethernet8/1 down down N/A N/A Ethernet8 16 25G 9100 Ethernet9/1 down down N/A N/A Ethernet9 17 25G 9100 Ethernet10/1 down down N/A N/A Ethernet10 18 25G 9100 Ethernet11/1 down down N/A N/A Ethernet11 19 25G 9100 Ethernet12/1 down down N/A N/A Ethernet12 20 25G 9100 Ethernet13/1 down down N/A N/A Ethernet13 21 25G 9100 Ethernet14/1 down down N/A N/A Ethernet14 22 25G 9100 Ethernet15/1 down down N/A N/A Ethernet15 23 25G 9100 Ethernet16/1 down down N/A N/A Ethernet16 32 25G 9100 Ethernet17/1 down down N/A N/A Ethernet17 33 25G 9100 Ethernet18/1 down down N/A N/A Ethernet18 34 25G 9100 Ethernet19/1 down down N/A N/A Ethernet19 35 25G 9100 Ethernet20/1 down down N/A N/A Ethernet20 40 25G 9100 Ethernet21/1 down down N/A N/A Ethernet21 41 25G 9100 Ethernet22/1 down down N/A N/A Ethernet22 42 25G 9100 Ethernet23/1 down down N/A N/A Ethernet23 43 25G 9100 Ethernet24/1 down down N/A N/A Ethernet24 48 25G 9100 Ethernet25/1 down down N/A N/A Ethernet25 49 25G 9100 Ethernet26/1 down down N/A N/A Ethernet26 50 25G 9100 Ethernet27/1 down down N/A N/A Ethernet27 51 25G 9100 Ethernet28/1 down down N/A N/A Ethernet28 56 25G 9100 Ethernet29/1 down down N/A N/A Ethernet29 57 25G 9100 Ethernet30/1 down down N/A N/A Ethernet30 58 25G 9100 Ethernet31/1 down down N/A N/A Ethernet31 59 25G 9100 Ethernet32/1 down down N/A N/A Ethernet32 64 25G 9100 Ethernet33/1 down down N/A N/A Ethernet33 65 25G 9100 Ethernet34/1 down down N/A N/A Ethernet34 66 25G 9100 Ethernet35/1 down down N/A N/A Ethernet35 67 25G 9100 Ethernet36/1 down down N/A N/A Ethernet36 68 25G 9100 Ethernet37/1 down down N/A N/A Ethernet37 69 25G 9100 Ethernet38/1 down down N/A N/A Ethernet38 70 25G 9100 Ethernet39/1 down down N/A N/A Ethernet39 71 25G 9100 Ethernet40/1 down down N/A N/A Ethernet40 72 25G 9100 Ethernet41/1 down down N/A N/A Ethernet41 73 25G 9100 Ethernet42/1 down down N/A N/A Ethernet42 74 25G 9100 Ethernet43/1 down down N/A N/A Ethernet43 75 25G 9100 Ethernet44/1 down down N/A N/A Ethernet44 76 25G 9100 Ethernet45/1 down down N/A N/A Ethernet45 77 25G 9100 Ethernet46/1 down down N/A N/A Ethernet46 78 25G 9100 Ethernet47/1 down down N/A N/A Ethernet47 79 25G 9100 Ethernet48/1 down down N/A N/A Ethernet48 84,85,86,87 100G 9100 Ethernet49/1 up up QSFP28 N/A Ethernet49 80,81,82,83 100G 9100 Ethernet50/1 up up QSFP28 N/A Ethernet50 92,93,94,95 100G 9100 Ethernet51/1 down down N/A N/A Ethernet51 88,89,90,91 100G 9100 Ethernet52/1 down down N/A N/A Ethernet52 108,109,110,111 100G 9100 Ethernet53/1 down down N/A N/A Ethernet53 104,105,106,107 100G 9100 Ethernet54/1 down down N/A N/A Ethernet54 116,117,118,119 100G 9100 Ethernet55/1 down down N/A N/A Ethernet55 112,113,114,115 100G 9100 Ethernet56/1 down down N/A N/A root@switch1:~# --- .../Cig-CS6436-56P/buffers.json.j2 | 111 ++ .../Cig-CS6436-56P/pg_profile_lookup.ini | 17 + .../Cig-CS6436-56P/port_config.ini | 57 + .../Cig-CS6436-56P/port_config.nps | 702 +++++++ .../Cig-CS6436-56P/port_config.nps.AOC.R0B | 702 +++++++ .../Cig-CS6436-56P/port_config.nps.DAC.R0B | 702 +++++++ .../Cig-CS6436-56P/qos.json.j2 | 1 + .../Cig-CS6436-56P/sai.profile | 2 + .../cig/x86_64-cig_cs6436_56p-r0/default_sku | 1 + .../x86_64-cig_cs6436_56p-r0/installer.conf | 4 + .../led_proc_init.nps | 10 + .../plugins/eeprom.py | 21 + .../plugins/psuutil.py | 92 + .../plugins/sfputil.py | 160 ++ .../cig/x86_64-cig_cs6436_56p-r0/sensors.conf | 13 + platform/nephos/one-image.mk | 5 +- platform/nephos/platform-modules-cig.mk | 12 + platform/nephos/rules.mk | 1 + .../nephos/sonic-platform-modules-cig/LICENSE | 16 + .../sonic-platform-modules-cig/README.md | 1 + .../cs6436-56p/classes/__init__.py | 0 .../cs6436-56p/classes/fanutil.py | 0 .../cs6436-56p/classes/thermalutil.py | 0 .../cs6436-56p/modules/Makefile | 5 + .../cs6436-56p/modules/i2c-algo-lpc.h | 97 + .../cs6436-56p/modules/i2c-algo-lpc2iic.h | 48 + .../modules/x86-64-cig-cs6436-56p-cpld.c | 1632 +++++++++++++++++ .../modules/x86-64-cig-cs6436-56p-fan.c | 451 +++++ .../modules/x86-64-cig-cs6436-56p-led.c | 594 ++++++ .../modules/x86-64-cig-cs6436-56p-psu.c | 586 ++++++ .../modules/x86-64-cig-cs6436-56p-sfp.c | 1454 +++++++++++++++ .../service/cs6436-platform-init.service | 13 + .../service/cs6436-platform-misc.service | 15 + .../cs6436-56p/setup.py | 15 + .../cs6436-56p/utils/cig_cs6436_misc.py | 154 ++ .../cs6436-56p/utils/cig_cs6436_util.py | 538 ++++++ .../debian/changelog | 5 + .../sonic-platform-modules-cig/debian/compat | 1 + .../sonic-platform-modules-cig/debian/control | 11 + .../sonic-platform-modules-cig/debian/rules | 86 + 40 files changed, 8333 insertions(+), 2 deletions(-) create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/default_sku create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/installer.conf create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py create mode 100755 device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf create mode 100644 platform/nephos/platform-modules-cig.mk create mode 100755 platform/nephos/sonic-platform-modules-cig/LICENSE create mode 100755 platform/nephos/sonic-platform-modules-cig/README.md create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/__init__.py create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/fanutil.py create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/thermalutil.py create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py create mode 100755 platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py create mode 100755 platform/nephos/sonic-platform-modules-cig/debian/changelog create mode 100755 platform/nephos/sonic-platform-modules-cig/debian/compat create mode 100755 platform/nephos/sonic-platform-modules-cig/debian/control create mode 100755 platform/nephos/sonic-platform-modules-cig/debian/rules diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 new file mode 100755 index 000000000000..2c391214fa65 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 @@ -0,0 +1,111 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_speed = '10G' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "20971328", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "20971328", + "type": "ingress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "20971328", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, + "BUFFER_PG": { + }, + "BUFFER_QUEUE": { + } +} + \ No newline at end of file diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini new file mode 100755 index 000000000000..d98b0eca6d19 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 3584 32256 59136 36736 + 25000 5m 3584 41216 68096 45696 + 40000 5m 3584 47488 74368 51968 + 50000 5m 3584 52864 79744 57344 + 100000 5m 3584 78400 132160 82880 + 10000 40m 3584 32256 59136 36736 + 25000 40m 3584 41216 68096 45696 + 40000 40m 3584 47488 74368 51968 + 50000 40m 3584 52864 79744 57344 + 100000 40m 3584 78400 132160 82880 + 10000 300m 3584 32256 65856 36736 + 25000 300m 3584 41216 84672 45696 + 40000 300m 3584 47488 101024 51968 + 50000 300m 3584 52864 113120 57344 + 100000 300m 3584 78400 198688 82880 \ No newline at end of file diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini new file mode 100755 index 000000000000..0a25fc0a3454 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 8 Ethernet1/1 0 25000 +Ethernet1 9 Ethernet2/1 1 25000 +Ethernet2 10 Ethernet3/1 2 25000 +Ethernet3 11 Ethernet4/1 3 25000 +Ethernet4 12 Ethernet5/1 4 25000 +Ethernet5 13 Ethernet6/1 5 25000 +Ethernet6 14 Ethernet7/1 6 25000 +Ethernet7 15 Ethernet8/1 7 25000 +Ethernet8 16 Ethernet9/1 8 25000 +Ethernet9 17 Ethernet10/1 9 25000 +Ethernet10 18 Ethernet11/1 10 25000 +Ethernet11 19 Ethernet12/1 11 25000 +Ethernet12 20 Ethernet13/1 12 25000 +Ethernet13 21 Ethernet14/1 13 25000 +Ethernet14 22 Ethernet15/1 14 25000 +Ethernet15 23 Ethernet16/1 15 25000 +Ethernet16 32 Ethernet17/1 16 25000 +Ethernet17 33 Ethernet18/1 17 25000 +Ethernet18 34 Ethernet19/1 18 25000 +Ethernet19 35 Ethernet20/1 19 25000 +Ethernet20 40 Ethernet21/1 20 25000 +Ethernet21 41 Ethernet22/1 21 25000 +Ethernet22 42 Ethernet23/1 22 25000 +Ethernet23 43 Ethernet24/1 23 25000 +Ethernet24 48 Ethernet25/1 24 25000 +Ethernet25 49 Ethernet26/1 25 25000 +Ethernet26 50 Ethernet27/1 26 25000 +Ethernet27 51 Ethernet28/1 27 25000 +Ethernet28 56 Ethernet29/1 28 25000 +Ethernet29 57 Ethernet30/1 29 25000 +Ethernet30 58 Ethernet31/1 30 25000 +Ethernet31 59 Ethernet32/1 31 25000 +Ethernet32 64 Ethernet33/1 32 25000 +Ethernet33 65 Ethernet34/1 33 25000 +Ethernet34 66 Ethernet35/1 34 25000 +Ethernet35 67 Ethernet36/1 35 25000 +Ethernet36 68 Ethernet37/1 36 25000 +Ethernet37 69 Ethernet38/1 37 25000 +Ethernet38 70 Ethernet39/1 38 25000 +Ethernet39 71 Ethernet40/1 39 25000 +Ethernet40 72 Ethernet41/1 40 25000 +Ethernet41 73 Ethernet42/1 41 25000 +Ethernet42 74 Ethernet43/1 42 25000 +Ethernet43 75 Ethernet44/1 43 25000 +Ethernet44 76 Ethernet45/1 44 25000 +Ethernet45 77 Ethernet46/1 45 25000 +Ethernet46 78 Ethernet47/1 46 25000 +Ethernet47 79 Ethernet48/1 47 25000 +Ethernet48 84,85,86,87 Ethernet49/1 48 100000 +Ethernet49 80,81,82,83 Ethernet50/1 49 100000 +Ethernet50 92,93,94,95 Ethernet51/1 50 100000 +Ethernet51 88,89,90,91 Ethernet52/1 51 100000 +Ethernet52 108,109,110,111 Ethernet53/1 52 100000 +Ethernet53 104,105,106,107 Ethernet54/1 53 100000 +Ethernet54 116,117,118,119 Ethernet55/1 54 100000 +Ethernet55 112,113,114,115 Ethernet56/1 55 100000 diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 new file mode 100755 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile new file mode 100755 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/default_sku b/device/cig/x86_64-cig_cs6436_56p-r0/default_sku new file mode 100755 index 000000000000..77eed7781071 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/default_sku @@ -0,0 +1 @@ +Cig-CS6436-56P t1 diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf b/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf new file mode 100755 index 000000000000..01b639138116 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3e8 +CONSOLE_DEV=2 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pci=noaer" diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps b/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps new file mode 100755 index 000000000000..3ba2f35e5517 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps @@ -0,0 +1,10 @@ +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 7 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 + diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py new file mode 100755 index 000000000000..5019b9c40a9a --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/7-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py new file mode 100755 index 000000000000..137531c36e16 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/5-005a", + "/sys/bus/i2c/devices/5-005b"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_power_good' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_present' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 1): + status = 1 + + return status + diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py new file mode 100755 index 000000000000..f5fe6c93142e --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 55 + _qsfp_port_start = 48 + _ports_in_block = 55 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0 : 8, + 1 : 9, + 2 : 10, + 3 : 11, + 4 : 12, + 5 : 13, + 6 : 14, + 7 : 15, + 8 : 16, + 9 : 17, + 10 : 18, + 11 : 19, + 12 : 20, + 13 : 21, + 14 : 22, + 15 : 23, + 16 : 24, + 17 : 25, + 18 : 26, + 19 : 27, + 20 : 28, + 21 : 29, + 22 : 30, + 23 : 31, + 24 : 32, + 25 : 33, + 26 : 34, + 27 : 35, + 28 : 36, + 29 : 37, + 30 : 38, + 31 : 39, + 32 : 40, + 33 : 41, + 34 : 42, + 35 : 43, + 36 : 44, + 37 : 45, + 38 : 46, + 39 : 47, + 40 : 48, + 41 : 49, + 42 : 50, + 43 : 51, + 44 : 52, + 45 : 53, + 46 : 54, + 47 : 55, + 48 : 56, + 49 : 57, + 50 : 58, + 51 : 59, + 52 : 60, + 53 : 61, + 54 : 62, + 55 : 63, + } + + _qsfp_ports = range(_qsfp_port_start, _ports_in_block + 1) + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return self._qsfp_ports + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf b/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf new file mode 100755 index 000000000000..565186de2807 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf @@ -0,0 +1,13 @@ +# libsensors configuration file + +chip "cs6436_56p_fan-*" + label fan1 "front fan 1" + label fan2 "front fan 2" + label fan3 "front fan 3" + label fan4 "front fan 4" + label fan5 "front fan 5" + label fan6 "rear fan 1" + label fan7 "rear fan 2" + label fan8 "rear fan 3" + label fan9 "rear fan 4" + label fan10 "rear fan 5" diff --git a/platform/nephos/one-image.mk b/platform/nephos/one-image.mk index ace042d5ce4f..d29d0e8c9350 100644 --- a/platform/nephos/one-image.mk +++ b/platform/nephos/one-image.mk @@ -5,7 +5,8 @@ $(SONIC_ONE_IMAGE)_MACHINE = nephos $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \ - $(INGRASYS_S9230_64X_PLATFORM_MODULE) \ - $(ACCTON_AS7116_54X_PLATFORM_MODULE) + $(INGRASYS_S9230_64X_PLATFORM_MODULE) \ + $(ACCTON_AS7116_54X_PLATFORM_MODULE) \ + $(CIG_CS6436_56P_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/nephos/platform-modules-cig.mk b/platform/nephos/platform-modules-cig.mk new file mode 100644 index 000000000000..98bbadf9ce3c --- /dev/null +++ b/platform/nephos/platform-modules-cig.mk @@ -0,0 +1,12 @@ +# Cig CS6436 56P Platform modules + +CIG_CS6436_56P_PLATFORM_MODULE_VERSION = 1.0.0 + +export CIG_CS6436_56P_PLATFORM_MODULE_VERSION + +CIG_CS6436_56P_PLATFORM_MODULE = sonic-platform-cig-cs6436-56p_$(CIG_CS6436_56P_PLATFORM_MODULE_VERSION)_amd64.deb +$(CIG_CS6436_56P_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cig +$(CIG_CS6436_56P_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CIG_CS6436_56P_PLATFORM_MODULE)_PLATFORM = x86_64-cig_cs6436_56p-r0 +SONIC_DPKG_DEBS += $(CIG_CS6436_56P_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(CIG_CS6436_56P_PLATFORM_MODULE) \ No newline at end of file diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index bf77ad0e6edf..2e2ee702fb5b 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -2,6 +2,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk +include $(PLATFORM_PATH)/platform-modules-cig.mk include $(PLATFORM_PATH)/docker-orchagent-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk diff --git a/platform/nephos/sonic-platform-modules-cig/LICENSE b/platform/nephos/sonic-platform-modules-cig/LICENSE new file mode 100755 index 000000000000..baf27e167418 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Cambridgeig Technology Corporation + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/nephos/sonic-platform-modules-cig/README.md b/platform/nephos/sonic-platform-modules-cig/README.md new file mode 100755 index 000000000000..9dc23910b59e --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/README.md @@ -0,0 +1 @@ +platform drivers of Cambridgeig products for the SONiC project diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/__init__.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/fanutil.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/fanutil.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/thermalutil.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/thermalutil.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile new file mode 100755 index 000000000000..cdb114aad510 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile @@ -0,0 +1,5 @@ +obj-m := x86-64-cig-cs6436-56p-cpld.o \ + x86-64-cig-cs6436-56p-fan.o \ + x86-64-cig-cs6436-56p-led.o \ + x86-64-cig-cs6436-56p-psu.o \ + x86-64-cig-cs6436-56p-sfp.o diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h new file mode 100755 index 000000000000..7ce6ae378596 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h @@ -0,0 +1,97 @@ +/* -------------------------------------------------------------------- + + * A hwmon driver for the CIG cs6436-56P + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* -------------------------------------------------------------------- */ + +#ifndef I2C_LPC_H +#define I2C_LPC_H 1 + +/* ----- Control register bits ---------------------------------------- */ +#define I2C_LPC_PIN 0x80 +#define I2C_LPC_ESO 0x40 +#define I2C_LPC_ES1 0x20 +#define I2C_LPC_ES2 0x10 +#define I2C_LPC_ENI 0x08 + +#define I2C_LPC_STO 0x40 +#define I2C_LPC_ACK 0x01 + +/*command register*/ +#define I2C_LPC_STA 0x80 +#define I2C_LPC_ABT 0x40 + +/*status register*/ +#define I2C_LPC_TBE 0x02 +#define I2C_LPC_IBB 0x80 +#define I2C_LPC_RBF 0x01 +#define I2C_LPC_TD 0x08 + +#define I2C_LPC_START I2C_LPC_STA +#define I2C_LPC_STOP I2C_LPC_STO +#define I2C_LPC_REPSTART I2C_LPC_STA +#define I2C_LPC_IDLE + +/* ----- Status register bits ----------------------------------------- */ +/*#define I2C_LPC_PIN 0x80 as above*/ + +#define I2C_LPC_INI 0x40 /* 1 if not initialized */ +#define I2C_LPC_STS 0x20 +#define I2C_LPC_BER 0x10 +#define I2C_LPC_AD0 0x08 +#define I2C_LPC_LRB 0x08 +#define I2C_LPC_AAS 0x04 +#define I2C_LPC_LAB 0x02 +#define I2C_LPC_BB 0x80 + +/* ----- Chip clock frequencies --------------------------------------- */ +#define I2C_LPC_CLK3 0x00 +#define I2C_LPC_CLK443 0x10 +#define I2C_LPC_CLK6 0x14 +#define I2C_LPC_CLK 0x18 +#define I2C_LPC_CLK12 0x1c + +/* ----- transmission frequencies ------------------------------------- */ +#define I2C_LPC_TRNS90 0x00 /* 90 kHz */ +#define I2C_LPC_TRNS45 0x01 /* 45 kHz */ +#define I2C_LPC_TRNS11 0x02 /* 11 kHz */ +#define I2C_LPC_TRNS15 0x03 /* 1.5 kHz */ + + +#define I2C_LPC_OWNADR 0 +#define I2C_LPC_INTREG I2C_LPC_ES2 +#define I2C_LPC_CLKREG I2C_LPC_ES1 + +#define I2C_LPC_REG_TEST 0x01 +#define I2C_LPC_REG_BUS_SEL 0x80 +#define I2C_LPC_REG_DEVICE_ADDR 0x81 +#define I2C_LPC_REG_BYTE_COUNT 0x83 +#define I2C_LPC_REG_COMMAND 0x84 +#define I2C_LPC_REG_STATUS 0x85 +#define I2C_LPC_REG_DATA_RX1 0x86 +#define I2C_LPC_REG_DATA_RX2 0x87 +#define I2C_LPC_REG_DATA_RX3 0x88 +#define I2C_LPC_REG_DATA_RX4 0x89 +#define I2C_LPC_REG_DATA_TX1 0x8a +#define I2C_LPC_REG_DATA_TX2 0x8b +#define I2C_LPC_REG_DATA_TX3 0x8c +#define I2C_LPC_REG_DATA_TX4 0x8d + +#endif /* I2C_LPC_H */ diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h new file mode 100755 index 000000000000..6963bef734f1 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h @@ -0,0 +1,48 @@ +/* -------------------------------------------------------------------- + + * A hwmon driver for the CIG cs6436-56P + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* -------------------------------------------------------------------- */ + + +#ifndef _LINUX_I2C_ALGO_LPC_H +#define _LINUX_I2C_ALGO_LPC_H + +struct i2c_algo_lpc_data { + void *data; /* private data for lolevel routines */ + void (*setlpc) (void *data, int ctl, int val); + int (*getlpc) (void *data, int ctl); + int (*getown) (void *data); + int (*getclock) (void *data); + void (*waitforpin) (void *data); + + int (*xfer_begin) (void *data); + int (*xfer_end) (void *data); + + /* Multi-master lost arbitration back-off delay (msecs) + * This should be set by the bus adapter or knowledgable client + * if bus is multi-mastered, else zero + */ + unsigned long lab_mdelay; +}; + +int lpc_add_iic_bus(struct i2c_adapter * adap, unsigned int id); + +#endif /* _LINUX_I2C_ALGO_LPC_H */ diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c new file mode 100755 index 000000000000..a3c6e2db54eb --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c @@ -0,0 +1,1632 @@ +/* + * A hwmon driver for the CIG cs6436-56P CPLD + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c-algo-lpc.h" +#include "i2c-algo-lpc2iic.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef CPLD_USER +# include +#else +# include +#endif + +/* + * ISA bus. + */ + +static void platform_isa_bus_release(struct device * dev) +{ + return ; +} + + +static struct device isa_bus = { + .init_name = "lpc-isa", + .release = platform_isa_bus_release, +}; + +struct isa_dev { + struct device dev; + struct device *next; + unsigned int id; +}; + +#define to_isa_dev(x) container_of((x), struct isa_dev, dev) + +static int isa_bus_match(struct device *dev, struct device_driver *driver) +{ + struct isa_driver *isa_driver = to_isa_driver(driver); + + if (dev->platform_data == isa_driver) { + if (!isa_driver->match || + isa_driver->match(dev, to_isa_dev(dev)->id)) + return 1; + dev->platform_data = NULL; + } + return 0; +} + +static int isa_bus_probe(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->probe) + return isa_driver->probe(dev, to_isa_dev(dev)->id); + + return 0; +} + +static int isa_bus_remove(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->remove) + return isa_driver->remove(dev, to_isa_dev(dev)->id); + + return 0; +} + +static void isa_bus_shutdown(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->shutdown) + isa_driver->shutdown(dev, to_isa_dev(dev)->id); +} + +static int isa_bus_suspend(struct device *dev, pm_message_t state) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->suspend) + return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); + + return 0; +} + +static int isa_bus_resume(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->resume) + return isa_driver->resume(dev, to_isa_dev(dev)->id); + + return 0; +} + +static struct bus_type isa_bus_type = { + .name = "lpc-isa", + .match = isa_bus_match, + .probe = isa_bus_probe, + .remove = isa_bus_remove, + .shutdown = isa_bus_shutdown, + .suspend = isa_bus_suspend, + .resume = isa_bus_resume +}; + +static void isa_dev_release(struct device *dev) +{ + kfree(to_isa_dev(dev)); +} + +void lpc_unregister_driver(struct isa_driver *isa_driver) +{ + struct device *dev = isa_driver->devices; + + while (dev) { + struct device *tmp = to_isa_dev(dev)->next; + device_unregister(dev); + dev = tmp; + } + driver_unregister(&isa_driver->driver); +} + + +int lpc_register_driver(struct isa_driver *isa_driver, unsigned int ndev) +{ + int error; + unsigned int id; + + isa_driver->driver.bus = &isa_bus_type; + isa_driver->devices = NULL; + + error = driver_register(&isa_driver->driver); + if (error) + return error; + + for (id = 0; id < ndev; id++) { + struct isa_dev *isa_dev; + + isa_dev = kzalloc(sizeof *isa_dev, GFP_KERNEL); + if (!isa_dev) { + error = -ENOMEM; + break; + } + + isa_dev->dev.parent = &isa_bus; + isa_dev->dev.bus = &isa_bus_type; + + dev_set_name(&isa_dev->dev, "%s.%u", + isa_driver->driver.name, id); + isa_dev->dev.platform_data = isa_driver; + isa_dev->dev.release = isa_dev_release; + isa_dev->id = id; + + isa_dev->dev.coherent_dma_mask = DMA_BIT_MASK(24); + isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask; + + error = device_register(&isa_dev->dev); + if (error) { + put_device(&isa_dev->dev); + break; + } + + if (isa_dev->dev.platform_data) { + isa_dev->next = isa_driver->devices; + isa_driver->devices = &isa_dev->dev; + } else + device_unregister(&isa_dev->dev); + } + + if (!error && !isa_driver->devices) + error = -ENODEV; + + if (error) + isa_unregister_driver(isa_driver); + + return error; +} + + +int lpc_bus_init(void) +{ + int error; + + error = bus_register(&isa_bus_type); + if (!error) { + error = device_register(&isa_bus); + if (error) + bus_unregister(&isa_bus_type); + } + return error; +} + +void lpc_bus_exit(void) +{ + + device_unregister(&isa_bus); + + bus_unregister(&isa_bus_type); +} + + +/* + * module parameters: + */ +static int i2c_debug = 0; +static struct mutex lpc_lock; + + +#define DEB2(x) if (i2c_debug >= 2) x +#define DEB3(x) if (i2c_debug >= 3) x + /* print several statistical values */ +#define DEBPROTO(x) if (i2c_debug >= 9) x; + /* debug the protocol by showing transferred bits */ +#define DEF_TIMEOUT 160 + + + +/* setting states on the bus with the right timing: */ + +#define set_lpc(adap, ctl, val) adap->setlpc(adap->data, ctl, val) +#define get_lpc(adap, ctl) adap->getlpc(adap->data, ctl) +#define get_own(adap) adap->getown(adap->data) +#define get_clock(adap) adap->getclock(adap->data) +#define i2c_outaddr(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DEVICE_ADDR, val) + +#define i2c_outbyte1(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX1, val) +#define i2c_outbyte2(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX2, val) +#define i2c_outbyte3(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX3, val) +#define i2c_outbyte4(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX4, val) +#define i2c_inbyte1(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX1) +#define i2c_inbyte2(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX2) +#define i2c_inbyte3(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX3) +#define i2c_inbyte4(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX4) + + + +#define LPC_FPRINTF_LOG_PATH "/tmp/file.log" +struct file *lpc_fprintf_file = NULL; + + +static int lpc_fprintf_debug(const char *fmt, ...) +{ + char lpc_fprintf_buf[256]={0}; + + struct va_format vaf; + va_list args; + int r; + unsigned int file_size = 0; + mm_segment_t old_fs; + struct timeval tv; + do_gettimeofday(&tv); + + va_start(args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + r=snprintf(lpc_fprintf_buf,"[%012d.%012d] %pV\n",sizeof(lpc_fprintf_buf),tv.tv_sec, tv.tv_usec, &vaf); + va_end(args); + + old_fs = get_fs(); + set_fs(KERNEL_DS); + lpc_fprintf_file->f_op->write(lpc_fprintf_file, (char *)lpc_fprintf_buf, strlen(lpc_fprintf_buf), &lpc_fprintf_file->f_pos); + set_fs(old_fs); + + memset(lpc_fprintf_buf,0x0,sizeof(lpc_fprintf_buf)); + return r; + +} + + +static int lpc_fprintf_init(void) +{ + mm_segment_t old_fs; + + DEB2(printk("lpc_fprintf_init.\n");) + + + if(lpc_fprintf_file == NULL) + lpc_fprintf_file = filp_open(LPC_FPRINTF_LOG_PATH, O_RDWR | O_APPEND | O_CREAT, 0644); + if (IS_ERR(lpc_fprintf_file)) { + DEB2(printk("error occured while opening file %s, exiting...\n", LPC_FPRINTF_LOG_PATH);) + return 0; + } + + return 0; +} + +static int lpc_fprintf_exit(void) +{ + DEB2(printk("lpc_fprintf_exit.\n");) + + if(lpc_fprintf_file != NULL) + filp_close(lpc_fprintf_file, NULL); + return 0; +} + + +/* other auxiliary functions */ + + +void print_reg(struct i2c_algo_lpc_data *adap) +{ + unsigned char status; + DEBPROTO(lpc_fprintf_debug("================================================\n");) + status = get_lpc(adap, I2C_LPC_REG_BUS_SEL); + DEBPROTO(lpc_fprintf_debug("%s select reg %x : %x\n",__func__,I2C_LPC_REG_BUS_SEL, status);) + status = get_lpc(adap, I2C_LPC_REG_BYTE_COUNT); + DEBPROTO(lpc_fprintf_debug("%s count reg %x : %x\n",__func__,I2C_LPC_REG_BYTE_COUNT, status);) + + status = get_lpc(adap, I2C_LPC_REG_COMMAND); + DEBPROTO(lpc_fprintf_debug("%s command reg %x : %x\n",__func__,I2C_LPC_REG_COMMAND, status);) + status = get_lpc(adap, I2C_LPC_REG_DEVICE_ADDR); + DEBPROTO(lpc_fprintf_debug("%s address reg %x : %x\n",__func__,I2C_LPC_REG_DEVICE_ADDR, status);) + + status = get_lpc(adap, I2C_LPC_REG_STATUS); + DEBPROTO(lpc_fprintf_debug("%s status reg %x : %x\n",__func__,I2C_LPC_REG_STATUS, status);) +} + + + +static void i2c_repstart(struct i2c_algo_lpc_data *adap) +{ + DEBPROTO(lpc_fprintf_debug(" Sr\n")); + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_REPSTART); +} + +static void i2c_stop(struct i2c_algo_lpc_data *adap) +{ + DEBPROTO(lpc_fprintf_debug("%s :\n",__func__);) + + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_STOP); + udelay(60); + set_lpc(adap, I2C_LPC_REG_COMMAND, 0x00); +} + + + + +static void i2c_start(struct i2c_algo_lpc_data *adap) +{ + unsigned char status; + int timeout = DEF_TIMEOUT; + + print_reg(adap); + + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_START); + + print_reg(adap); + +} + + + + +static int wait_for_bb(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status; + + while (--timeout) { + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus free status : %x\n",__func__,status);) + + if(status == I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is free status : %x\n",__func__,status);) + break; + } + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout for free busy status : %x\n",__func__,status);) + return -ETIMEDOUT; + } + + + + return 0; +} + + +static int wait_for_be(int mode,struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + unsigned char status; + + + while (--timeout) { + + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus empty status : %x\n",__func__,status);) + + if(mode == 1) + { + if((status & I2C_LPC_IBB) && (status & I2C_LPC_TBE)) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is empty status : %x\n",__func__,status);) + break; + } + } + else + { + if(status & I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is empty status : %x\n",__func__,status);) + break; + } + } + + status = get_lpc(adap, I2C_LPC_REG_TEST); + + DEBPROTO(lpc_fprintf_debug("%s : The test register data : %x\n",__func__,status);) + udelay(1); /* wait for 100 us */ + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Empty\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + + +static int wait_for_bf(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status; + + + while (--timeout) { + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus full status : %x\n",__func__,status);) + + if(status & I2C_LPC_RBF) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is full status : %x\n",__func__,status);) + break; + } + + status = get_lpc(adap, I2C_LPC_REG_TEST); + + DEBPROTO(lpc_fprintf_debug("%s : The test register data : %x\n",__func__,status);) + udelay(1); /* wait for 100 us */ + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Full\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + +static int wait_for_td(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status=0; + + while (--timeout) { + udelay(4); + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus done status : %x\n",__func__,status);) + + if(status == I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is done status : %x\n",__func__,status);) + break; + } + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Done\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + + + +static int wait_for_pin(struct i2c_algo_lpc_data *adap, int *status) +{ + int timeout = DEF_TIMEOUT; + *status = get_lpc(adap, I2C_LPC_REG_STATUS); + + while ((*status & I2C_LPC_TBE) && --timeout) { + *status = get_lpc(adap, I2C_LPC_REG_STATUS); + } + + if (timeout == 0) + return -ETIMEDOUT; + + + return 0; +} + + +static int lpc_doAddress(struct i2c_algo_lpc_data *adap,struct i2c_msg *msg) +{ + unsigned short flags = msg->flags; + unsigned char addr; + + addr = msg->addr << 1; + if (flags & I2C_M_RD) + { + addr |= 1; + DEBPROTO(lpc_fprintf_debug("step 7 : read mode then write device address 0x%x\n",addr);) + } + else + { + DEBPROTO(lpc_fprintf_debug("step 2 : write mode then write device address 0x%x\n",addr);) + } + + if (flags & I2C_M_REV_DIR_ADDR) + { + addr ^= 1; + + } + i2c_outaddr(adap, addr); + return 0; + +} + + +static int lpc_sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + int i = 0,timeout=0; + + unsigned int count = msg->len; + unsigned char *buf = msg->buf; + + do{ + lpc_doAddress(adap,msg); + set_lpc(adap, I2C_LPC_REG_BYTE_COUNT, (count-i) >= 4 ? 4:(count - i)); + DEBPROTO(lpc_fprintf_debug("step 3 : write register count %x\n",count);) + + if((count -i) >= 4) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + i2c_outbyte3(adap, buf[i+2] & 0xff); + i2c_outbyte4(adap, buf[i+3] & 0xff); + + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+2,buf[i+2]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+3,buf[i+3]);) + i += 4; + } + else if((count -i) == 3) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + i2c_outbyte3(adap, buf[i+2] & 0xff); + + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+2,buf[i+2]);) + + i += 3; + } + else if((count -i) == 2) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + i += 2; + } + else if((count -i) == 1) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + i += 1; + } + + /* Send START */ + DEBPROTO(lpc_fprintf_debug("step 5-1 : Delay 6mS \n");) + udelay(6000); + DEBPROTO(lpc_fprintf_debug("step 5-2 : Start to transfrom \n");) + i2c_stop(adap); + i2c_start(adap); + DEBPROTO(lpc_fprintf_debug("step 5-3 : Start done\n");) + + udelay(400); + DEBPROTO(lpc_fprintf_debug("step 6 : Waiting for BE\n");) + timeout = wait_for_td(adap); + if (timeout) { + DEBPROTO(lpc_fprintf_debug("step 6 : Timeout waiting for BE \n");) + return -1; + } + }while (i < count); + + if(i == count) + { + DEBPROTO(lpc_fprintf_debug("Writen %d bytes successd !\n",count);) + return i; + } + else + { + DEBPROTO(lpc_fprintf_debug("Writen %d bytes failed \n",count);) + return -1; + } +} + +static int lpc_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + int i=0,timeout=0; + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + int wfp; + + unsigned int count = msg->len; + unsigned char *buf = msg->buf; + + do{ + lpc_doAddress(adap,msg); + set_lpc(adap, I2C_LPC_REG_BYTE_COUNT, (count-i) >= 4 ? 4:(count - i)); + DEBPROTO(lpc_fprintf_debug("step 8 : write register count %d\n",count);) + + /* Send START */ + DEBPROTO(lpc_fprintf_debug("step 9-1 : Delay 6mS\n");) + udelay(6000); + DEBPROTO(lpc_fprintf_debug("step 9-2 : Start to receive data\n");) + i2c_stop(adap); + i2c_start(adap); + DEBPROTO(lpc_fprintf_debug("step 9-3 : Start done\n");) + + udelay(400); + DEBPROTO(lpc_fprintf_debug("step 10 : Waiting for TD\n");) + timeout = wait_for_td(adap); + if (timeout) { + DEBPROTO(lpc_fprintf_debug("step 10 : Timeout waiting for TD \n");) + return -1; + } + + if((count -i) >= 4) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + buf[i+2] = 0xff & i2c_inbyte3(adap); + buf[i+3] = 0xff & i2c_inbyte4(adap); + + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+2,buf[i+2]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+3,buf[i+3]);) + + i += 4; + } + else if((count -i) == 3) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + buf[i+2] = 0xff & i2c_inbyte3(adap); + + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+2,buf[i+2]);) + + i += 3; + } + else if((count -i) == 2) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + i += 2; + } + else if((count -i) == 1) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + i += 1; + } + + + }while(i < count); + + if(i == count) + { + DEBPROTO(lpc_fprintf_debug("Read %d bytes successd !\n",count);) + return i; + } + else + { + DEBPROTO(lpc_fprintf_debug("Read %d bytes failed \n",count);) + return -1; + } + + return i; +} + + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; +#define LPC_I2C_MAX_NCHANS 6 + + +struct lpc_iic { + struct i2c_adapter *virt_adaps[LPC_I2C_MAX_NCHANS]; + u8 last_chan; /* last register value */ +}; + + +static int lpc_master_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg *msgs, + int num) +{ + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + struct i2c_msg *pmsg; + int i; + int ret=0, timeout, status; + + mutex_lock(&lpc_lock); + + if (adap->xfer_begin) + adap->xfer_begin(&i2c_adap->nr); + + + for (i = 0;ret >= 0 && i < num; i++) { + pmsg = &msgs[i]; + + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: Doing %s %d bytes to 0x%02x - %d of %d messages\n", + pmsg->flags & I2C_M_RD ? "read" : "write", + pmsg->len, pmsg->addr, i + 1, num);) + + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: Msg %d, addr=0x%x, flags=0x%x, len=%d\n", + i, msgs[i].addr, msgs[i].flags, msgs[i].len);) + + if (pmsg->flags & I2C_M_RD) { + ret = lpc_readbytes(i2c_adap, pmsg); + + if (ret != pmsg->len) { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: fail: " + "only read %d bytes.\n",ret)); + } else { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: read %d bytes.\n",ret)); + } + } else { + + ret = lpc_sendbytes(i2c_adap, pmsg); + + if (ret != pmsg->len) { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: fail: " + "only wrote %d bytes.\n",ret)); + } else { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: wrote %d bytes.\n",ret)); + } + } + } + + if (adap->xfer_end) + adap->xfer_end(&i2c_adap->nr); + + mutex_unlock(&lpc_lock); + + return i; + +} + + +static u32 lpc_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_QUICK; +} + +/* exported algorithm data: */ +static const struct i2c_algorithm lpc_algo = { + .master_xfer = lpc_master_xfer, + //.smbus_xfer = lpc_smbus_xfer, + .functionality = lpc_func, +}; + + +/* + * registering functions to load algorithms at runtime + */ +int lpc_add_iic_bus(struct i2c_adapter *adap,unsigned int id) +{ + //struct i2c_algo_lpc_data *lpc_adap = adap->3; + int rval,num; + + DEB2(dev_dbg(&adap->dev, "hw routines registered.\n")); + + /* register new adapter to i2c module... */ + adap->algo = &lpc_algo; + + for(num = 0; num < LPC_I2C_MAX_NCHANS;num++) + { + adap->nr = num; + snprintf(adap->name, sizeof(adap->name), + "i2c-%d-lpc (chan_id %d)", i2c_adapter_id(adap), num); + if(num) + { + rval = i2c_add_numbered_adapter(adap); + } + else + { + rval = i2c_add_adapter(adap); + } + } + return rval; +} +EXPORT_SYMBOL(lpc_add_iic_bus); + + +#define DEFAULT_BASE 0x0a00 + +static int lpc_base= 0x0a00; +static u8 __iomem *lpc_base_iomem; + +static int lpc_irq; +static int lpc_clock = 0x1c; +static int lpc_own = 0x55; +static int lpc_mmapped; + +static unsigned long lpc_base_addr = 0x0a00; +static unsigned int lpc_io_space_size = 2; + +static unsigned long LPC_INDEX_REG; +static unsigned long LPC_DATA_REG; + + +/* notice : removed static struct i2c_lpc_iic gpi; code - + this module in real supports only one device, due to missing arguments + in some functions, called from the algo-lpc module. Sometimes it's + need to be rewriten - but for now just remove this for simpler reading */ + +static wait_queue_head_t lpc_wait; +static int lpc_pending; +static spinlock_t lock; +static spinlock_t lpc_slock; + +static struct i2c_adapter lpc_iic_ops; + +struct cpld_dev_type { + struct resource *io_resource; + struct semaphore sem; + struct cdev cdev; +}; + +struct cpld_dev_type *cpld_device; + + +/* ----- local functions ---------------------------------------------- */ + +static void lpc_cpld_setbyte(void *data, int ctl, int val) +{ + //udelay(2); + outb(ctl, LPC_INDEX_REG); + mb(); + + outb(val, LPC_DATA_REG); + mb(); +} + +static int lpc_cpld_getbyte(void *data, int ctl) +{ + u8 val = 0; + //udelay(2); + outb(ctl, LPC_INDEX_REG); + mb(); + + val = inb(LPC_DATA_REG); + mb(); + + return val; +} + +static void lpc_iic_setbyte(void *data, int ctl, int val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + lpc_cpld_setbyte(data,ctl,val); + + up(&cpld_device->sem); + DEB2(printk("%s REG[%x] = %x\n",__func__,ctl,val);) +} + +static int lpc_iic_getbyte(void *data, int ctl) +{ + u8 val = 0; + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + val = lpc_cpld_getbyte(data,ctl); + + up(&cpld_device->sem); + DEB2(printk("%s REG[%x] = %x\n",__func__,ctl,val);) + return val; +} + +int cig_cpld_read_register(u8 reg_off, u8 *val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + *val = lpc_cpld_getbyte(cpld_device, reg_off); + + up(&cpld_device->sem); + + return 0; +} +EXPORT_SYMBOL(cig_cpld_read_register); + +int cig_cpld_write_register(u8 reg_off, u8 val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + lpc_cpld_setbyte(cpld_device, reg_off, val); + up(&cpld_device->sem); + return 0; +} +EXPORT_SYMBOL(cig_cpld_write_register); + + + +static int lpc_iic_getown(void *data) +{ + return (lpc_own); +} + + +static int lpc_iic_getclock(void *data) +{ + return (lpc_clock); +} + +static void lpc_iic_waitforpin(void *data) +{ + DEFINE_WAIT(wait); + int timeout = 2; + unsigned long flags; + + if (lpc_irq > 0) { + spin_lock_irqsave(&lock, flags); + if (lpc_pending == 0) { + spin_unlock_irqrestore(&lock, flags); + prepare_to_wait(&lpc_wait, &wait, TASK_INTERRUPTIBLE); + if (schedule_timeout(timeout*HZ)) { + spin_lock_irqsave(&lock, flags); + if (lpc_pending == 1) { + lpc_pending = 0; + } + spin_unlock_irqrestore(&lock, flags); + } + finish_wait(&lpc_wait, &wait); + } else { + lpc_pending = 0; + spin_unlock_irqrestore(&lock, flags); + } + } else { + udelay(100); + } +} + + +static irqreturn_t lpc_iic_handler(int this_irq, void *dev_id) { + spin_lock(&lock); + lpc_pending = 1; + spin_unlock(&lock); + wake_up_interruptible(&lpc_wait); + return IRQ_HANDLED; +} + +static int board_id = 0; + + +static int lpc_select_chan(void *data) +{ + unsigned int chan_id=0; + chan_id = *(unsigned int *)data; + chan_id -= 1; + DEB2(printk("step 1 : selest channel id = %d\n",chan_id);) + lpc_iic_setbyte(data,I2C_LPC_REG_BUS_SEL,chan_id); + + return 0; +} + +static int lpc_deselect_chan(void *data) +{ + + unsigned int chan_id=0; + chan_id = *(unsigned int *)data; + chan_id -= 1; + DEB2(printk("step last :deselect channel id = %d\n",chan_id);) + + return 0; +} + + +/* ------------------------------------------------------------------------ + * Encapsulate the above functions in the correct operations structure. + * This is only done when more than one hardware adapter is supported. + */ +static struct i2c_algo_lpc_data lpc_iic_data = { + .setlpc = lpc_iic_setbyte, + .getlpc = lpc_iic_getbyte, + .getown = lpc_iic_getown, + .getclock = lpc_iic_getclock, + .waitforpin = lpc_iic_waitforpin, + .xfer_begin = lpc_select_chan, + .xfer_end = lpc_deselect_chan, +}; + +#include + +static struct i2c_adapter lpc_iic_arr_ops[LPC_I2C_MAX_NCHANS] = {0}; + +static void dummy_setscl(void *data, int state) +{ + return 1; +} + +static void dummy_setsda(void *data, int state) +{ + return 1; + +} + +static int dummy_getscl(void *data) +{ + return 1; + +} + +static int dummy_getsda(void *data) +{ + return 1; +} + + +static struct i2c_algo_bit_data dummy_algo_data = { + .setsda = dummy_setsda, + .setscl = dummy_setscl, + .getsda = dummy_getsda, + .getscl = dummy_getscl, + .udelay = 50, + .timeout = HZ, +}; + + +static int dummy_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg *msgs, + int num) +{ + return 1; +} + +static u32 dummy_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_QUICK; +} + + +static const struct i2c_algorithm dummy_algo = { + .master_xfer = dummy_xfer, + .functionality = dummy_func, +}; + + + +static struct i2c_adapter i2c_dummy = { + .owner = THIS_MODULE, + .class = I2C_CLASS_HWMON, + .algo_data = &dummy_algo_data, + .algo = &dummy_algo, + .name = "i2c_dummy", +}; + + +static int lpc_iic_match(struct device *dev, unsigned int id) +{ + /* sanity checks for lpc_mmapped I/O */ + + DEB2(printk("lpc_iic_match\n");) + + + if (lpc_base < DEFAULT_BASE) { + dev_err(dev, "incorrect lpc_base address (%#x) specified " + "for lpc_mmapped I/O\n", lpc_base); + return 0; + } + + if (lpc_base == 0) { + lpc_base = DEFAULT_BASE; + } + return 1; +} + +static int lpc_iic_probe(struct device *dev, unsigned int id) +{ + int rval,num; + + lpc_fprintf_init(); + + DEB2(printk("lpc_iic_probe\n");) + + mutex_init(&lpc_lock); + if(board_id == 1) + i2c_add_adapter(&i2c_dummy); + + for(num = 0; num < LPC_I2C_MAX_NCHANS;num++) + { + lpc_iic_arr_ops[num].dev.parent = dev; + lpc_iic_arr_ops[num].owner = THIS_MODULE; + lpc_iic_arr_ops[num].class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + lpc_iic_arr_ops[num].algo = &lpc_algo; + lpc_iic_arr_ops[num].algo_data = &lpc_iic_data, + lpc_iic_arr_ops[num].nr=num; + snprintf(lpc_iic_arr_ops[num].name, sizeof(lpc_iic_arr_ops[num].name), "i2c-%d-lpc", i2c_adapter_id(&lpc_iic_arr_ops[num]), num); + rval |= i2c_add_adapter(&lpc_iic_arr_ops[num]); + DEB2(printk("%s\n",lpc_iic_arr_ops[num].name);) + } + + return 0; +} + +static int lpc_iic_remove(struct device *dev, unsigned int id) +{ + int num; + DEB2(printk("lpc_iic_remove\n")); + + lpc_fprintf_exit(); + for(num = LPC_I2C_MAX_NCHANS - 1; num >= 0 ;num--) + i2c_del_adapter(&lpc_iic_arr_ops[num]); + + if(board_id == 1) + i2c_del_adapter(&i2c_dummy); + + return 0; +} + +static struct isa_driver i2c_lpc_driver = { + .match = lpc_iic_match, + .probe = lpc_iic_probe, + .remove = lpc_iic_remove, + .driver = { + .owner = THIS_MODULE, + .name = "lpc-iic", + }, +}; + + +struct kset cpld_kset; +static int cpld_major = 0; +static int cpld_minor = 0; + +struct cpld_rw_msg { + unsigned char addr; + unsigned char data; +}; + + +static struct cpld_rw_msg param_read = {-1}; +static struct cpld_rw_msg param_write = {-1}; + +void cpld_sysfs_kobj_release(struct kobject *kobj) +{ + return; +} + +int cpld_sysfs_add_attr(struct kobject* kobj, char* attr_name) +{ + + struct attribute *attr; + + attr = kmalloc(sizeof(struct attribute), GFP_KERNEL); + attr->name = attr_name; + attr->mode = 0644; + + return sysfs_create_file(kobj, attr); +} + + +static ssize_t cpld_sysfs_show(struct kobject *kobj, struct attribute *attr, char *buffer) +{ + u8 val,ret; + + if (0 == strcmp(attr->name, "read")) + { + val = lpc_iic_getbyte(NULL,param_read.addr); + ret = sprintf(buffer,"read : addr = %x val = %x\n",param_read.addr, val); + + } + else if (0 == strcmp(attr->name, "write")) + { + lpc_iic_setbyte(NULL, param_write.addr,param_write.data); + ret = sprintf(buffer,"write : addr = %x val = %x\n",param_write.addr, param_write.data); + } + else if (0 == strcmp(attr->name, "version")) + { + val = lpc_iic_getbyte(NULL, 0x02); + ret = sprintf(buffer,"CPLD version : V%02x\n",val); + } + + return ret; + +} + +static ssize_t cpld_sysfs_store(struct kobject *kobj, struct attribute *attr, const char *buffer, size_t count) +{ + int param[3]; + + if (0 == strcmp(attr->name, "read")) + { + sscanf(buffer, "0x%02x", ¶m[0]); + param_read.addr = param[0]; + } + else if (0 == strcmp(attr->name, "write")) + { + sscanf(buffer, "0x%2x 0x%02x", ¶m[0], ¶m[1]); + param_write.addr = param[0]; + param_write.data = param[1]; + } + return count; +} + + + +static struct sysfs_ops cpld_sysfs_ops = +{ + .show = cpld_sysfs_show, + .store = cpld_sysfs_store, +}; + +static struct kobj_type cpld_kobj_type = +{ + .release = cpld_sysfs_kobj_release, + .sysfs_ops = &cpld_sysfs_ops, + .default_attrs = NULL, +}; + + +static const char driver_name[] = "cpld_drv"; +static atomic_t cpld_available = ATOMIC_INIT(1); +static struct class *cpld_class; +#define CPLD_IOC_MAGIC '[' + +#define CPLD_IOC_RDREG _IOR(CPLD_IOC_MAGIC, 0, struct cpld_rw_msg) +#define CPLD_IOC_WRREG _IOW(CPLD_IOC_MAGIC, 1, struct cpld_rw_msg) + +#define CPLD_IOC_MAXNR 2 + + +int cpld_open(struct inode *inode, struct file *filp) +{ + struct cpld_dev_type *dev; + + if (! atomic_dec_and_test(&cpld_available)) { + atomic_inc(&cpld_available); + return -EBUSY; + } + + dev = container_of(inode->i_cdev, struct cpld_dev_type, cdev); + filp->private_data = dev; + + return 0; +} + +int cpld_release(struct inode *inode, struct file *flip) +{ + atomic_inc(&cpld_available); + return 0; +} + + +long cpld_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + int rc = 0; + int err = 0; + struct cpld_dev_type *dev = (struct cpld_dev_type *)filp->private_data; + struct cpld_rw_msg msg; + + if (_IOC_TYPE(cmd) != CPLD_IOC_MAGIC) + return -ENOTTY; + if (_IOC_NR(cmd) > CPLD_IOC_MAXNR) + return -ENOTTY; + + if (_IOC_DIR(cmd) & _IOC_READ) + err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); + if (_IOC_DIR(cmd) & _IOC_WRITE) + err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); + if (err) + return -EFAULT; + + if (down_interruptible(&dev->sem)) + return -ERESTARTSYS; + + switch(cmd){ + case CPLD_IOC_RDREG: + rc = copy_from_user(&msg, (void __user *)arg, sizeof(msg)); + if (!rc) { + msg.data = lpc_cpld_getbyte(dev, msg.addr); + rc = copy_to_user((void __user *)arg, &msg, sizeof(msg)); + } + break; + + case CPLD_IOC_WRREG: + rc = copy_from_user(&msg, (void __user *)arg, sizeof(msg)); + if (!rc) { + lpc_cpld_setbyte(dev, msg.addr, msg.data); + } + break; + default: + rc = -ENOTTY; + break; + } + up(&dev->sem); + + return rc; +} + +struct file_operations cpld_fops = { + .owner = THIS_MODULE, + .open = cpld_open, + .unlocked_ioctl = cpld_ioctl, + .release = cpld_release, +}; + + +static void cpld_setup_cdev(struct cpld_dev_type *dev) +{ + int err, devno = MKDEV(cpld_major, cpld_minor); + + cdev_init(&dev->cdev, &cpld_fops); + dev->cdev.owner = THIS_MODULE; + dev->cdev.ops = &cpld_fops; + err = cdev_add(&dev->cdev, devno, 1); + + if (err) + DEB2(printk(KERN_NOTICE "Error %d adding cpld", err);) +} +//#define CPLD_KTHREAD_TEST +#ifdef CPLD_KTHREAD_TEST +#include +#include +#include +#include +#include +#include +static struct task_struct *test_TaskStruct; +void get_random_bytes(void *buf, int nbytes); + +#define LM75_REAR_LEFT_PATH "/sys/class/hwmon/hwmon5/temp1_input" +#define LM75_REAR_RIGHT_PATH "/sys/class/hwmon/hwmon6/temp1_input" + + +static int threadTask(void* arg) +{ + static int count =0; + unsigned char lpc_read_data=0; + unsigned char lpc_write_data=0; + unsigned char lpc_random_data=0; + + struct file *temp1_file = NULL,*temp2_file = NULL; + unsigned char temp1_buffer[8]={0},temp2_buffer[8]={0}; + + mm_segment_t old_fs; + while(1) + { + if(kthread_should_stop()) + { + DEB2(printk("threadTask: kthread_should_stop\n")); + break; + } + +#if 1 + get_random_bytes(&lpc_random_data,1); + + lpc_write_data = lpc_random_data; + + lpc_iic_setbyte(NULL,I2C_LPC_REG_TEST,lpc_write_data); + //DEB2(printk("threadTask: lpc write reg[01] data : %02x\n",lpc_write_data)); + + lpc_read_data = lpc_iic_getbyte(NULL,I2C_LPC_REG_TEST); + //DEB2(printk("threadTask: lpc read reg[01] data : %02x\n",lpc_read_data)); + udelay(10000); + if(lpc_write_data != lpc_read_data) + { + printk("Error : WRITE %02x != READ %02x\n",lpc_write_data,lpc_read_data); + } + msleep(10); +#else + + if(temp1_file != NULL) + temp1_file = filp_open(LM75_REAR_LEFT_PATH, O_RDONLY , 0); + if (IS_ERR(temp1_file)) { + printk("error occured while opening file %s, exiting...\n", LM75_REAR_LEFT_PATH); + } + + if(temp2_file != NULL) + temp2_file = filp_open(LM75_REAR_RIGHT_PATH, O_RDONLY ,0); + if (IS_ERR(temp2_file)) { + printk("error occured while opening file %s, exiting...\n", LM75_REAR_RIGHT_PATH); + } + + + old_fs = get_fs(); + set_fs(KERNEL_DS); + + temp1_file->f_op->read(temp1_file, (char *)temp1_buffer, strlen(temp1_buffer), &temp1_file->f_pos); + + temp2_file->f_op->read(temp2_file, (char *)temp2_buffer, strlen(temp2_buffer), &temp2_file->f_pos); + + set_fs(old_fs); + + if((simple_strtoul(temp1_buffer,NULL,10) >=30000) || (simple_strtoul(temp2_buffer,NULL,10) >=30000)) + { + lpc_iic_setbyte(NULL,0x40,0xff); + printk("Full speed\n"); + } + + msleep(1000); +#endif + } +} + +static int init_kernel_Thread(void) +{ + test_TaskStruct=kthread_create(threadTask,NULL,"KernelThead",0); + if(IS_ERR(test_TaskStruct)) + { + printk("kthread_create error\n"); + } + else + { + wake_up_process(test_TaskStruct); + } + return 0; +} + +static void exit_kernel_Thread(void) +{ + kthread_stop(test_TaskStruct); + test_TaskStruct = NULL; +} + +#endif + + +static int __init cpld_init(void) +{ + int rval,rc; + dev_t dev; + + DEB2(printk("cpld_init\n");) + + cpld_device = kzalloc(sizeof(struct cpld_dev_type), GFP_KERNEL); + if (!cpld_device) + goto error3; + cpld_device->io_resource = request_region(lpc_base_addr, + lpc_io_space_size, "lpc-i2c"); + if (!cpld_device->io_resource) { + DEB2(printk("lpc: claim I/O resource fail\n");) + goto error2; + } + sema_init(&cpld_device->sem, 1); + + LPC_INDEX_REG = lpc_base_addr; + LPC_DATA_REG = lpc_base_addr + 1; + + rval = lpc_bus_init(); + rval = lpc_register_driver(&i2c_lpc_driver, 1); + + kobject_set_name(&cpld_kset.kobj, "cpld"); + cpld_kset.kobj.ktype= &cpld_kobj_type; + kset_register(&cpld_kset); + cpld_sysfs_add_attr(&cpld_kset.kobj, "read"); + cpld_sysfs_add_attr(&cpld_kset.kobj, "write"); + cpld_sysfs_add_attr(&cpld_kset.kobj, "version"); + + if (cpld_major) { + dev = MKDEV(cpld_major, cpld_minor); + rc = register_chrdev_region(dev, 1, "cpld"); + } else { + rc = alloc_chrdev_region(&dev, cpld_major, 1, "cpld"); + cpld_major = MAJOR(dev); + } + + cpld_setup_cdev(cpld_device); + + cpld_class = class_create(THIS_MODULE, KBUILD_MODNAME); + if (!cpld_class) { + DEB2(printk("failed to create class\n");) + goto error1; + } + + device_create(cpld_class, NULL, dev, NULL, "cpld"); +#ifdef CPLD_KTHREAD_TEST + init_kernel_Thread(); +#endif + + return 0; +error1: + cdev_del(&cpld_device->cdev); + unregister_chrdev_region(dev, 1); +error2: + release_resource(cpld_device->io_resource); +error3: + kfree(cpld_device); + + return rc; +} + +static void __exit cpld_exit(void) +{ + DEB2(printk("cpld_exit\n")); + + lpc_unregister_driver(&i2c_lpc_driver); + lpc_bus_exit(); +#ifdef CPLD_KTHREAD_TEST + exit_kernel_Thread(); +#endif + dev_t devno = MKDEV(cpld_major, cpld_minor); + + cdev_del(&cpld_device->cdev); + if (cpld_class) { + device_destroy(cpld_class, devno); + class_destroy(cpld_class); + } + + kobject_put(&cpld_kset.kobj); + + if(cpld_kset.kobj.ktype) + kset_unregister(&cpld_kset); + + if (cpld_device) { + if (cpld_device->io_resource) + release_resource(cpld_device->io_resource); + + kfree(cpld_device); + } + unregister_chrdev_region(devno, 1); + + +} + +module_param(cpld_major, int, S_IRUGO); +module_param(cpld_minor, int, S_IRUGO); +module_param(i2c_debug, int, S_IRUGO); +module_param(board_id, int, S_IRUGO); + +module_init(cpld_init); +module_exit(cpld_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436-56p-cpld driver"); +MODULE_LICENSE("GPL"); + + + + + + + + + + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c new file mode 100755 index 000000000000..09beb6912c32 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c @@ -0,0 +1,451 @@ +/* + * A hwmon driver for the CIG cs6436-56P fan + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define FAN_SPEED_DUTY_TO_CPLD_STEP 10 + +static struct cs6436_56p_fan_data *cs6436_56p_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +extern int cig_cpld_write_register(u8 reg_off, u8 val); +extern int cig_cpld_read_register(u8 reg_off, u8 *val); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x41, /* fan enable/disable */ + 0x40, /* fan PWM(for all fan) */ + 0x42, /* front fan 1 speed(rpm) */ + 0x44, /* front fan 2 speed(rpm) */ + 0x46, /* front fan 3 speed(rpm) */ + 0x48, /* front fan 4 speed(rpm) */ + 0x4a, /* front fan 5 speed(rpm) */ + 0x43, /* rear fan 1 speed(rpm) */ + 0x45, /* rear fan 2 speed(rpm) */ + 0x47, /* rear fan 3 speed(rpm) */ + 0x49, /* rear fan 4 speed(rpm) */ + 0x4b, /* rear fan 5 speed(rpm) */ +}; + + +/* Each client has this additional data */ +struct cs6436_56p_fan_data { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ +}; + +static struct cs6436_56p_fan_data *fan_data = NULL; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, +}; + +enum sysfs_fan_attributes { + FAN_STATE_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN1_STATE, + FAN2_STATE, + FAN3_STATE, + FAN4_STATE, + FAN5_STATE, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, +}; + +/* Define attributes + */ +#define DECLARE_FAN_STATE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_state, S_IRUGO, fan_show_value, NULL, FAN##index##_STATE) +#define DECLARE_FAN_STATE_ATTR(index) &sensor_dev_attr_fan##index##_state.dev_attr.attr + +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr + +/* 5 fan state attributes in this platform */ +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(4); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(5); + + +/* 5 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); + +/* 5 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5); + +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); + +static struct attribute *cs6436_56p_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_STATE_ATTR(1), + DECLARE_FAN_STATE_ATTR(2), + DECLARE_FAN_STATE_ATTR(3), + DECLARE_FAN_STATE_ATTR(4), + DECLARE_FAN_STATE_ATTR(5), + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + DECLARE_FAN_FAULT_ATTR(5), + DECLARE_FAN_SPEED_RPM_ATTR(1), + DECLARE_FAN_SPEED_RPM_ATTR(2), + DECLARE_FAN_SPEED_RPM_ATTR(3), + DECLARE_FAN_SPEED_RPM_ATTR(4), + DECLARE_FAN_SPEED_RPM_ATTR(5), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + if (reg_val +== 0xFF) { + return 100; + } + return ((u32)(reg_val) * 100)/ 255; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + if (duty_cycle >= FAN_MAX_DUTY_CYCLE) { + return 0xFF; + } + + return 255 / 10 * (duty_cycle / 10); +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_is_state(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct cs6436_56p_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value <= 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + cig_cpld_write_register(fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + cs6436_56p_fan_update_device(dev); + + struct cs6436_56p_fan_data *data = fan_data; + + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + + case FAN1_STATE: + case FAN2_STATE: + case FAN3_STATE: + case FAN4_STATE: + case FAN5_STATE: + //printk("FAN_STATE_REG: 0x%x\n", data->reg_val[FAN_STATE_REG]); + //printk("index: %d\n", attr->index); + ret = sprintf(buf, "%d\n", + reg_val_to_is_state(data->reg_val[FAN_STATE_REG], + attr->index - FAN1_STATE)); + break; + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: +// printk("FAN_seed_REG: 0x%x\n", data->reg_val[attr->index]); +// printk("index: %d\n", attr->index); + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group cs6436_56p_fan_group = { + .attrs = cs6436_56p_fan_attributes, +}; + +static struct cs6436_56p_fan_data *cs6436_56p_fan_update_device(struct device *dev) +{ + struct cs6436_56p_fan_data *data = fan_data; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + u8 status; + (void)cig_cpld_read_register(fan_reg[i], &status); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int cs6436_56p_fan_probe(struct platform_device *pdev) +{ + int status = -1; + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &cs6436_56p_fan_group); + if (status) { + goto exit; + + } + + fan_data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(fan_data->hwmon_dev)) { + status = PTR_ERR(fan_data->hwmon_dev); + goto exit_remove; + } + + dev_info(&pdev->dev, "cs6436_56p_fan\n"); + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &cs6436_56p_fan_group); +exit: + return status; +} + +static int cs6436_56p_fan_remove(struct platform_device *pdev) +{ + hwmon_device_unregister(fan_data->hwmon_dev); + sysfs_remove_group(&fan_data->pdev->dev.kobj, &cs6436_56p_fan_group); + + return 0; +} + +#define DRVNAME "cs6436_56p_fan" + +static struct platform_driver cs6436_56p_fan_driver = { + .probe = cs6436_56p_fan_probe, + .remove = cs6436_56p_fan_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + + + + + +static int __init cs6436_56p_fan_init(void) +{ + int ret; + + cig_cpld_write_register(0x40, duty_cycle_to_reg_val(50)); + + ret = platform_driver_register(&cs6436_56p_fan_driver); + if (ret < 0) { + goto exit; + } + + fan_data = kzalloc(sizeof(struct cs6436_56p_fan_data), GFP_KERNEL); + if (!fan_data) { + ret = -ENOMEM; + platform_driver_unregister(&cs6436_56p_fan_driver); + goto exit; + } + + mutex_init(&fan_data->update_lock); + fan_data->valid = 0; + + fan_data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fan_data->pdev)) { + ret = PTR_ERR(fan_data->pdev); + platform_driver_unregister(&cs6436_56p_fan_driver); + kfree(fan_data); + goto exit; + } + +exit: + return ret; +} + +static void __exit cs6436_56p_fan_exit(void) +{ + platform_device_unregister(fan_data->pdev); + platform_driver_unregister(&cs6436_56p_fan_driver); + kfree(fan_data); +} + +MODULE_AUTHOR("CIG"); +MODULE_DESCRIPTION("cs6436_56p_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(cs6436_56p_fan_init); +module_exit(cs6436_56p_fan_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c new file mode 100755 index 000000000000..4c7c629f3e7b --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c @@ -0,0 +1,594 @@ +/* + * A hwmon driver for the CIG cs6436-56P LED + * + * Copyright (C) 2018 Cambridge, Inc. + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int cig_cpld_write_register(u8 reg_off, u8 val); + +extern int cig_cpld_read_register(u8 reg_off, u8 *val); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "cs6436_56p_led" + +struct cs6436_56p_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[6]; /* 0: system & location + 1: PSU1 &PSU12 + 2: fan & management + 3: console & ToD + 4-5 : fan1-fan5*/ +}; + +static struct cs6436_56p_led_data *ledctl = NULL; + +/* LED related data + */ +#define LED_TYPE_PSU1_REG_MASK 0x0C +#define LED_MODE_PSU1_GREEN_MASK 0x08 +#define LED_MODE_PSU1_RED_MASK 0x04 +#define LED_MODE_PSU1_AMBER_MASK 0x0C +#define LED_MODE_PSU1_OFF_MASK 0x00 + +#define LED_TYPE_PSU2_REG_MASK 0x30 +#define LED_MODE_PSU2_GREEN_MASK 0x20 +#define LED_MODE_PSU2_RED_MASK 0x10 +#define LED_MODE_PSU2_AMBER_MASK 0x30 +#define LED_MODE_PSU2_OFF_MASK 0x00 + +#define LED_TYPE_SYS_REG_MASK 0xF0 +#define LED_MODE_SYS_GREEN_MASK 0x40 +#define LED_MODE_SYS_RED_MASK 0x20 +#define LED_MODE_SYS_AMBER_MASK 0x60 +#define LED_MODE_SYS_AMBER_FLASHING_MASK 0x70 +#define LED_MODE_SYS_OFF_MASK 0x00 + +#define LED_TYPE_RES_REG_MASK 0x0F +#define LED_MODE_RES_GREEN_MASK 0x04 +#define LED_MODE_RES_RED_MASK 0x02 +#define LED_MODE_RES_AMBER_MASK 0x06 +#define LED_MODE_RES_AMBER_FLASHING_MASK 0x07 +#define LED_MODE_RES_OFF_MASK 0x00 + +#define LED_TYPE_FAN_REG_MASK 0x03 +#define LED_MODE_FAN_GREEN_MASK 0x02 +#define LED_MODE_FAN_RED_MASK 0x01 +#define LED_MODE_FAN_AMBER_MASK 0x03 +#define LED_MODE_FAN_OFF_MASK 0x00 + +#define LED_TYPE_FAN1_REG_MASK 0x03 +#define LED_TYPE_FAN2_REG_MASK 0x0C +#define LED_TYPE_FAN3_REG_MASK 0x30 +#define LED_TYPE_FAN4_REG_MASK 0xC0 +#define LED_TYPE_FAN5_REG_MASK 0x03 + +#define LED_MODE_FANX_GREEN_MASK 0x02 +#define LED_MODE_FANX_RED_MASK 0x01 +#define LED_MODE_FANX_AMBER_MASK 0x03 +#define LED_MODE_FANX_OFF_MASK 0x00 + +enum led_type { + LED_TYPE_SYS, + LED_TYPE_PSU2, + LED_TYPE_PSU1, + LED_TYPE_FAN, + LED_TYPE_FAN1, + LED_TYPE_FAN2, + LED_TYPE_FAN3, + LED_TYPE_FAN4, + LED_TYPE_FAN5, +}; + +static const u8 led_reg[] = { + 0x30, /* system & reserved*/ + 0x31, /* fan & PSU1 & PSU2 */ + 0x32, /* FAN5 LED */ + 0x33, /* FAN1-4 LED */ +}; + + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_GREEN_FLASHING, + LED_MODE_AMBER_FLASHING, + LED_MODE_RED_FLASHING, + LED_MODE_AUTO, + LED_MODE_UNKNOWN +}; + +struct led_type_mode { + enum led_type type; + int type_mask; + enum led_light_mode mode; + int mode_mask; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU1_GREEN_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU1_AMBER_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_RED, LED_MODE_PSU1_RED_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_OFF, LED_MODE_PSU1_OFF_MASK}, + +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU2_GREEN_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU2_AMBER_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_RED, LED_MODE_PSU2_RED_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_OFF, LED_MODE_PSU2_OFF_MASK}, + +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_GREEN, LED_MODE_SYS_GREEN_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_AMBER, LED_MODE_SYS_AMBER_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_RED, LED_MODE_SYS_RED_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_AMBER_FLASHING, LED_MODE_SYS_AMBER_FLASHING_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_OFF, LED_MODE_SYS_OFF_MASK}, + +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_GREEN, LED_MODE_FAN_GREEN_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AMBER, LED_MODE_FAN_AMBER_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_RED, LED_MODE_FAN_RED_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_OFF, LED_MODE_FAN_OFF_MASK}, + +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 2}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 4}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 6}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +}; + +struct fanx_info_s { + u8 cname; /* device name */ + enum led_type type; + u8 reg_id; /* map to led_reg & reg_val */ +}; + +static struct fanx_info_s fanx_info[] = { + {'1', LED_TYPE_FAN1, 3}, + {'2', LED_TYPE_FAN2, 3}, + {'3', LED_TYPE_FAN3, 3}, + {'4', LED_TYPE_FAN4, 3}, + {'5', LED_TYPE_FAN5, 2}, +}; + + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + break; + } + + return reg_val; +} + +static void cs6436_56p_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting cs6436_56p_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + u8 status; + cig_cpld_read_register(led_reg[i], &status); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void cs6436_56p_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + u8 reg_val; + mutex_lock(&ledctl->update_lock); + + cig_cpld_read_register(reg, ®_val); + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + + cig_cpld_write_register(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void cs6436_56p_led_fanx_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (led_cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[reg_id], led_type1); + return; + } + } +} + + +static enum led_brightness cs6436_56p_led_fanx_get(struct led_classdev *cdev) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(led_type1, ledctl->reg_val[reg_id]); + } + } + + return led_reg_val_to_light_mode(LED_TYPE_FAN1, ledctl->reg_val[5]); +} + + +static void cs6436_56p_led_psu1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness cs6436_56p_led_psu1_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_psu2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness cs6436_56p_led_psu2_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_sys_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode,led_reg[0], LED_TYPE_SYS); +} + +static enum led_brightness cs6436_56p_led_sys_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_SYS, ledctl->reg_val[0]); +} + + +static enum led_brightness cs6436_56p_led_fan_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_FAN); +} + + +static struct led_classdev cs6436_56p_leds[] = { + [LED_TYPE_SYS] = { + .name = "cs6436_56p_led::sys", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_sys_set, + .brightness_get = cs6436_56p_led_sys_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN] = { + .name = "cs6436_56p_led::fan", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fan_set, + .brightness_get = cs6436_56p_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + + [LED_TYPE_PSU1] = { + .name = "cs6436_56p_led::psu1", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_psu1_set, + .brightness_get = cs6436_56p_led_psu1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "cs6436_56p_led::psu2", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_psu2_set, + .brightness_get = cs6436_56p_led_psu2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + + [LED_TYPE_FAN1] = { + .name = "cs6436_56p_led::fan1", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN2] = { + .name = "cs6436_56p_led::fan2", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN3] = { + .name = "cs6436_56p_led::fan3", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN4] = { + .name = "cs6436_56p_led::fan4", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN5] = { + .name = "cs6436_56p_led::fan5", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + } +}; + +static int cs6436_56p_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_suspend(&cs6436_56p_leds[i]); + } + + return 0; +} + +static int cs6436_56p_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_resume(&cs6436_56p_leds[i]); + } + + return 0; +} + +static int cs6436_56p_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + ret = led_classdev_register(&pdev->dev, &cs6436_56p_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(cs6436_56p_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&cs6436_56p_leds[i]); + } + } + + return ret; +} + +static int cs6436_56p_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_unregister(&cs6436_56p_leds[i]); + } + + return 0; +} + +static struct platform_driver cs6436_56p_led_driver = { + .probe = cs6436_56p_led_probe, + .remove = cs6436_56p_led_remove, + .suspend = cs6436_56p_led_suspend, + .resume = cs6436_56p_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int cs6436_56p_led_default(void) +{ + cig_cpld_write_register(0x30, 0x40);// system green led solid on +} + +static int __init cs6436_56p_led_init(void) +{ + int ret; + + ret = platform_driver_register(&cs6436_56p_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct cs6436_56p_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&cs6436_56p_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&cs6436_56p_led_driver); + kfree(ledctl); + goto exit; + } + + cs6436_56p_led_default(); + +exit: + return ret; +} + +static void __exit cs6436_56p_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&cs6436_56p_led_driver); + kfree(ledctl); +} + +module_init(cs6436_56p_led_init); +module_exit(cs6436_56p_led_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_led driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c new file mode 100755 index 000000000000..8754007408c7 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c @@ -0,0 +1,586 @@ +/* + * A hwmon driver for the CIG cs6436-56P Power Module + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Address scanned */ +static const unsigned short normal_i2c[] = {I2C_CLIENT_END }; + +/* This is additional data */ +struct cs6436_56p_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; /* In jiffies */ + + /* Registers value */ + u8 vout_mode; + u16 v_in; + u16 v_out; + u16 i_in; + u16 i_out; + u16 p_in; + u16 p_out; + u16 temp_input[3]; + u8 temp_fault; + u8 fan_fault; + u16 fan_duty_cycle[2]; + u16 fan_speed[2]; + u8 mfr_id[8]; + u8 mfr_model[20]; + u8 mfr_serial[20]; + u8 psu_is_present; + u8 psu_is_good; +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count); +static ssize_t for_linear_data(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_fan_fault(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_fan_warning(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_temp_fault(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_temp_warning(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_vout_data(struct device *dev, struct device_attribute *dev_attr, char *buf); +static int cs6436_56p_psu_read_byte(struct i2c_client *client, u8 reg); +static int cs6436_56p_psu_read_word(struct i2c_client *client, u8 reg); +static int cs6436_56p_psu_write_word(struct i2c_client *client, u8 reg, u16 value); +static int cs6436_56p_psu_read_block(struct i2c_client *client, u8 command, u8 *data, int data_len); +static struct cs6436_56p_psu_data *cs6436_56p_psu_update_device(struct device *dev); +static ssize_t for_ascii(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr, char *buf); + +enum cs6436_56p_psu_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_TEMP2_INPUT, + PSU_TEMP3_INPUT, + PSU_TEMP_FAULT, + PSU_TEMP_WARN, + PSU_FAN1_FAULT, + PSU_FAN1_WARN, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_SERIAL, + PSU_PRESENT, + PSU_P_GOOD, +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + + bool is_negative = valid_data >> (valid_bit - 1); + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct i2c_client *client = to_i2c_client(dev); + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cs6436_56p_psu_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t for_linear_data(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_TEMP2_INPUT: + value = data->temp_input[1]; + break; + case PSU_TEMP3_INPUT: + value = data->temp_input[2]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_fan_fault(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t for_fan_warning(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_WARN) ? 5 : 4; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t for_temp_fault(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + + return sprintf(buf, "%d\n", data->temp_fault >> 7); +} + +static ssize_t for_temp_warning(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + return sprintf(buf, "%d\n", data->temp_fault >> 6); +} +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", ((mantissa * multiplier) >> (-exponent))); +} + +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) + return 0; + + switch (attr->index) { + case PSU_MFR_ID: + ptr = data->mfr_id + 1; + break; + case PSU_MFR_MODEL: + ptr = data->mfr_model + 1; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial + 1; + break; + default: + return 0; + } + return sprintf(buf, "%s\n", ptr); +} + + +static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + u8 *ptr = NULL; + + u8 status = 0; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_PRESENT) { + status = data->psu_is_present; + } + else { /* PSU_POWER_GOOD */ + status = data->psu_is_good; + } + + return sprintf(buf, "%d\n", status); +} + + + +static int cs6436_56p_psu_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cs6436_56p_psu_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cs6436_56p_psu_write_word(struct i2c_client *client, u8 reg, \ + u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_xfer(client->adapter, client->addr, + client->flags |= I2C_CLIENT_PEC, + I2C_SMBUS_WRITE, reg, + I2C_SMBUS_WORD_DATA, &data); + +} + +static int cs6436_56p_psu_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, + data); + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; +abort: + return result; + +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cs6436_56p_psu_data *cs6436_56p_psu_update_device( \ + struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + + if (time_after(jiffies, data->last_updated)) { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = { + {0x20, &data->vout_mode}, + {0x81, &data->fan_fault}, + {0x7d, &data->temp_fault}, + }; + struct reg_data_word regs_word[] = { + {0x88, &data->v_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x97, &data->p_in}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x8f, &(data->temp_input[2])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x90, &(data->fan_speed[0])}, + }; + + dev_dbg(&client->dev, "start data update\n"); + + /* one milliseconds from now */ + data->last_updated = jiffies + HZ / 1000; + + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cs6436_56p_psu_read_byte(client, + regs_byte[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } else { + *(regs_byte[i].value) = status; + } + } + + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cs6436_56p_psu_read_word(client, + regs_word[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } else { + *(regs_word[i].value) = status; + } + } + + command = 0x99; /* PSU mfr_id */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_id, ARRAY_SIZE(data->mfr_id) - 1); + data->mfr_id[ARRAY_SIZE(data->mfr_id) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + command = 0x9a; /* PSU mfr_model */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + command = 0x9e; /* PSU mfr_serial */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + data->valid = 1; + data->psu_is_present = strlen(data->mfr_id) > 1 ? 1:0; + if(data->psu_is_present) + data->psu_is_good = ((data->fan_fault) || (data->temp_fault))? 0:1; + else + data->psu_is_good = 0; + } + + mutex_unlock(&data->update_lock); + + return data; + +} + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, for_linear_data, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, for_vout_data, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, for_linear_data, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, for_linear_data, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, for_linear_data, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, for_linear_data, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp2_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP2_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp3_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP3_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, for_temp_fault, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_temp_warning, S_IRUGO, for_temp_warning, NULL, PSU_TEMP_WARN); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, for_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_warning, S_IRUGO, for_fan_warning, NULL, PSU_FAN1_WARN); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, for_linear_data, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, for_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, for_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, for_status, NULL, PSU_P_GOOD); + + + +static struct attribute *cs6436_56p_psu_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_temp2_input.dev_attr.attr, + &sensor_dev_attr_psu_temp3_input.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_temp_warning.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_warning.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static const struct attribute_group cs6436_56p_psu_group = { + .attrs = cs6436_56p_psu_attributes, +}; + +static int cs6436_56p_psu_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cs6436_56p_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "new chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cs6436_56p_psu_group); + if (status) + goto exit_sysfs_create_group; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_hwmon_device_register; + } + + return 0; + +exit_hwmon_device_register: + sysfs_remove_group(&client->dev.kobj, &cs6436_56p_psu_group); +exit_sysfs_create_group: + kfree(data); +exit: + return status; +} + +static int cs6436_56p_psu_remove(struct i2c_client *client) +{ + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cs6436_56p_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + cs6436_56p_psu1, + cs6436_56p_psu2 +}; + +static const struct i2c_device_id cs6436_56p_psu_id[] = { + { "cs6436_56p_psu1", cs6436_56p_psu1 }, + { "cs6436_56p_psu2", cs6436_56p_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cs6436_56p_psu_id); + +static struct i2c_driver cs6436_56p_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cs6436_56p_psu", + }, + .probe = cs6436_56p_psu_probe, + .remove = cs6436_56p_psu_remove, + .id_table = cs6436_56p_psu_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(cs6436_56p_psu_driver); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c new file mode 100755 index 000000000000..f2b54a260fcb --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c @@ -0,0 +1,1454 @@ +/* + * A hwmon driver for the CIG cs6436-56P SFP Module + * + * Copyright (C) 2018 Cambridge, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "cs6436_56p_sfp" /* Platform dependent */ + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 /* Platform dependent */ +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) +#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + + +#define ADDR_REG_SFP_STATUS_ADDR 0X62 //reg addr +R/W# //1031 +#define ADDR_REG_SFP_STATUS_TX 0X63 // write data +#define ADDR_REG_SFP_STATUS_RX 0X64 //read data +#define ADDR_REG_SFP_STATUS_COMMAND 0X65 //cmd bit7=1,go +#define ADDR_REG_SFP_STATUS_STATUS 0X66 //status + + + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);; +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int cig_cpld_read_register(u8 reg_off, u8 *val); +extern int cig_cpld_write_register(u8 reg_off, u8 val); + + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL +}; + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); +static SENSOR_DEVICE_ATTR(sfp_rx_los_all, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS_ALL); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +/* SFP ddm attributes for sysfs */ +static struct attribute *sfp_ddm_attributes[] = { + NULL +}; + +/* Platform dependent +++ */ +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +cs6436_56p_sfp1, cs6436_56p_sfp2, cs6436_56p_sfp3, cs6436_56p_sfp4, +cs6436_56p_sfp5, cs6436_56p_sfp6, cs6436_56p_sfp7, cs6436_56p_sfp8, +cs6436_56p_sfp9, cs6436_56p_sfp10, cs6436_56p_sfp11, cs6436_56p_sfp12, +cs6436_56p_sfp13, cs6436_56p_sfp14, cs6436_56p_sfp15, cs6436_56p_sfp16, +cs6436_56p_sfp17, cs6436_56p_sfp18, cs6436_56p_sfp19, cs6436_56p_sfp20, +cs6436_56p_sfp21, cs6436_56p_sfp22, cs6436_56p_sfp23, cs6436_56p_sfp24, +cs6436_56p_sfp25, cs6436_56p_sfp26, cs6436_56p_sfp27, cs6436_56p_sfp28, +cs6436_56p_sfp29, cs6436_56p_sfp30, cs6436_56p_sfp31, cs6436_56p_sfp32, +cs6436_56p_sfp33, cs6436_56p_sfp34, cs6436_56p_sfp35, cs6436_56p_sfp36, +cs6436_56p_sfp37, cs6436_56p_sfp38, cs6436_56p_sfp39, cs6436_56p_sfp40, +cs6436_56p_sfp41, cs6436_56p_sfp42, cs6436_56p_sfp43, cs6436_56p_sfp44, +cs6436_56p_sfp45, cs6436_56p_sfp46, cs6436_56p_sfp47, cs6436_56p_sfp48, +cs6436_56p_sfp49, cs6436_56p_sfp50, cs6436_56p_sfp51, cs6436_56p_sfp52, +cs6436_56p_sfp53, cs6436_56p_sfp54, cs6436_56p_sfp55, cs6436_56p_sfp56 +}; + +#define I2C_DEV_ID(x) { #x, x} + +static const struct i2c_device_id sfp_device_id[] = { +I2C_DEV_ID(cs6436_56p_sfp1), +I2C_DEV_ID(cs6436_56p_sfp2), +I2C_DEV_ID(cs6436_56p_sfp3), +I2C_DEV_ID(cs6436_56p_sfp4), +I2C_DEV_ID(cs6436_56p_sfp5), +I2C_DEV_ID(cs6436_56p_sfp6), +I2C_DEV_ID(cs6436_56p_sfp7), +I2C_DEV_ID(cs6436_56p_sfp8), +I2C_DEV_ID(cs6436_56p_sfp9), +I2C_DEV_ID(cs6436_56p_sfp10), +I2C_DEV_ID(cs6436_56p_sfp11), +I2C_DEV_ID(cs6436_56p_sfp12), +I2C_DEV_ID(cs6436_56p_sfp13), +I2C_DEV_ID(cs6436_56p_sfp14), +I2C_DEV_ID(cs6436_56p_sfp15), +I2C_DEV_ID(cs6436_56p_sfp16), +I2C_DEV_ID(cs6436_56p_sfp17), +I2C_DEV_ID(cs6436_56p_sfp18), +I2C_DEV_ID(cs6436_56p_sfp19), +I2C_DEV_ID(cs6436_56p_sfp20), +I2C_DEV_ID(cs6436_56p_sfp21), +I2C_DEV_ID(cs6436_56p_sfp22), +I2C_DEV_ID(cs6436_56p_sfp23), +I2C_DEV_ID(cs6436_56p_sfp24), +I2C_DEV_ID(cs6436_56p_sfp25), +I2C_DEV_ID(cs6436_56p_sfp26), +I2C_DEV_ID(cs6436_56p_sfp27), +I2C_DEV_ID(cs6436_56p_sfp28), +I2C_DEV_ID(cs6436_56p_sfp29), +I2C_DEV_ID(cs6436_56p_sfp30), +I2C_DEV_ID(cs6436_56p_sfp31), +I2C_DEV_ID(cs6436_56p_sfp32), +I2C_DEV_ID(cs6436_56p_sfp33), +I2C_DEV_ID(cs6436_56p_sfp34), +I2C_DEV_ID(cs6436_56p_sfp35), +I2C_DEV_ID(cs6436_56p_sfp36), +I2C_DEV_ID(cs6436_56p_sfp37), +I2C_DEV_ID(cs6436_56p_sfp38), +I2C_DEV_ID(cs6436_56p_sfp39), +I2C_DEV_ID(cs6436_56p_sfp40), +I2C_DEV_ID(cs6436_56p_sfp41), +I2C_DEV_ID(cs6436_56p_sfp42), +I2C_DEV_ID(cs6436_56p_sfp43), +I2C_DEV_ID(cs6436_56p_sfp44), +I2C_DEV_ID(cs6436_56p_sfp45), +I2C_DEV_ID(cs6436_56p_sfp46), +I2C_DEV_ID(cs6436_56p_sfp47), +I2C_DEV_ID(cs6436_56p_sfp48), +I2C_DEV_ID(cs6436_56p_sfp49), +I2C_DEV_ID(cs6436_56p_sfp50), +I2C_DEV_ID(cs6436_56p_sfp51), +I2C_DEV_ID(cs6436_56p_sfp52), +I2C_DEV_ID(cs6436_56p_sfp53), +I2C_DEV_ID(cs6436_56p_sfp54), +I2C_DEV_ID(cs6436_56p_sfp55), +I2C_DEV_ID(cs6436_56p_sfp56), +{ /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[6]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss + 3 => device id + 4 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 5 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +#define WAIT_TIME_OUT_COUNT 100 + +static int cig_cpld_write_sfp_register(u8 sfp_reg_addr, u8 sfp_write_reg_data) +{ + u8 sfp_read_status = 0; + u8 wait_time_out = WAIT_TIME_OUT_COUNT; + + cig_cpld_write_register(ADDR_REG_SFP_STATUS_ADDR, sfp_reg_addr << 1); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_TX, sfp_write_reg_data); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_COMMAND, 0x80); + do{ + cig_cpld_read_register(ADDR_REG_SFP_STATUS_STATUS, &sfp_read_status); + udelay(60); + wait_time_out--; + if(wait_time_out == 0) + break; + }while(sfp_read_status != 0x02); + + if(wait_time_out == 0) + return -1; + + return 1; +} + + +static int cig_cpld_read_sfp_register(u8 sfp_reg_addr, u8 *sfp_read_reg_data) +{ + u8 sfp_read_status = 0; + u8 wait_time_out = WAIT_TIME_OUT_COUNT; + + cig_cpld_write_register(ADDR_REG_SFP_STATUS_ADDR, sfp_reg_addr << 1 | 1); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_COMMAND, 0x80); + do{ + udelay(60); + cig_cpld_read_register(ADDR_REG_SFP_STATUS_STATUS, &sfp_read_status); + wait_time_out--; + if(wait_time_out == 0) + break; + }while(sfp_read_status != 0x01); + + cig_cpld_read_register(ADDR_REG_SFP_STATUS_RX,sfp_read_reg_data); + + if(wait_time_out == 0) + return -1; + + return 1; +} + + + + + + +/* Platform dependent +++ */ +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + int i = 0, j = 0, status = -1; + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0; + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + data->present = 0; + + udelay(6000); + + /* Read present status of port 1~48(SFP port) */ + for (i = 0; i < 6; i++) { + cpld_reg_addr = 1 + i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->present |= (u64)cpld_reg_data << (i*8); + + DEBUG_PRINT("Present status = 0x%lx\r\n", data->present); + } + + /* Read present status of port 49-56(QSFP port) */ + cpld_reg_addr = 25; + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + else { + data->present |= (u64)cpld_reg_data << 48; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0, j = 0; + int status = -1; + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0; + + if (time_before(jiffies, data->msa->last_updated + HZ + HZ / 2) && data->msa->valid) { + return data; + } + + DEBUG_PRINT("Starting cs6436_56p sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->msa->valid = 0; + memset(data->msa->status, 0, sizeof(data->msa->status)); + + udelay(6000); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 6; i++) { + cpld_reg_addr = 13+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[0] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[0] = 0x%lx\r\n", data->msa->status[0]); + } + + + for (i = 0; i < 6; i++) { + cpld_reg_addr = 19+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[1] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[1] = 0x%lx\r\n", data->msa->status[1]); + } + + for (i = 0; i < 6; i++) { + cpld_reg_addr = 7+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[2] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[2] = 0x%lx\r\n", data->msa->status[2]); + } + + data->msa->valid = 1; + data->msa->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0,cpld_reg_bit = 0,cpld_reg_val = 0; + long disable; + int error; + + if (data->driver_type == DRIVER_TYPE_QSFP) { + return qsfp_set_tx_disable(dev, da, buf, count); + } + + error = kstrtol(buf, 10, &disable); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + udelay(6000); + + if(data->port <= 48) { + cpld_reg_addr = 19 + data->port / 8; + cpld_reg_bit = 1 << (data->port); + } + + /* Read current status */ + error = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + + /* Update tx_disable status */ + if (disable) { + data->msa->status[1] |= BIT_INDEX(data->port); + cpld_reg_data |= cpld_reg_bit; + } + else { + data->msa->status[1] &= ~BIT_INDEX(data->port); + cpld_reg_data &= ~cpld_reg_bit; + } + + error = cig_cpld_write_sfp_register(cpld_reg_addr,cpld_reg_data); + + mutex_unlock(&data->update_lock); + return count; +} +/* Platform dependent --- */ + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = sfp_update_present(client); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + return !(data->present & BIT_INDEX(data->port)); /* Platform dependent */ +} + +/* Platform dependent +++ */ +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if (PRESENT_ALL == attr->index) { + int i; + u8 values[7] = {0}; + struct sfp_port_data *data = sfp_update_present(client); + + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = ~(u8)(data->present >> (i * 8)); + } + + /* Return values 1 -> 56 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5], + values[6]); + } + else { + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + /* PRESENT */ + return sprintf(buf, "%d\n", present); + } +} +/* Platform dependent --- */ + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = buf; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + if (!present) { + /* port is not present */ + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + DEBUG_PRINT(""); + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + DEBUG_PRINT("Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + DEBUG_PRINT(""); + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + } + msleep(200); + DEBUG_PRINT(""); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + DEBUG_PRINT(""); + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + +exit: + DEBUG_PRINT(""); + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + int present; + u8 val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT(""); + present = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + DEBUG_PRINT(""); + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + DEBUG_PRINT(""); + data = qsfp_update_tx_rx_status(dev); + DEBUG_PRINT(""); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + DEBUG_PRINT(""); + switch (attr->index) { + case TX_FAULT: + val = !!(data->qsfp->status[2] & 0xF); + break; + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)); + break; + case TX_DISABLE: + val = data->qsfp->status[1] & 0xF; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)); + break; + case RX_LOS: + val = !!(data->qsfp->status[0] & 0xF); + break; + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)); + break; + default: + break; + } + + DEBUG_PRINT(""); + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (!status) { + /* port is not present */ + return -ENXIO; + } + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + mutex_lock(&data->update_lock); + + if (attr->index == TX_DISABLE) { + data->qsfp->status[1] = disable & 0xF; + } + else {/* TX_DISABLE1 ~ TX_DISABLE4*/ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + status = sfp_eeprom_write(data->client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + if (unlikely(status < 0)) { + count = status; + } + + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (status == 0) { + /* port is not present */ + return -ENODEV; + } + + status = sfp_eeprom_read(client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (unlikely(status < 0)) { + return status; + } + + return sprintf(buf, "%d\n", !!(ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK)); +} + +/* Platform dependent +++ */ +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("driver type = (%d)", data->driver_type); + if (data->driver_type == DRIVER_TYPE_QSFP) { + DEBUG_PRINT(""); + return qsfp_show_tx_rx_status(dev, da, buf); + } + + DEBUG_PRINT(""); + data = sfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + if(attr->index == RX_LOS_ALL) { + int i = 0; + u8 values[6] = {0}; + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = (u8)(data->msa->status[2] >> (i * 8)); + } + + /** Return values 1 -> 48 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5]); + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + break; + } + + val = !!(data->msa->status[index] & BIT_INDEX(data->port)); + return sprintf(buf, "%d\n", val); +} +/* Platform dependent --- */ +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return data_len; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, command, *data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return 1; +#endif + + +} + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + goto abort; + } + if (unlikely(status != data_len)) { + status = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return status; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, command); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, status); + goto abort; + } + + *data = (u8)status; + status = 1; + +abort: + return status; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + + /* Bring QSFPs out of reset */ + //cig_lpc_write(0x62, 0x15, 0x3F); + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +/* Platform dependent +++ */ +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (dev_id->driver_data >= cs6436_56p_sfp1 && dev_id->driver_data <= cs6436_56p_sfp48) { + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_MSA; + return sfp_msa_probe(client, dev_id, &data->msa); + } + else if (client->addr == SFP_EEPROM_A2_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_DDM; + return sfp_ddm_probe(client, dev_id, &data->ddm); + } + } + else { /* cs6436_56p_sfp49 ~ cs6436_56p_sfp56 */ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); + } + } + + return -ENODEV; +} +/* Platform dependent --- */ + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver cs6436_56p_sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(cs6436_56p_sfp_driver); + + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_sfp driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service new file mode 100755 index 000000000000..3936b54dee2f --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Cig CS6436-56P Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cig_cs6436_util.py install +ExecStop=/usr/local/bin/cig_cs6436_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service new file mode 100755 index 000000000000..7ff410cbb3c1 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service @@ -0,0 +1,15 @@ +[Unit] +Description=Cig CS6436-56P Platform miscellaneous service +After=cs6436-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/cig_cs6436_misc.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py new file mode 100755 index 000000000000..c17c10c83190 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='cs6436-56p', + version='1.0.0', + description='Module to initialize Cig CS6436-56P platforms', + + packages=['cs6436-56p'], + package_dir={'cs6436-56p': 'cs6436-56p/classes'}, + ) diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py new file mode 100755 index 000000000000..08decef98ad0 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Cambridge, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple +from threading import Thread + +DEBUG = False +i2c_prefix = '/sys/bus/i2c/devices/' +cs6436__prefix = '/sys/devices/platform/cs6436_56p_led/leds/' + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"5-005a", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"5-005b", 0) + ret3, log = log_os_system("ls "+cs6436__prefix+"cs6436_56p_led*", 0) + return not(ret1 or ret2 or ret3) + + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + + +def system_misc_polling(threadName,delay): + for count in range(1,5): + if device_exist() == False: + time.sleep(delay+3) + print "%s: %s, count=%d" % ( threadName, time.ctime(time.time()), count) + else: + break + + if count == 4: + return + + status, output = log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::sys/brightness", 1) + status, output = log_os_system("hwconfig -cfp 1", 1) + + while 1: + status, output = log_os_system("cat /sys/bus/i2c/devices/5-005a/psu_present", 1) + if status: + print "failed to check status for 5-005a/psu_present" + continue + + if output=='1': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu1/brightness", 1) + else: + log_os_system("echo 0 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu1/brightness", 1) + + status, output = log_os_system("cat /sys/bus/i2c/devices/5-005b/psu_present", 1) + if status: + print "failed to check status for 5-005b/psu_present" + continue + + if output=='1': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu2/brightness", 1) + else: + log_os_system("echo 0 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu2/brightness", 1) + + status, fan1 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan1_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan1_fault" + continue + + if fan1=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan1/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan1/brightness", 1) + + status, fan2 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan2_fault",1) + + if status: + print "failed to check status for cs6436_56p_fan/fan2_fault" + continue + + if fan2=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan2/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan2/brightness", 1) + + status, fan3 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan3_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan3_fault" + continue + + if fan3=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan3/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan3/brightness", 1) + + status, fan4 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan4_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan4_fault" + continue + + if fan4=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan4/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan4/brightness", 1) + + status, fan5 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan5_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan5_fault" + continue + + if fan5=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan5/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan5/brightness", 1) + + if fan1=='0' or fan2=='0' or fan3=='0' or fan4=='0' or fan5=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan/brightness", 1) + time.sleep(delay) + print "%s: %s" % ( threadName, time.ctime(time.time())) + return + +if __name__ == '__main__': + target=system_misc_polling("Thread-misc",3) + + + + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py new file mode 100755 index 000000000000..2b64d2e107b9 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py @@ -0,0 +1,538 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Cambridge, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'cs6436_56p' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':9, 'fan':5, 'thermal':4, 'psu':2, 'sfp':56} +FORCE = 0 + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + for count in range(1,5): + time.sleep(1) + ret, lsmod = log_os_system("lsmod| grep i2c_i801", 0) + if len(lsmod) > 2: + log_os_system("rmmod i2c_i801", 0) + break + + ret, lsmod = log_os_system("lsmod| grep i2c_designware_platform", 0) + if len(lsmod) > 2: + log_os_system("rmmod i2c_designware_platform", 0) + log_os_system("modprobe i2c-designware-platform", 0) + + ret, lsmod = log_os_system("lsmod| grep cig", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ + 'depmod', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe x86-64-cig-cs6436-56p-cpld ' , + 'modprobe x86-64-cig-cs6436-56p-fan' , + 'modprobe x86-64-cig-cs6436-56p-psu' , + 'modprobe x86-64-cig-cs6436-56p-sfp' , + 'modprobe x86-64-cig-cs6436-56p-led' ] + +def driver_install(): + global FORCE + + for i in range(0,len(kos)): + if i == 3: + ret, board_type = log_os_system("cat /proc/cpuinfo | grep \"model name\" | cut -b 32-39 | head -n 1", 0) + if board_type=='i3-6100U': + kos[i] =kos[i] + 'board_id=1' + + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['sys','fan','fan1','fan2','fan3','fan4','fan5','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['4-0048','4-0049', '5-004a', '5-004b'] , + 'psu': ['5-005a','5-005b'], + 'sfp': ['-0050']} +i2c_nodes = {'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +fan_prefix ='/sys/bus/platform/devices/'+PROJECT_NAME+'_fan' +fan_types = {'fan': ['fan1','fan2', 'fan3', 'fan4', 'fan5']} +fan_nodes = {'fan': ['state', 'front_speed_rpm', 'rear_speed_rpm', 'fault']} + + +sfp_map = [8,9,10,11,12,13,14,15,16, + 17,18,19,20,21,22,23,24,25,26, + 27,28,29,30,31,32,33,34,35,36, + 37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56, + 57,58,59,60,61,62,63] + +mknod =[ + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo cs6436_56p_psu1 0x5a > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo cs6436_56p_psu2 0x5b > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo cs6436_56p_psu1 0x52 > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo cs6436_56p_psu2 0x53 > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo 24c128 0x57 > /sys/bus/i2c/devices/i2c-7/new_device'] + + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo cs6436_56p_sfp"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + if i <= 47: + status, output =log_os_system("echo cs6436_56p_sfp"+str(i+1)+" 0x51 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types, fan_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + for key in fan_types: + itypes = fan_types[key] + nodes = fan_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = fan_prefix+"/"+ itypes[i]+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0077", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-3", 0) + return not(ret1 or ret2) + + +if __name__ == "__main__": + main() diff --git a/platform/nephos/sonic-platform-modules-cig/debian/changelog b/platform/nephos/sonic-platform-modules-cig/debian/changelog new file mode 100755 index 000000000000..7a4aa7996fdc --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/changelog @@ -0,0 +1,5 @@ +sonic-cig-platform-modules (1.0.0) unstable; urgency=low + + * Add support for CS6436-56P series + + -- developer Wed, 12 Sep 2018 10:00:00 +0800 diff --git a/platform/nephos/sonic-platform-modules-cig/debian/compat b/platform/nephos/sonic-platform-modules-cig/debian/compat new file mode 100755 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/nephos/sonic-platform-modules-cig/debian/control b/platform/nephos/sonic-platform-modules-cig/debian/control new file mode 100755 index 000000000000..c617c76bbba3 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/control @@ -0,0 +1,11 @@ +Source: sonic-cig-platform-modules +Section: main +Priority: extra +Maintainer: yanglijie@cigtech.com +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-cig-cs6436-56p +Architecture: amd64 +Depends: linux-image-4.9.0-8-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/nephos/sonic-platform-modules-cig/debian/rules b/platform/nephos/sonic-platform-modules-cig/debian/rules new file mode 100755 index 000000000000..3192948cc08d --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-cig +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= cs6436-56p +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean From 034ac41e57b01dcb55baaff12354b724a42653cb Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 17 Apr 2019 12:34:48 +0530 Subject: [PATCH 069/219] [devices]: Watchdog enable/disable in DellEMC S6100 (#2730) --- .../debian/platform-modules-s6100.install | 2 ++ .../s6100/scripts/platform_watchdog_disable.sh | 13 +++++++++++++ .../s6100/scripts/platform_watchdog_enable.sh | 8 ++++++++ .../s6100/scripts/s6100_platform.sh | 5 +++++ 4 files changed, 28 insertions(+) create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index 9be9da0ab428..a54e5b092642 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -6,5 +6,7 @@ common/fstrim.timer etc/systemd/system common/fstrim.service etc/systemd/system common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin +s6100/scripts/platform_watchdog_enable.sh usr/local/bin +s6100/scripts/platform_watchdog_disable.sh usr/local/bin s6100/scripts/sensors usr/bin s6100/systemd/platform-modules-s6100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh new file mode 100755 index 000000000000..c3a90f3e89b2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#This script is used to disable SMF Watchdog Timer + +wd_status=-1 +enabled=0 + +# Disable Watchdog if enabled +wd_status=$(io_rd_wr.py --get --offset 0x207 | cut -d " " -f3) + +if [[ $wd_status -eq $enabled ]]; then + echo "Disabling Watchdog Timer.." + io_rd_wr.py --set --val 1 --offset 0x207 +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh new file mode 100755 index 000000000000..804627b5e2fc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh @@ -0,0 +1,8 @@ +#!/bin/bash +#This script is used to enable SMF Watchdog Timer + +# Set watchdog to 180 seconds +io_rd_wr.py --set --val 3 --offset 0x206 + +# Enable watchdog timer +io_rd_wr.py --set --val 0 --offset 0x207 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index 1ac6ce93bc1d..f8480f567380 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -226,6 +226,11 @@ if [[ "$1" == "init" ]]; then modprobe dell_s6100_iom_cpld modprobe dell_s6100_lpc + # Disable Watchdog Timer + if [[ -e /usr/local/bin/platform_watchdog_disable.sh ]]; then + exec /usr/local/bin/platform_watchdog_disable.sh + fi + cpu_board_mux "new_device" switch_board_mux "new_device" sys_eeprom "new_device" From 08fed3c125a2583dd341527c3d8215499dc33632 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Wed, 17 Apr 2019 04:32:36 +0300 Subject: [PATCH 070/219] [snmp.service] Make swss.service a requisite (#2790) --- files/build_templates/snmp.service.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index b00c2107702c..416156d5a891 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -1,6 +1,7 @@ [Unit] Description=SNMP container -Requires=updategraph.service swss.service +Requires=updategraph.service +Requisite=swss.service After=updategraph.service swss.service Before=ntp-config.service From f082cff528a3d94ccc17c9459848b0a9123a92cf Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 16 Apr 2019 19:11:24 -0700 Subject: [PATCH 071/219] teamd: lacp: update port state according to partner's sync bit (#2793) Backport of https://github.com/jpirko/libteam/commit/54f137c10579bf97800c61ebb13e732aa1d843e6 According to 6.4.15 of IEEE 802.1AX-2014, Figure 6-22, the state that the port is selected moves MUX state from DETACHED to ATTACHED. But ATTACHED state does not mean that the port can send and receive user frames. COLLECTING_DISTRIBUTION state is the state that the port can send and receive user frames. To move MUX state from ATTACHED to COLLECTING_DISTRIBUTION, the partner state should be sync as well as the port selected. In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION should be set to the actor.state when the port is selected. INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of partner.state is set. In function lacp_port_should_be_{enabled, disabled}(), we also need to check the INFO_STATE_SYNCHRONIZATION bit of partner.state. Signed-off-by: Hangbin Liu Signed-off-by: Jiri Pirko --- ...-port-state-according-to-partners-sy.patch | 71 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 72 insertions(+) create mode 100644 src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch diff --git a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch new file mode 100644 index 000000000000..33e6140bab6d --- /dev/null +++ b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch @@ -0,0 +1,71 @@ +commit 15b56de0f309c942f0f3a588f40944d078db97f9 +Author: Pavel Shirshov +Date: Tue Apr 16 12:18:12 2019 -0700 + + teamd: lacp: update port state according to partner's sync bit + + Backport of + https://github.com/jpirko/libteam/commit/54f137c10579bf97800c61ebb13e732aa1d843e6#diff-f17610bfcc2bafe661a9f3ba496ebf12 + + According to 6.4.15 of IEEE 802.1AX-2014, Figure 6-22, the state that the + port is selected moves MUX state from DETACHED to ATTACHED. + + But ATTACHED state does not mean that the port can send and receive user + frames. COLLECTING_DISTRIBUTION state is the state that the port can send + and receive user frames. To move MUX state from ATTACHED to + COLLECTING_DISTRIBUTION, the partner state should be sync as well as the + port selected. + + In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION + should be set to the actor.state when the port is selected. + INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false + with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of + partner.state is set. + + In function lacp_port_should_be_{enabled, disabled}(), we also need to + check the INFO_STATE_SYNCHRONIZATION bit of partner.state. + + Signed-off-by: Hangbin Liu + Signed-off-by: Jiri Pirko + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index dae9086..5fa026a 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -361,7 +361,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) + struct lacp *lacp = lacp_port->lacp; + + if (lacp_port_selected(lacp_port) && +- lacp_port->agg_lead == lacp->selected_agg_lead) ++ lacp_port->agg_lead == lacp->selected_agg_lead && ++ lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) + return true; + return false; + } +@@ -371,7 +372,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) + struct lacp *lacp = lacp_port->lacp; + + if (!lacp_port_selected(lacp_port) || +- lacp_port->agg_lead != lacp->selected_agg_lead) ++ lacp_port->agg_lead != lacp->selected_agg_lead || ++ !(lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)) + return true; + return false; + } +@@ -966,9 +968,14 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) + state |= INFO_STATE_LACP_ACTIVITY; + if (lacp_port->lacp->cfg.fast_rate) + state |= INFO_STATE_LACP_TIMEOUT; +- if (lacp_port_selected(lacp_port)) ++ if (lacp_port_selected(lacp_port) && ++ lacp_port_agg_selected(lacp_port)) { + state |= INFO_STATE_SYNCHRONIZATION; +- state |= INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING; ++ state &= ~(INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING); ++ if (lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) ++ state |= INFO_STATE_COLLECTING | ++ INFO_STATE_DISTRIBUTING; ++ } + if (lacp_port->state == PORT_STATE_EXPIRED) + state |= INFO_STATE_EXPIRED; + if (lacp_port->state == PORT_STATE_DEFAULTED) diff --git a/src/libteam/series b/src/libteam/series index a6c4893d021a..415d6f79af92 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -7,3 +7,4 @@ 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch 0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch 0009-teamd-prevent-private-change-handler-reentrance.patch +0010-teamd-lacp-update-port-state-according-to-partners-sy.patch \ No newline at end of file From 03dfd3dea3e6a9742f599e5f0f973914db8528c2 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 18 Apr 2019 15:10:43 -0700 Subject: [PATCH 072/219] [201811][utilities] advance sonic-utilities sub module head (#2801) Submodule src/sonic-utilities 79a0185..6ba6d27: > load_minigraph: restart hostcfgd (#511) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 79a0185e7e6d..6ba6d27342a6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 79a0185e7e6d23421e5d476e91c9c452f93295ba +Subproject commit 6ba6d27342a695609429083bcc23f31ea3a79236 From 5628de537ab42697c9510986c037cde3b42360e5 Mon Sep 17 00:00:00 2001 From: padmanarayana Date: Fri, 18 Jan 2019 01:57:06 -0800 Subject: [PATCH 073/219] [devices]: Make the get_transceiver_change_event's epoll blocking S6100/Z9100 (#2459) --- .../plugins/sfputil.py | 52 ++++++++++++++---- .../plugins/sfputil.py | 53 +++++++++++++++---- 2 files changed, 83 insertions(+), 22 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py index 04723b109a55..ff4426ba10c2 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6100_c2538-r0/plugins/sfputil.py @@ -236,11 +236,6 @@ def __init__(self): self.port_to_eeprom_mapping[port_num] =\ "No IOM" - self.oir_fd = open(self.OIR_FD_PATH, "r") - self.epoll = select.epoll() - if self.oir_fd != -1: - self.epoll.register(self.oir_fd.fileno(), select.EPOLLIN) - SfpUtilBase.__init__(self) def __del__(self): @@ -582,13 +577,40 @@ def get_transceiver_change_event(self, timeout=0): port_dict = {} try: # We get notified when there is an SCI interrupt from GPIO SUS6 + # Open the sysfs file and register the epoll object + self.oir_fd = open(self.OIR_FD_PATH, "r") + if self.oir_fd != -1: + # Do a dummy read before epoll register + self.oir_fd.read() + self.epoll = select.epoll() + self.epoll.register(self.oir_fd.fileno(), + select.EPOLLIN & select.EPOLLET) + else: + print("get_transceiver_change_event : unable to create fd") + return False, {} + # Check for missed interrupts by invoking self.check_interrupts - # it will update the port_dict. - # Then poll for new xcvr insertion/removal and - # call self.check_interrupts again and return - retval, is_port_dict_updated = self.check_interrupts(port_dict) - if ((retval == 0) and (is_port_dict_updated is True)): - return True, port_dict + # which will update the port_dict. + while True: + interrupt_count_start = self.get_register(self.OIR_FD_PATH) + + retval, is_port_dict_updated = \ + self.check_interrupts(port_dict) + if ((retval == 0) and (is_port_dict_updated is True)): + return True, port_dict + + interrupt_count_end = self.get_register(self.OIR_FD_PATH) + + if (interrupt_count_start == 'ERR' or + interrupt_count_end == 'ERR'): + print("get_transceiver_change_event : \ + unable to retrive interrupt count") + break + + # check_interrupts() itself may take upto 100s of msecs. + # We detect a missed interrupt based on the count + if interrupt_count_start == interrupt_count_end: + break # Block until an xcvr is inserted or removed with timeout = -1 events = self.epoll.poll( @@ -599,9 +621,17 @@ def get_transceiver_change_event(self, timeout=0): self.check_interrupts(port_dict) if (retval != 0): return False, {} + return True, port_dict except: return False, {} + finally: + if self.oir_fd != -1: + self.epoll.unregister(self.oir_fd.fileno()) + self.epoll.close() + self.oir_fd.close() + self.oir_fd = -1 + self.epoll = -1 return False, {} diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index b31a44ca1539..4cccfbb291f4 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -119,11 +119,6 @@ def __init__(self): self.port_to_i2c_mapping[x][0], self.port_to_i2c_mapping[x][1]) - self.oir_fd = open(self.OIR_FD_PATH, "r") - self.epoll = select.epoll() - if self.oir_fd != -1: - self.epoll.register(self.oir_fd.fileno(), select.EPOLLIN) - SfpUtilBase.__init__(self) def __del__(self): @@ -428,13 +423,40 @@ def get_transceiver_change_event(self, timeout=0): port_dict = {} try: # We get notified when there is an SCI interrupt from GPIO SUS6 + # Open the sysfs file and register the epoll object + self.oir_fd = open(self.OIR_FD_PATH, "r") + if self.oir_fd != -1: + # Do a dummy read before epoll register + self.oir_fd.read() + self.epoll = select.epoll() + self.epoll.register(self.oir_fd.fileno(), + select.EPOLLIN & select.EPOLLET) + else: + print("get_transceiver_change_event : unable to create fd") + return False, {} + # Check for missed interrupts by invoking self.check_interrupts - # it will update the port_dict. - # Then poll for new xcvr insertion/removal and - # call self.check_interrupts again and return - retval, is_port_dict_updated = self.check_interrupts(port_dict) - if ((retval == 0) and (is_port_dict_updated is True)): - return True, port_dict + # which will update the port_dict. + while True: + interrupt_count_start = self.get_register(self.OIR_FD_PATH) + + retval, is_port_dict_updated = \ + self.check_interrupts(port_dict) + if ((retval == 0) and (is_port_dict_updated is True)): + return True, port_dict + + interrupt_count_end = self.get_register(self.OIR_FD_PATH) + + if (interrupt_count_start == 'ERR' or + interrupt_count_end == 'ERR'): + print("get_transceiver_change_event : \ + unable to retrive interrupt count") + break + + # check_interrupts() itself may take upto 100s of msecs. + # We detect a missed interrupt based on the count + if interrupt_count_start == interrupt_count_end: + break # Block until an xcvr is inserted or removed with timeout = -1 events = self.epoll.poll( @@ -445,8 +467,17 @@ def get_transceiver_change_event(self, timeout=0): self.check_interrupts(port_dict) if (retval != 0): return False, {} + return True, port_dict except: return False, {} + finally: + if self.oir_fd != -1: + self.epoll.unregister(self.oir_fd.fileno()) + self.epoll.close() + self.oir_fd.close() + self.oir_fd = -1 + self.epoll = -1 + return False, {} From 08eea92cf01665611629ddc534210badce9f7a81 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 18 Apr 2019 18:45:00 -0700 Subject: [PATCH 074/219] Update sonic-quagga submodulde. Quagga crash fix (#2802) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index e5ede97424ad..81ad4d25b618 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit e5ede97424ad764b10af768d2e99cb4357177b7a +Subproject commit 81ad4d25b618755099be6859f387449132a00229 From 15a5264b851681232d66d0a8896b5b47093f883b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 21 Apr 2019 18:22:40 -0700 Subject: [PATCH 075/219] [201811][swss][utilities] advance swss/utilities sub modules (#2809) Submodule src/sonic-swss ae74a27..6e8f991: > Create ingress table group during the PFCWD stats list installment (#815) Submodule src/sonic-utilities 6ba6d27..0f7e75c: > If fast-reboot-dump gives an error, don't continue with fast-reboot (#515) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index ae74a27df766..6e8f9917a851 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit ae74a27df766321e0802f8bb38e9fa41dadffd88 +Subproject commit 6e8f9917a851b3cb63c85a6c7cb89269a3464d1d diff --git a/src/sonic-utilities b/src/sonic-utilities index 6ba6d27342a6..0f7e75cf8416 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6ba6d27342a695609429083bcc23f31ea3a79236 +Subproject commit 0f7e75cf841658e40619e8c5fbe84c5a172c4328 From 5663c812e1a4a8144607da0dbb3bc5f4cecc8bee Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 23 Apr 2019 09:35:20 -0700 Subject: [PATCH 076/219] Revert "[devices]: Watchdog enable/disable in DellEMC S6100 (#2730)" (#2817) This reverts commit 22d17da09c0dd42ffe828c8b5b3dcf2aef7cd472. --- .../debian/platform-modules-s6100.install | 2 -- .../s6100/scripts/platform_watchdog_disable.sh | 13 ------------- .../s6100/scripts/platform_watchdog_enable.sh | 8 -------- .../s6100/scripts/s6100_platform.sh | 5 ----- 4 files changed, 28 deletions(-) delete mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh delete mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index a54e5b092642..9be9da0ab428 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -6,7 +6,5 @@ common/fstrim.timer etc/systemd/system common/fstrim.service etc/systemd/system common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin -s6100/scripts/platform_watchdog_enable.sh usr/local/bin -s6100/scripts/platform_watchdog_disable.sh usr/local/bin s6100/scripts/sensors usr/bin s6100/systemd/platform-modules-s6100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh deleted file mode 100755 index c3a90f3e89b2..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_disable.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -#This script is used to disable SMF Watchdog Timer - -wd_status=-1 -enabled=0 - -# Disable Watchdog if enabled -wd_status=$(io_rd_wr.py --get --offset 0x207 | cut -d " " -f3) - -if [[ $wd_status -eq $enabled ]]; then - echo "Disabling Watchdog Timer.." - io_rd_wr.py --set --val 1 --offset 0x207 -fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh deleted file mode 100755 index 804627b5e2fc..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_watchdog_enable.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -#This script is used to enable SMF Watchdog Timer - -# Set watchdog to 180 seconds -io_rd_wr.py --set --val 3 --offset 0x206 - -# Enable watchdog timer -io_rd_wr.py --set --val 0 --offset 0x207 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index f8480f567380..1ac6ce93bc1d 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -226,11 +226,6 @@ if [[ "$1" == "init" ]]; then modprobe dell_s6100_iom_cpld modprobe dell_s6100_lpc - # Disable Watchdog Timer - if [[ -e /usr/local/bin/platform_watchdog_disable.sh ]]; then - exec /usr/local/bin/platform_watchdog_disable.sh - fi - cpu_board_mux "new_device" switch_board_mux "new_device" sys_eeprom "new_device" From 5004d2b4fec72a2b115a46177be223c84c8ef8a1 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 24 Apr 2019 17:51:26 +0300 Subject: [PATCH 077/219] Increase syncd start timeout (#2776) * Increase syncd start timeout Signed-off-by: Andriy Moroz * Replace TimeoutSec to TimeoutStartSec Signed-off-by: Andriy Moroz --- files/build_templates/syncd.service.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index 0c61b3193877..ec9696752a03 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -22,6 +22,9 @@ Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/syncd.sh start ExecStart=/usr/local/bin/syncd.sh wait ExecStop=/usr/local/bin/syncd.sh stop +{% if sonic_asic_platform == 'mellanox' %} +TimeoutStartSec=150 +{% endif %} [Install] WantedBy=multi-user.target From 525ee591653a6b736c6d1387c153e7866644340e Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 25 Apr 2019 16:16:22 -0700 Subject: [PATCH 078/219] Downport the netlink patch to libteam1.26. Increase netlink buffers (#2822) --- ...nize-ifinfo-after-lost-RTNLGRP_LINK-.patch | 302 ++++++++++++++++++ src/libteam/series | 3 +- 2 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch diff --git a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch new file mode 100644 index 000000000000..fcda98301174 --- /dev/null +++ b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch @@ -0,0 +1,302 @@ +commit 046fb6ba0aec8246075b18d787daec43201566fa +Author: Antti Tiainen +Date: Mon Feb 6 15:41:05 2017 +0200 + + libteam: resynchronize ifinfo after lost RTNLGRP_LINK notifications + + When there's a large number of interfaces (e.g. vlans), teamd loses + link notifications as it cannot read them as fast as kernel is + broadcasting them. This often prevents teamd starting properly if + started concurrently when other links are being set up. It can also + fail when it's up and running, especially in the cases where the team + device itself has a lot of vlans under it. + + This can easily be reproduces by simple example (in SMP system) by + manually adding team device with a bunch of vlans, putting it up, + and starting teamd with --take-over option: + + root@debian:~# ip link add name team0 type team + root@debian:~# for i in `seq 100 150` ; do + > ip link add link team0 name team0.$i type vlan id $i ; done + root@debian:~# ip link set team0 up + root@debian:~# cat teamd.conf + { + "device": "team0", + "runner": { + "name": "activebackup" + }, + "ports": { + "eth1": {}, + "eth2": {} + } + } + root@debian:~# teamd -o -N -f teamd.conf + + At this point, teamd will not give any error messages or other + indication that something is wrong. But state will not look healthy: + + root@debian:~# teamdctl team0 state + setup: + runner: activebackup + ports: + eth1 + link watches: + link summary: up + instance[link_watch_0]: + name: ethtool + link: up + down count: 0 + Failed to parse JSON port dump. + command call failed (Invalid argument) + + If checking state dump, it will show that port eth2 is missing info. + Running strace to teamd will reveal that there's one recvmsgs() that + returned -1 with errno ENOBUFS. What happened in this example was + that when teamd started, all vlans got carrier up, and kernel flooded + notifications faster than teamd could read them. It then lost events + related to port eth2 getting enslaved and up. + + The socket that joins RTNLGRP_LINK notifications uses default libnl + 32k buffer size. Netlink messages are large (over 1k), and this buffer + gets easily full. Kernel neither knows nor cares were notification + broadcasts delivered. This cannot be fixed by simply increasing the + buffer size, as there's no size that is guaranteed to work in every + use case, and this can require several megabytes of buffer (a way over + normal rmem_max limit) if there are hunderds of vlans. + + Only way to recover from this is to refresh all ifinfo list, as it's + invalidated at this point. It cannot easily work around of this by + just refreshing team device and its ports, because library side might + not have ports linked due to events missed, and it doesn't know about + teamd configuration. + + Checks now return value of nl_recvmsgs_default() for event socket. In + case of ENOBUFS (which libnl nicely changes to ENOMEM), refreshes + all ifinfo list. get_ifinfo_list() also checks now for removed interfaces + in case of missed dellink event. Currently all TEAM_IFINFO_CHANGE + handlers processed events one by one, so it had to be changed to support + multiple ifinfo changes. For this, ifinfo changed flags are cleared + and removed entries destroyed only after all handlers have been called. + + Also, increased nl_cli.sock_event receive buffers to 96k like all other + sockets. Added possibility to change this via environment variable. + + Signed-off-by: Antti Tiainen + Signed-off-by: Jiri Pirko + +diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c +index 72155ae..5c32a9c 100644 +--- a/libteam/ifinfo.c ++++ b/libteam/ifinfo.c +@@ -72,6 +72,10 @@ struct team_ifinfo { + #define CHANGED_PHYS_PORT_ID (1 << 5) + #define CHANGED_PHYS_PORT_ID_LEN (1 << 6) + #define CHANGED_ADMIN_STATE (1 << 7) ++/* This is only used when tagging interfaces for finding ++ * removed, and thus not included to CHANGED_ANY. ++ */ ++#define CHANGED_REFRESHING (1 << 8) + #define CHANGED_ANY (CHANGED_REMOVED | CHANGED_HWADDR | \ + CHANGED_HWADDR_LEN | CHANGED_IFNAME | \ + CHANGED_MASTER_IFINDEX | CHANGED_PHYS_PORT_ID | \ +@@ -202,7 +206,7 @@ static struct team_ifinfo *ifinfo_find(struct team_handle *th, uint32_t ifindex) + return NULL; + } + +-static void clear_last_changed(struct team_handle *th) ++void ifinfo_clear_changed(struct team_handle *th) + { + struct team_ifinfo *ifinfo; + +@@ -236,7 +240,7 @@ static void ifinfo_destroy(struct team_ifinfo *ifinfo) + free(ifinfo); + } + +-static void ifinfo_destroy_removed(struct team_handle *th) ++void ifinfo_destroy_removed(struct team_handle *th) + { + struct team_ifinfo *ifinfo, *tmp; + +@@ -254,8 +258,6 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) + uint32_t ifindex; + int err; + +- ifinfo_destroy_removed(th); +- + link = (struct rtnl_link *) obj; + + ifindex = rtnl_link_get_ifindex(link); +@@ -269,7 +271,7 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) + return; + } + +- clear_last_changed(th); ++ clear_changed(ifinfo); + ifinfo_update(ifinfo, link); + + if (event) +@@ -292,8 +294,6 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) + uint32_t ifindex; + int err; + +- ifinfo_destroy_removed(th); +- + link = (struct rtnl_link *) obj; + + ifindex = rtnl_link_get_ifindex(link); +@@ -311,7 +311,7 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) + return; + } + +- clear_last_changed(th); ++ clear_changed(ifinfo); + set_changed(ifinfo, CHANGED_REMOVED); + set_call_change_handlers(th, TEAM_IFINFO_CHANGE); + } +@@ -367,6 +367,14 @@ int get_ifinfo_list(struct team_handle *th) + }; + int ret; + int retry = 1; ++ struct team_ifinfo *ifinfo; ++ ++ /* Tag all ifinfo, this is cleared in newlink handler. ++ * Any interface that has this after dump is processed ++ * has been removed. ++ */ ++ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) ++ set_changed(ifinfo, CHANGED_REFRESHING); + + while (retry) { + retry = 0; +@@ -395,6 +403,15 @@ int get_ifinfo_list(struct team_handle *th) + retry = 1; + } + } ++ ++ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) { ++ if (is_changed(ifinfo, CHANGED_REFRESHING)) { ++ clear_changed(ifinfo); ++ set_changed(ifinfo, CHANGED_REMOVED); ++ set_call_change_handlers(th, TEAM_IFINFO_CHANGE); ++ } ++ } ++ + ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE); + if (ret < 0) + err(th, "get_ifinfo_list: check_call_change_handers failed"); +diff --git a/libteam/libteam.c b/libteam/libteam.c +index ac187aa..d5f22cd 100644 +--- a/libteam/libteam.c ++++ b/libteam/libteam.c +@@ -236,6 +236,10 @@ int check_call_change_handlers(struct team_handle *th, + break; + } + } ++ if (call_type_mask & TEAM_IFINFO_CHANGE) { ++ ifinfo_destroy_removed(th); ++ ifinfo_clear_changed(th); ++ } + th->change_handler.pending_type_mask &= ~call_type_mask; + return err; + } +@@ -546,6 +550,11 @@ int team_destroy(struct team_handle *th) + #endif + /* \endcond */ + ++/* libnl uses default 32k socket receive buffer size, ++ * whicn can get too small. Use 96k for all sockets. ++ */ ++#define NETLINK_RCVBUF 983040 ++ + /** + * @param th libteam library context + * @param ifindex team device interface index +@@ -561,6 +570,8 @@ int team_init(struct team_handle *th, uint32_t ifindex) + int err; + int grp_id; + int val; ++ int eventbufsize; ++ const char *env; + + if (!ifindex) { + err(th, "Passed interface index %d is not valid.", ifindex); +@@ -589,12 +600,12 @@ int team_init(struct team_handle *th, uint32_t ifindex) + return -errno; + } + +- err = nl_socket_set_buffer_size(th->nl_sock, 98304, 0); ++ err = nl_socket_set_buffer_size(th->nl_sock, NETLINK_RCVBUF, 0); + if (err) { + err(th, "Failed to set buffer size of netlink sock."); + return -nl2syserr(err); + } +- err = nl_socket_set_buffer_size(th->nl_sock_event, 98304, 0); ++ err = nl_socket_set_buffer_size(th->nl_sock_event, NETLINK_RCVBUF, 0); + if (err) { + err(th, "Failed to set buffer size of netlink event sock."); + return -nl2syserr(err); +@@ -627,6 +638,25 @@ int team_init(struct team_handle *th, uint32_t ifindex) + nl_socket_modify_cb(th->nl_cli.sock_event, NL_CB_VALID, + NL_CB_CUSTOM, cli_event_handler, th); + nl_cli_connect(th->nl_cli.sock_event, NETLINK_ROUTE); ++ ++ env = getenv("TEAM_EVENT_BUFSIZE"); ++ if (env) { ++ eventbufsize = strtol(env, NULL, 10); ++ /* ignore other errors, libnl forces minimum 32k and ++ * too large values are truncated to system rmem_max ++ */ ++ if (eventbufsize < 0) ++ eventbufsize = 0; ++ } else { ++ eventbufsize = NETLINK_RCVBUF; ++ } ++ ++ err = nl_socket_set_buffer_size(th->nl_cli.sock_event, eventbufsize, 0); ++ if (err) { ++ err(th, "Failed to set cli event socket buffer size."); ++ return err; ++ } ++ + err = nl_socket_add_membership(th->nl_cli.sock_event, RTNLGRP_LINK); + if (err < 0) { + err(th, "Failed to add netlink membership."); +@@ -767,7 +797,23 @@ static int get_cli_sock_event_fd(struct team_handle *th) + + static int cli_sock_event_handler(struct team_handle *th) + { +- nl_recvmsgs_default(th->nl_cli.sock_event); ++ int err; ++ ++ err = nl_recvmsgs_default(th->nl_cli.sock_event); ++ err = -nl2syserr(err); ++ ++ /* libnl thinks ENOBUFS and ENOMEM are same. Hope it was ENOBUFS. */ ++ if (err == -ENOMEM) { ++ warn(th, "Lost link notifications from kernel."); ++ /* There's no way to know what events were lost and no ++ * way to get them again. Refresh all. ++ */ ++ err = get_ifinfo_list(th); ++ } ++ ++ if (err) ++ return err; ++ + return check_call_change_handlers(th, TEAM_IFINFO_CHANGE); + } + +diff --git a/libteam/team_private.h b/libteam/team_private.h +index a07632f..a5eb0be 100644 +--- a/libteam/team_private.h ++++ b/libteam/team_private.h +@@ -115,6 +115,9 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, + int ifinfo_link(struct team_handle *th, uint32_t ifindex, + struct team_ifinfo **p_ifinfo); + void ifinfo_unlink(struct team_ifinfo *ifinfo); ++void ifinfo_clear_changed(struct team_handle *th); ++void ifinfo_destroy_removed(struct team_handle *th); ++int get_ifinfo_list(struct team_handle *th); + int get_options_handler(struct nl_msg *msg, void *arg); + int option_list_alloc(struct team_handle *th); + int option_list_init(struct team_handle *th); diff --git a/src/libteam/series b/src/libteam/series index 415d6f79af92..3cdcbd993ca9 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -7,4 +7,5 @@ 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch 0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch 0009-teamd-prevent-private-change-handler-reentrance.patch -0010-teamd-lacp-update-port-state-according-to-partners-sy.patch \ No newline at end of file +0010-teamd-lacp-update-port-state-according-to-partners-sy.patch +0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch \ No newline at end of file From 042d6145a5f6ccd6a1a216de32da3568baaa938a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 26 Apr 2019 12:00:14 -0700 Subject: [PATCH 079/219] [201811][sairedis][utilities] advance sub module heads (#2830) Submodule src/sonic-sairedis 74f0f44..d027eae: > [SAI header] upgrade SAI header to version v1.3.7 (#445) Submodule src/sonic-utilities 0f7e75c..9005508: > Bring queue storm status to 'pfcwd show stats' (#500) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 74f0f44bd790..d027eae034d5 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 74f0f44bd7906b27d6e080614784919079afb66b +Subproject commit d027eae034d538febe9fdb62682745a6b39a79ee diff --git a/src/sonic-utilities b/src/sonic-utilities index 0f7e75cf8416..9005508d0ba6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0f7e75cf841658e40619e8c5fbe84c5a172c4328 +Subproject commit 9005508d0ba6e62e3b1b215a0ac6cfb5beacd06f From edc8685e1e6bf0d136596da83cf18428506913d1 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 26 Apr 2019 15:12:33 -0700 Subject: [PATCH 080/219] [teamd service] start teamd service after swss (#2829) SWSS clears DB tables, if teamd is not started after swss, there is a race condition that swss might clear vital teamd information. Signed-off-by: Ying Xie --- files/build_templates/teamd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 792b8247119f..8034698ecc07 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=TEAMD container Requires=updategraph.service -After=updategraph.service +After=updategraph.service swss.service Before=ntp-config.service [Service] From 34734e4c554c09a7faa5f98685261892f337ede4 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 26 Apr 2019 15:25:09 -0700 Subject: [PATCH 081/219] [minigraph]: Fix bug in copying list in Python (#2831) '=' cannot be used for copying the list Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/minigraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 5ff350bc8965..9b86d024282f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -251,7 +251,7 @@ def parse_dpg(dpg, hname): # Erspan session will be attached to all front panel ports, # if panel ports is a member port of LAG, should add the LAG # to acl table instead of the panel ports - acl_intfs = pc_intfs + acl_intfs = pc_intfs[:] for panel_port in port_alias_map.values(): if panel_port not in intfs_inpc: acl_intfs.append(panel_port) From 675a89959a3bebe2ca2044ac6cfb19a19fc94eb5 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 29 Apr 2019 09:13:10 +0300 Subject: [PATCH 082/219] [mellanox] Update Mellanox FW version (#2827) Fixes random failures during ISSU start (warm pre-shutdown) Signed-off-by: Stepan Blyschak --- platform/mellanox/fw.mk | 2 +- platform/mellanox/sdk.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 48f86cc05e78..3116a4d7b10e 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1910.0920 +MLNX_FW_VERSION = 13.1910.0928 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index c9aed71fdc57..9d3799765098 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/f3e389f1ba9535fdd6afb134897683b65d1ad4e7/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/6ea244309b944af3bb34a9b99ad6ed60c5dc9937/sdk MLNX_SDK_VERSION = 4.3.0136 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ From e4a663a6062fe27e6cc69ea3bcfc2d1cabc4eb10 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 29 Apr 2019 17:56:42 -0700 Subject: [PATCH 083/219] [teamd] do not process lacpdu before the port ifinfo is set (#2815) Port libteam patch which fixes the race condition we observed during warm reboot. Remove early patches: 0006, 0008, 0009. Signed-off-by: Ying Xie --- ...ith_port-race-condition-with-newlink.patch | 45 ---------- ...hange-handler-for-TEAM_IFINFO_CHANGE.patch | 34 ------- ...nt-private-change-handler-reentrance.patch | 90 ------------------- ...cess-lacpdu-before-the-port-ifinfo-i.patch | 46 ++++++++++ src/libteam/series | 6 +- 5 files changed, 48 insertions(+), 173 deletions(-) delete mode 100644 src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch delete mode 100644 src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch delete mode 100644 src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch create mode 100644 src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch diff --git a/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch b/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch deleted file mode 100644 index bab3a9108325..000000000000 --- a/src/libteam/0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 9a27e9b85afbbf6235e61c2426481e49a2139219 Mon Sep 17 00:00:00 2001 -From: Shu0T1an ChenG -Date: Tue, 15 Jan 2019 12:23:02 -0800 -Subject: [PATCH] Fix ifinfo_link_with_port race condition with newlink - -The race condition could happen like this: -When an interface is enslaved into the port channel immediately after -it is created, the order of creating the ifinfo and linking the ifinfo to -the port is not guaranteed. - -The team handler will listen to both netlink message to track new links -get created to allocate the ifinfo and add the ifinfo into its linked list, -and the team port change message to link the new port with ifinfo found -in its linkedin list. However, when the ifinfo is not yet created, the error -message "Failed to link port with ifinfo" is thrown with member port failed -to be added into the team handler's port list. - -This fix adds a condition to check if ifinfo_link_with_port is linking ifinfo -to a port or to the team interface itself. If it is a port, ifinfo_find_create -function is used to fix the race condition. - -Signed-off-by: Shu0T1an ChenG ---- - libteam/ifinfo.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 44de4ca..444e0cd 100644 ---- a/libteam/ifinfo.c -+++ b/libteam/ifinfo.c -@@ -429,7 +429,10 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, - { - struct team_ifinfo *ifinfo; - -- ifinfo = ifinfo_find(th, ifindex); -+ if (port) -+ ifinfo = ifinfo_find_create(th, ifindex); -+ else -+ ifinfo = ifinfo_find(th, ifindex); - if (!ifinfo) - return -ENOENT; - if (ifinfo->linked) --- -2.1.4 - diff --git a/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch b/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch deleted file mode 100644 index a603f91f62fe..000000000000 --- a/src/libteam/0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 7dff9798c2c92eb75b0120737efb81febcdb80c1 Mon Sep 17 00:00:00 2001 -From: Ying Xie -Date: Sun, 24 Mar 2019 21:49:59 +0000 -Subject: [PATCH] [teamd] register change handler for TEAM_IFINFO_CHANGE as - well - -There has been a race condition in the libnal/teamd interation, causing -TEAM_PORT_CHANGE to report a port with empty device name. Which then -causes the teamd unable to add the lag members into the lag. - -Registering to the TEAM_IFINFO_CHANGE would give teamd another chance to -add member again. - -Signed-off-by: Ying Xie ---- - teamd/teamd_per_port.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c -index 09d1dc7..137da57 100644 ---- a/teamd/teamd_per_port.c -+++ b/teamd/teamd_per_port.c -@@ -274,7 +274,7 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, - - static const struct team_change_handler port_priv_change_handler = { - .func = port_priv_change_handler_func, -- .type_mask = TEAM_PORT_CHANGE, -+ .type_mask = TEAM_PORT_CHANGE | TEAM_IFINFO_CHANGE, - }; - - int teamd_per_port_init(struct teamd_context *ctx) --- -2.7.4 - diff --git a/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch b/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch deleted file mode 100644 index dad10a4c1ae9..000000000000 --- a/src/libteam/0009-teamd-prevent-private-change-handler-reentrance.patch +++ /dev/null @@ -1,90 +0,0 @@ -From fb00b070482dc587eec7b4e34acec094be1af00d Mon Sep 17 00:00:00 2001 -From: Ying Xie -Date: Fri, 29 Mar 2019 20:54:49 +0000 -Subject: [PATCH 10/11] [teamd] prevent private change handler reentrance - -While handling PORT_CHANGE, teamd could casue an INTERFACE_CHANGE in the -same context. Which will interfere with the PORT_CHANGE handling and -causing it to fail. - -Lock is not needed because the re-entrance happened in the same thread -context. - -This issue was noticed while dynamically adding a port into a lag. - -Signed-off-by: Ying Xie ---- - teamd/teamd.c | 2 ++ - teamd/teamd.h | 2 ++ - teamd/teamd_per_port.c | 13 +++++++++++-- - 3 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/teamd/teamd.c b/teamd/teamd.c -index e28aa7d..140b98b 100644 ---- a/teamd/teamd.c -+++ b/teamd/teamd.c -@@ -1255,6 +1255,8 @@ static int teamd_init(struct teamd_context *ctx) - { - int err; - -+ ctx->reentrant = false; -+ - ctx->th = team_alloc(); - if (!ctx->th) { - teamd_log_err("Team alloc failed."); -diff --git a/teamd/teamd.h b/teamd/teamd.h -index 622c365..7cd3266 100644 ---- a/teamd/teamd.h -+++ b/teamd/teamd.h -@@ -160,6 +160,8 @@ struct teamd_context { - int pipe_r; - int pipe_w; - } workq; -+ -+ bool reentrant; - }; - - struct teamd_port { -diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c -index 137da57..8b4a457 100644 ---- a/teamd/teamd_per_port.c -+++ b/teamd/teamd_per_port.c -@@ -250,6 +250,10 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, - struct port_obj *port_obj; - int err; - -+ if (ctx->reentrant) { -+ return 0; -+ } -+ ctx->reentrant = true; - team_for_each_port(port, th) { - uint32_t ifindex = team_get_port_ifindex(port); - -@@ -258,17 +262,22 @@ static int port_priv_change_handler_func(struct team_handle *th, void *priv, - if (team_is_port_removed(port)) - continue; - err = port_obj_create(ctx, &port_obj, ifindex, port); -- if (err) -+ if (err) { -+ ctx->reentrant = false; - return err; -+ } - } - if (team_is_port_changed(port)) { - err = teamd_event_port_changed(ctx, _port(port_obj)); -- if (err) -+ if (err) { -+ ctx->reentrant = false; - return err; -+ } - } - if (team_is_port_removed(port)) - port_obj_remove(ctx, port_obj); - } -+ ctx->reentrant = false; - return 0; - } - --- -2.7.4 - diff --git a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch new file mode 100644 index 000000000000..db29825fb9da --- /dev/null +++ b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch @@ -0,0 +1,46 @@ +From 28ccb37eb388e7e3d214a9b05011f8421f0d65ac Mon Sep 17 00:00:00 2001 +From: Ying Xie +Date: Fri, 26 Apr 2019 23:30:38 +0000 +Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set + +Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK +event is received. + +But when a port is being added, if a lacpdu gets received on this port +before the RTM_NEWLINK event, lacpdu_recv will process the packet with +incorrect port ifinfo. + +In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this +port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to +be updated in lacp_switch_agg_lead. Later the lacp_port actor would go +to a unexpected state. + +This patch is to avoid it by checking teamd_port_present in lacpdu_recv +so that it would not process lacpdu before the port ifinfo is set. + +Reported-by: Patrick Talbert +Tested-by: Patrick Talbert +Signed-off-by: Xin Long +Reviewed-by: Marcelo Ricardo Leitner +Signed-off-by: Jiri Pirko +--- + teamd/teamd_runner_lacp.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 78f05dd..c8ae541 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1132,6 +1132,9 @@ static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) + { + int err; + ++ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) ++ return 0; ++ + if (!lacpdu_check(lacpdu)) { + teamd_log_warn("malformed LACP PDU came."); + return 0; +-- +2.7.4 + diff --git a/src/libteam/series b/src/libteam/series index 3cdcbd993ca9..e9ef676ce52a 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -3,9 +3,7 @@ 0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch 0004-libteam-Add-lacp-fallback-support-for-single-member-.patch 0005-libteam-Add-warm_reboot-mode.patch -0006-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch -0008-teamd-register-change-handler-for-TEAM_IFINFO_CHANGE.patch -0009-teamd-prevent-private-change-handler-reentrance.patch 0010-teamd-lacp-update-port-state-according-to-partners-sy.patch -0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch \ No newline at end of file +0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch +0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch From dd31c2d84ac3aee805fceac817d32d337c399b14 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 29 Apr 2019 17:21:24 -0700 Subject: [PATCH 084/219] Remove unused packages in docker images and host (#2807) * Remove unneeded packages in docker images and host * Remove libpython3.6 from snmp docker image --- dockers/docker-base/Dockerfile.j2 | 4 ++++ dockers/docker-config-engine/Dockerfile.j2 | 2 +- dockers/docker-lldp-sv2/Dockerfile.j2 | 2 +- dockers/docker-platform-monitor/Dockerfile.j2 | 2 +- dockers/docker-snmp-sv2/Dockerfile.j2 | 4 +++- dockers/docker-sonic-mgmt/Dockerfile.j2 | 4 ++-- files/build_templates/sonic_debian_extension.j2 | 2 +- rules/python3.mk | 4 ++-- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index c622e6a59843..481af6e821ed 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -73,6 +73,10 @@ RUN apt-get -y install {{ dbg_pkg }} RUN ln /usr/bin/vim.tiny /usr/bin/vim {%- endif %} +# Remove python3.4 +# Note: if later python3 is required by more docker images, consider install homebrew python3 here instead of in SNMP image only +RUN apt-get purge -y libpython3.4-minimal + # Clean up apt # Remove /var/lib/apt/lists/*, could be obsoleted for derived images RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index bc82e1ca2883..ba72cce31d47 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -43,5 +43,5 @@ python-wheels/{{ whl }}{{' '}} {%- endif -%} ## Clean up -RUN apt-get remove -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs /python-wheels diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index f08a70c01302..ec5de2a25a31 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -37,7 +37,7 @@ RUN pip install /python-wheels/{{ whl }} {% endif %} # Clean up -RUN apt-get remove -y python-pip +RUN apt-get purge -y python-pip RUN apt-get clean -y RUN apt-get autoclean -y RUN apt-get autoremove -y diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index e33ea72f07b1..5d621223cc28 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -37,7 +37,7 @@ RUN pip install /python-wheels/{{ whl }} {% endif %} # Clean up -RUN apt-get remove -y python-pip +RUN apt-get purge -y python-pip RUN apt-get clean -y RUN apt-get autoclean -y RUN apt-get autoremove -y diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 1063f6d24b4d..7e6fb5f5caec 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -56,7 +56,9 @@ RUN pip install /python-wheels/{{ whl }} RUN python3.6 -m sonic_ax_impl install # Clean up -RUN apt-get -y purge libpython3.6-dev curl gcc make +RUN apt-get -y purge libpython3.6-dev libpython3.6 curl gcc make +# Note: these packages should be removed with autoremove but actually not, so explicitly purged +RUN apt-get -y purge libldap-2.4-2 libsasl2-2 libsasl2-modules libsasl2-modules-db RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge RUN find / | grep -E "__pycache__" | xargs rm -rf RUN rm -rf /debs /python-wheels ~/.cache diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index 9d07f668b595..d79c5d068fc0 100644 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -29,9 +29,9 @@ RUN apt-get install -y default-jre RUN apt-get install -y rsyslog psmisc # Remove cffi 1.5.2, will install 1.10.0 by pip later -RUN apt-get remove -y python-cffi python-cffi-backend +RUN apt-get purge -y python-cffi python-cffi-backend # Remove pycparser 2.14, will install >=2.17 by pip later -RUN apt-get remove -y python-ply python-pycparser +RUN apt-get purge -y python-ply python-pycparser RUN easy_install pip diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0eeba7bad965..5127c5bf6a9b 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -309,7 +309,7 @@ sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y diff --git a/rules/python3.mk b/rules/python3.mk index 2473c9aeb498..247a80b0cbea 100644 --- a/rules/python3.mk +++ b/rules/python3.mk @@ -26,8 +26,8 @@ $(PY3_MIN)_RDEPENDS += $(LIBPY3_MIN) PY3 = $(PYTHON_PNAME)_$(PYTHON_VER)_amd64.deb $(eval $(call add_derived_package,$(LIBPY3_MIN),$(PY3))) -$(PY3)_DEPENDS += $(PY3_MIN) $(LIBPY3) -$(PY3)_RDEPENDS += $(PY3_MIN) $(LIBPY3) $(LIBPY3_MIN) +$(PY3)_DEPENDS += $(PY3_MIN) $(LIBPY3_STD) +$(PY3)_RDEPENDS += $(PY3_MIN) $(LIBPY3_STD) LIBPY3_DEV = lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)_amd64.deb $(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_DEV))) From af380e9c79485a2eb4640effa26e8450801a48ff Mon Sep 17 00:00:00 2001 From: paavaanan Date: Tue, 30 Apr 2019 07:00:36 +0530 Subject: [PATCH 085/219] [devices]: DellEMC S6000 xcvrd support (#2560) * DellEMC S6000, xcvrd support * sleep 1 second to avoid busy looping * removal of dead code * Correct typo error to 1 second * Introduced 1 second sleep * Revamped script with blocking call support * get_transceiver_change_event api definition update * adding timeout support for get_transceiver_change_event --- .../plugins/sfputil.py | 87 +++++++++++++++++-- 1 file changed, 80 insertions(+), 7 deletions(-) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py index 9275c4c9b6fb..b27bf4bc22ea 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -5,6 +5,7 @@ try: import time + import datetime from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -20,6 +21,7 @@ class SfpUtil(SfpUtilBase): EEPROM_OFFSET = 20 _port_to_eeprom_mapping = {} + port_dict = {} @property def port_start(self): @@ -37,12 +39,33 @@ def qsfp_ports(self): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + @property + def get_transceiver_status(self): + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_modprs") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + reg_file.close() + + return int(content, 16) + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + # Get Transceiver status + self.modprs_register = self.get_transceiver_status + SfpUtilBase.__init__(self) def get_presence(self, port_num): @@ -174,10 +197,60 @@ def reset(self, port_num): return True - def get_transceiver_change_event(self): - """ - TODO: This function need to be implemented - when decide to support monitoring SFP(Xcvrd) - on this platform. - """ - raise NotImplementedError + def get_transceiver_change_event(self, timeout=0): + + start_time = time.time() + port_dict = {} + port = self.port_start + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print "get_transceiver_change_event:Invalid timeout value", timeout + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print 'get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout + + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + reg_value = self.get_transceiver_status + if reg_value != self.modprs_register: + changed_ports = self.modprs_register ^ reg_value + while port >= self.port_start and port <= self.port_end: + + # Mask off the bit corresponding to our port + mask = (1 << port) + + if changed_ports & mask: + # ModPrsL is active low + if reg_value & mask == 0: + port_dict[port] = '1' + else: + port_dict[port] = '0' + + port += 1 + + # Update reg value + self.modprs_register = reg_value + return True, port_dict + + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + print "get_transceiver_change_event: Should not reach here." + return False, {} From f22666ce58fbe5d9dbbfaf6159db68e43432361f Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 30 Apr 2019 16:41:38 -0700 Subject: [PATCH 086/219] [201811][utilities] advance sub-module head (#2844) Submodule src/sonic-utilities 9005508..584e706: > [db migrator] Introduce the DB migration infrastructure (#519) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 9005508d0ba6..584e7068572f 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 9005508d0ba6e62e3b1b215a0ac6cfb5beacd06f +Subproject commit 584e7068572fe2f835a62c952ce8728bb60d0563 From 3b02eec933743dde246177fc3072226588f0e4bf Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 30 Apr 2019 14:46:18 -0700 Subject: [PATCH 087/219] [db migrator] migrate the DB to latest schema when needed (#2808) Signed-off-by: Ying Xie --- files/build_templates/docker_image_ctl.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 92c3f69c8a8d..2afc381cb96f 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -59,6 +59,11 @@ function postStartAction() redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1" fi + + if [[ -x /usr/bin/db_migrator.py ]]; then + # Migrate the DB to the latest schema version if needed + /usr/bin/db_migrator.py -o migrate + fi {%- elif docker_container_name == "swss" %} docker exec swss rm -f /ready # remove cruft if [[ "$BOOT_TYPE" == "fast" ]] && [[ -d /host/fast-reboot ]]; then From cc90d7f5ee05775ab1993b5ec2639b8d95a9c7ee Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 1 May 2019 08:01:44 -0700 Subject: [PATCH 088/219] [sudoers] Add /usr/bin/teamshow to READ_ONLY_CMDS (#2846) --- files/image_config/sudoers/sudoers | 1 + 1 file changed, 1 insertion(+) diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 9944299830b0..45b943846cb1 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -32,6 +32,7 @@ Cmnd_Alias READ_ONLY_CMDS = /sbin/brctl show, \ /usr/bin/psuutil *, \ /usr/bin/sensors, \ /usr/bin/sfputil show *, \ + /usr/bin/teamshow, \ /usr/bin/vtysh -c show *, \ /bin/cat /var/log/syslog*, \ /usr/bin/tail -F /var/log/syslog From 65cd722223630374453ce4a07236ee205c207088 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 1 May 2019 08:51:56 -0700 Subject: [PATCH 089/219] [201811][utilities] advance sub-module head (#2849) Submodule src/sonic-utilities 584e706..e3bb8b9: > [show] Call teamshow using sudo in 'show interfaces portchannel' (#524) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 584e7068572f..e3bb8b9d7534 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 584e7068572fe2f835a62c952ce8728bb60d0563 +Subproject commit e3bb8b9d75345b79fef49546e43eae4ac654d5ee From cf6f22f77558a40cf339b9e5e159689d018bfc3c Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 1 May 2019 21:57:08 +0300 Subject: [PATCH 090/219] [mellanox]: Update SAI (#2841) Add support to trap copy action Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 71d93a142e94..477a3fc64746 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIRel1.13.4-master -MLNX_SAI_REVISION = 07a104bf1f00ff8ada39056c0dc23bd895cf1a62 +MLNX_SAI_REVISION = 6ea244309b944af3bb34a9b99ad6ed60c5dc9937 export MLNX_SAI_VERSION MLNX_SAI_REVISION From 4e99b603eabe6893b256ec6763747f80123ef79e Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Thu, 2 May 2019 20:35:33 +0530 Subject: [PATCH 091/219] Enable Debugs in BCM Kernel-bde and Knet Modules (#2786) * Enable Debugs in BCM Kernel-bde and Knet Modules * Added Explanation for debugs enabled --- .../debian/opennsl-modules-4.9.0-8-amd64.init | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init index fa9379061ef8..0b526b012d0a 100755 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init @@ -25,11 +25,16 @@ function create_devices() mknod /dev/linux-kernel-bde c 127 0 } +# linux-kernel-bde debug=4 ==> Verbose level debug +# dma_debug=1 ==> Enable DMA debug +# linux-bcm-knet debug=0x5020 ==> Enable KNET Warning(0x1000), +# Events(0x20) and Instance(0x4000) +# level logs function load_kernel_modules() { - modprobe linux-kernel-bde dmasize=32M maxpayload=128 + modprobe linux-kernel-bde dmasize=32M maxpayload=128 debug=4 dma_debug=1 modprobe linux-user-bde - modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 + modprobe linux-bcm-knet use_rx_skb=1 rx_buffer_size=9238 debug=0x5020 modprobe linux-knet-cb } From d12782cc480982e9915f4d245ee3b8713130deb9 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 6 May 2019 15:09:31 -0700 Subject: [PATCH 092/219] [201811][swss] advance sub-module head (#2868) Submodule src/sonic-swss 6e8f991..e26e1d8: > [arp] copy arp IO to cpu instead of trap and drop (#812) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 6e8f9917a851..e26e1d80c6cf 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 6e8f9917a851b3cb63c85a6c7cb89269a3464d1d +Subproject commit e26e1d80c6cf2c0c2e267229e6dc20ede9f077c3 From dc2fb747a5e57f6d625c648413b2ba9de3ad9f78 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 19 Apr 2019 00:30:24 +0000 Subject: [PATCH 093/219] [ebtables] install ebtables in base image and install filter rules - Add ebtables package, and install some filter rules: 1. ebtables -A FORWARD -d BGA -j DROP 2. ebtables -A FORWARD -p ARP -j DROP Basically, we let the ARP packets in the VLAN being forwarded by the ASIC, kernel gets a copy of these ARP packets and the forwarding from Kenerl gets dropped. So there is always only one copy of ARP/response in the VLAN. Signed-off-by: Ying Xie --- build_debian.sh | 5 +++++ files/image_config/ebtables/ebtables.filter | Bin 0 -> 616 bytes 2 files changed, 5 insertions(+) create mode 100644 files/image_config/ebtables/ebtables.filter diff --git a/build_debian.sh b/build_debian.sh index aa8c6b04eb70..7806388c5e52 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -227,6 +227,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in usbutils \ pciutils \ iptables-persistent \ + ebtables \ logrotate \ curl \ kexec-tools \ @@ -402,6 +403,10 @@ if [ "${enable_organization_extensions}" = "y" ]; then fi fi +## Setup ebtable rules (rule file is in binary format) +sudo sed -i 's/EBTABLES_LOAD_ON_START="no"/EBTABLES_LOAD_ON_START="yes"/g' ${FILESYSTEM_ROOT}/etc/default/ebtables +sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc + ## Remove gcc and python dev pkgs sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev diff --git a/files/image_config/ebtables/ebtables.filter b/files/image_config/ebtables/ebtables.filter new file mode 100644 index 0000000000000000000000000000000000000000..4faad1f5f4bdbe57c1bb0378a4b959e209067ed9 GIT binary patch literal 616 zcmYex%qdANVql2SJ|?SE&wv5=fFevle1Q=nRcO3Y9;B||+^xtpp$rTQptQgR2)_<0 z4^=5pDpuHd# zNIl5C!VqCNc@WKAFbQ+0e(m&=V1L2f4U;$IfU!U{W5XdJ39+0V%G?Js#y>O!6hUCn QhQ)qRI731Lq6Qxc07O|=rvLx| literal 0 HcmV?d00001 From b54d7874c6145a649fc3d1bc9659df5479ab4ff4 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Thu, 9 May 2019 12:52:18 +0530 Subject: [PATCH 094/219] [devices]: DellEMC S6100/Z9100 sensor.conf update (#2861) --- .../x86_64-dell_s6100_c2538-r0/sensors.conf | 22 ++++++++++++++++++- .../x86_64-dell_z9100_c2538-r0/sensors.conf | 22 ++++++++++++++++++- .../s6100/scripts/sensors | 4 ---- .../z9100/scripts/sensors | 4 ---- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf b/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf index 43fa7357c177..dfb1aa7c92b1 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf +++ b/device/dell/x86_64-dell_s6100_c2538-r0/sensors.conf @@ -4,6 +4,26 @@ label power2 "PSU1 Output Power" label power3 "PSU2 Input Power" label power4 "PSU2 Output Power" label temp14 "PSU1 Temp" -label temp15 "PSU1 Temp" +label temp15 "PSU2 Temp" +label curr601 "PSU1 Input Current" +label curr602 "PSU1 Output Current" +label curr701 "PSU2 Input Current" +label curr702 "PSU2 Output Current" ignore temp12 ignore temp13 +ignore in101 +ignore in102 +ignore in103 +ignore in104 +ignore in201 +ignore in202 +ignore in203 +ignore in204 +ignore in301 +ignore in302 +ignore in303 +ignore in304 +ignore in401 +ignore in402 +ignore in403 +ignore in404 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf b/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf index 31a656fcf0b3..e23891de6bf9 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf +++ b/device/dell/x86_64-dell_z9100_c2538-r0/sensors.conf @@ -4,9 +4,29 @@ label power2 "PSU1 Output Power" label power3 "PSU2 Input Power" label power4 "PSU2 Output Power" label temp14 "PSU1 Temp" -label temp15 "PSU1 Temp" +label temp15 "PSU2 Temp" +label curr601 "PSU1 Input Current" +label curr602 "PSU1 Output Current" +label curr701 "PSU2 Input Current" +label curr702 "PSU2 Output Current" ignore temp12 ignore temp13 ignore temp5 ignore temp7 ignore temp8 +ignore in101 +ignore in102 +ignore in103 +ignore in104 +ignore in201 +ignore in202 +ignore in203 +ignore in204 +ignore in301 +ignore in302 +ignore in303 +ignore in304 +ignore in401 +ignore in402 +ignore in403 +ignore in404 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors index 030d636a1565..958cbdcb7bef 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/sensors @@ -1,7 +1,3 @@ #!/bin/bash docker exec -i pmon sensors "$@" -#To probe sensors not part of lm-sensors -if [ -r /usr/local/bin/platform_sensors.py ]; then - python /usr/local/bin/platform_sensors.py -fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors index 030d636a1565..958cbdcb7bef 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/sensors @@ -1,7 +1,3 @@ #!/bin/bash docker exec -i pmon sensors "$@" -#To probe sensors not part of lm-sensors -if [ -r /usr/local/bin/platform_sensors.py ]; then - python /usr/local/bin/platform_sensors.py -fi From 21f31e97e139f223e1d969db4cd179efe74f0477 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 9 May 2019 17:34:21 -0700 Subject: [PATCH 095/219] [201811][swss][utilities] advance sub-module head (#2878) Submodule src/sonic-swss e26e1d8..8246bd9: > [watermarkorch] only perform periodic clear if the polling is on (#781) Submodule src/sonic-utilities e3bb8b9..6130695: > [reboot] log reboot progress and add a sanity check before reboot (#526) > Fix TODO to get/set active ports only (#494) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index e26e1d80c6cf..8246bd9b08d2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit e26e1d80c6cf2c0c2e267229e6dc20ede9f077c3 +Subproject commit 8246bd9b08d2a1db671af6b628c0b89e336b2ad7 diff --git a/src/sonic-utilities b/src/sonic-utilities index e3bb8b9d7534..61306952d1a2 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit e3bb8b9d75345b79fef49546e43eae4ac654d5ee +Subproject commit 61306952d1a2575bed004301e727384109e793ec From 99de97c5cc01a15a096e530686e34fd27a06100f Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sat, 11 May 2019 11:54:09 -0700 Subject: [PATCH 096/219] [sonic-quagga]: Fix missing fpm messages (#2884) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 81ad4d25b618..2e192c06b8f5 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 81ad4d25b618755099be6859f387449132a00229 +Subproject commit 2e192c06b8f526cab6fce710ab5da0223b0ba2b1 From c1836146a3b72095d3f4c054857819777161e7a7 Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Fri, 10 May 2019 14:28:24 -0700 Subject: [PATCH 097/219] Fix for LLDP portname issue (#2886) * Fix for LLDP portname issue First check for operstate and if its not present then check for ifindex * Addressing review comments --- dockers/docker-lldp-sv2/lldpmgrd | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd index 7d2528a9d3a6..62ed6904fb13 100755 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -74,11 +74,14 @@ def signal_handler(sig, frame): # ========================== Helpers ================================== def is_port_exist(port_name): - filename = "/sys/class/net/%s/ifindex" % port_name - if not os.path.exists(filename): - return False - - return True + filename = "/sys/class/net/%s/operstate" % port_name + if os.path.exists(filename): + with open(filename) as fp: + state = fp.read() + return "up" in state + else: + filename = "/sys/class/net/%s/ifindex" % port_name + return os.path.exists(filename) # ============================== Classes ============================== From 116246de1be108b42053fe9eaa48e8953df7b273 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 14 May 2019 15:39:16 -0700 Subject: [PATCH 098/219] [201811][utilities] update sub module head (#2897) Submodule src/sonic-utilities 6130695..a1f961c: > update scheme variable name (#531) > [teamshow]: Add * to indicate if the state has been synced into database (#395) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 61306952d1a2..a1f961c96245 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 61306952d1a2575bed004301e727384109e793ec +Subproject commit a1f961c962452b5e6916850fbbd8f36101f1f22a From bd7b96fea35718ae9ccfa60b0bfbf8eb439e9313 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 18 May 2019 10:33:26 -0700 Subject: [PATCH 099/219] [201811][dhcp_relay] Add support for DHCP client(s) on one VLAN and DHCP server(s) on another (#2919) * Change URL for isc-dhcp source repository * Modify supervisor conf to generate dhcrelay commands with '-id' and '-iu' options * Comments; Also clean up jinja2 syntax * Patch relay to open one socket per interface and send to all servers on all upstream interfaces * Patch relay agent to properly forward BOOTREQUEST only on appropriate interface if it is a directed broadcast * Port upstream patches to isc-dhcp-relay to support upstream/downstream interfaces * Update patch to properly support interfaces with multiple IP addresses assigned * Pass --enable-use-sockets to configure instead of uncommenting USE_SOCKETS directly --- .../docker-dhcp-relay.supervisord.conf.j2 | 35 ++- src/isc-dhcp/Makefile | 2 +- ...anges-from-commit-f2e70402f0f2955f39.patch | 102 +++++++ ...anges-from-commit-edd6d8881bc4d8ec4b.patch | 157 +++++++++++ ...ockets-to-configure-flags-in-debian-.patch | 28 ++ ...VE_SO_BINDTODEVICE-has-a-chance-to-b.patch | 122 ++++++++ ...f-BOOTREQUEST-is-directed-broadcast-.patch | 264 ++++++++++++++++++ src/isc-dhcp/patch/series | 6 +- .../docker-dhcp-relay.supervisord.conf | 2 +- 9 files changed, 700 insertions(+), 18 deletions(-) create mode 100644 src/isc-dhcp/patch/0008-Port-upstream-changes-from-commit-f2e70402f0f2955f39.patch create mode 100644 src/isc-dhcp/patch/0009-Port-upstream-changes-from-commit-edd6d8881bc4d8ec4b.patch create mode 100644 src/isc-dhcp/patch/0010-Add-enable-use-sockets-to-configure-flags-in-debian-.patch create mode 100644 src/isc-dhcp/patch/0011-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch create mode 100644 src/isc-dhcp/patch/0012-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 index 747f65a3aaf6..cd18dfa13108 100644 --- a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -32,28 +32,33 @@ stderr_logfile=syslog {% if num_relays.count > 0 %} [group:isc-dhcp-relay] programs= -{%- set add_preceding_comma = { 'flag': False } -%} -{%- for vlan_name in VLAN -%} -{%- if VLAN[vlan_name]['dhcp_servers'] -%} -{%- if add_preceding_comma.flag %},{% endif -%} -{%- set _dummy = add_preceding_comma.update({'flag': True}) -%} +{%- set add_preceding_comma = { 'flag': False } %} +{% for vlan_name in VLAN %} +{% if VLAN[vlan_name]['dhcp_servers'] %} +{% if add_preceding_comma.flag %},{% endif %} +{% set _dummy = add_preceding_comma.update({'flag': True}) %} isc-dhcp-relay-{{ vlan_name }} {%- endif %} {% endfor %} {# Create a program entry for each DHCP relay agent instance #} -{% for vlan_name in VLAN -%} -{%- if VLAN[vlan_name]['dhcp_servers'] -%} +{% for vlan_name in VLAN %} +{% if VLAN[vlan_name]['dhcp_servers'] %} [program:isc-dhcp-relay-{{ vlan_name }}] -command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i {{ vlan_name }} -{%- for (name, prefix) in INTERFACE -%} -{%- if prefix | ipv4 %} -i {{ name }}{% endif -%} -{%- endfor -%} -{%- for (name, prefix) in PORTCHANNEL_INTERFACE -%} -{%- if prefix | ipv4 %} -i {{ name }}{% endif -%} -{%- endfor -%} -{%- for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %} +{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #} +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }} +{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #} +{% for (name, prefix) in VLAN_INTERFACE %} +{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%} +{% endfor %} +{% for (name, prefix) in INTERFACE %} +{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} +{% endfor %} +{% for (name, prefix) in PORTCHANNEL_INTERFACE %} +{% if prefix | ipv4 %} -iu {{ name }}{% endif -%} +{% endfor %} +{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %} priority=3 autostart=false diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index ce4fbc62608f..1227b3a0c33f 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -10,7 +10,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./isc-dhcp # Clone isc-dhcp repo - git clone https://salsa.debian.org/berni/isc-dhcp.git + git clone https://salsa.debian.org/dhcp-team/isc-dhcp.git pushd ./isc-dhcp # Reset HEAD to the commit of the proper tag diff --git a/src/isc-dhcp/patch/0008-Port-upstream-changes-from-commit-f2e70402f0f2955f39.patch b/src/isc-dhcp/patch/0008-Port-upstream-changes-from-commit-f2e70402f0f2955f39.patch new file mode 100644 index 000000000000..2efbfd6d664d --- /dev/null +++ b/src/isc-dhcp/patch/0008-Port-upstream-changes-from-commit-f2e70402f0f2955f39.patch @@ -0,0 +1,102 @@ +From 0092eed7a80f38078a38fedf601952d0d25c6183 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Thu, 2 May 2019 19:20:59 +0000 +Subject: [PATCH 1/2] Port upstream changes from commit + f2e70402f0f2955f392edc4eb2dd835b820e25bc to add '-iu' option + +--- + common/discover.c | 8 +++++++- + relay/dhcrelay.c | 36 +++++++++++++++++++++++++++++++++++- + 2 files changed, 42 insertions(+), 2 deletions(-) + +diff --git a/common/discover.c b/common/discover.c +index 3cd64a7..e20d9d5 100644 +--- a/common/discover.c ++++ b/common/discover.c +@@ -948,8 +948,14 @@ discover_interfaces(int state) { + ir = 0; + else if (state == DISCOVER_UNCONFIGURED) + ir = INTERFACE_REQUESTED | INTERFACE_AUTOMATIC; +- else ++ else { + ir = INTERFACE_REQUESTED; ++ if (state == DISCOVER_RELAY && local_family == AF_INET) { ++ /* We're a v4 relay without specifically requested ++ * interfaces, so mark them all as bidirectional. */ ++ ir |= INTERFACE_STREAMS; ++ } ++ } + + /* Cycle through the list of interfaces looking for IP addresses. */ + while (next_iface(&info, &err, &ifaces)) { +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 15f0acf..8051e17 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -172,6 +172,7 @@ static const char url[] = + " [-m append|replace|forward|discard]\n" \ + " [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ ++" [-iu interface0 [ ... -iu interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ +@@ -188,6 +189,7 @@ static const char url[] = + " [-pf ] [--no-pid]\n"\ + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ ++" [-iu interface0 [ ... -iu interfaceN]\n" \ + " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + +@@ -304,7 +306,34 @@ main(int argc, char **argv) { + isc_result_totext(status)); + } + strcpy(tmp->name, argv[i]); +- interface_snorf(tmp, INTERFACE_REQUESTED); ++ interface_snorf(tmp, (INTERFACE_REQUESTED | ++ INTERFACE_STREAMS)); ++ interface_dereference(&tmp, MDL); ++ } else if (!strcmp(argv[i], "-iu")) { ++#ifdef DHCPv6 ++ if (local_family_set && (local_family == AF_INET6)) { ++ usage(); ++ } ++ local_family_set = 1; ++ local_family = AF_INET; ++#endif ++ if (++i == argc) { ++ usage(); ++ } ++ if (strlen(argv[i]) >= sizeof(tmp->name)) { ++ log_fatal("%s: interface name too long " ++ "(is %ld)", ++ argv[i], (long)strlen(argv[i])); ++ } ++ status = interface_allocate(&tmp, MDL); ++ if (status != ISC_R_SUCCESS) { ++ log_fatal("%s: interface_allocate: %s", ++ argv[i], ++ isc_result_totext(status)); ++ } ++ strcpy(tmp->name, argv[i]); ++ interface_snorf(tmp, (INTERFACE_REQUESTED | ++ INTERFACE_UPSTREAM)); + interface_dereference(&tmp, MDL); + } else if (!strcmp(argv[i], "-a")) { + #ifdef DHCPv6 +@@ -691,6 +720,11 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, + + /* If it's a bootreply, forward it to the client. */ + if (packet->op == BOOTREPLY) { ++ if (!(ip->flags & INTERFACE_UPSTREAM)) { ++ log_debug("Dropping reply received on %s", ip->name); ++ return; ++ } ++ + if (!(packet->flags & htons(BOOTP_BROADCAST)) && + can_unicast_without_arp(out)) { + to.sin_addr = packet->yiaddr; +-- +2.17.1 + diff --git a/src/isc-dhcp/patch/0009-Port-upstream-changes-from-commit-edd6d8881bc4d8ec4b.patch b/src/isc-dhcp/patch/0009-Port-upstream-changes-from-commit-edd6d8881bc4d8ec4b.patch new file mode 100644 index 000000000000..952d1cf66a8a --- /dev/null +++ b/src/isc-dhcp/patch/0009-Port-upstream-changes-from-commit-edd6d8881bc4d8ec4b.patch @@ -0,0 +1,157 @@ +From 1d59a7bd4dc9cb3cd13aedf604a15a8589febe43 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Thu, 2 May 2019 19:46:42 +0000 +Subject: [PATCH 2/2] Port upstream changes from commit + edd6d8881bc4d8ec4b04173c66c1c840756bbe76 to add '-id' option + +--- + relay/dhcrelay.c | 89 +++++++++++++++++++++++++++++++++--------------- + 1 file changed, 61 insertions(+), 28 deletions(-) + +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 8051e17..292ba4f 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -142,6 +142,8 @@ static int strip_relay_agent_options(struct interface_info *, + struct interface_info **, + struct dhcp_packet *, unsigned); + ++static void request_v4_interface(const char* name, int flags); ++ + static int load_interface_alias_map(const char *port_alias_map_file_path); + static int get_interface_alias_by_name(const char *if_name, char *if_alias_out); + static void free_interface_alias_map(void); +@@ -173,6 +175,7 @@ static const char url[] = + " [--name-alias-map-file ]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " [-iu interface0 [ ... -iu interfaceN]\n" \ ++" [-id interface0 [ ... -id interfaceN]\n" \ + " server0 [ ... serverN]\n\n" \ + " dhcrelay -6 [-d] [-q] [-I] [-c ] [-p ]\n" \ + " [-pf ] [--no-pid]\n" \ +@@ -190,6 +193,7 @@ static const char url[] = + " [-m append|replace|forward|discard]\n" \ + " [-i interface0 [ ... -i interfaceN]\n" \ + " [-iu interface0 [ ... -iu interfaceN]\n" \ ++" [-id interface0 [ ... -id interfaceN]\n" \ + " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE + #endif + +@@ -294,21 +298,8 @@ main(int argc, char **argv) { + if (++i == argc) { + usage(); + } +- if (strlen(argv[i]) >= sizeof(tmp->name)) { +- log_fatal("%s: interface name too long " +- "(is %ld)", +- argv[i], (long)strlen(argv[i])); +- } +- status = interface_allocate(&tmp, MDL); +- if (status != ISC_R_SUCCESS) { +- log_fatal("%s: interface_allocate: %s", +- argv[i], +- isc_result_totext(status)); +- } +- strcpy(tmp->name, argv[i]); +- interface_snorf(tmp, (INTERFACE_REQUESTED | +- INTERFACE_STREAMS)); +- interface_dereference(&tmp, MDL); ++ ++ request_v4_interface(argv[i], INTERFACE_STREAMS); + } else if (!strcmp(argv[i], "-iu")) { + #ifdef DHCPv6 + if (local_family_set && (local_family == AF_INET6)) { +@@ -320,21 +311,21 @@ main(int argc, char **argv) { + if (++i == argc) { + usage(); + } +- if (strlen(argv[i]) >= sizeof(tmp->name)) { +- log_fatal("%s: interface name too long " +- "(is %ld)", +- argv[i], (long)strlen(argv[i])); ++ ++ request_v4_interface(argv[i], INTERFACE_UPSTREAM); ++ } else if (!strcmp(argv[i], "-id")) { ++#ifdef DHCPv6 ++ if (local_family_set && (local_family == AF_INET6)) { ++ usage(); + } +- status = interface_allocate(&tmp, MDL); +- if (status != ISC_R_SUCCESS) { +- log_fatal("%s: interface_allocate: %s", +- argv[i], +- isc_result_totext(status)); ++ local_family_set = 1; ++ local_family = AF_INET; ++#endif ++ if (++i == argc) { ++ usage(); + } +- strcpy(tmp->name, argv[i]); +- interface_snorf(tmp, (INTERFACE_REQUESTED | +- INTERFACE_UPSTREAM)); +- interface_dereference(&tmp, MDL); ++ ++ request_v4_interface(argv[i], INTERFACE_DOWNSTREAM); + } else if (!strcmp(argv[i], "-a")) { + #ifdef DHCPv6 + if (local_family_set && (local_family == AF_INET6)) { +@@ -782,6 +773,11 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, + if (out) + return; + ++ if (!(ip->flags & INTERFACE_DOWNSTREAM)) { ++ log_debug("Dropping request received on %s", ip->name); ++ return; ++ } ++ + /* Add relay agent options if indicated. If something goes wrong, + drop the packet. */ + if (!(length = add_relay_agent_options(ip, packet, length, +@@ -1991,6 +1987,43 @@ dhcp_set_control_state(control_object_state_t oldstate, + exit(0); + } + ++/*! ++ * ++ * \brief Allocate an interface as requested with a given set of flags ++ * ++ * The requested interface is allocated, its flags field is set to ++ * INTERFACE_REQUESTED OR'd with the given flags, and then added to ++ * the list of interfaces. ++ * ++ * \param name - name of the requested interface ++ * \param flags - additional flags for the interface ++ * ++ * \return Nothing ++ */ ++void request_v4_interface(const char* name, int flags) { ++ struct interface_info *tmp = NULL; ++ int len = strlen(name); ++ isc_result_t status; ++ ++ if (len >= sizeof(tmp->name)) { ++ log_fatal("%s: interface name too long (is %d)", name, len); ++ } ++ ++ status = interface_allocate(&tmp, MDL); ++ if (status != ISC_R_SUCCESS) { ++ log_fatal("%s: interface_allocate: %s", name, ++ isc_result_totext(status)); ++ } ++ ++ log_debug("Requesting: %s as upstream: %c downstream: %c", name, ++ (flags & INTERFACE_UPSTREAM ? 'Y' : 'N'), ++ (flags & INTERFACE_DOWNSTREAM ? 'Y' : 'N')); ++ ++ strncpy(tmp->name, name, len); ++ interface_snorf(tmp, (INTERFACE_REQUESTED | flags)); ++ interface_dereference(&tmp, MDL); ++} ++ + #define MAX_PORT_CONFIG_LINE_LEN 1024 + + // Allocates and loads global map g_interface_name_alias_map +-- +2.17.1 + diff --git a/src/isc-dhcp/patch/0010-Add-enable-use-sockets-to-configure-flags-in-debian-.patch b/src/isc-dhcp/patch/0010-Add-enable-use-sockets-to-configure-flags-in-debian-.patch new file mode 100644 index 000000000000..a21b210a3b2e --- /dev/null +++ b/src/isc-dhcp/patch/0010-Add-enable-use-sockets-to-configure-flags-in-debian-.patch @@ -0,0 +1,28 @@ +From ab779f1d59f27f66e6e6bea89287c810e0a10a0f Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Wed, 15 May 2019 23:48:08 +0000 +Subject: [PATCH 1/3] Add --enable-use-sockets to configure flags in + debian/rules + +This defines USE_SOCKETS at compile time which forces dhcrelay +to create and bind separate sockets to each interface +--- + debian/rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/debian/rules b/debian/rules +index 4184716..46d6527 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -23,7 +23,7 @@ CFLAGS+=-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"' + CFLAGS+=-D_PATH_DHCLIENT_DB='\"$(LEASE_PATH)/dhclient.leases\"' + CFLAGS+=-D_PATH_DHCLIENT6_DB='\"$(LEASE_PATH)/dhclient6.leases\"' + +-CONFFLAGS=--prefix=/usr --enable-log-pid --enable-paranoia ++CONFFLAGS=--prefix=/usr --enable-log-pid --enable-paranoia --enable-use-sockets + + # cross-architecture building + ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) +-- +2.17.1 + diff --git a/src/isc-dhcp/patch/0011-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch b/src/isc-dhcp/patch/0011-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch new file mode 100644 index 000000000000..291d5b0ed69f --- /dev/null +++ b/src/isc-dhcp/patch/0011-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch @@ -0,0 +1,122 @@ +From c26520f36ebcd1f143312fc61440ed3d546c7504 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Wed, 8 May 2019 18:08:13 +0000 +Subject: [PATCH 2/3] Bugfix: Ensure HAVE_SO_BINDTODEVICE has a chance to be + defined before it is referenced + +--- + includes/osdep.h | 93 ++++++++++++++++++++++++------------------------ + 1 file changed, 47 insertions(+), 46 deletions(-) + +diff --git a/includes/osdep.h b/includes/osdep.h +index 5ae0c35..670b356 100644 +--- a/includes/osdep.h ++++ b/includes/osdep.h +@@ -139,52 +139,6 @@ + # define USE_UPF_RECEIVE + #endif + +-/* Porting:: +- +- If you add support for sending packets directly out an interface, +- and your support does not do ARP or routing, you must use a fallback +- mechanism to deal with packets that need to be sent to routers. +- Currently, all low-level packet interfaces use BSD sockets as a +- fallback. */ +- +-#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ +- defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ +- defined (USE_LPF_SEND) || \ +- (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) +-# define USE_SOCKET_FALLBACK +-# define USE_FALLBACK +-#endif +- +-/* Porting:: +- +- If you add support for sending packets directly out an interface +- and need to be able to assemble packets, add the USE_XXX_SEND +- definition for your interface to the list tested below. */ +- +-#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ +- defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ +- defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) +-# define PACKET_ASSEMBLY +-#endif +- +-/* Porting:: +- +- If you add support for receiving packets directly from an interface +- and need to be able to decode raw packets, add the USE_XXX_RECEIVE +- definition for your interface to the list tested below. */ +- +-#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ +- defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ +- defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) +-# define PACKET_DECODING +-#endif +- +-/* If we don't have a DLPI packet filter, we have to filter in userland. +- Probably not worth doing, actually. */ +-#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) +-# define USERLAND_FILTER +-#endif +- + /* jmp_buf is assumed to be a struct unless otherwise defined in the + system header. */ + #ifndef jbp_decl +@@ -288,4 +242,51 @@ + # define STDERR_FILENO 2 + #endif + ++/* Porting:: ++ ++ If you add support for sending packets directly out an interface, ++ and your support does not do ARP or routing, you must use a fallback ++ mechanism to deal with packets that need to be sent to routers. ++ Currently, all low-level packet interfaces use BSD sockets as a ++ fallback. */ ++ ++#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ ++ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \ ++ defined (USE_LPF_SEND) || \ ++ (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE)) ++# define USE_SOCKET_FALLBACK ++# define USE_FALLBACK ++#endif ++ ++/* Porting:: ++ ++ If you add support for sending packets directly out an interface ++ and need to be able to assemble packets, add the USE_XXX_SEND ++ definition for your interface to the list tested below. */ ++ ++#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ ++ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ ++ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) ++# define PACKET_ASSEMBLY ++#endif ++ ++/* Porting:: ++ ++ If you add support for receiving packets directly from an interface ++ and need to be able to decode raw packets, add the USE_XXX_RECEIVE ++ definition for your interface to the list tested below. */ ++ ++#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ ++ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ ++ defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE) ++# define PACKET_DECODING ++#endif ++ ++/* If we don't have a DLPI packet filter, we have to filter in userland. ++ Probably not worth doing, actually. */ ++#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) ++# define USERLAND_FILTER ++#endif ++ ++ + #endif /* __ISC_DHCP_OSDEP_H__ */ +-- +2.17.1 + diff --git a/src/isc-dhcp/patch/0012-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch b/src/isc-dhcp/patch/0012-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch new file mode 100644 index 000000000000..4a572e933624 --- /dev/null +++ b/src/isc-dhcp/patch/0012-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch @@ -0,0 +1,264 @@ +From d8ed5f313d06829290e49d4d4b5413700affcf26 Mon Sep 17 00:00:00 2001 +From: Joe LeVeque +Date: Sun, 5 May 2019 22:52:49 +0000 +Subject: [PATCH 3/3] If destination of BOOTREQUEST is directed broadcast, + forward on that interface. Otherwise forward on fallback or all upstream + interfaces + +--- + common/discover.c | 46 ++++++++++++++++++++--- + includes/dhcpd.h | 3 ++ + relay/dhcrelay.c | 96 ++++++++++++++++++++++++++++++++++++++++++----- + 3 files changed, 130 insertions(+), 15 deletions(-) + +diff --git a/common/discover.c b/common/discover.c +index e20d9d5..bf82735 100644 +--- a/common/discover.c ++++ b/common/discover.c +@@ -227,6 +227,7 @@ struct iface_conf_list { + struct iface_info { + char name[IF_NAMESIZE+1]; /* name of the interface, e.g. "bge0" */ + struct sockaddr_storage addr; /* address information */ ++ struct sockaddr_storage netmask; /* netmask information */ + isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ + }; + +@@ -401,6 +402,7 @@ struct iface_conf_list { + struct iface_info { + char name[IFNAMSIZ]; /* name of the interface, e.g. "eth0" */ + struct sockaddr_storage addr; /* address information */ ++ struct sockaddr_storage netmask; /* netmask information */ + isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ + }; + +@@ -576,6 +578,17 @@ next_iface4(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { + } + memcpy(&info->addr, &tmp.ifr_addr, sizeof(tmp.ifr_addr)); + ++ if (ioctl(ifaces->sock, SIOCGIFNETMASK, &tmp) < 0) { ++ if (errno == EADDRNOTAVAIL) { ++ continue; ++ } ++ log_error("Error getting netmask " ++ "for '%s'; %m", name); ++ *err = 1; ++ return 0; ++ } ++ memcpy(&info->netmask, &tmp.ifr_netmask, sizeof(tmp.ifr_netmask)); ++ + memset(&tmp, 0, sizeof(tmp)); + strncpy(tmp.ifr_name, name, sizeof(tmp.ifr_name) - 1); + if (ioctl(ifaces->sock, SIOCGIFFLAGS, &tmp) < 0) { +@@ -779,6 +792,7 @@ struct iface_conf_list { + struct iface_info { + char name[IFNAMSIZ]; /* name of the interface, e.g. "bge0" */ + struct sockaddr_storage addr; /* address information */ ++ struct sockaddr_storage netmask; /* netmask information */ + isc_uint64_t flags; /* interface flags, e.g. IFF_LOOPBACK */ + }; + +@@ -838,7 +852,8 @@ end_iface_scan(struct iface_conf_list *ifaces) { + /* XXX: perhaps create drealloc() rather than do it manually */ + void + add_ipv4_addr_to_interface(struct interface_info *iface, +- const struct in_addr *addr) { ++ const struct in_addr *addr, ++ const struct in_addr *netmask) { + /* + * We don't expect a lot of addresses per IPv4 interface, so + * we use 4, as our "chunk size" for collecting addresses. +@@ -849,6 +864,12 @@ add_ipv4_addr_to_interface(struct interface_info *iface, + log_fatal("Out of memory saving IPv4 address " + "on interface."); + } ++ ++ iface->netmasks = dmalloc(4 * sizeof(struct in_addr), MDL); ++ if (iface->netmasks == NULL) { ++ log_fatal("Out of memory saving IPv4 netmask " ++ "on interface."); ++ } + iface->address_count = 0; + iface->address_max = 4; + } else if (iface->address_count >= iface->address_max) { +@@ -861,14 +882,28 @@ add_ipv4_addr_to_interface(struct interface_info *iface, + log_fatal("Out of memory saving IPv4 address " + "on interface."); + } +- memcpy(tmp, +- iface->addresses, ++ memcpy(tmp, ++ iface->addresses, + iface->address_max * sizeof(struct in_addr)); + dfree(iface->addresses, MDL); + iface->addresses = tmp; ++ ++ tmp = dmalloc(new_max * sizeof(struct in_addr), MDL); ++ if (tmp == NULL) { ++ log_fatal("Out of memory saving IPv4 netmask " ++ "on interface."); ++ } ++ memcpy(tmp, ++ iface->netmasks, ++ iface->address_max * sizeof(struct in_addr)); ++ dfree(iface->netmasks, MDL); ++ iface->netmasks = tmp; ++ + iface->address_max = new_max; + } +- iface->addresses[iface->address_count++] = *addr; ++ iface->addresses[iface->address_count] = *addr; ++ iface->netmasks[iface->address_count] = *netmask; ++ iface->address_count++; + } + + #ifdef DHCPv6 +@@ -1003,6 +1038,7 @@ discover_interfaces(int state) { + if ((info.addr.ss_family == AF_INET) && + (local_family == AF_INET)) { + struct sockaddr_in *a = (struct sockaddr_in*)&info.addr; ++ struct sockaddr_in *n = (struct sockaddr_in*)&info.netmask; + struct iaddr addr; + + /* We don't want the loopback interface. */ +@@ -1016,7 +1052,7 @@ discover_interfaces(int state) { + if (a->sin_addr.s_addr != htonl(INADDR_ANY)) + tmp->configured = 1; + +- add_ipv4_addr_to_interface(tmp, &a->sin_addr); ++ add_ipv4_addr_to_interface(tmp, &a->sin_addr, &n->sin_addr); + + /* invoke the setup hook */ + addr.len = 4; +diff --git a/includes/dhcpd.h b/includes/dhcpd.h +index 1fd12db..8b509f1 100644 +--- a/includes/dhcpd.h ++++ b/includes/dhcpd.h +@@ -1323,6 +1323,9 @@ struct interface_info { + struct in_addr *addresses; /* Addresses associated with this + * interface. + */ ++ struct in_addr *netmasks; /* Netmask associated with this ++ * interface. ++ */ + int address_count; /* Number of addresses stored. */ + int address_max; /* Size of addresses buffer. */ + struct in6_addr *v6addresses; /* IPv6 addresses associated with +diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c +index 292ba4f..339be87 100644 +--- a/relay/dhcrelay.c ++++ b/relay/dhcrelay.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + TIME default_lease_time = 43200; /* 12 hours... */ + TIME max_lease_time = 86400; /* 24 hours... */ +@@ -799,18 +800,93 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet, + /* Otherwise, it's a BOOTREQUEST, so forward it to all the + servers. */ + for (sp = servers; sp; sp = sp->next) { +- if (send_packet((fallback_interface +- ? fallback_interface : interfaces), +- NULL, packet, length, ip->addresses[0], +- &sp->to, NULL) < 0) { +- ++client_packet_errors; ++ int packet_relay_attempted = 0; ++ ++ log_debug("Server IP: %s", inet_ntoa(sp->to.sin_addr)); ++ ++ /* If the server's IP address is the broadcast IP of one ++ of our interfaces, we send it directly on that interface's ++ socket, because the kernel will drop directed broadcast ++ packets if we send on the fallback. */ ++ for (out = interfaces; out; out = out->next) { ++ int i = 0; ++ ++ // Only relay BOOTREQUEST on upstream interfaces ++ if (!(out->flags & INTERFACE_UPSTREAM)) ++ continue; ++ ++ if (!out->addresses || !out->netmasks) ++ continue; ++ ++ for (i = 0; i < out->address_count; i++) { ++ struct in_addr bcast_addr; ++ ++ log_debug("Iface %s addr: %s", out->name, inet_ntoa(out->addresses[i])); ++ log_debug("Iface %s netmask: %s", out->name, inet_ntoa(out->netmasks[i])); ++ ++ // Broadcast = ip_addr | ~netmask ++ bcast_addr.s_addr = out->addresses[i].s_addr | ~out->netmasks[i].s_addr; ++ log_debug("Iface %s broadcast: %s", out->name, inet_ntoa(bcast_addr)); ++ ++ if (sp->to.sin_addr.s_addr == bcast_addr.s_addr) { ++ log_debug("Packet destined for broadcast IP of %s", out->name); ++ if (send_packet(out, NULL, packet, ++ length, ip->addresses[0],&sp->to, NULL) < 0) { ++ ++client_packet_errors; ++ } else { ++ log_debug("Forwarded BOOTREQUEST for %s to %s on interface %s", ++ print_hw_addr(packet->htype, packet->hlen, ++ packet->chaddr), ++ inet_ntoa(sp->to.sin_addr), out->name); ++ ++ ++client_packets_relayed; ++ } ++ ++ packet_relay_attempted = 1; ++ ++ break; ++ } ++ } ++ ++ if (packet_relay_attempted) ++ break; ++ } ++ ++ if (packet_relay_attempted) ++ continue; ++ ++ /* Otherwise, if we have a fallback interface, we send the packet ++ on it. If not, we send the packet out all interfaces.*/ ++ if (fallback_interface) { ++ if (send_packet(fallback_interface, NULL, packet, ++ length, ip->addresses[0],&sp->to, NULL) < 0) { ++ ++client_packet_errors; ++ } else { ++ log_debug("Forwarded BOOTREQUEST for %s to %s on fallback interface", ++ print_hw_addr(packet->htype, packet->hlen, ++ packet->chaddr), ++ inet_ntoa(sp->to.sin_addr)); ++ ++ ++client_packets_relayed; ++ } + } else { +- log_debug("Forwarded BOOTREQUEST for %s to %s", +- print_hw_addr(packet->htype, packet->hlen, +- packet->chaddr), +- inet_ntoa(sp->to.sin_addr)); ++ for (out = interfaces; out; out = out->next) { ++ // Only relay BOOTREQUEST on upstream interfaces ++ if (!(out->flags & INTERFACE_UPSTREAM)) ++ continue; ++ ++ if (send_packet(out, NULL, packet, ++ length, ip->addresses[0],&sp->to, NULL) < 0) { ++ ++client_packet_errors; ++ } else { ++ log_debug("Forwarded BOOTREQUEST for %s to %s on interface %s", ++ print_hw_addr(packet->htype, packet->hlen, ++ packet->chaddr), ++ inet_ntoa(sp->to.sin_addr), out->name); + +- ++client_packets_relayed; ++ ++client_packets_relayed; ++ } ++ } + } + } + +-- +2.17.1 + diff --git a/src/isc-dhcp/patch/series b/src/isc-dhcp/patch/series index 3e1c15338687..4455dc97e93e 100644 --- a/src/isc-dhcp/patch/series +++ b/src/isc-dhcp/patch/series @@ -6,4 +6,8 @@ 0005-CVE-2017-3144.patch 0006-CVE-2018-5733.patch 0007-CVE-2018-5732.patch - +0008-Port-upstream-changes-from-commit-f2e70402f0f2955f39.patch +0009-Port-upstream-changes-from-commit-edd6d8881bc4d8ec4b.patch +0010-Add-enable-use-sockets-to-configure-flags-in-debian-.patch +0011-Bugfix-Ensure-HAVE_SO_BINDTODEVICE-has-a-chance-to-b.patch +0012-If-destination-of-BOOTREQUEST-is-directed-broadcast-.patch diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf index ed14f2ca0f8c..d285fbfc788c 100644 --- a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -23,7 +23,7 @@ stderr_logfile=syslog programs=isc-dhcp-relay-Vlan1000 [program:isc-dhcp-relay-Vlan1000] -command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -i Vlan1000 -i PortChannel01 -i PortChannel02 -i PortChannel03 -i PortChannel04 192.0.0.1 192.0.0.2 +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 192.0.0.1 192.0.0.2 priority=3 autostart=false autorestart=false From 643d16a4d79804343e4590732a88f3d5dae7f488 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 15 May 2019 04:37:41 +0530 Subject: [PATCH 100/219] LED Supprot For DellEMC Z9100 (#2799) --- .../Force10-Z9100-C32/led_proc_init.soc | 51 ++++++++++++++++ .../Force10-Z9100-C8D48/led_proc_init.soc | 58 +++++++++++++++++++ .../z9100/scripts/z9100_platform.sh | 34 +++++++++++ 3 files changed, 143 insertions(+) create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/led_proc_init.soc create mode 100644 device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/led_proc_init.soc diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/led_proc_init.soc b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/led_proc_init.soc new file mode 100644 index 000000000000..dd30163ddcf6 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/led_proc_init.soc @@ -0,0 +1,51 @@ +# LED microprocessor initialization for Dell Z9100 +# +# +#Led0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=19 REMAP_PORT_9=18 REMAP_PORT_10=17 REMAP_PORT_11=16 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=23 REMAP_PORT_13=22 REMAP_PORT_14=21 REMAP_PORT_15=20 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=27 REMAP_PORT_1=26 REMAP_PORT_2=25 REMAP_PORT_3=24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=31 REMAP_PORT_5=30 REMAP_PORT_6=29 REMAP_PORT_7=28 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=39 REMAP_PORT_45=38 REMAP_PORT_46=37 REMAP_PORT_47=36 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=43 REMAP_PORT_33=42 REMAP_PORT_34=41 REMAP_PORT_35=40 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=47 REMAP_PORT_37=46 REMAP_PORT_38=45 REMAP_PORT_39=44 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=51 REMAP_PORT_25=50 REMAP_PORT_26=49 REMAP_PORT_27=48 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=55 REMAP_PORT_29=54 REMAP_PORT_30=53 REMAP_PORT_31=52 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=59 REMAP_PORT_17=58 REMAP_PORT_18=57 REMAP_PORT_19=56 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=63 REMAP_PORT_21=62 REMAP_PORT_22=61 REMAP_PORT_23=60 + +#Led1 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=35 REMAP_PORT_5=34 REMAP_PORT_6=33 REMAP_PORT_7=32 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=39 REMAP_PORT_1=38 REMAP_PORT_2=37 REMAP_PORT_3=36 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=43 REMAP_PORT_13=42 REMAP_PORT_14=41 REMAP_PORT_15=40 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=47 REMAP_PORT_9=46 REMAP_PORT_10=45 REMAP_PORT_11=44 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 stop +led 0 prog 02 A8 60 AA 02 00 60 A7 02 00 60 FE 02 00 60 AB 06 A7 D2 08 74 20 02 A9 60 AA 06 A7 E2 08 60 A7 06 FE 28 67 3D 86 FE 06 FE 86 AB 06 AB D2 04 71 10 86 A7 06 FE D2 40 71 0C 86 FF 3A 80 32 08 97 71 7C 77 4C 57 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 06 AA 61 A6 16 A7 49 27 16 A6 97 71 53 77 45 57 02 0A 50 95 75 74 85 75 5A 57 16 FF CA 05 74 4C 77 5A 06 FE 12 BC F8 32 00 32 01 B7 97 71 6A 77 5A +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 02 A8 60 AA 02 00 60 A7 02 00 60 FE 02 00 60 AB 06 A7 D2 08 74 20 02 A9 60 AA 06 A7 E2 08 60 A7 06 FE 28 67 3D 86 FE 06 FE 86 AB 06 AB D2 04 71 10 86 A7 06 FE D2 40 71 0C 86 FF 3A 80 32 08 97 71 7C 77 4C 57 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 06 AA 61 A6 16 A7 49 27 16 A6 97 71 53 77 45 57 02 0A 50 95 75 74 85 75 5A 57 16 FF CA 05 74 4C 77 5A 06 FE 12 BC F8 32 00 32 01 B7 97 71 6A 77 5A + +led 1 auto on +led 1 start + +led 2 stop diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/led_proc_init.soc b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/led_proc_init.soc new file mode 100644 index 000000000000..487c9fb7dcd9 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C8D48/led_proc_init.soc @@ -0,0 +1,58 @@ +# LED microprocessor initialization for Dell Z9100 +# +# +#Led0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=3 REMAP_PORT_61=2 REMAP_PORT_62=1 REMAP_PORT_63=0 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=7 REMAP_PORT_57=6 REMAP_PORT_58=5 REMAP_PORT_59=4 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=11 REMAP_PORT_53=10 REMAP_PORT_54=9 REMAP_PORT_55=8 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=15 REMAP_PORT_49=14 REMAP_PORT_50=13 REMAP_PORT_51=12 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=19 REMAP_PORT_9=18 REMAP_PORT_10=17 REMAP_PORT_11=16 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=23 REMAP_PORT_13=22 REMAP_PORT_14=21 REMAP_PORT_15=20 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=27 REMAP_PORT_1=26 REMAP_PORT_2=25 REMAP_PORT_3=24 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=31 REMAP_PORT_5=30 REMAP_PORT_6=29 REMAP_PORT_7=28 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=35 REMAP_PORT_41=34 REMAP_PORT_42=33 REMAP_PORT_43=32 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=39 REMAP_PORT_45=38 REMAP_PORT_46=37 REMAP_PORT_47=36 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=43 REMAP_PORT_33=42 REMAP_PORT_34=41 REMAP_PORT_35=40 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=47 REMAP_PORT_37=46 REMAP_PORT_38=45 REMAP_PORT_39=44 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=51 REMAP_PORT_25=50 REMAP_PORT_26=49 REMAP_PORT_27=48 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=55 REMAP_PORT_29=54 REMAP_PORT_30=53 REMAP_PORT_31=52 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=59 REMAP_PORT_17=58 REMAP_PORT_18=57 REMAP_PORT_19=56 +modreg CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=63 REMAP_PORT_21=62 REMAP_PORT_22=61 REMAP_PORT_23=60 + +#Led1 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_16=3 REMAP_PORT_17=2 REMAP_PORT_18=1 REMAP_PORT_19=0 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_20=7 REMAP_PORT_21=6 REMAP_PORT_22=5 REMAP_PORT_23=4 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_24=11 REMAP_PORT_25=10 REMAP_PORT_26=9 REMAP_PORT_27=8 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_28=15 REMAP_PORT_29=14 REMAP_PORT_30=13 REMAP_PORT_31=12 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_32=19 REMAP_PORT_33=18 REMAP_PORT_34=17 REMAP_PORT_35=16 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_36=23 REMAP_PORT_37=22 REMAP_PORT_38=21 REMAP_PORT_39=20 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_40=27 REMAP_PORT_41=26 REMAP_PORT_42=25 REMAP_PORT_43=24 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_44=31 REMAP_PORT_45=30 REMAP_PORT_46=29 REMAP_PORT_47=28 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_4=35 REMAP_PORT_5=34 REMAP_PORT_6=33 REMAP_PORT_7=32 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_0=39 REMAP_PORT_1=38 REMAP_PORT_2=37 REMAP_PORT_3=36 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_12=43 REMAP_PORT_13=42 REMAP_PORT_14=41 REMAP_PORT_15=40 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_8=47 REMAP_PORT_9=46 REMAP_PORT_10=45 REMAP_PORT_11=44 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_48=51 REMAP_PORT_49=50 REMAP_PORT_50=49 REMAP_PORT_51=48 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_52=55 REMAP_PORT_53=54 REMAP_PORT_54=53 REMAP_PORT_55=52 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_56=59 REMAP_PORT_57=58 REMAP_PORT_58=57 REMAP_PORT_59=56 +modreg CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_60=63 REMAP_PORT_61=62 REMAP_PORT_62=61 REMAP_PORT_63=60 + +led 0 stop +led 0 prog 02 A8 60 AA 02 00 60 A7 02 00 60 FE 02 00 60 AB 06 A7 D2 08 74 20 02 A9 60 AA 06 A7 E2 08 60 A7 06 FE 28 67 3D 86 FE 06 FE 86 AB 06 AB D2 04 71 10 86 A7 06 FE D2 40 71 0C 86 FF 3A 80 32 08 97 71 7C 77 4C 57 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 06 AA 61 A6 16 A7 49 27 16 A6 97 71 53 77 45 57 02 0A 50 95 75 74 85 75 5A 57 16 FF CA 05 74 4C 77 5A 06 FE 12 BC F8 32 00 32 01 B7 97 71 6A 77 5A +led 0 auto on +led 0 start + +led 1 stop +led 1 prog 02 A8 60 AA 02 00 60 A7 02 00 60 FE 02 00 60 AB 06 A7 D2 08 74 20 02 A9 60 AA 06 A7 E2 08 60 A7 06 FE 28 67 3D 86 FE 06 FE 86 AB 06 AB D2 04 71 10 86 A7 06 FE D2 40 71 0C 86 FF 3A 80 32 08 97 71 7C 77 4C 57 22 0E 87 22 0E 87 57 22 0F 87 22 0F 87 57 22 0F 87 22 0E 87 57 06 AA 61 A6 16 A7 49 27 16 A6 97 71 53 77 45 57 02 0A 50 95 75 74 85 75 5A 57 16 FF CA 05 74 4C 77 5A 06 FE 12 BC F8 32 00 32 01 B7 97 71 6A 77 5A + +led 1 auto on +led 1 start + +led 2 stop + + +setreg CMIC_LEDUP1_DATA_RAM[0xa8] 0x3f +setreg CMIC_LEDUP1_DATA_RAM[0xa9] 0xFC +setreg CMIC_LEDUP0_DATA_RAM[0xa8] 0xff +setreg CMIC_LEDUP0_DATA_RAM[0xa9] 0xC3 + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index c943e584943c..294b1b79aa88 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -171,6 +171,35 @@ reset_muxes() { io_rd_wr.py --set --val 0xff --offset 0x20b } +# Copy led_proc_init.soc file according to the HWSKU +init_switch_port_led() { + T0="Force10-Z9100-C8D48" + T1="Force10-Z9100-C32" + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + hwsku=$(cat /etc/sonic/config_db.json | grep -A2 "DEVICE_METADATA" | grep "hwsku" | cut -d ":" -f2 | sed 's/"//g' | sed 's/,//g'| xargs ) + + if [ -z "$hwsku" ]; then + #Check minigraph for hwsku + cat /etc/sonic/minigraph.xml | grep $T1 > /dev/null + if [ $? -eq 0 ]; then + hwsku=$T1 + else + hwsku=$T0 + fi + fi + + led_proc_init="$device/$platform/$hwsku/led_proc_init.soc" + + # Remove old HWSKU LED file.. + rm -rf $device/$platform/led_proc_init.soc + + if [ -e $led_proc_init ] && [ ! -e $device/$platform/led_proc_init.soc ]; then + cp $led_proc_init $device/$platform + fi + +} + init_devnum if [[ "$1" == "init" ]]; then @@ -188,6 +217,11 @@ if [[ "$1" == "init" ]]; then switch_board_sfp "new_device" switch_board_qsfp "new_device" xcvr_presence_interrupts "enable" + + #Copy led_proc_init.soc + init_switch_port_led + + elif [[ "$1" == "deinit" ]]; then xcvr_presence_interrupts "disable" switch_board_sfp "delete_device" From 238db1e06abea1f3c4f11e37539f25d9bf1dbd2d Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Thu, 9 May 2019 14:36:32 -0700 Subject: [PATCH 101/219] [tacacs]: skip accessing tacacs servers for local non-tacacs users (#2843) * Switch the nss look up order as "compat" followed by "tacplus". This helps use the legacy passwd file for user info and go to tacacs only if not found. This means, we never contact tacacs for local users like "admin". This isolates local users from any issues with tacacs servers. W/o this fix, the sudo commands by local users could take * seconds, if the tacacs servers are unreachable. * Skip tacacs server access for local non-tacacs users. Revert the order of 'compat tacplus' to original 'tacplus compat' as tacplus access is required for all tacacs users, who also get created locally. --- .../image_config/hostcfgd/tacplus_nss.conf.j2 | 2 +- ...acacs-servers-for-local-non-tacacs-u.patch | 81 +++++++++++++++++++ src/tacacs/nss/Makefile | 1 + 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 src/tacacs/nss/0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch diff --git a/files/image_config/hostcfgd/tacplus_nss.conf.j2 b/files/image_config/hostcfgd/tacplus_nss.conf.j2 index 347a9ec3d8c2..7f737888f59d 100644 --- a/files/image_config/hostcfgd/tacplus_nss.conf.j2 +++ b/files/image_config/hostcfgd/tacplus_nss.conf.j2 @@ -1,4 +1,4 @@ -onfiguration for libnss-tacplus +# Configuration for libnss-tacplus # debug - If you want to open debug log, set it on # Default: off diff --git a/src/tacacs/nss/0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch b/src/tacacs/nss/0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch new file mode 100644 index 000000000000..fc0dd46376fb --- /dev/null +++ b/src/tacacs/nss/0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch @@ -0,0 +1,81 @@ +From 228d743b907be6346731cacc9c5d2bc78ce6a4e8 Mon Sep 17 00:00:00 2001 +From: Renuka Manavalan +Date: Mon, 6 May 2019 04:23:26 +0000 +Subject: [PATCH 4/4] Skip accessing tacacs servers for local non-tacacs users. + +--- + nss_tacplus.c | 44 +++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 43 insertions(+), 1 deletion(-) + +diff --git a/nss_tacplus.c b/nss_tacplus.c +index aac5246..f2a86e1 100644 +--- a/nss_tacplus.c ++++ b/nss_tacplus.c +@@ -487,7 +487,7 @@ static int create_or_modify_local_user(const char *name, int level, bool existin + /* + * Lookup user in /etc/passwd, and fill up passwd info if found. + */ +-static int lookup_pw_local(char* username, struct pwbuf *pb, bool *found) ++static int lookup_pw_local(const char* username, struct pwbuf *pb, bool *found) + { + FILE *fp; + struct passwd *pw = NULL; +@@ -517,6 +517,45 @@ static int lookup_pw_local(char* username, struct pwbuf *pb, bool *found) + return ret; + } + ++/* ++ * Return true, if user has entry in /etc/passwd and his gecos ++ * does not match with expected gecos for any tacacs user of any ++ * privilege level. ++ */ ++static bool is_non_tacacs_user(const char *name) ++{ ++ char buf[1024]; ++ struct passwd pw; ++ int err = 0; ++ struct pwbuf pwbuf; ++ bool found = false; ++ bool ret = false; ++ ++ pwbuf.buf = buf; ++ pwbuf.pw = &pw; ++ pwbuf.errnop = &err; ++ pwbuf.buflen = sizeof(buf); ++ ++ lookup_pw_local(name, &pwbuf, &found); ++ ++ if (found && (err == 0)) { ++ int i = MIN_TACACS_USER_PRIV; ++ const useradd_info_t *pinfo = &useradd_grp_list[i]; ++ ++ for(; (i <= MAX_TACACS_USER_PRIV); ++i, ++pinfo) { ++ if ((pinfo->info != NULL) && ++ (strcmp(pinfo->info, pwbuf.pw->pw_gecos) == 0)) { ++ break; ++ } ++ } ++ if (i > MAX_TACACS_USER_PRIV) { ++ /* gecos did not match with gecos of any tacacs user info */ ++ ret = true; ++ } ++ } ++ return ret; ++} ++ + /* + * Lookup local user passwd info for TACACS+ user. If not found, local user will + * be created by user mapping strategy. +@@ -768,6 +807,9 @@ enum nss_status _nss_tacplus_getpwnam_r(const char *name, struct passwd *pw, + syslog(LOG_WARNING, "%s: no tacacs server in config for nss_tacplus", + nssname); + } ++ else if(is_non_tacacs_user(name)) { ++ /* It is non-tacacs user, so bail out */ ++ } + else { + /* marshal the args for the lower level functions */ + pbuf.name = (char *)name; +-- +2.17.1 + diff --git a/src/tacacs/nss/Makefile b/src/tacacs/nss/Makefile index d9c858bdcb38..308b05f2c13b 100644 --- a/src/tacacs/nss/Makefile +++ b/src/tacacs/nss/Makefile @@ -15,6 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git am ../0001-Modify-user-map-profile.patch git am ../0002-Enable-modifying-local-user-permission.patch git am ../0003-management-vrf-support.patch + git am ../0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch dpkg-buildpackage -rfakeroot -b -us -uc popd From 85c51bf5c9a277709f7843ec1d1a3528f7164d9c Mon Sep 17 00:00:00 2001 From: "Sudharsan D.G" Date: Thu, 16 May 2019 16:27:13 +0000 Subject: [PATCH 102/219] [devices]: Added index for dell z9100 c32 (#2892) --- .../Force10-Z9100-C32/port_config.ini | 66 +++++++++---------- .../plugins/sfputil.py | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/port_config.ini b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/port_config.ini index e000f29bef38..6a8e8351f8b0 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/port_config.ini +++ b/device/dell/x86_64-dell_z9100_c2538-r0/Force10-Z9100-C32/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias -Ethernet0 49,50,51,52 hundredGigE1/1 -Ethernet4 53,54,55,56 hundredGigE1/2 -Ethernet8 57,58,59,60 hundredGigE1/3 -Ethernet12 61,62,63,64 hundredGigE1/4 -Ethernet16 65,66,67,68 hundredGigE1/5 -Ethernet20 69,70,71,72 hundredGigE1/6 -Ethernet24 73,74,75,76 hundredGigE1/7 -Ethernet28 77,78,79,80 hundredGigE1/8 -Ethernet32 37,38,39,40 hundredGigE1/9 -Ethernet36 33,34,35,36 hundredGigE1/10 -Ethernet40 45,46,47,48 hundredGigE1/11 -Ethernet44 41,42,43,44 hundredGigE1/12 -Ethernet48 81,82,83,84 hundredGigE1/13 -Ethernet52 85,86,87,88 hundredGigE1/14 -Ethernet56 89,90,91,92 hundredGigE1/15 -Ethernet60 93,94,95,96 hundredGigE1/16 -Ethernet64 97,98,99,100 hundredGigE1/17 -Ethernet68 101,102,103,104 hundredGigE1/18 -Ethernet72 105,106,107,108 hundredGigE1/19 -Ethernet76 109,110,111,112 hundredGigE1/20 -Ethernet80 21,22,23,24 hundredGigE1/21 -Ethernet84 17,18,19,20 hundredGigE1/22 -Ethernet88 29,30,31,32 hundredGigE1/23 -Ethernet92 25,26,27,28 hundredGigE1/24 -Ethernet96 117,118,119,120 hundredGigE1/25 -Ethernet100 113,114,115,116 hundredGigE1/26 -Ethernet104 125,126,127,128 hundredGigE1/27 -Ethernet108 121,122,123,124 hundredGigE1/28 -Ethernet112 5,6,7,8 hundredGigE1/29 -Ethernet116 1,2,3,4 hundredGigE1/30 -Ethernet120 13,14,15,16 hundredGigE1/31 -Ethernet124 9,10,11,12 hundredGigE1/32 +# name lanes alias index +Ethernet0 49,50,51,52 hundredGigE1/1 1 +Ethernet4 53,54,55,56 hundredGigE1/2 2 +Ethernet8 57,58,59,60 hundredGigE1/3 3 +Ethernet12 61,62,63,64 hundredGigE1/4 4 +Ethernet16 65,66,67,68 hundredGigE1/5 5 +Ethernet20 69,70,71,72 hundredGigE1/6 6 +Ethernet24 73,74,75,76 hundredGigE1/7 7 +Ethernet28 77,78,79,80 hundredGigE1/8 8 +Ethernet32 37,38,39,40 hundredGigE1/9 9 +Ethernet36 33,34,35,36 hundredGigE1/10 10 +Ethernet40 45,46,47,48 hundredGigE1/11 11 +Ethernet44 41,42,43,44 hundredGigE1/12 12 +Ethernet48 81,82,83,84 hundredGigE1/13 13 +Ethernet52 85,86,87,88 hundredGigE1/14 14 +Ethernet56 89,90,91,92 hundredGigE1/15 15 +Ethernet60 93,94,95,96 hundredGigE1/16 16 +Ethernet64 97,98,99,100 hundredGigE1/17 17 +Ethernet68 101,102,103,104 hundredGigE1/18 18 +Ethernet72 105,106,107,108 hundredGigE1/19 19 +Ethernet76 109,110,111,112 hundredGigE1/20 20 +Ethernet80 21,22,23,24 hundredGigE1/21 21 +Ethernet84 17,18,19,20 hundredGigE1/22 22 +Ethernet88 29,30,31,32 hundredGigE1/23 23 +Ethernet92 25,26,27,28 hundredGigE1/24 24 +Ethernet96 117,118,119,120 hundredGigE1/25 25 +Ethernet100 113,114,115,116 hundredGigE1/26 26 +Ethernet104 125,126,127,128 hundredGigE1/27 27 +Ethernet108 121,122,123,124 hundredGigE1/28 28 +Ethernet112 5,6,7,8 hundredGigE1/29 29 +Ethernet116 1,2,3,4 hundredGigE1/30 30 +Ethernet120 13,14,15,16 hundredGigE1/31 31 +Ethernet124 9,10,11,12 hundredGigE1/32 32 diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index 4cccfbb291f4..77d75f71f578 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -77,7 +77,7 @@ def port_end(self): @property def qsfp_ports(self): - return range(0, self.PORTS_IN_BLOCK + 1) + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) @property def iom1_port_start(self): From 82cd144fbdfc81b607828cc0b61cd2184fc22a67 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Fri, 17 May 2019 04:49:00 +0300 Subject: [PATCH 103/219] [mlnx] refactor and fix mlnx-sfpd shutdown (#2907) * [mlnx] fix mlnx-sfpd shutdown Signed-off-by: Stepan Blyschak * fix type and handle only EINTR and EAGAIN errors from select Signed-off-by: Stepan Blyschak * handle select.error as well during init/run Signed-off-by: Stepan Blyschak --- platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 367 +++++++++--------- 1 file changed, 191 insertions(+), 176 deletions(-) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index a1d2e6d9c3b5..764bcc7c5ad7 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -10,6 +10,7 @@ import os import time import syslog import signal +import select import json import threading from python_sdk_api.sx_api import * @@ -27,9 +28,12 @@ STATUS_PLUGIN = '1' STATUS_PLUGOUT = '0' STATUS_UNKNOWN = '2' -SFPD_LIVENESS_UPDATE_INTERVAL_SECS = 30 +SFPD_LIVENESS_EXPIRE_SECS = 30 -sfp_value_status_dict = {SDK_SFP_STATE_IN:STATUS_PLUGIN, SDK_SFP_STATE_OUT:STATUS_PLUGOUT} +sfp_value_status_dict = { + SDK_SFP_STATE_IN: STATUS_PLUGIN, + SDK_SFP_STATE_OUT: STATUS_PLUGOUT, +} # ========================== Syslog wrappers ========================== def log_info(msg, also_print_to_console=False): @@ -56,188 +60,199 @@ def log_error(msg, also_print_to_console=False): if also_print_to_console: print(msg) -# ========================== Signal Handling ========================== -def signal_handler(sig, frame): - if sig == signal.SIGHUP: - log_info("Caught SIGHUP - ignoring...") - return - elif sig == signal.SIGINT: - log_info("Caught SIGINT - exiting...") - sys.exit(128 + sig) - elif sig == signal.SIGTERM: - log_info("Caught SIGTERM - exiting...") - sys.exit(128 + sig) - else: - log_warning("Caught unhandled signal '" + sig + "'") - - -def sx_recv(fd_p, handle): - # recv parameters - pkt_size = 2000 - pkt_size_p = new_uint32_t_p() - uint32_t_p_assign(pkt_size_p, pkt_size) - pkt = new_uint8_t_arr(pkt_size) - recv_info_p = new_sx_receive_info_t_p() - pmpe_t = sx_event_pmpe_t() - logical_port_list = new_sx_port_log_id_t_arr(4) - port_attributes_list = new_sx_port_attributes_t_arr(64) - port_cnt_p = new_uint32_t_p() - uint32_t_p_assign(port_cnt_p,64) - label_port_list = [] - status = True - module_state = 0 - - rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) - if rc != 0: - log_error("event receive exit with error, rc %d" % rc) - status = False - return status, label_port_list, module_state - - pmpe_t = recv_info_p.event_info.pmpe - port_list_size = pmpe_t.list_size - logical_port_list = pmpe_t.log_port_list - module_state = pmpe_t.module_state - - for i in range(0, port_list_size): - logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) - rc = sx_api_port_device_get(handle, 1 , 0, port_attributes_list, port_cnt_p) - port_cnt = uint32_t_p_value(port_cnt_p) - - for i in range(0, port_cnt): - port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) - if port_attributes.log_port == logical_port: - lable_port = port_attributes.port_mapping.module_port +# ========================== MlnxSfpd class ========================== +class MlnxSfpd: + ''' Listen to plugin/plugout cable events ''' + + SX_OPEN_RETRIES = 20 + SELECT_TIMEOUT = 1 + + def __init__(self): + self.swid = 0 + self.running = False + self.handle = None + + # Allocate SDK fd and user channel structures + self.rx_fd_p = new_sx_fd_t_p() + self.user_channel_p = new_sx_user_channel_t_p() + + self.state_db = SonicV2Connector(host=REDIS_HOSTIP) + + # Register our signal handlers + signal.signal(signal.SIGHUP, self.signal_handler) + signal.signal(signal.SIGINT, self.signal_handler) + signal.signal(signal.SIGTERM, self.signal_handler) + + def signal_handler(self, signum, frame): + if signum == signal.SIGHUP: + log_info("Caught SIGHUP - ignoring...") + elif signum == signal.SIGINT: + log_info("Caught SIGINT - exiting...") + self.running = False + elif signum == signal.SIGTERM: + log_info("Caught SIGINT - exiting...") + self.running = False + else: + log_warning("Caught unhandled signal '{}'".format(signum)) + + def initialize(self): + self.state_db.connect("STATE_DB") + + # open SDK API handle + # retry at most SX_OPEN_RETRIES times to wait + # until SDK is started during system startup + retry = 1 + while True: + rc, self.handle = sx_api_open(None) + if rc == SX_STATUS_SUCCESS: break - label_port_list.append(lable_port) - - return status, label_port_list, module_state, - -def send_sfp_notification(db, interface, state): - sfp_notify = [interface, state] - msg = json.dumps(sfp_notify, separators=(',', ':')) - db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg) - return - -def update_sfpd_liveness_key(db, timeout_secs): - if db.exists('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS'): - db.expire('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', timeout_secs) - else: - db.set('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', 'value', 'ok') - db.expire('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', timeout_secs) - -# Timer thread wrapper class to update mlnx-sfpd liveness info to DB periodically -class sfpd_liveness_update_task: - def __init__(self, db): - self.task_stopping_event = threading.Event() - self.task_timer = None - self.state_db = db - - def task_run(self): - if self.task_stopping_event.isSet(): - log_error("Error: sfpd liveness update thread received stop event, exiting...") - return - update_sfpd_liveness_key(self.state_db, 2*SFPD_LIVENESS_UPDATE_INTERVAL_SECS) + log_warning("failed to open SDK API handle... retrying {}".format(retry)) + + time.sleep(2 ** retry) + retry += 1 + + if retry > self.SX_OPEN_RETRIES: + raise RuntimeError("failed to open SDK API handle after {} retries".format(retry)) + + rc = sx_api_host_ifc_open(self.handle, self.rx_fd_p) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc)) - self.task_timer = threading.Timer(SFPD_LIVENESS_UPDATE_INTERVAL_SECS, self.task_run) - self.task_timer.start() + self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD + self.user_channel_p.fd = self.rx_fd_p + + rc = sx_api_host_ifc_trap_id_register_set(self.handle, + SX_ACCESS_CMD_REGISTER, + self.swid, + SX_TRAP_ID_PMPE, + self.user_channel_p) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("sx_api_host_ifc_trap_id_register_set exited with error, rc {}".format(c)) + + def deinitialize(self): + # remove mlnx-sfpd liveness key in DB if not expired yet + if self.state_db.exists("STATE_DB", "MLNX_SFPD_TASK|LIVENESS"): + self.state_db.delete("STATE_DB", "MLNX_SFPD_TASK|LIVENESS") + + if self.handle is None: + return - def task_stop(self): - self.task_stopping_event.set() - self.task_timer.join() + # unregister trap id + rc = sx_api_host_ifc_trap_id_register_set(self.handle, + SX_ACCESS_CMD_DEREGISTER, + self.swid, + SX_TRAP_ID_PMPE, + self.user_channel_p) + if rc != SX_STATUS_SUCCESS: + log_error("sx_api_host_ifc_trap_id_register_set exited with error, rc {}".format(rc)) + + rc = sx_api_host_ifc_close(self.handle, self.rx_fd_p) + if rc != SX_STATUS_SUCCESS: + log_error("sx_api_host_ifc_close exited with error, rc {}".format(rc)) + + rc = sx_api_close(self.handle) + if rc != SX_STATUS_SUCCESS: + log_error("sx_api_close exited with error, rc {}".format(rc)) + + def run(self): + self.running = True + + while self.running: + try: + read, _, _ = select.select([self.rx_fd_p.fd], [], [], self.SELECT_TIMEOUT) + except select.error as err: + rc, msg = err + if rc == errno.EAGAIN or rc == errno.EINTR: + continue + else: + raise + + for fd in read: + if fd == self.rx_fd_p.fd: + rc, port_list, module_state = self.on_pmpe(self.rx_fd_p) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("failed to read from {}".format(fd)) + + sfp_state = sfp_value_status_dict.get(module_state, STATUS_UNKNOWN) + if sfp_state == STATUS_UNKNOWN: + log_error("unknown module state {} on port {}".format(module_state, port)) + continue + + for port in port_list: + log_info("SFP on port {} state {}".format(port, sfp_state)) + self.send_sfp_notification(port, sfp_state) + + self.update_sfpd_liveness_key(SFPD_LIVENESS_EXPIRE_SECS) + + def send_sfp_notification(self, port, state): + sfp_notify = [port, state] + msg = json.dumps(sfp_notify, seperators=(',', ':')) + self.state_db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg) + + def update_sfpd_liveness_key(self, timeout_secs): + if not self.state_db.exists('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS'): + self.state_db.set('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', 'value', 'ok') + self.state_db.expire('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS', timeout_secs) + + def on_pmpe(self, fd_p): + ''' on port module plug event handler ''' + + # recv parameters + pkt_size = 2000 + pkt_size_p = new_uint32_t_p() + uint32_t_p_assign(pkt_size_p, pkt_size) + pkt = new_uint8_t_arr(pkt_size) + recv_info_p = new_sx_receive_info_t_p() + pmpe_t = sx_event_pmpe_t() + logical_port_list = new_sx_port_log_id_t_arr(4) + port_attributes_list = new_sx_port_attributes_t_arr(64) + port_cnt_p = new_uint32_t_p() + uint32_t_p_assign(port_cnt_p,64) + label_port_list = [] + status = True + module_state = 0 + + rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) + if rc != 0: + log_error("sx_lib_host_ifc_recv exited with error, rc %d" % rc) + status = False + return status, label_port_list, module_state + + pmpe_t = recv_info_p.event_info.pmpe + port_list_size = pmpe_t.list_size + logical_port_list = pmpe_t.log_port_list + module_state = pmpe_t.module_state + + for i in xrange(port_list_size): + logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) + rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p) + port_cnt = uint32_t_p_value(port_cnt_p) + + for i in xrange(port_cnt): + port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) + if port_attributes.log_port == logical_port: + lable_port = port_attributes.port_mapping.module_port + break + label_port_list.append(lable_port) + + return status, label_port_list, module_state, # main start def main(): - # Register our signal handlers - signal.signal(signal.SIGHUP, signal_handler) - signal.signal(signal.SIGINT, signal_handler) - signal.signal(signal.SIGTERM, signal_handler) - - # Connect to state db for notification sending - state_db = SonicV2Connector(host=REDIS_HOSTIP) - state_db.connect(state_db.STATE_DB) - - # Open SDK handler - log_info("starting mlnx-sfpd...") - rc, handle = sx_api_open(None) - retry_time = 1 - while rc != SX_STATUS_SUCCESS: - time.sleep(2**retry_time) - retry_time += 1 - rc, handle = sx_api_open(None) - if retry_time > 20: - log_error("Failed to open api handle. Please check that SDK is running.") - sys.exit(errno.EACCES) - - # Open recv fd - rx_fd_p = new_sx_fd_t_p() - rc = sx_api_host_ifc_open(handle, rx_fd_p) - if rc != 0: - log_error("sx_api_host_ifc_open exit with error, rc %d" % rc) - exit(rc) - - # Set up general host ifc parameters - swid = 0 - cmd = SX_ACCESS_CMD_REGISTER - uc_p = new_sx_user_channel_t_p() - uc_p.type = SX_USER_CHANNEL_TYPE_FD - uc_p.channel.fd = rx_fd_p - trap_id = SX_TRAP_ID_PMPE - - rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) - if rc != 0: - log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) - exit(rc) - - liveness_info_update = sfpd_liveness_update_task(state_db) - liveness_info_update.task_run() - - # Main loop for sfp event listening - log_info("mlnx-sfpd started") - while True: - sfp_state = STATUS_UNKNOWN - rc, port_list, module_state = sx_recv(rx_fd_p, handle) - if not rc: - log_error("Failed to recv event from SDK, please check that SDK is running.") - break - - if module_state in sfp_value_status_dict: sfp_state = sfp_value_status_dict[module_state] - - if sfp_state != STATUS_UNKNOWN: - for port in port_list: - log_info("SFP on port %d state %s" % (port, sfp_state)) - send_sfp_notification(state_db, str(port), sfp_state) - - log_info("sfp change event handling done") - - # Stop liveness update task - liveness_info_update.task_stop() - - # Remove mlnx-sfpd liveness key in DB if not expired yet. - if state_db.exists('STATE_DB', 'MLNX_SFPD_TASK|LIVENESS'): - state_db.delete(state_db, 'MLNX_SFPD_TASK|LIVENESS') - - # unregister trap id - cmd = SX_ACCESS_CMD_DEREGISTER - rc = sx_api_host_ifc_trap_id_register_set(handle, cmd, swid, trap_id, uc_p) - if rc != 0: - log_error("sx_api_host_ifc_trap_id_register_set exit with error, rc %d" % rc) - exit(rc) - - # Close read fp - rc = sx_api_host_ifc_close(handle, rx_fd_p) - if rc != 0: - log_error("sx_api_host_ifc_close exit with error, rc %d" % rc) - exit(rc) - - # Close sdk handler - rc = sx_api_close(handle) - if rc != 0: - log_error("sx_api_close exit with error, rc %d" % rc) - exit(rc) - - log_info("mlnx-sfpd exited") + log_info("mlnx-sfpd daemon started") + + sfpd = MlnxSfpd() + try: + sfpd.initialize() + sfpd.run() + except (RuntimeError, select.error) as err: + log_error("error: {}".format(err)) + finally: + sfpd.deinitialize() + + log_info("mlnx-sfpd daemon exited") if __name__ == '__main__': From 712d4b90fe9e6c1cd3d28a9ec3381c2745b3161c Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Sat, 18 May 2019 04:53:57 +0300 Subject: [PATCH 104/219] [mlnx] fix incorrect attr assignment in mlnx-sfpd (#2913) * [mlnx] fix incorrect attr assignment in mlnx-sfpd Signed-off-by: Stepan Blyschak * [mlnx] on_pmpe returns bool and not SX_STATUS_SUCCESS Signed-off-by: Stepan Blyschak * [mlnx] fix typo Signed-off-by: Stepan Blyschak --- platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index 764bcc7c5ad7..d5f53c1c710e 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -120,7 +120,7 @@ class MlnxSfpd: raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc)) self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD - self.user_channel_p.fd = self.rx_fd_p + self.user_channel_p.channel.fd = self.rx_fd_p rc = sx_api_host_ifc_trap_id_register_set(self.handle, SX_ACCESS_CMD_REGISTER, @@ -170,8 +170,8 @@ class MlnxSfpd: for fd in read: if fd == self.rx_fd_p.fd: - rc, port_list, module_state = self.on_pmpe(self.rx_fd_p) - if rc != SX_STATUS_SUCCESS: + success, port_list, module_state = self.on_pmpe(self.rx_fd_p) + if not success: raise RuntimeError("failed to read from {}".format(fd)) sfp_state = sfp_value_status_dict.get(module_state, STATUS_UNKNOWN) @@ -187,7 +187,7 @@ class MlnxSfpd: def send_sfp_notification(self, port, state): sfp_notify = [port, state] - msg = json.dumps(sfp_notify, seperators=(',', ':')) + msg = json.dumps(sfp_notify, separators=(',', ':')) self.state_db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg) def update_sfpd_liveness_key(self, timeout_secs): From 5975a9c25ba24aca8d0e8b90e90bab0322898169 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sat, 18 May 2019 22:08:41 -0700 Subject: [PATCH 105/219] [updategraph] set DB version after minigraph reload (#2917) Signed-off-by: Ying Xie --- files/image_config/updategraph/updategraph | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/image_config/updategraph/updategraph b/files/image_config/updategraph/updategraph index 686108727b27..b14f75f8582f 100755 --- a/files/image_config/updategraph/updategraph +++ b/files/image_config/updategraph/updategraph @@ -16,6 +16,11 @@ reload_minigraph() fi config qos reload pfcwd start_default + + if [[ -x /usr/bin/db_migrator.py ]]; then + # Set latest version number + /usr/bin/db_migrator.py -o set_version + fi } function copy_config_files_and_directories() From f434b80758b9127c7fe5d04a3854fb8e178f20ba Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 20 May 2019 12:09:28 -0700 Subject: [PATCH 106/219] [201811][utilities] update sub-module head (#2927) Submodule src/sonic-utilities a1f961c..7a2348c: > [201811] enable DB migrator code (#536) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index a1f961c96245..7a2348c8caf7 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit a1f961c962452b5e6916850fbbd8f36101f1f22a +Subproject commit 7a2348c8caf7e6ee8153e3b445d3f7cc37601367 From c49bac145797e3429f540389a552e0da42dcb1cb Mon Sep 17 00:00:00 2001 From: paavaanan Date: Wed, 6 Feb 2019 00:05:50 +0530 Subject: [PATCH 107/219] [devices]: Dell Hwmon S6100/Z9100 SFM version export (#2521) --- .../common/dell_pmc.c | 146 +++++++++++++++--- 1 file changed, 125 insertions(+), 21 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c index 557976457503..57eff4181d97 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c @@ -28,6 +28,7 @@ #define SIO_DRVNAME "SMF" #define DEBUG 1 #define LABELS 1 +#define SMF_VERSION_ADDR 0x0000 #define FANIN_MAX 12 /* Counted from 1 */ #define VSEN_MAX 48 /* VSEN1.. */ @@ -471,6 +472,35 @@ static int smf_read_reg16(struct smf_data *data, u16 reg) return res; } +/* SMF Version */ +static ssize_t show_smf_version(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + unsigned int ret = 0; + unsigned int smf_version = 0; + unsigned int smf_firmware_major_ver = 0; + unsigned int smf_firmware_minor_ver = 0; + struct smf_data *data = dev_get_drvdata(dev); + + ret = smf_read_reg(data, (SMF_VERSION_ADDR + index*2)); + + printk("smf_firmware_details-->0x%x index[%d]", ret, index); + + if (index > 0) { + smf_firmware_major_ver = ((ret & (0xC0)) >> 6); + smf_firmware_minor_ver = (ret & (0x3F)); + + ret = sprintf(buf, "%u.%u\n", smf_firmware_major_ver, + smf_firmware_minor_ver); + } else { + smf_version = ret; + ret = sprintf(buf, "%u\n", smf_version); + } + + return ret; +} + /* FANIN ATTR */ static ssize_t @@ -514,6 +544,9 @@ static ssize_t show_fan(struct device *dev, if (ret < 0) return ret; + if (ret & 0x8000) + ret = - (ret & 0x7fff); + rpm = ret; if(export_hex) @@ -1327,23 +1360,28 @@ static ssize_t show_temp_crit(struct device *dev, } -/*static ssize_t show_temp_alarm(struct device *dev, +static ssize_t show_temp_alarm(struct device *dev, struct device_attribute *devattr, char *buf) { int index = to_sensor_dev_attr(devattr)->index; struct smf_data *data = dev_get_drvdata(dev); - int ret; - int temp; + int ret = 0; + int temp = 0; - ret = smf_read_reg16(data, TEMP_SENSOR_1_STATUS + index * 2); + ret = smf_read_reg(data, TEMP_SENSOR_1_STATUS + index); - if (ret < 0) - return ret; + if (ret < 0) { + return ret; + } + + if (ret == 0xff) { + ret = 0; + } temp = ret; return sprintf(buf, "%d\n", temp); -}*/ +} static umode_t smf_tcpu_is_visible(struct kobject *kobj, @@ -1432,6 +1470,25 @@ static SENSOR_DEVICE_ATTR(temp13_max, S_IRUGO, show_temp_crit, NULL, 50); static SENSOR_DEVICE_ATTR(temp14_max, S_IRUGO, show_temp_crit, NULL, 46); static SENSOR_DEVICE_ATTR(temp15_max, S_IRUGO, show_temp_crit, NULL, 50); +static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0); +static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 2); +static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_temp_alarm, NULL, 3); +static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_temp_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_temp_alarm, NULL, 5); +static SENSOR_DEVICE_ATTR(temp7_alarm, S_IRUGO, show_temp_alarm, NULL, 6); +static SENSOR_DEVICE_ATTR(temp8_alarm, S_IRUGO, show_temp_alarm, NULL, 7); +static SENSOR_DEVICE_ATTR(temp9_alarm, S_IRUGO, show_temp_alarm, NULL, 8); +static SENSOR_DEVICE_ATTR(temp10_alarm, S_IRUGO, show_temp_alarm, NULL, 9); +static SENSOR_DEVICE_ATTR(temp11_alarm, S_IRUGO, show_temp_alarm, NULL, 10); +static SENSOR_DEVICE_ATTR(temp12_alarm, S_IRUGO, show_temp_alarm, NULL, 11); +static SENSOR_DEVICE_ATTR(temp13_alarm, S_IRUGO, show_temp_alarm, NULL, 12); + +static SENSOR_DEVICE_ATTR(temp14_alarm, S_IRUGO, show_temp_alarm, NULL, 13); +static SENSOR_DEVICE_ATTR(temp15_alarm, S_IRUGO, show_temp_alarm, NULL, 14); + + + static struct attribute *smf_tcpu_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, @@ -1498,6 +1555,23 @@ static struct attribute *smf_tcpu_attrs[] = { &sensor_dev_attr_temp14_max.dev_attr.attr, &sensor_dev_attr_temp15_max.dev_attr.attr, + &sensor_dev_attr_temp1_alarm.dev_attr.attr, + &sensor_dev_attr_temp2_alarm.dev_attr.attr, + &sensor_dev_attr_temp3_alarm.dev_attr.attr, + &sensor_dev_attr_temp4_alarm.dev_attr.attr, + &sensor_dev_attr_temp5_alarm.dev_attr.attr, + &sensor_dev_attr_temp6_alarm.dev_attr.attr, + &sensor_dev_attr_temp7_alarm.dev_attr.attr, + &sensor_dev_attr_temp8_alarm.dev_attr.attr, + &sensor_dev_attr_temp9_alarm.dev_attr.attr, + &sensor_dev_attr_temp10_alarm.dev_attr.attr, + &sensor_dev_attr_temp11_alarm.dev_attr.attr, + &sensor_dev_attr_temp12_alarm.dev_attr.attr, + &sensor_dev_attr_temp13_alarm.dev_attr.attr, + &sensor_dev_attr_temp14_alarm.dev_attr.attr, + &sensor_dev_attr_temp15_alarm.dev_attr.attr, + + NULL }; @@ -1525,26 +1599,36 @@ static ssize_t show_psu(struct device *dev, struct smf_data *data = dev_get_drvdata(dev); int ret=0, export_hex=0; int psu_status=0, pow; + int pow_val = 0; switch (index) { case 0: pow = smf_read_reg16(data, PSU_1_MAX_POWER); - /* TODO Fix */ - if (data->kind == s6100smf) - ret = 1000000 * 1100; - else - ret = 1000000 * 750; + if (data->kind == s6100smf) + ret = 1000000 * 1100; + else + ret = 1000000 * 750; break; case 1: ret = smf_read_reg(data, PSU_1_STATUS); export_hex=1; break; case 2: - ret = 100000 * smf_read_reg16(data, PSU_1_INPUT_POWER); + pow_val = smf_read_reg16(data, PSU_1_INPUT_POWER); + /* In case of absent psu, pow_val will be 0xffff */ + if (pow_val == 0xffff) { + pow_val = 0; + } + ret = 100000 * pow_val; break; case 3: - ret = 100000 * smf_read_reg16(data, PSU_1_OUTPUT_POWER); + pow_val = smf_read_reg16(data, PSU_1_OUTPUT_POWER); + /* In case of absent psu, pow_val will be 0xffff */ + if (pow_val == 0xffff) { + pow_val = 0; + } + ret = 100000 * pow_val; break; case 4: psu_status = smf_read_reg(data, PSU_1_STATUS); @@ -1554,21 +1638,30 @@ static ssize_t show_psu(struct device *dev, case 5: pow = smf_read_reg16(data, PSU_2_MAX_POWER); ret = 1000000 * pow; - /* TODO Fix */ - if (data->kind == s6100smf) - ret = 1000000 * 1100; - else - ret = 1000000 * 750; + if (data->kind == s6100smf) + ret = 1000000 * 1100; + else + ret = 1000000 * 750; break; case 6: ret = smf_read_reg(data, PSU_2_STATUS); export_hex=1; break; case 7: - ret = 100000 * smf_read_reg16(data, PSU_2_INPUT_POWER); + pow_val = smf_read_reg16(data, PSU_2_INPUT_POWER); + /* In case of absent psu, pow_val will be 0xffff */ + if (pow_val == 0xffff) { + pow_val = 0; + } + ret = 100000 * pow_val; break; case 8: - ret = 100000 * smf_read_reg16(data, PSU_2_OUTPUT_POWER); + pow_val = smf_read_reg16(data, PSU_2_OUTPUT_POWER); + /* In case of absent psu, pow_val will be 0xffff */ + if (pow_val == 0xffff) { + pow_val = 0; + } + ret = 100000 * pow_val; break; case 9: psu_status = smf_read_reg(data, PSU_2_STATUS); @@ -1577,6 +1670,10 @@ static ssize_t show_psu(struct device *dev, break; case 10: pow = smf_read_reg16(data, CURRENT_TOTAL_POWER); + /* In case of both psu absent, pow will be 0xffff */ + if (pow == 0xffff) { + pow = 0; + } ret = pow/10; break; default: @@ -1678,7 +1775,14 @@ static SENSOR_DEVICE_ATTR(psu1_presence, S_IRUGO, show_psu, NULL, 1); static SENSOR_DEVICE_ATTR(psu2_presence, S_IRUGO, show_psu, NULL, 6); static SENSOR_DEVICE_ATTR(current_total_power, S_IRUGO, show_psu, NULL, 10); +/* SMF Version */ +static SENSOR_DEVICE_ATTR(smf_version, S_IRUGO, show_smf_version, NULL, 0); +static SENSOR_DEVICE_ATTR(smf_firmware_ver, S_IRUGO, show_smf_version, NULL, 1); + + static struct attribute *smf_dell_attrs[] = { + &sensor_dev_attr_smf_version.dev_attr.attr, + &sensor_dev_attr_smf_firmware_ver.dev_attr.attr, &sensor_dev_attr_fan_tray_presence.dev_attr.attr, &sensor_dev_attr_fan1_airflow.dev_attr.attr, &sensor_dev_attr_fan3_airflow.dev_attr.attr, From 5b52a24e25ad3ba9f29fad6cd05933f518704f44 Mon Sep 17 00:00:00 2001 From: paavaanan Date: Mon, 20 May 2019 22:05:31 +0530 Subject: [PATCH 108/219] [devices]: Export reboot_reason sysfs attribute for DellEMC S6100/Z9100 (#2922) --- .../common/dell_pmc.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c index 57eff4181d97..b8ed4bbb082b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c @@ -45,6 +45,7 @@ #define SMF_READ_DATA_REG_OFFSET 2 #define SMF_REG_ADDR 0x200 #define SMF_PROBE_ADDR 0x210 +#define SMF_RST_SRC_REG 0x20A #define SIO_REG_DEVID 0x1 #define SIO_Z9100_ID 0x1 @@ -502,6 +503,23 @@ static ssize_t show_smf_version(struct device *dev, } +/* SMF Reset Reason */ +static ssize_t show_reset_reason(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int index = to_sensor_dev_attr(devattr)->index; + unsigned int ret = 0, val = 0; + struct smf_data *data = dev_get_drvdata(dev); + + ret = inb(SMF_RST_SRC_REG); + + if(ret < 0) + return ret; + + return sprintf(buf, "%x\n", ret); +} + + /* FANIN ATTR */ static ssize_t show_fan_label(struct device *dev, struct device_attribute *attr, char *buf) @@ -1779,10 +1797,14 @@ static SENSOR_DEVICE_ATTR(current_total_power, S_IRUGO, show_psu, NULL, 10); static SENSOR_DEVICE_ATTR(smf_version, S_IRUGO, show_smf_version, NULL, 0); static SENSOR_DEVICE_ATTR(smf_firmware_ver, S_IRUGO, show_smf_version, NULL, 1); +/* SMF Reset Reason */ +static SENSOR_DEVICE_ATTR(smf_reset_reason, S_IRUGO, show_reset_reason, NULL, 1); + static struct attribute *smf_dell_attrs[] = { &sensor_dev_attr_smf_version.dev_attr.attr, &sensor_dev_attr_smf_firmware_ver.dev_attr.attr, + &sensor_dev_attr_smf_reset_reason.dev_attr.attr, &sensor_dev_attr_fan_tray_presence.dev_attr.attr, &sensor_dev_attr_fan1_airflow.dev_attr.attr, &sensor_dev_attr_fan3_airflow.dev_attr.attr, From fae35536c31d732e4065dacc154510df444c350e Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Thu, 23 May 2019 08:07:29 +0300 Subject: [PATCH 109/219] [swss.sh] flush FDB table during cold start (#2933) Signed-off-by: Stepan Blyschak --- files/scripts/swss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 780051def9e6..5093e4c7f9fd 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -104,7 +104,7 @@ start() { /usr/bin/docker exec database redis-cli -n 1 FLUSHDB /usr/bin/docker exec database redis-cli -n 2 FLUSHDB /usr/bin/docker exec database redis-cli -n 5 FLUSHDB - clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*'" + clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*'" fi # start service docker From fb1f156eb2faf2d7a0c2894a6e5153a2ae44c4cb Mon Sep 17 00:00:00 2001 From: "Sudharsan D.G" Date: Sun, 26 May 2019 01:06:53 +0000 Subject: [PATCH 110/219] [devices]: Optics fixes in Dell Z9100/Z9264f platforms (#2936) --- .../z9100/scripts/z9100_platform.sh | 4 ++++ .../z9264f/scripts/z9264f_platform.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index 294b1b79aa88..3cc48e52110f 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -221,6 +221,10 @@ if [[ "$1" == "init" ]]; then #Copy led_proc_init.soc init_switch_port_led + value=0x0 + echo $value > /sys/class/i2c-adapter/i2c-14/14-003e/qsfp_lpmode + echo $value > /sys/class/i2c-adapter/i2c-15/15-003e/qsfp_lpmode + echo $value > /sys/class/i2c-adapter/i2c-16/16-003e/qsfp_lpmode elif [[ "$1" == "deinit" ]]; then xcvr_presence_interrupts "disable" diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh index 5002ce72c081..d06928229139 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh @@ -82,7 +82,7 @@ switch_board_modsel() { do port_addr=$(( 16384 + ((i - 1) * 16))) hex=$( printf "0x%x" $port_addr ) - python /usr/bin/pcisysfs.py --set --offset $hex --val 0x41 --res $resource > /dev/null 2>&1 + python /usr/bin/pcisysfs.py --set --offset $hex --val 0x10 --res $resource > /dev/null 2>&1 done } init_devnum From 0f4cb41efc4c4bbedfa39fbdf1509383956c1fc6 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 24 May 2019 02:38:41 -0700 Subject: [PATCH 111/219] [monit] Set memory usage alert at 50% (#2939) Signed-off-by: Qi Luo --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 7806388c5e52..e04843891fa7 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -301,7 +301,7 @@ check filesystem root-overlay with path / check filesystem var-log with path /var/log if space usage > 90% for 5 times within 10 cycles then alert check system $HOST - if memory usage > 90% for 5 times within 10 cycles then alert + if memory usage > 50% for 5 times within 10 cycles then alert if cpu usage (user) > 90% for 5 times within 10 cycles then alert if cpu usage (system) > 90% for 5 times within 10 cycles then alert EOF From 8ae67c4c5ddb634af9629a7872e8288062b53da0 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 25 May 2019 18:00:18 -0700 Subject: [PATCH 112/219] [logrotate] Enhance robustness (#2942) * [logrotate] Decrease frequency to every 10 minutes; kill any lingering logrotate processes * [logrotate] Delete all *.1.gz files as firstaction; Remove note about init-system-helpers < 1.47 workaround However, continue to send SIGHUP directly to rsyslogd process because 'service rsyslog rotate' still doesn't work properly with init-system-helpers version 1.48 --- files/image_config/cron.d/logrotate | 5 +++-- .../image_config/logrotate/logrotate.d/rsyslog | 18 +++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/files/image_config/cron.d/logrotate b/files/image_config/cron.d/logrotate index d0c2e0829ba9..173a2abe2bd2 100644 --- a/files/image_config/cron.d/logrotate +++ b/files/image_config/cron.d/logrotate @@ -1,2 +1,3 @@ -# Attempt to rotate system logs once per minute -* * * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1 +# Attempt to rotate system logs once every 10 minutes. +# First kill any logrotate process(es) if they are still running, as they're most likely hung +*/10 * * * * root /usr/bin/pkill -9 logrotate > /dev/null 2>&1; /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1 diff --git a/files/image_config/logrotate/logrotate.d/rsyslog b/files/image_config/logrotate/logrotate.d/rsyslog index 6788762d7687..76737ba14420 100644 --- a/files/image_config/logrotate/logrotate.d/rsyslog +++ b/files/image_config/logrotate/logrotate.d/rsyslog @@ -19,11 +19,7 @@ delaycompress sharedscripts postrotate - # calling kill directly instead of 'service rsyslog rotate >/dev/null' due - # to bug in init-system-helpers. bug has apparently been fixed in v1.47. - # however, debian jessie is still using v1.22. - # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 - kill -hup $(cat /var/run/rsyslogd.pid) + /bin/kill -HUP $(cat /var/run/rsyslogd.pid) endscript } @@ -44,7 +40,7 @@ compress delaycompress nosharedscripts - prerotate + firstaction # Adjust NUM_LOGS_TO_ROTATE to reflect number of log files that trigger this block specified above NUM_LOGS_TO_ROTATE=8 @@ -65,6 +61,10 @@ # of caution, giving us a bit of a cushion if a log grows quickly and passes its rotation size THRESHOLD_KB=$((USABLE_SPACE_KB - (NUM_LOGS_TO_ROTATE * LOG_FILE_ROTATE_SIZE_KB * 2))) + # First, delete any *.1.gz files that might be left around from a prior incomplete + # logrotate execution, otherwise logrotate will fail to do its job + find /var/log/ -name '*.1.gz' -type f -exec rm -f {} + + while true; do USED_KB=$(du -s /var/log | awk '{ print $1; }') @@ -87,11 +87,7 @@ if [ $(echo $1 | grep -c "/var/log/swss/") -gt 0 ]; then pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true else - # Calling kill directly instead of 'service rsyslog rotate >/dev/null' due - # to bug in init-system-helpers. Bug has apparently been fixed in v1.47. - # However, Debian Jessie is still using v1.22. - # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672218 - kill -HUP $(cat /var/run/rsyslogd.pid) + /bin/kill -HUP $(cat /var/run/rsyslogd.pid) fi endscript } From 506081813ac1f85eff3a57592054f1bd5a71aae1 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Tue, 28 May 2019 23:32:08 +0800 Subject: [PATCH 113/219] [mellanox]: fix wrong type of paramerter (#2950) --- platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index d5f53c1c710e..08d1f1188005 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -181,7 +181,7 @@ class MlnxSfpd: for port in port_list: log_info("SFP on port {} state {}".format(port, sfp_state)) - self.send_sfp_notification(port, sfp_state) + self.send_sfp_notification(str(port), sfp_state) self.update_sfpd_liveness_key(SFPD_LIVENESS_EXPIRE_SECS) From f7915022370b35ed3b1fed3bc95935d59f7fb62c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 28 May 2019 17:58:30 -0700 Subject: [PATCH 114/219] [201811][utilities][swss] advance sub-module heads (#2953) Submodule src/sonic-utilities 7a2348c..4488525: > use vlan members (#542) > [sonic_installer] If asked to install an image which is already installed, simply set as default (#534) Submodule src/sonic-swss 8246bd9..9c4ae18: > Ignore neighbor entry with BCAST MAC, check SAI status exists (#914) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 8246bd9b08d2..9c4ae1864120 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 8246bd9b08d2a1db671af6b628c0b89e336b2ad7 +Subproject commit 9c4ae186412043d55ae820feff1044799d7b6c92 diff --git a/src/sonic-utilities b/src/sonic-utilities index 7a2348c8caf7..4488525158e1 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 7a2348c8caf7e6ee8153e3b445d3f7cc37601367 +Subproject commit 4488525158e1cad8fbe3b52a2ab9b65852dbaf45 From abc25df612ca81086ba288b7bade87e5551f089e Mon Sep 17 00:00:00 2001 From: Phanindra TV <48400987+phanindra-tv@users.noreply.github.com> Date: Wed, 29 May 2019 11:13:04 +0530 Subject: [PATCH 115/219] [teamd]: Administratively shutdown port channel has member ports in deselected state and traffic is not forwarded. #1771 (#2882) --- ...-port-admin-down-recv-not-processing.patch | 22 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 23 insertions(+) create mode 100644 src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch diff --git a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch new file mode 100644 index 000000000000..6e6c37e096fe --- /dev/null +++ b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch @@ -0,0 +1,22 @@ +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 4a3fe6b..19592c5 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1182,12 +1182,17 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + struct lacpdu lacpdu; + struct sockaddr_ll ll_from; + int err; ++ bool admin_state; + + err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, + (struct sockaddr *) &ll_from, sizeof(ll_from)); + if (err <= 0) + return err; + ++ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); ++ if (!admin_state) ++ return 0; ++ + return lacpdu_process(lacp_port, &lacpdu); + } + diff --git a/src/libteam/series b/src/libteam/series index e9ef676ce52a..76e5e8177ccd 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -7,3 +7,4 @@ 0010-teamd-lacp-update-port-state-according-to-partners-sy.patch 0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch 0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch +0013-teamd-lacp-port-admin-down-recv-not-processing.patch From 3954e0821c286111c053770ee586594fca0bb1e2 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 30 May 2019 13:26:32 -0700 Subject: [PATCH 116/219] [libteam] Send updates as soon as we need to update the LACP partner about changes (#2955) --- ...PDU-immediately-if-our-state-changed.patch | 39 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 40 insertions(+) create mode 100644 src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch diff --git a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch b/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch new file mode 100644 index 000000000000..1dbf67df4d20 --- /dev/null +++ b/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch @@ -0,0 +1,39 @@ +From 0e0ee4a68b118d540d9ef5836a55483fcfb8771b Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Wed, 29 May 2019 19:15:20 +0000 +Subject: [PATCH] Send LACP PDU immediately if our state changed + +--- + teamd/teamd_runner_lacp.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 19592c5..a505284 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1049,8 +1049,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, + return err; + + lacp_port_actor_update(lacp_port); +- if (lacp_port->periodic_on) +- return 0; ++ + return lacpdu_send(lacp_port); + } + +@@ -1160,9 +1159,10 @@ static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) + if (err) + return err; + ++ lacp_port_actor_update(lacp_port); ++ + /* Check if the other side has correct info about us */ +- if (!lacp_port->periodic_on && +- memcmp(&lacpdu->partner, &lacp_port->actor, ++ if (memcmp(&lacpdu->partner, &lacp_port->actor, + sizeof(struct lacpdu_info))) { + err = lacpdu_send(lacp_port); + if (err) +-- +2.7.4 + diff --git a/src/libteam/series b/src/libteam/series index 76e5e8177ccd..1c6820678c8d 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -8,3 +8,4 @@ 0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch 0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch 0013-teamd-lacp-port-admin-down-recv-not-processing.patch +0014-Send-LACP-PDU-immediately-if-our-state-changed.patch From fbe55e9adf31e606ef2fcd91beefbba7a189698a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 30 May 2019 14:34:48 -0700 Subject: [PATCH 117/219] [201811][utilities] advance utilties sub module head (#2960) Submodule src/sonic-utilities 4488525..6b4d1a0: > [show vlan brief] Support 'alias' interface naming mode (#497) > [show interface neighbor expected] Support 'alias' interface naming mode (#495) > updated show ipv6 interface for alias mode (#493) > [show] Add serial numbers/uptime/hwinfo to 'show version' output (#488) > [show] show interface status added vlan and portchannels to command (#483) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 4488525158e1..6b4d1a0fb459 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 4488525158e1cad8fbe3b52a2ab9b65852dbaf45 +Subproject commit 6b4d1a0fb459ffdd3b244ef39dce9d3645dd8c94 From fbe9715f85fbe8fb992d3cf84dfed4ec9f2e0db2 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 4 Jun 2019 11:35:08 -0700 Subject: [PATCH 118/219] [201811][swss][utilities] advance sub module head (#2968) Submodule src/sonic-utilities 6b4d1a0..46b5aa8: > [show ip interface] Add support for 'alias' interface naming mode (#486) Submodule src/sonic-swss 9c4ae18..a637562: > Suppress storm detect counter increment for ongoing pfc storm case during a warm reboot (#869) > Remove *_LEFT fields to allow PFC watchdog to enter fresh into the (#897) > Set LAG mtu value based on kernel netlink msg (#922) > [warm restart assist] assume vector values could be reordered (#921) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 9c4ae1864120..a637562902ff 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 9c4ae186412043d55ae820feff1044799d7b6c92 +Subproject commit a637562902ffb95b31a60b30a7af6324183d4c19 diff --git a/src/sonic-utilities b/src/sonic-utilities index 6b4d1a0fb459..46b5aa8a8094 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 6b4d1a0fb459ffdd3b244ef39dce9d3645dd8c94 +Subproject commit 46b5aa8a80940bcf314884cc0b74b39be78f9e04 From 2295dab965e77d90bc3a984b2a9292b2d56ce5cc Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Sat, 8 Jun 2019 15:29:18 -0700 Subject: [PATCH 119/219] [submodule]: Update sonic-quagga submodule (#2984) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 2e192c06b8f5..6397c2c9b588 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 2e192c06b8f526cab6fce710ab5da0223b0ba2b1 +Subproject commit 6397c2c9b588a2271aaf3f4d7383111db16d090a From 0023fca739bec8ac51fe038ac027f32dfb9a6f34 Mon Sep 17 00:00:00 2001 From: SuvarnaMeenakshi <50386592+SuvarnaMeenakshi@users.noreply.github.com> Date: Tue, 11 Jun 2019 16:19:49 -0700 Subject: [PATCH 120/219] [baseimage] kernel oom-killer to panic when the system is truly out of memory (#2988) - What I did Currently when the system is under memory pressure, the OOM killer kicks in and kills a rogue process. Killing a rogue process can cause the device to be un-healthy leading to blackholing of the traffic. To avoid this, configure the OOM to do a kernel panic which will cause the device to reboot and come back up healthy. - How I did it Added the sysctl variable panic_on_oom and set the value to 2. Setting it to 2 will ensure OOM killer to always do a kernel panic. --- build_debian.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_debian.sh b/build_debian.sh index e04843891fa7..be6a0c833d1f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -313,6 +313,7 @@ set /files/etc/sysctl.conf/kernel.core_pattern '|/usr/bin/coredump-compress %e % set /files/etc/sysctl.conf/kernel.softlockup_panic 1 set /files/etc/sysctl.conf/kernel.panic 10 +set /files/etc/sysctl.conf/vm.panic_on_oom 2 set /files/etc/sysctl.conf/fs.suid_dumpable 2 set /files/etc/sysctl.conf/net.ipv4.conf.default.forwarding 1 From 13b066fc0ec06ab9b4f3d017ea4956e65e864181 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 4 Jun 2019 13:20:31 -0700 Subject: [PATCH 121/219] [201803][monit] Restart rsyslog service if rsyslogd consumes > 800 MB memory (#2963) --- build_debian.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_debian.sh b/build_debian.sh index be6a0c833d1f..4c2f4ccfd322 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -304,6 +304,10 @@ check system $HOST if memory usage > 50% for 5 times within 10 cycles then alert if cpu usage (user) > 90% for 5 times within 10 cycles then alert if cpu usage (system) > 90% for 5 times within 10 cycles then alert +check process rsyslog with pidfile /var/run/rsyslogd.pid + start program = "/bin/systemctl start rsyslog.service" + stop program = "/bin/systemctl stop rsyslog.service" + if totalmem > 800 MB for 5 times within 10 cycles then restart EOF ## Config sysctl From be799cbed36006bd5aea7bb4d28a66f7f2a8ab3d Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 13 Jun 2019 12:24:45 -0700 Subject: [PATCH 122/219] [swss][utilities] advance sub module head (#3010) Submodule src/sonic-utilities 46b5aa8..5b73b83: > [intfutil] Fix error when specified in show interface related commands (#548) Submodule src/sonic-swss a637562..93497ec: > [orchagent] PFC WD support for BFN platform (#916) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index a637562902ff..93497ec838ad 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit a637562902ffb95b31a60b30a7af6324183d4c19 +Subproject commit 93497ec838adf476e3d549e7aad26a59e8bdfceb diff --git a/src/sonic-utilities b/src/sonic-utilities index 46b5aa8a8094..5b73b8366546 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 46b5aa8a80940bcf314884cc0b74b39be78f9e04 +Subproject commit 5b73b8366546e3b7927b74a13f551a0d8ae50202 From 983a4b24ebfdc525b0e3e55f493aa56473d40f96 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 13 Jun 2019 22:23:40 -0700 Subject: [PATCH 123/219] [bcm SAI] upgrade Broadcom SAI to version 3.3.6.1-9 (#3009) - Broadcom SAI GA version 20190513 - Broadcom fix for CS7999193, CS7913246, CS4529162, CS8180755, CS8242625 Signed-off-by: Ying Xie --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index b563703efa9c..dc6519dc6da4 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.3.5.4-1_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.5.4-1_amd64.deb?sv=2015-04-05&sr=b&sig=fjyImKBuCbR8x48tzRhx32tfnDq1kk1VsCJblaXh8U4%3D&se=2032-12-10T01%3A43%3A35Z&sp=r" +BRCM_SAI = libsaibcm_3.3.6.1-9_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.6.1-9_amd64.deb?sv=2015-04-05&sr=b&sig=ZsZxC0bmXIX9PCa73BpyMatePq8m2jWvCahFx3OJ%2F8I%3D&se=2033-02-13T21%3A31%3A33Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.3.5.4-1_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.3.6.1-9_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.5.4-1_amd64.deb?sv=2015-04-05&sr=b&sig=91u8Og2PHD2ig%2BlIyi6UlXQ8rMSxz%2FUeJdyy%2BhecvrE%3D&se=2032-12-10T01%3A43%3A16Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.6.1-9_amd64.deb?sv=2015-04-05&sr=b&sig=RUAbTNEcmaSvNeAKz%2F8x06hPC%2BS%2BVlGPA2%2FiwHZMF4o%3D&se=2033-02-13T21%3A31%3A02Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From f71c66570592b19681cbec4cb50df9e425d086ea Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Fri, 14 Jun 2019 13:56:16 -0700 Subject: [PATCH 124/219] [libteam]: Reimplement Warm-Reboot procedure (#2999) * [libteam]: Reimplement Warm-Reboot procedure * Address internal comments --- .../0005-libteam-Add-warm_reboot-mode.patch | 533 ----------- ...-same-hwaddr-to-lag-port-to-avoid-di.patch | 4 +- ...-port-state-according-to-partners-sy.patch | 8 +- ...nize-ifinfo-after-lost-RTNLGRP_LINK-.patch | 2 +- ...cess-lacpdu-before-the-port-ifinfo-i.patch | 11 +- ...-port-admin-down-recv-not-processing.patch | 17 +- ...PDU-immediately-if-our-state-changed.patch | 10 +- .../0015-libteam-Add-warm_reboot-mode.patch | 829 ++++++++++++++++++ src/libteam/series | 2 +- 9 files changed, 857 insertions(+), 559 deletions(-) delete mode 100644 src/libteam/0005-libteam-Add-warm_reboot-mode.patch create mode 100644 src/libteam/0015-libteam-Add-warm_reboot-mode.patch diff --git a/src/libteam/0005-libteam-Add-warm_reboot-mode.patch b/src/libteam/0005-libteam-Add-warm_reboot-mode.patch deleted file mode 100644 index 625af96eaa16..000000000000 --- a/src/libteam/0005-libteam-Add-warm_reboot-mode.patch +++ /dev/null @@ -1,533 +0,0 @@ -diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 72155ae..44de4ca 100644 ---- a/libteam/ifinfo.c -+++ b/libteam/ifinfo.c -@@ -105,15 +105,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link) - hwaddr_len = nl_addr_get_len(nl_addr); - if (ifinfo->hwaddr_len != hwaddr_len) { - ifinfo->hwaddr_len = hwaddr_len; -- if (!ifinfo->master_ifindex) -- ifinfo->orig_hwaddr_len = hwaddr_len; -+ ifinfo->orig_hwaddr_len = hwaddr_len; - set_changed(ifinfo, CHANGED_HWADDR_LEN); - } - hwaddr = nl_addr_get_binary_addr(nl_addr); - if (memcmp(ifinfo->hwaddr, hwaddr, hwaddr_len)) { - memcpy(ifinfo->hwaddr, hwaddr, hwaddr_len); -- if (!ifinfo->master_ifindex) -- memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len); -+ memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len); - set_changed(ifinfo, CHANGED_HWADDR); - } - } -diff --git a/teamd/teamd.c b/teamd/teamd.c -index c987333..225b8c8 100644 ---- a/teamd/teamd.c -+++ b/teamd/teamd.c -@@ -116,7 +116,9 @@ static void print_help(const struct teamd_context *ctx) { - " -D --dbus-enable Enable D-Bus interface\n" - " -Z --zmq-enable=ADDRESS Enable ZeroMQ interface\n" - " -U --usock-enable Enable UNIX domain socket interface\n" -- " -u --usock-disable Disable UNIX domain socket interface\n", -+ " -u --usock-disable Disable UNIX domain socket interface\n" -+ " -w --warm-start Warm-start startup mode\n" -+ " -L --lacp-directory Directory for saving lacp pdu dumps\n", - ctx->argv0); - printf("Available runners: "); - for (i = 0; i < TEAMD_RUNNER_LIST_SIZE; i++) { -@@ -129,7 +131,7 @@ static void print_help(const struct teamd_context *ctx) { - - static int parse_command_line(struct teamd_context *ctx, - int argc, char *argv[]) { -- int opt; -+ int opt, err; - static const struct option long_options[] = { - { "help", no_argument, NULL, 'h' }, - { "daemonize", no_argument, NULL, 'd' }, -@@ -149,10 +151,12 @@ static int parse_command_line(struct teamd_context *ctx, - { "zmq-enable", required_argument, NULL, 'Z' }, - { "usock-enable", no_argument, NULL, 'U' }, - { "usock-disable", no_argument, NULL, 'u' }, -+ { "warm-start", no_argument, NULL, 'w' }, -+ { "lacp-directory", required_argument, NULL, 'L' }, - { NULL, 0, NULL, 0 } - }; - -- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:Uu", -+ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:UuwL:", - long_options, NULL)) >= 0) { - - switch(opt) { -@@ -230,11 +234,29 @@ static int parse_command_line(struct teamd_context *ctx, - case 'u': - ctx->usock.enabled = false; - break; -+ case 'w': -+ ctx->warm_start_read = true; -+ ctx->warm_start_carrier = true; -+ break; -+ case 'L': -+ ctx->lacp_directory = strdup(optarg); -+ if (access(ctx->lacp_directory, R_OK | W_OK | X_OK) != 0) { -+ fprintf(stderr, "Can't write to the lacp directory '%s': %s\n", ctx->lacp_directory, strerror(errno)); -+ free(ctx->lacp_directory); -+ ctx->lacp_directory = NULL; -+ } -+ break; - default: - return -1; - } - } - -+ if (ctx->warm_start_read && !ctx->lacp_directory) { -+ fprintf(stderr, "Can't enable warm-start mode without lacp-directory specified\n"); -+ ctx->warm_start_read = false; -+ ctx->warm_start_carrier = false; -+ } -+ - if (optind < argc) { - fprintf(stderr, "Too many arguments\n"); - return -1; -@@ -384,8 +406,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) - if (err != -1) { - switch(ctrl_byte) { - case 'q': -+ case 'w': - if (quit_in_progress) - return -EBUSY; -+ if (ctrl_byte == 'w') { -+ ctx->keep_ports = true; -+ ctx->no_quit_destroy = true; -+ teamd_ports_flush_data(ctx); -+ } - teamd_refresh_ports(ctx); - err = teamd_flush_ports(ctx); - if (err) -@@ -428,6 +456,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) - teamd_run_loop_sent_ctrl_byte(ctx, 'q'); - } - -+static void teamd_run_loop_quit_w_boot(struct teamd_context *ctx, int err) -+{ -+ ctx->run_loop.err = err; -+ teamd_run_loop_sent_ctrl_byte(ctx, 'w'); -+} -+ - void teamd_run_loop_restart(struct teamd_context *ctx) - { - teamd_run_loop_sent_ctrl_byte(ctx, 'r'); -@@ -694,6 +728,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, - teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM."); - teamd_run_loop_quit(ctx, 0); - break; -+ case SIGUSR1: -+ teamd_log_warn("Got SIGUSR1."); -+ teamd_run_loop_quit_w_boot(ctx, 0); -+ break; - } - return 0; - } -@@ -1507,7 +1545,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) - return -errno; - } - -- if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, 0) < 0) { -+ if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, 0) < 0) { - teamd_log_err("Could not register signal handlers."); - daemon_retval_send(errno); - err = -errno; -diff --git a/teamd/teamd.h b/teamd/teamd.h -index ef0fb1c..622c365 100644 ---- a/teamd/teamd.h -+++ b/teamd/teamd.h -@@ -125,6 +125,10 @@ struct teamd_context { - char * hwaddr; - uint32_t hwaddr_len; - bool hwaddr_explicit; -+ bool warm_start_read; -+ bool warm_start_carrier; -+ bool keep_ports; -+ char * lacp_directory; - struct { - struct list_item callback_list; - int ctrl_pipe_r; -@@ -191,12 +195,15 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); - void (*refresh)(struct teamd_context *ctx, - struct teamd_port *tdport, void *priv); -+ void (*port_flush_data)(struct teamd_context *ctx, -+ struct teamd_port *tdport, void *priv); - int (*option_changed)(struct teamd_context *ctx, - struct team_option *option, void *priv); - char *option_changed_match_name; - }; - - void teamd_refresh_ports(struct teamd_context *ctx); -+void teamd_ports_flush_data(struct teamd_context *ctx); - int teamd_event_port_added(struct teamd_context *ctx, - struct teamd_port *tdport); - void teamd_event_port_removed(struct teamd_context *ctx, -diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 5c2ef56..50e5a08 100644 ---- a/teamd/teamd_events.c -+++ b/teamd/teamd_events.c -@@ -47,6 +47,19 @@ void teamd_refresh_ports(struct teamd_context *ctx) - } - } - -+void teamd_ports_flush_data(struct teamd_context *ctx) -+{ -+ struct teamd_port *tdport; -+ struct event_watch_item *watch; -+ -+ teamd_for_each_tdport(tdport, ctx) { -+ list_for_each_node_entry(watch, &ctx->event_watch_list, list) { -+ if (!watch->ops->port_flush_data) continue; -+ watch->ops->port_flush_data(ctx, tdport, watch->priv); -+ } -+ } -+} -+ - int teamd_event_port_added(struct teamd_context *ctx, - struct teamd_port *tdport) - { -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 81324de..9e88ce0 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - #include "teamd.h" - #include "teamd_config.h" -@@ -131,6 +132,7 @@ struct lacp { - struct teamd_context *ctx; - struct lacp_port *selected_agg_lead; /* leading port of selected aggregator */ - bool carrier_up; -+ time_t warm_start_carrier_timer; - struct { - bool active; - #define LACP_CFG_DFLT_ACTIVE true -@@ -174,6 +176,9 @@ struct lacp_port { - struct lacp_port *agg_lead; /* leading port of aggregator. - * NULL in case this port is not selected */ - enum lacp_port_state state; -+ bool lacpdu_saved; -+ bool lacpdu_read; -+ struct lacpdu last_pdu; - struct { - uint32_t speed; - uint8_t duplex; -@@ -491,15 +496,28 @@ static int lacp_update_carrier(struct lacp *lacp) - bool state; - int err; - -+ #define WARM_START_CARRIER_TIMEOUT 3 -+ /* wait three seconds until disable warm_start_carrier mode */ -+ if (lacp->ctx->warm_start_carrier && -+ lacp->warm_start_carrier_timer >= (time(NULL) + WARM_START_CARRIER_TIMEOUT)) { -+ lacp->ctx->warm_start_carrier = false; -+ lacp->warm_start_carrier_timer = 0; -+ } -+ - ports_enabled = 0; - teamd_for_each_tdport(tdport, lacp->ctx) { - err = teamd_port_enabled(lacp->ctx, tdport, &state); - if (err) - return err; -- if (state && ++ports_enabled >= lacp->cfg.min_ports) -+ if (state && ++ports_enabled >= lacp->cfg.min_ports) { -+ lacp->ctx->warm_start_carrier = false; - return lacp_set_carrier(lacp, true); -+ } - } - -+ if (lacp->ctx->warm_start_carrier) -+ return 0; /* Don't put carrier down if we're in warm_start_carrier mode */ -+ - return lacp_set_carrier(lacp, false); - } - -@@ -917,6 +935,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port) - memcpy(actor->system, lacp_port->ctx->hwaddr, ETH_ALEN); - } - -+static int lacp_portname_to_port_id(const char* name) -+{ -+#define PORT_PREFIX "Ethernet" -+ const char* strport_id = name + sizeof(PORT_PREFIX) - 1; -+ const int port_id = atoi(strport_id); -+ if ((port_id == 0) && strcmp(strport_id, "0")) { -+ teamd_log_err("%s: Can't convert from port name to port id. Port id is equal to 0, but this is not expected", name); -+ } -+ -+ return htons(port_id + 1); -+} -+ - static void lacp_port_actor_init(struct lacp_port *lacp_port) - { - struct lacpdu_info *actor = &lacp_port->actor; -@@ -924,7 +954,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port) - actor->system_priority = htons(lacp_port->lacp->cfg.sys_prio); - actor->key = htons(lacp_port->cfg.lacp_key); - actor->port_priority = htons(lacp_port->cfg.lacp_prio); -- actor->port = htons(lacp_port->tdport->ifindex); -+ actor->port = lacp_portname_to_port_id(lacp_port->tdport->ifname); - lacp_port_actor_system_update(lacp_port); - } - -@@ -994,6 +1024,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, - break; - } - -+ if (new_state != PORT_STATE_CURRENT) { -+ /* clean saved lacp pdu up when the current port: -+ disabled, expired, or defaulted */ -+ (void)memset(&lacp_port->last_pdu, 0, sizeof(struct lacpdu)); -+ lacp_port->lacpdu_saved = false; -+ } -+ - teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"", - lacp_port->tdport->ifname, - lacp_port_state_name[lacp_port->state], -@@ -1084,26 +1121,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) - return err; - } - --static int lacpdu_recv(struct lacp_port *lacp_port) -+static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) - { -- struct lacpdu lacpdu; -- struct sockaddr_ll ll_from; - int err; - -- err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, -- (struct sockaddr *) &ll_from, sizeof(ll_from)); -- if (err <= 0) -- return err; -- -- if (!lacpdu_check(&lacpdu)) { -+ if (!lacpdu_check(lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; - } - -+ /* save received lacp pdu frame */ -+ (void)memcpy(&lacp_port->last_pdu, lacpdu, sizeof(struct lacpdu)); -+ lacp_port->lacpdu_saved = true; -+ - /* Check if we have correct info about the other side */ -- if (memcmp(&lacpdu.actor, &lacp_port->partner, -+ if (memcmp(&lacpdu->actor, &lacp_port->partner, - sizeof(struct lacpdu_info))) { -- lacp_port->partner = lacpdu.actor; -+ lacp_port->partner = lacpdu->actor; - err = lacp_port_partner_update(lacp_port); - if (err) - return err; -@@ -1118,7 +1152,7 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - - /* Check if the other side has correct info about us */ - if (!lacp_port->periodic_on && -- memcmp(&lacpdu.partner, &lacp_port->actor, -+ memcmp(&lacpdu->partner, &lacp_port->actor, - sizeof(struct lacpdu_info))) { - err = lacpdu_send(lacp_port); - if (err) -@@ -1133,6 +1167,65 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - return 0; - } - -+static int lacpdu_recv(struct lacp_port *lacp_port) -+{ -+ struct lacpdu lacpdu; -+ struct sockaddr_ll ll_from; -+ int err; -+ -+ err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, -+ (struct sockaddr *) &ll_from, sizeof(ll_from)); -+ if (err <= 0) -+ return err; -+ -+ return lacpdu_process(lacp_port, &lacpdu); -+} -+ -+static int lacpdu_read(struct lacp_port *lacp_port) -+{ -+ FILE* fp; -+ char filename[PATH_MAX]; -+ struct lacpdu lacpdu; -+ int err, nitems; -+ struct teamd_port *tdport; -+ -+ /* we read saved lacpdu for the current lacp_port */ -+ lacp_port->lacpdu_read = true; -+ -+ strcpy(filename, lacp_port->ctx->lacp_directory); -+ if (filename[strlen(filename) - 1] != '/') -+ strcat(filename, "/"); /* Add trailing slash if we don't have one in the filename */ -+ strcat(filename, lacp_port->tdport->ifname); -+ -+ /* check that file is readable. if there is no file, don't do anything */ -+ if (access(filename, R_OK) != 0) { -+ return 0; -+ } -+ -+ fp = fopen(filename, "r"); -+ if (!fp) { -+ teamd_log_err("Can't open lacp-saved dump from file %s: %s", filename, strerror(errno)); -+ return errno; -+ } -+ -+ nitems = fread(&lacpdu, sizeof(struct lacpdu), 1, fp); -+ (void)fclose(fp); -+ -+ err = unlink(filename); -+ if (err < 0) { -+ teamd_log_err("Can't remove file %s: %s", filename, strerror(errno)); -+ } -+ -+ if (nitems != 1) { -+ teamd_log_err("Can't read lacp-saved dump from file %s: %s", filename, strerror(errno)); -+ return err; -+ } -+ -+ teamd_log_info("%s: LACP state was read", lacp_port->tdport->ifname); -+ -+ return lacpdu_process(lacp_port, &lacpdu); -+} -+ - static int lacp_callback_timeout(struct teamd_context *ctx, int events, - void *priv) - { -@@ -1284,6 +1377,13 @@ static int lacp_port_added(struct teamd_context *ctx, - goto periodic_callback_del; - } - -+ /* refresh ports from the kernel */ -+ err = team_refresh(ctx->th); -+ if (err) { -+ teamd_log_err("%s: Team refresh failed.", tdport->ifname); -+ goto timeout_callback_del; -+ } -+ - /* Newly added ports are disabled */ - err = team_set_port_enabled(ctx->th, tdport->ifindex, false); - if (err) { -@@ -1299,6 +1399,13 @@ static int lacp_port_added(struct teamd_context *ctx, - lacp_port_actor_init(lacp_port); - lacp_port_link_update(lacp_port); - -+ /* Read data from file and process it */ -+ if (ctx->warm_start_read) { -+ err = lacpdu_read(lacp_port); -+ if (err) -+ goto timeout_callback_del; -+ } -+ - teamd_loop_callback_enable(ctx, LACP_SOCKET_CB_NAME, lacp_port); - return 0; - -@@ -1321,7 +1428,11 @@ static void lacp_port_removed(struct teamd_context *ctx, - { - struct lacp_port *lacp_port = priv; - -- lacp_port_set_state(lacp_port, PORT_STATE_DISABLED); -+ if (!lacp_port->ctx->keep_ports) { -+ /* Don't transition into DISABLED state, -+ which sends EXPIRED LACP PDU update */ -+ lacp_port_set_state(lacp_port, PORT_STATE_DISABLED); -+ } - teamd_loop_callback_del(ctx, LACP_TIMEOUT_CB_NAME, lacp_port); - teamd_loop_callback_del(ctx, LACP_PERIODIC_CB_NAME, lacp_port); - teamd_loop_callback_del(ctx, LACP_SOCKET_CB_NAME, lacp_port); -@@ -1413,6 +1524,31 @@ static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_por - (void) lacpdu_send(lacp_port); - } - -+static void lacp_event_watch_port_flush_data(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) -+{ -+ struct lacp *lacp = priv; -+ -+ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); -+ if (lacp_port->lacpdu_saved && lacp_port->ctx->lacp_directory) { -+ char filename[PATH_MAX]; -+ strcpy(filename, lacp_port->ctx->lacp_directory); -+ if (filename[strlen(filename) - 1] != '/') -+ strcat(filename, "/"); /* Add trailing slash if we don't have one in the filename */ -+ strcat(filename, lacp_port->tdport->ifname); -+ FILE *fp = fopen(filename, "wb"); -+ if (fp != NULL) { -+ (void)fwrite(&lacp_port->last_pdu, sizeof(struct lacpdu), 1, fp); -+ (void)fclose(fp); -+ } else { -+ teamd_log_err("Can't open file %s for writing %s", filename, strerror(errno)); -+ } -+ } else { -+ teamd_log_err("Can't dump received lacp pdu for port %s. " -+ "Either it wasn't received, or directory to save wasn't configured", -+ lacp_port->tdport->ifname); -+ } -+} -+ - static const struct teamd_event_watch_ops lacp_event_watch_ops = { - .hwaddr_changed = lacp_event_watch_hwaddr_changed, - .port_added = lacp_event_watch_port_added, -@@ -1420,21 +1556,38 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { - .port_changed = lacp_event_watch_port_changed, - .admin_state_changed = lacp_event_watch_admin_state_changed, - .refresh = lacp_event_watch_refresh, -+ .port_flush_data = lacp_event_watch_port_flush_data, - }; - - static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp) - { - int err; - -- /* initialize carrier control */ -- err = team_carrier_set(ctx->th, false); -- if (err && err != -EOPNOTSUPP) { -- teamd_log_err("Failed to set carrier down."); -- return err; -+ if (ctx->warm_start_carrier) { -+ /* Read the current carrier state, don't change it */ -+ bool state; -+ err = team_carrier_get(ctx->th, &state); -+ if (err && err != -EOPNOTSUPP) { -+ teamd_log_err("Failed to read carrier."); -+ return err; -+ } -+ lacp->carrier_up = state; -+ if (state) { -+ /* enable timer for warm_start_carrier mode */ -+ lacp->warm_start_carrier_timer = time(NULL); -+ } else { -+ /* disable warm_start_carrier mode. The LAG interface is already down. */ -+ ctx->warm_start_carrier = false; -+ } -+ } else { -+ err = team_carrier_set(ctx->th, false); -+ if (err && err != -EOPNOTSUPP) { -+ teamd_log_err("Failed to set carrier down."); -+ return err; -+ } -+ lacp->carrier_up = false; - } - -- lacp->carrier_up = false; -- - return 0; - } - -@@ -1946,7 +2099,7 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) - teamd_state_val_unregister(ctx, &lacp_state_vg, lacp); - teamd_balancer_fini(lacp->tb); - teamd_event_watch_unregister(ctx, &lacp_event_watch_ops, lacp); -- lacp_carrier_fini(ctx, lacp); -+ if (!ctx->keep_ports) lacp_carrier_fini(ctx, lacp); - } - - const struct teamd_runner teamd_runner_lacp = { diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch index 8a59756bb02b..f6c8a832d593 100644 --- a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +++ b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -10,10 +10,10 @@ Signed-off-by: Jipan Yang 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/teamd/teamd.c b/teamd/teamd.c -index 225b8c8..e28aa7d 100644 +index c987333..0f8993e 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c -@@ -866,7 +866,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) +@@ -828,7 +828,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) err = -EINVAL; goto free_hwaddr; } diff --git a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch index 33e6140bab6d..4cef90ea1920 100644 --- a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch +++ b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch @@ -29,10 +29,10 @@ Date: Tue Apr 16 12:18:12 2019 -0700 Signed-off-by: Jiri Pirko diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index dae9086..5fa026a 100644 +index 81324de..813b604 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -361,7 +361,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) +@@ -356,7 +356,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) struct lacp *lacp = lacp_port->lacp; if (lacp_port_selected(lacp_port) && @@ -42,7 +42,7 @@ index dae9086..5fa026a 100644 return true; return false; } -@@ -371,7 +372,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) +@@ -366,7 +367,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) struct lacp *lacp = lacp_port->lacp; if (!lacp_port_selected(lacp_port) || @@ -52,7 +52,7 @@ index dae9086..5fa026a 100644 return true; return false; } -@@ -966,9 +968,14 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) +@@ -936,9 +938,14 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) state |= INFO_STATE_LACP_ACTIVITY; if (lacp_port->lacp->cfg.fast_rate) state |= INFO_STATE_LACP_TIMEOUT; diff --git a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch index fcda98301174..a53369fb7376 100644 --- a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch +++ b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch @@ -185,7 +185,7 @@ index 72155ae..5c32a9c 100644 if (ret < 0) err(th, "get_ifinfo_list: check_call_change_handers failed"); diff --git a/libteam/libteam.c b/libteam/libteam.c -index ac187aa..d5f22cd 100644 +index 106e5cf..afe05cb 100644 --- a/libteam/libteam.c +++ b/libteam/libteam.c @@ -236,6 +236,10 @@ int check_call_change_handlers(struct team_handle *th, diff --git a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch index db29825fb9da..3779ae186351 100644 --- a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch +++ b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch @@ -28,19 +28,20 @@ Signed-off-by: Jiri Pirko 1 file changed, 3 insertions(+) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 78f05dd..c8ae541 100644 +index 813b604..d6e5840 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1132,6 +1132,9 @@ static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) - { - int err; +@@ -1102,6 +1102,9 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + if (err <= 0) + return err; + if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) + return 0; + - if (!lacpdu_check(lacpdu)) { + if (!lacpdu_check(&lacpdu)) { teamd_log_warn("malformed LACP PDU came."); return 0; + -- 2.7.4 diff --git a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch index 6e6c37e096fe..e5f26637ee5d 100644 --- a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch +++ b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch @@ -1,22 +1,23 @@ diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 4a3fe6b..19592c5 100644 +index d6e5840..2144334 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1182,12 +1182,17 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1096,6 +1096,7 @@ static int lacpdu_recv(struct lacp_port *lacp_port) struct lacpdu lacpdu; struct sockaddr_ll ll_from; int err; -+ bool admin_state; ++ bool admin_state; err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, (struct sockaddr *) &ll_from, sizeof(ll_from)); - if (err <= 0) - return err; +@@ -1105,6 +1106,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) + return 0; + admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); + if (!admin_state) + return 0; + - return lacpdu_process(lacp_port, &lacpdu); - } - + if (!lacpdu_check(&lacpdu)) { + teamd_log_warn("malformed LACP PDU came."); + return 0; diff --git a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch b/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch index 1dbf67df4d20..b4c9c68f8aca 100644 --- a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch +++ b/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch @@ -8,10 +8,10 @@ Subject: [PATCH] Send LACP PDU immediately if our state changed 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 19592c5..a505284 100644 +index 2144334..0930b22 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1049,8 +1049,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1012,8 +1012,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, return err; lacp_port_actor_update(lacp_port); @@ -21,7 +21,7 @@ index 19592c5..a505284 100644 return lacpdu_send(lacp_port); } -@@ -1160,9 +1159,10 @@ static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) +@@ -1131,9 +1130,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) if (err) return err; @@ -29,8 +29,8 @@ index 19592c5..a505284 100644 + /* Check if the other side has correct info about us */ - if (!lacp_port->periodic_on && -- memcmp(&lacpdu->partner, &lacp_port->actor, -+ if (memcmp(&lacpdu->partner, &lacp_port->actor, +- memcmp(&lacpdu.partner, &lacp_port->actor, ++ if (memcmp(&lacpdu.partner, &lacp_port->actor, sizeof(struct lacpdu_info))) { err = lacpdu_send(lacp_port); if (err) diff --git a/src/libteam/0015-libteam-Add-warm_reboot-mode.patch b/src/libteam/0015-libteam-Add-warm_reboot-mode.patch new file mode 100644 index 000000000000..e6f2a3257198 --- /dev/null +++ b/src/libteam/0015-libteam-Add-warm_reboot-mode.patch @@ -0,0 +1,829 @@ +diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c +index 5c32a9c..c418243 100644 +--- a/libteam/ifinfo.c ++++ b/libteam/ifinfo.c +@@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link) + hwaddr_len = nl_addr_get_len(nl_addr); + if (ifinfo->hwaddr_len != hwaddr_len) { + ifinfo->hwaddr_len = hwaddr_len; +- if (!ifinfo->master_ifindex) +- ifinfo->orig_hwaddr_len = hwaddr_len; ++ ifinfo->orig_hwaddr_len = hwaddr_len; + set_changed(ifinfo, CHANGED_HWADDR_LEN); + } + hwaddr = nl_addr_get_binary_addr(nl_addr); + if (memcmp(ifinfo->hwaddr, hwaddr, hwaddr_len)) { + memcpy(ifinfo->hwaddr, hwaddr, hwaddr_len); +- if (!ifinfo->master_ifindex) +- memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len); ++ memcpy(ifinfo->orig_hwaddr, hwaddr, hwaddr_len); + set_changed(ifinfo, CHANGED_HWADDR); + } + } +diff --git a/teamd/teamd.c b/teamd/teamd.c +index 0f8993e..ad91fe5 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -116,7 +116,9 @@ static void print_help(const struct teamd_context *ctx) { + " -D --dbus-enable Enable D-Bus interface\n" + " -Z --zmq-enable=ADDRESS Enable ZeroMQ interface\n" + " -U --usock-enable Enable UNIX domain socket interface\n" +- " -u --usock-disable Disable UNIX domain socket interface\n", ++ " -u --usock-disable Disable UNIX domain socket interface\n" ++ " -w --warm-start Warm-start startup mode\n" ++ " -L --lacp-directory Directory for saving lacp pdu dumps\n", + ctx->argv0); + printf("Available runners: "); + for (i = 0; i < TEAMD_RUNNER_LIST_SIZE; i++) { +@@ -149,10 +151,12 @@ static int parse_command_line(struct teamd_context *ctx, + { "zmq-enable", required_argument, NULL, 'Z' }, + { "usock-enable", no_argument, NULL, 'U' }, + { "usock-disable", no_argument, NULL, 'u' }, ++ { "warm-start", no_argument, NULL, 'w' }, ++ { "lacp-directory", required_argument, NULL, 'L' }, + { NULL, 0, NULL, 0 } + }; + +- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:Uu", ++ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:UuwL:", + long_options, NULL)) >= 0) { + + switch(opt) { +@@ -230,11 +234,27 @@ static int parse_command_line(struct teamd_context *ctx, + case 'u': + ctx->usock.enabled = false; + break; ++ case 'w': ++ ctx->warm_start_mode = true; ++ break; ++ case 'L': ++ ctx->lacp_directory = strdup(optarg); ++ if (access(ctx->lacp_directory, R_OK | W_OK | X_OK) != 0) { ++ fprintf(stderr, "Can't write to the lacp directory '%s': %s\n", ctx->lacp_directory, strerror(errno)); ++ free(ctx->lacp_directory); ++ ctx->lacp_directory = NULL; ++ } ++ break; + default: + return -1; + } + } + ++ if (ctx->warm_start_mode && !ctx->lacp_directory) { ++ fprintf(stderr, "Can't enable warm-start mode without lacp-directory specified\n"); ++ ctx->warm_start_mode = false; ++ } ++ + if (optind < argc) { + fprintf(stderr, "Too many arguments\n"); + return -1; +@@ -384,8 +404,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) + if (err != -1) { + switch(ctrl_byte) { + case 'q': ++ case 'w': + if (quit_in_progress) + return -EBUSY; ++ if (ctrl_byte == 'w') { ++ ctx->keep_ports = true; ++ ctx->no_quit_destroy = true; ++ teamd_ports_flush_data(ctx); ++ } + teamd_refresh_ports(ctx); + err = teamd_flush_ports(ctx); + if (err) +@@ -428,6 +454,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) + teamd_run_loop_sent_ctrl_byte(ctx, 'q'); + } + ++static void teamd_run_loop_quit_w_boot(struct teamd_context *ctx, int err) ++{ ++ ctx->run_loop.err = err; ++ teamd_run_loop_sent_ctrl_byte(ctx, 'w'); ++} ++ + void teamd_run_loop_restart(struct teamd_context *ctx) + { + teamd_run_loop_sent_ctrl_byte(ctx, 'r'); +@@ -694,6 +726,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, + teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM."); + teamd_run_loop_quit(ctx, 0); + break; ++ case SIGUSR1: ++ teamd_log_warn("Got SIGUSR1."); ++ teamd_run_loop_quit_w_boot(ctx, 0); ++ break; + } + return 0; + } +@@ -1516,7 +1552,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) + return -errno; + } + +- if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, 0) < 0) { ++ if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, 0) < 0) { + teamd_log_err("Could not register signal handlers."); + daemon_retval_send(errno); + err = -errno; +diff --git a/teamd/teamd.h b/teamd/teamd.h +index ef0fb1c..72330f1 100644 +--- a/teamd/teamd.h ++++ b/teamd/teamd.h +@@ -125,6 +125,9 @@ struct teamd_context { + char * hwaddr; + uint32_t hwaddr_len; + bool hwaddr_explicit; ++ bool warm_start_mode; ++ bool keep_ports; ++ char * lacp_directory; + struct { + struct list_item callback_list; + int ctrl_pipe_r; +@@ -191,12 +194,15 @@ struct teamd_event_watch_ops { + struct teamd_port *tdport, void *priv); + void (*refresh)(struct teamd_context *ctx, + struct teamd_port *tdport, void *priv); ++ void (*port_flush_data)(struct teamd_context *ctx, ++ struct teamd_port *tdport, void *priv); + int (*option_changed)(struct teamd_context *ctx, + struct team_option *option, void *priv); + char *option_changed_match_name; + }; + + void teamd_refresh_ports(struct teamd_context *ctx); ++void teamd_ports_flush_data(struct teamd_context *ctx); + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport); + void teamd_event_port_removed(struct teamd_context *ctx, +diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c +index 5c2ef56..50e5a08 100644 +--- a/teamd/teamd_events.c ++++ b/teamd/teamd_events.c +@@ -47,6 +47,19 @@ void teamd_refresh_ports(struct teamd_context *ctx) + } + } + ++void teamd_ports_flush_data(struct teamd_context *ctx) ++{ ++ struct teamd_port *tdport; ++ struct event_watch_item *watch; ++ ++ teamd_for_each_tdport(tdport, ctx) { ++ list_for_each_node_entry(watch, &ctx->event_watch_list, list) { ++ if (!watch->ops->port_flush_data) continue; ++ watch->ops->port_flush_data(ctx, tdport, watch->priv); ++ } ++ } ++} ++ + int teamd_event_port_added(struct teamd_context *ctx, + struct teamd_port *tdport) + { +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 0930b22..dc87448 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #include "teamd.h" + #include "teamd_config.h" +@@ -127,10 +128,18 @@ static const char *lacp_agg_select_policy_names_list[] = { + + struct lacp_port; + ++struct wr_tdport_state ++{ ++ char name[IFNAMSIZ+1]; ++ bool enabled; ++ bool checked; ++}; ++ + struct lacp { + struct teamd_context *ctx; + struct lacp_port *selected_agg_lead; /* leading port of selected aggregator */ + bool carrier_up; ++ time_t warm_start_mode_timer; + struct { + bool active; + #define LACP_CFG_DFLT_ACTIVE true +@@ -145,6 +154,11 @@ struct lacp { + enum lacp_agg_select_policy agg_select_policy; + #define LACP_CFG_DFLT_AGG_SELECT_POLICY LACP_AGG_SELECT_LACP_PRIO + } cfg; ++ struct { ++ bool carrier_up; ++ uint16_t nr_of_tdports; ++ struct wr_tdport_state *state; ++ } wr; + struct teamd_balancer *tb; + }; + +@@ -174,6 +188,8 @@ struct lacp_port { + struct lacp_port *agg_lead; /* leading port of aggregator. + * NULL in case this port is not selected */ + enum lacp_port_state state; ++ bool lacpdu_saved; ++ struct lacpdu last_pdu; + struct { + uint32_t speed; + uint8_t duplex; +@@ -189,6 +205,201 @@ struct lacp_port { + } cfg; + }; + ++static void generate_path(struct teamd_context *ctx, char path[PATH_MAX], const char* filename) ++{ ++ strcpy(path, ctx->lacp_directory); ++ /* Add trailing slash if we don't have one in the filename */ ++ if (path[strlen(path) - 1] != '/') ++ strcat(path, "/"); ++ strcat(path, filename); ++} ++ ++static int find_wr_info(struct lacp_port *lacp_port) { ++ struct lacp* lacp = lacp_port->lacp; ++ int i, found = -1; ++ ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ if (strcmp(lacp->wr.state[i].name, lacp_port->tdport->ifname) == 0) { ++ found = i; ++ break; ++ } ++ } ++ ++ if (found == -1) ++ teamd_log_warn("WR-mode. Found a newly added LAG member port: '%s' after restart. " ++ "The configuration was changed?", lacp_port->tdport->ifname); ++ ++ return found; ++} ++ ++static void remove_file(struct teamd_context *ctx, const char *name) { ++ char filename[PATH_MAX]; ++ int err; ++ ++ generate_path(ctx, filename, name); ++ ++ err = access(filename, R_OK); ++ if (err != 0) { ++ /* file is not present. Skip it */ ++ return; ++ } ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file %s: %s", filename, strerror(errno)); ++ } ++} ++ ++static void stop_wr_mode(struct lacp *lacp) { ++ int i; ++ ++ teamd_log_info("WR-mode. Stopping WR start mode"); ++ ++ lacp->ctx->warm_start_mode = false; ++ lacp->warm_start_mode_timer = 0; ++ ++ remove_file(lacp->ctx, lacp->ctx->team_devname); ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ remove_file(lacp->ctx, lacp->wr.state[i].name); ++ } ++ ++ lacp->wr.nr_of_tdports = 0; ++ if (lacp->wr.state) ++ free(lacp->wr.state); ++ lacp->wr.state = NULL; ++} ++ ++static int lacpdu_read(struct lacp_port *lacp_port, struct lacpdu *lacpdu) ++{ ++ FILE* fp; ++ char filename[PATH_MAX]; ++ int err, nitems; ++ ++ teamd_log_dbg("WR-mode. function lacpdu_read(): %s", lacp_port->tdport->ifname); ++ ++ generate_path(lacp_port->ctx, filename, lacp_port->tdport->ifname); ++ ++ /* check that file is readable. if there is no file, don't do anything */ ++ err = access(filename, R_OK); ++ if (err != 0) { ++ teamd_log_err("WR-mode. LACPDU state file '%s' is unreadable", filename); ++ return err; ++ } ++ ++ fp = fopen(filename, "r"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open lacp-saved dump from file '%s': %s", filename, strerror(errno)); ++ return errno; ++ } ++ ++ nitems = fread(lacpdu, sizeof(struct lacpdu), 1, fp); ++ (void)fclose(fp); ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file '%s': %s", filename, strerror(errno)); ++ } ++ ++ if (nitems != 1) { ++ teamd_log_err("WR-mode. Can't read lacp-saved dump from file '%s': %s", filename, strerror(errno)); ++ return -EINVAL; ++ } ++ ++ teamd_log_info("WR-mode. LACP state was read for port '%s'", lacp_port->tdport->ifname); ++ ++ return 0; ++} ++ ++static void lacp_state_save(struct teamd_context *ctx, struct lacp *lacp) ++{ ++ char filename[PATH_MAX]; ++ FILE *fp; ++ int i, err; ++ ++ generate_path(ctx, filename, ctx->team_devname); ++ ++ fp = fopen(filename, "wt"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error; ++ } ++ ++ err = fprintf(fp, "%d\n%d\n", lacp->carrier_up ? 1 : 0, lacp->wr.nr_of_tdports); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't write to the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error_with_close; ++ } ++ ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ err = fprintf(fp, "%s\n%d\n", lacp->wr.state[i].name, lacp->wr.state[i].enabled ? 1 : 0); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't write to the file '%s' to save the lacp dump: %s", filename, strerror(errno)); ++ goto error_with_close; ++ } ++ } ++ ++error_with_close: ++ (void)fclose(fp); ++ ++error: ++ (void)free(lacp->wr.state); ++ lacp->wr.state = NULL; ++ lacp->wr.nr_of_tdports = 0; ++} ++ ++static int lacp_state_load(struct teamd_context *ctx, struct lacp *lacp) ++{ ++ char filename[PATH_MAX]; ++ FILE *fp; ++ int data1, data2, i, err; ++ ++ teamd_log_dbg("WR-mode. function lacp_state_load()"); ++ ++ generate_path(ctx, filename, ctx->team_devname); ++ ++ fp = fopen(filename, "rt"); ++ if (!fp) { ++ teamd_log_err("WR-mode. Can't open the file '%s' to load the lacp dump: %s", filename, strerror(errno)); ++ return errno; ++ } ++ ++ err = fscanf(fp, "%d\n%d\n", &data1, &data2); ++ if (err != 2) { ++ teamd_log_err("WR-mode. Can't read the file '%s'. Wrong format", filename); ++ (void)fclose(fp); ++ return -1; ++ } ++ lacp->wr.carrier_up = data1 == 1; ++ lacp->wr.nr_of_tdports = data2; ++ ++ lacp->wr.state = calloc(lacp->wr.nr_of_tdports, sizeof(struct wr_tdport_state)); ++ if (!lacp->wr.state) { ++ teamd_log_err("WR-mode. lacp_state_load: Not enough memory. %s", ctx->team_devname); ++ return -1; ++ } ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) { ++ err = fscanf(fp, "%16s\n%d\n", &lacp->wr.state[i].name[0], &data1); ++ if (err != 2) { ++ teamd_log_err("WR-mode. Can't read the file '%s'. Wrong format", filename); ++ (void)free(lacp->wr.state); ++ lacp->wr.state = NULL; ++ (void)fclose(fp); ++ return -1; ++ } ++ lacp->wr.state[i].enabled = data1 == 1; ++ lacp->wr.state[i].checked = false; ++ } ++ ++ (void)fclose(fp); ++ ++ err = unlink(filename); ++ if (err < 0) { ++ teamd_log_err("WR-mode. Can't remove file %s: %s", filename, strerror(errno)); ++ } ++ ++ return 0; ++} ++ + static struct lacp_port *lacp_port_get(struct lacp *lacp, + struct teamd_port *tdport) + { +@@ -486,20 +697,95 @@ static int lacp_set_carrier(struct lacp *lacp, bool carrier_up) + return 0; + } + ++static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu); ++ ++#define LACP_WARM_START_CARRIER_TIMEOUT 3 ++ + static int lacp_update_carrier(struct lacp *lacp) + { + struct teamd_port *tdport; + int ports_enabled; +- bool state; + int err; + ++ if (lacp->ctx->warm_start_mode) { ++ teamd_log_dbg("WR-mode. function lacp_update_carrier()"); ++ } ++ + ports_enabled = 0; + teamd_for_each_tdport(tdport, lacp->ctx) { ++ bool state; + err = teamd_port_enabled(lacp->ctx, tdport, &state); + if (err) + return err; +- if (state && ++ports_enabled >= lacp->cfg.min_ports) +- return lacp_set_carrier(lacp, true); ++ ++ if (state) ++ ++ports_enabled; ++ ++ if (lacp->ctx->warm_start_mode) { ++ int found; ++ struct lacp_port* lacp_port; ++ bool linkup; ++ ++ lacp_port = lacp_port_get(lacp, tdport); ++ found = find_wr_info(lacp_port); ++ if (found < 0) /* newly added port was found */ ++ continue; ++ ++ linkup = team_is_port_link_up(lacp_port->tdport->team_port); ++ if (linkup) { /* read when the port is in carrier up state */ ++ if (!lacp->wr.state[found].checked) { ++ lacp->wr.state[found].checked = true; ++ ++ if(lacp->wr.state[found].enabled) { ++ /* the port was up before the WR. Trying to restore it */ ++ struct lacpdu lacpdu; ++ err = lacpdu_read(lacp_port, &lacpdu); ++ if (err) /* Can't read, so the port will start from scratch */ ++ continue; ++ teamd_log_info("WR-mode. State of the LAG member port '%s' was restored.", ++ tdport->ifname); ++ return lacpdu_process(lacp_port, &lacpdu); /* it runs lacp_update_carrier() inside of it */ ++ } else { ++ teamd_log_info("WR-mode. State of the LAG member port '%s' was down before the restart. Nothing to read", ++ tdport->ifname); ++ } ++ } ++ } ++ } ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ int i; ++ bool has_all_ports_added = true; ++ for (i = 0; i < lacp->wr.nr_of_tdports; ++i) ++ has_all_ports_added = has_all_ports_added && lacp->wr.state[i].checked; ++ ++ if (has_all_ports_added) { ++ teamd_log_info("WR-mode. The state for all %d LAG member ports was restored.", ++ lacp->wr.nr_of_tdports); ++ stop_wr_mode(lacp); ++ } ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ if (lacp->warm_start_mode_timer == 0) { ++ lacp->warm_start_mode_timer = time(NULL) + LACP_WARM_START_CARRIER_TIMEOUT; ++ } else if (time(NULL) >= lacp->warm_start_mode_timer) { ++ teamd_log_err("WR-mode. Timeout occured. Can't start in WR mode in %d seconds", ++ LACP_WARM_START_CARRIER_TIMEOUT); ++ stop_wr_mode(lacp); ++ } ++ } ++ ++ if (ports_enabled >= lacp->cfg.min_ports) { ++ teamd_log_dbg("Enable carrier. Number of enabled ports %d >= configured min_ports %d", ++ ports_enabled, lacp->cfg.min_ports); ++ return lacp_set_carrier(lacp, true); ++ } ++ ++ if (lacp->ctx->warm_start_mode) { ++ teamd_log_info("WR-mode. lacp_update_carrier(): Keep LAG interface up because of WR start mode"); ++ return lacp_set_carrier(lacp, true); + } + + return lacp_set_carrier(lacp, false); +@@ -919,6 +1205,18 @@ static void lacp_port_actor_system_update(struct lacp_port *lacp_port) + memcpy(actor->system, lacp_port->ctx->hwaddr, ETH_ALEN); + } + ++static int lacp_portname_to_port_id(const char* name) ++{ ++#define PORT_PREFIX "Ethernet" ++ const char* strport_id = name + sizeof(PORT_PREFIX) - 1; ++ const int port_id = atoi(strport_id); ++ if ((port_id == 0) && strcmp(strport_id, "0")) { ++ teamd_log_err("%s: Can't convert from port name to port id. Port id is equal to 0, but this is not expected", name); ++ } ++ ++ return htons(port_id + 1); ++} ++ + static void lacp_port_actor_init(struct lacp_port *lacp_port) + { + struct lacpdu_info *actor = &lacp_port->actor; +@@ -926,7 +1224,7 @@ static void lacp_port_actor_init(struct lacp_port *lacp_port) + actor->system_priority = htons(lacp_port->lacp->cfg.sys_prio); + actor->key = htons(lacp_port->cfg.lacp_key); + actor->port_priority = htons(lacp_port->cfg.lacp_prio); +- actor->port = htons(lacp_port->tdport->ifindex); ++ actor->port = lacp_portname_to_port_id(lacp_port->tdport->ifname); + lacp_port_actor_system_update(lacp_port); + } + +@@ -1001,6 +1299,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, + break; + } + ++ if (new_state != PORT_STATE_CURRENT) { ++ /* clean saved lacp pdu up when the current port: ++ disabled, expired, or defaulted */ ++ (void)memset(&lacp_port->last_pdu, 0, sizeof(struct lacpdu)); ++ lacp_port->lacpdu_saved = false; ++ } ++ + teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"", + lacp_port->tdport->ifname, + lacp_port_state_name[lacp_port->state], +@@ -1090,34 +1395,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) + return err; + } + +-static int lacpdu_recv(struct lacp_port *lacp_port) ++static int lacpdu_process(struct lacp_port *lacp_port, struct lacpdu* lacpdu) + { +- struct lacpdu lacpdu; +- struct sockaddr_ll ll_from; + int err; +- bool admin_state; + +- err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, +- (struct sockaddr *) &ll_from, sizeof(ll_from)); +- if (err <= 0) +- return err; +- +- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) +- return 0; +- +- admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); +- if (!admin_state) +- return 0; +- +- if (!lacpdu_check(&lacpdu)) { ++ if (!lacpdu_check(lacpdu)) { + teamd_log_warn("malformed LACP PDU came."); + return 0; + } + ++ /* save received lacp pdu frame */ ++ (void)memcpy(&lacp_port->last_pdu, lacpdu, sizeof(struct lacpdu)); ++ lacp_port->lacpdu_saved = true; ++ + /* Check if we have correct info about the other side */ +- if (memcmp(&lacpdu.actor, &lacp_port->partner, ++ if (memcmp(&lacpdu->actor, &lacp_port->partner, + sizeof(struct lacpdu_info))) { +- lacp_port->partner = lacpdu.actor; ++ lacp_port->partner = lacpdu->actor; + err = lacp_port_partner_update(lacp_port); + if (err) + return err; +@@ -1133,21 +1427,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + lacp_port_actor_update(lacp_port); + + /* Check if the other side has correct info about us */ +- if (memcmp(&lacpdu.partner, &lacp_port->actor, ++ if (memcmp(&lacpdu->partner, &lacp_port->actor, + sizeof(struct lacpdu_info))) { + err = lacpdu_send(lacp_port); + if (err) + return err; + } + err = lacp_port_timeout_set(lacp_port, false); +- if (err) { ++ if (err) + return err; +- } ++ + teamd_loop_callback_enable(lacp_port->ctx, + LACP_TIMEOUT_CB_NAME, lacp_port); + return 0; + } + ++static int lacpdu_recv(struct lacp_port *lacp_port) ++{ ++ struct lacpdu lacpdu; ++ struct sockaddr_ll ll_from; ++ int err; ++ bool admin_state; ++ ++ err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, ++ (struct sockaddr *) &ll_from, sizeof(ll_from)); ++ if (err <= 0) ++ return err; ++ ++ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) ++ return 0; ++ ++ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); ++ if (!admin_state) ++ return 0; ++ ++ /* if the lacpdu wasn't read yet, don't process received pdu */ ++ if (lacp_port->ctx->warm_start_mode) { ++ int found; ++ ++ found = find_wr_info(lacp_port); ++ if (found >= 0 && !lacp_port->lacp->wr.state[found].checked) { ++ teamd_log_info("WR-mode. Received LACP PDU on %s. " ++ "But saved LACP PDU wasn't processed yet.", ++ lacp_port->tdport->ifname); ++ return 0; ++ } ++ } ++ ++ return lacpdu_process(lacp_port, &lacpdu); ++} ++ + static int lacp_callback_timeout(struct teamd_context *ctx, int events, + void *priv) + { +@@ -1253,6 +1582,8 @@ static int lacp_port_added(struct teamd_context *ctx, + struct lacp *lacp = creator_priv; + int err; + ++ teamd_log_dbg("function lacp_port_added(): %s", tdport->ifname); ++ + lacp_port->ctx = ctx; + lacp_port->tdport = tdport; + lacp_port->lacp = lacp; +@@ -1299,6 +1630,13 @@ static int lacp_port_added(struct teamd_context *ctx, + goto periodic_callback_del; + } + ++ /* refresh ports from the kernel */ ++ err = team_refresh(ctx->th); ++ if (err) { ++ teamd_log_err("%s: Team refresh failed.", tdport->ifname); ++ goto timeout_callback_del; ++ } ++ + /* Newly added ports are disabled */ + err = team_set_port_enabled(ctx->th, tdport->ifindex, false); + if (err) { +@@ -1336,7 +1674,13 @@ static void lacp_port_removed(struct teamd_context *ctx, + { + struct lacp_port *lacp_port = priv; + +- lacp_port_set_state(lacp_port, PORT_STATE_DISABLED); ++ teamd_log_dbg("function lacp_port_removed(): %s", tdport->ifname); ++ ++ if (!lacp_port->ctx->keep_ports) { ++ /* Don't transition into DISABLED state, ++ which sends EXPIRED LACP PDU update */ ++ lacp_port_set_state(lacp_port, PORT_STATE_DISABLED); ++ } + teamd_loop_callback_del(ctx, LACP_TIMEOUT_CB_NAME, lacp_port); + teamd_loop_callback_del(ctx, LACP_PERIODIC_CB_NAME, lacp_port); + teamd_loop_callback_del(ctx, LACP_SOCKET_CB_NAME, lacp_port); +@@ -1428,6 +1772,42 @@ static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_por + (void) lacpdu_send(lacp_port); + } + ++static void lacp_event_watch_port_flush_data(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) ++{ ++ struct lacp *lacp = priv; ++ ++ /* save dump information for each tdport */ ++ lacp->wr.nr_of_tdports++; ++ lacp->wr.state = realloc(lacp->wr.state, sizeof(struct wr_tdport_state) * lacp->wr.nr_of_tdports); ++ if (lacp->wr.state) { ++ int err; ++ strcpy(lacp->wr.state[lacp->wr.nr_of_tdports-1].name, tdport->ifname); ++ err = teamd_port_enabled(ctx, tdport, &lacp->wr.state[lacp->wr.nr_of_tdports-1].enabled); ++ if (err) ++ lacp->wr.state[lacp->wr.nr_of_tdports-1].enabled = false; ++ } else { ++ teamd_log_err("WR-mode. Can't reallocate memory for LACP member %s dump", tdport->ifname); ++ lacp->wr.nr_of_tdports = 0; ++ } ++ ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); ++ if (lacp_port->lacpdu_saved && lacp_port->ctx->lacp_directory) { ++ char filename[PATH_MAX]; ++ generate_path(lacp_port->ctx, filename, lacp_port->tdport->ifname); ++ FILE *fp = fopen(filename, "wb"); ++ if (fp != NULL) { ++ (void)fwrite(&lacp_port->last_pdu, sizeof(struct lacpdu), 1, fp); ++ (void)fclose(fp); ++ } else { ++ teamd_log_err("WR-mode. Can't open file %s for writing %s", filename, strerror(errno)); ++ } ++ } else { ++ if (lacp_port->ctx->lacp_directory == NULL) ++ teamd_log_err("WR-mode. Can't dump received lacp pdu for port %s. " ++ "LACP directory wasn't configured", lacp_port->tdport->ifname); ++ } ++} ++ + static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .hwaddr_changed = lacp_event_watch_hwaddr_changed, + .port_added = lacp_event_watch_port_added, +@@ -1435,21 +1815,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .port_changed = lacp_event_watch_port_changed, + .admin_state_changed = lacp_event_watch_admin_state_changed, + .refresh = lacp_event_watch_refresh, ++ .port_flush_data = lacp_event_watch_port_flush_data, + }; + + static int lacp_carrier_init(struct teamd_context *ctx, struct lacp *lacp) + { + int err; + +- /* initialize carrier control */ +- err = team_carrier_set(ctx->th, false); ++ lacp->carrier_up = false; ++ ++ if (ctx->warm_start_mode) { ++ teamd_log_dbg("WR-mode. function lacp_carrier_init()"); ++ ++ /* Disable WR start mode if LAG interface was down */ ++ if (lacp->wr.carrier_up) { ++ teamd_log_info("WR-mode. Starting in WR mode"); ++ } else { ++ teamd_log_info("WR-mode. Starting in normal mode. The LAG interface was down before restart"); ++ } ++ ctx->warm_start_mode = lacp->wr.carrier_up; ++ lacp->carrier_up = lacp->wr.carrier_up; ++ lacp->warm_start_mode_timer = 0; ++ } ++ ++ err = team_carrier_set(ctx->th, lacp->carrier_up); + if (err && err != -EOPNOTSUPP) { +- teamd_log_err("Failed to set carrier down."); ++ teamd_log_err("Failed to set carrier"); + return err; + } + +- lacp->carrier_up = false; +- + return 0; + } + +@@ -1917,6 +2311,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) + } + + lacp->ctx = ctx; ++ if (ctx->warm_start_mode) { ++ err = lacp_state_load(ctx, lacp); ++ if (err) ++ stop_wr_mode(lacp); ++ } ++ + err = teamd_hash_func_set(ctx); + if (err) + return err; +@@ -1958,10 +2358,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) + { + struct lacp *lacp = priv; + ++ if (ctx->lacp_directory) ++ lacp_state_save(ctx, lacp); + teamd_state_val_unregister(ctx, &lacp_state_vg, lacp); + teamd_balancer_fini(lacp->tb); + teamd_event_watch_unregister(ctx, &lacp_event_watch_ops, lacp); +- lacp_carrier_fini(ctx, lacp); ++ if (!ctx->keep_ports) ++ lacp_carrier_fini(ctx, lacp); + } + + const struct teamd_runner teamd_runner_lacp = { diff --git a/src/libteam/series b/src/libteam/series index 1c6820678c8d..ed89005c17c0 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -2,10 +2,10 @@ 0002-libteam-Temporarily-remove-redundant-debug-mes.patch 0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch 0004-libteam-Add-lacp-fallback-support-for-single-member-.patch -0005-libteam-Add-warm_reboot-mode.patch 0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch 0010-teamd-lacp-update-port-state-according-to-partners-sy.patch 0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch 0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch 0013-teamd-lacp-port-admin-down-recv-not-processing.patch 0014-Send-LACP-PDU-immediately-if-our-state-changed.patch +0015-libteam-Add-warm_reboot-mode.patch From 34f3caf2e2932348ea0d027681c16fcf8ac55974 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Sat, 15 Jun 2019 15:57:10 -0700 Subject: [PATCH 125/219] Set the default mac ageing time to 600 seconds (#2365) * Set the default mac ageing time to 300 seconds The current mac ageing was disabled, this could lead the mac address table to increase over time and lead to resource and performance issues. Signed-off-by: Zhenggen Xu * Update the default HW ageing timer to be 600 seconds. This is to be on the safer side where ARP update interval is 300 seconds and SONiC does not flood when ARP is aged out. Signed-off-by: Zhenggen Xu --- dockers/docker-orchagent/switch.json.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index 7aaada1b1e40..a7dafd40f267 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -12,7 +12,8 @@ { "SWITCH_TABLE:switch": { "ecmp_hash_seed": "{{ hash_seed }}", - "lag_hash_seed": "{{ hash_seed }}" + "lag_hash_seed": "{{ hash_seed }}", + "fdb_aging_time": "600" }, "OP": "SET" } From cf9adfef646aa5fb1292169d574e2201da43b785 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 16 Jun 2019 10:36:22 -0700 Subject: [PATCH 126/219] [201811][swss] advance sub module head (#3018) Submodule src/sonic-swss 93497ec..87f0a5e: > Add vxlan remove operation (#938) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 93497ec838ad..87f0a5e46be9 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 93497ec838adf476e3d549e7aad26a59e8bdfceb +Subproject commit 87f0a5e46be98a9011cd8c85d92830f9296f63af From c9748dd85c0d7046ed6378636af71f17b340ea53 Mon Sep 17 00:00:00 2001 From: neethajohn <48968228+neethajohn@users.noreply.github.com> Date: Wed, 19 Jun 2019 00:17:06 -0700 Subject: [PATCH 127/219] [submodule]: Update submodule sonic-quagga (#3030) Reduce the retry time for IPV6 connections to avoid reprogramming IPv6 routes after warm-reboot (#37) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index 6397c2c9b588..b1d01a2dd841 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 6397c2c9b588a2271aaf3f4d7383111db16d090a +Subproject commit b1d01a2dd841f76e73067171702f7c6321793c49 From 02fc1306b04f44ec3a3d405cf10e0364d44838e4 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 19 Jun 2019 00:16:01 -0700 Subject: [PATCH 128/219] [baseimage]: Increase TMOUT for serial port connections to 15 minutes (#3032) Increase TMOUT value in order to close inactive serial console connections after 900 seconds (15 minutes) of inactivity --- files/image_config/bash/bash.bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc index d65beb5b0847..6651a51ceed0 100644 --- a/files/image_config/bash/bash.bashrc +++ b/files/image_config/bash/bash.bashrc @@ -54,5 +54,5 @@ if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-no } fi -# enable auto-logout for console ttyS* sessions -tty | grep ttyS >/dev/null && TMOUT=300 +# Automatically log out console ttyS* sessions after 15 minutes of inactivity +tty | grep ttyS >/dev/null && TMOUT=900 From f6c1cef3c530d3b599969e3703b1028295b5d527 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 19 Jun 2019 12:10:25 -0700 Subject: [PATCH 129/219] [201811][swss][utilities] advance sub module head (#3051) Submodule src/sonic-swss 87f0a5e..869c78a: > Add retryCount option for orchagent_restart_check program. (#833) Submodule src/sonic-utilities 5b73b83..a02c4ea: > [warm-reboot] Use retryCount option of orchagent_restart_check program (#555) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 87f0a5e46be9..869c78aeea0d 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 87f0a5e46be98a9011cd8c85d92830f9296f63af +Subproject commit 869c78aeea0d92f484d5e301a77d9879e5e51baa diff --git a/src/sonic-utilities b/src/sonic-utilities index 5b73b8366546..a02c4eaee840 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 5b73b8366546e3b7927b74a13f551a0d8ae50202 +Subproject commit a02c4eaee8404352f82531d89d8e0c2dfd8a76cf From 0ea679e297e7abc424091a8426081320d090f9bf Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 20 Jun 2019 21:21:36 -0700 Subject: [PATCH 130/219] [submodule] update sonic-linux-kernel (#3038) * [submodule] update sonic-linux-kernel (#2985) * Fix many version strings * Update minor version * Update arista-drivers submodule (#9) * Rebuild SDK on new kernel (#10) --- build_debian.sh | 4 ++-- files/build_templates/swss.service.j2 | 4 ++-- files/build_templates/syncd.service.j2 | 8 ++++---- installer/x86_64/install.sh | 10 +++++----- platform/barefoot/bfn-modules/debian/control | 2 +- platform/barefoot/sonic-platform-modules-arista | 2 +- .../sonic-platform-modules-bfn-montara/debian/control | 2 +- .../barefoot/sonic-platform-modules-bfn/debian/control | 2 +- platform/broadcom/sai-modules.mk | 2 +- platform/broadcom/saibcm-modules/debian/control | 4 ++-- .../debian/opennsl-modules-4.9.0-8-amd64.dirs | 2 +- .../debian/opennsl-modules-4.9.0-8-amd64.init | 2 +- .../debian/opennsl-modules-4.9.0-8-amd64.install | 10 +++++----- platform/broadcom/saibcm-modules/debian/rules | 6 +++--- .../systemd/opennsl-modules-4.9.0-8-amd64.service | 4 ++-- .../as7326-56x/utils/accton_handle_idt.sh | 10 +++++----- .../as7726-32x/utils/accton_handle_idt.sh | 10 +++++----- .../debian/control | 4 ++-- platform/broadcom/sonic-platform-modules-arista | 2 +- .../broadcom/sonic-platform-modules-cel/debian/control | 4 ++-- .../sonic-platform-modules-dell/debian/control | 6 +++--- .../sonic-platform-modules-delta/debian/control | 8 ++++---- .../debian/platform-modules-et-6248brb.init | 2 +- .../et-6248brb/scripts/led_status.sh | 2 +- .../sonic-platform-modules-inventec/debian/control | 10 +++++----- .../sonic-platform-modules-s6000/debian/control | 2 +- .../centec/sonic-platform-modules-e582/debian/control | 4 ++-- platform/mellanox/sdk.mk | 2 +- platform/nephos/sdk.mk | 2 +- .../sonic-platform-modules-accton/debian/control | 2 +- .../nephos/sonic-platform-modules-cig/debian/control | 2 +- rules/linux-kernel.mk | 6 +++--- src/sonic-linux-kernel | 2 +- 33 files changed, 72 insertions(+), 72 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 4c2f4ccfd322..cf87c7bdb563 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -30,7 +30,7 @@ set -x -e ## docker engine version (with platform) DOCKER_VERSION=5:18.09.2~3-0~debian-stretch -LINUX_KERNEL_VERSION=4.9.0-8 +LINUX_KERNEL_VERSION=4.9.0-9 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot @@ -403,7 +403,7 @@ fi ## Organization specific extensions such as Configuration & Scripts for features like AAA, ZTP... if [ "${enable_organization_extensions}" = "y" ]; then if [ -f files/build_templates/organization_extensions.sh ]; then - sudo chmod 755 files/build_templates/organization_extensions.sh + sudo chmod 755 files/build_templates/organization_extensions.sh ./files/build_templates/organization_extensions.sh -f $FILESYSTEM_ROOT -h $HOSTNAME fi fi diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index abf57b7bc89f..4fe55a9e957d 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -2,9 +2,9 @@ Description=switch state service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-4.9.0-8-amd64.service +Requires=opennsl-modules-4.9.0-9-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-8-amd64.service +Requires=nps-modules-4.9.0-9-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service diff --git a/files/build_templates/syncd.service.j2 b/files/build_templates/syncd.service.j2 index ec9696752a03..b11bf93255d9 100644 --- a/files/build_templates/syncd.service.j2 +++ b/files/build_templates/syncd.service.j2 @@ -2,16 +2,16 @@ Description=syncd service Requires=database.service updategraph.service {% if sonic_asic_platform == 'broadcom' %} -Requires=opennsl-modules-4.9.0-8-amd64.service +Requires=opennsl-modules-4.9.0-9-amd64.service {% elif sonic_asic_platform == 'nephos' %} -Requires=nps-modules-4.9.0-8-amd64.service +Requires=nps-modules-4.9.0-9-amd64.service {% endif %} After=database.service updategraph.service After=interfaces-config.service {% if sonic_asic_platform == 'broadcom' %} -After=opennsl-modules-4.9.0-8-amd64.service +After=opennsl-modules-4.9.0-9-amd64.service {% elif sonic_asic_platform == 'nephos' %} -After=nps-modules-4.9.0-8-amd64.service +After=nps-modules-4.9.0-9-amd64.service {% endif %} After=swss.service Before=ntp-config.service diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index b535182a89ef..040636cf1ec5 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -162,7 +162,7 @@ if [ "$install_env" = "onie" ]; then fi # Creates a new partition for the DEMO OS. -# +# # arg $1 -- base block device # # Returns the created partition number in $demo_part @@ -177,7 +177,7 @@ create_demo_gpt_partition() tmpfifo=$(mktemp -u) trap_push "rm $tmpfifo || true" mkfifo -m 600 "$tmpfifo" - + # See if demo partition already exists demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}') if [ -n "$demo_part" ] ; then @@ -438,7 +438,7 @@ if [ "$install_env" = "onie" ]; then echo "Error: Unable to mount $demo_dev on $demo_mnt" exit 1 } - + elif [ "$install_env" = "sonic" ]; then demo_mnt="/host" eval running_sonic_revision=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ") @@ -595,12 +595,12 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-4.9.0-8-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-4.9.0-9-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-4.9.0-8-amd64 + initrd /$image_dir/boot/initrd.img-4.9.0-9-amd64 } EOF diff --git a/platform/barefoot/bfn-modules/debian/control b/platform/barefoot/bfn-modules/debian/control index 1b6174d12090..6409ae752c3a 100644 --- a/platform/barefoot/bfn-modules/debian/control +++ b/platform/barefoot/bfn-modules/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: bfn-modules Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for bfn asic for mmap diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index d377e78fc4a8..9c517cbc40b1 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit d377e78fc4a85ecf86110db2a757dfcdea8f8d46 +Subproject commit 9c517cbc40b143c3d0ba32d7e996ac0618c17c5c diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control index 6845c80df8b1..707c1ece9caa 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn-montara Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control index 3898401035a4..c0c0e88a20ba 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index 0e6002c48bb8..d6c059dc1190 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -KVERSION = 4.9.0-8-amd64 +KVERSION = 4.9.0-9-amd64 BRCM_OPENNSL_KERNEL_VERSION = 3.4.1.11-1 BRCM_OPENNSL_KERNEL = opennsl-modules-$(KVERSION)_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb diff --git a/platform/broadcom/saibcm-modules/debian/control b/platform/broadcom/saibcm-modules/debian/control index 2af9ee05af51..830685297f4c 100644 --- a/platform/broadcom/saibcm-modules/debian/control +++ b/platform/broadcom/saibcm-modules/debian/control @@ -7,8 +7,8 @@ Standards-Version: 3.9.3 #Vcs-Git: git://git.debian.org/collab-maint/bcmsdk.git #Vcs-Browser: http://git.debian.org/?p=collab-maint/bcmsdk.git;a=summary -Package: opennsl-modules-4.9.0-8-amd64 +Package: opennsl-modules-4.9.0-9-amd64 Architecture: amd64 Section: main -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for broadcom SAI diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs index ed047543ad73..bd864e8d145e 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs @@ -1 +1 @@ -lib/modules/4.9.0-8-amd64/extra +lib/modules/4.9.0-9-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init index 0b526b012d0a..7b2d32a3e071 100755 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init @@ -69,7 +69,7 @@ force-reload|restart) ;; *) - echo "Usage: /etc/init.d/opennsl-modules-4.9.0-8-amd64.init {start|stop}" + echo "Usage: /etc/init.d/opennsl-modules-4.9.0-9-amd64.init {start|stop}" exit 1 ;; esac diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install index feef684b9dfd..2f6eed55a73f 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install @@ -1,5 +1,5 @@ -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-8-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-8-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-8-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-8-amd64/extra -systemd/opennsl-modules-4.9.0-8-amd64.service lib/systemd/system +systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.9.0-9-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.9.0-9-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.9.0-9-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.9.0-9-amd64/extra +systemd/opennsl-modules-4.9.0-9-amd64.service lib/systemd/system diff --git a/platform/broadcom/saibcm-modules/debian/rules b/platform/broadcom/saibcm-modules/debian/rules index 54706d74a096..b0849fe4b2fc 100755 --- a/platform/broadcom/saibcm-modules/debian/rules +++ b/platform/broadcom/saibcm-modules/debian/rules @@ -60,7 +60,7 @@ kdist_config: prep-deb-files kdist_clean: clean dh_testdir dh_clean - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean # rm -f driver/*.o driver/*.ko # ### end KERNEL SETUP @@ -78,7 +78,7 @@ build-arch-stamp: dh_testdir # Add here command to compile/build the package. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 touch $@ @@ -103,7 +103,7 @@ clean: rm -f build-arch-stamp build-indep-stamp configure-stamp # Add here commands to clean up after the build process. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-8-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-8-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 KERNDIR=/usr/src/linux-headers-4.9.0-9-amd64 KERNEL_SRC=/usr/src/linux-headers-4.9.0-9-amd64 $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean dh_clean diff --git a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service index 7610d41a0691..2cc2223fa3fd 100644 --- a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service +++ b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service @@ -5,13 +5,13 @@ Before=syncd.service [Service] Type=oneshot -ExecStart=-/etc/init.d/opennsl-modules-4.9.0-8-amd64 start +ExecStart=-/etc/init.d/opennsl-modules-4.9.0-9-amd64 start # Don't remove opennsl driver when stopping service. Because # removing knet drivers takes ~30 seconds to delete netdevs. # This delay cuts too deep into warm reboot time budget. # We could skip this step because we don't expect stopping # opennsl service in any context other than rebooting. -# ExecStop=-/etc/init.d/opennsl-modules-4.9.0-8-amd64 stop +# ExecStop=-/etc/init.d/opennsl-modules-4.9.0-9-amd64 stop RemainAfterExit=yes [Install] diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_handle_idt.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_handle_idt.sh index 2ec57550e646..d61d93a61951 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_handle_idt.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_handle_idt.sh @@ -4,13 +4,13 @@ if [ -s /usr/local/bin/done_idt_init ];then echo "There is a done_idt_init file" else - cat /etc/init.d/opennsl-modules-4.9.0-8-amd64|grep idt_init.sh + cat /etc/init.d/opennsl-modules-4.9.0-9-amd64|grep idt_init.sh if [ $? -ne 0 ];then echo "Add idt_init.sh to opennsl-modules for TD3 MAC" - sed -i '/modprobe linux-kernel-bde/i sleep 1' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/sleep/i /usr/local/bin/idt_init.sh' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/idt_init/i echo "IDT init" ' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/IDT init/i echo 1 > /usr/local/bin/done_idt_init' /etc/init.d/opennsl-modules-4.9.0-8-amd64 + sed -i '/modprobe linux-kernel-bde/i sleep 1' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/sleep/i /usr/local/bin/idt_init.sh' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/idt_init/i echo "IDT init" ' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/IDT init/i echo 1 > /usr/local/bin/done_idt_init' /etc/init.d/opennsl-modules-4.9.0-9-amd64 fi diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_handle_idt.sh b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_handle_idt.sh index 748017e6b595..7b1d0388dd19 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_handle_idt.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_handle_idt.sh @@ -3,13 +3,13 @@ if [ -s /usr/local/bin/done_idt_init ];then echo "There is a done_idt_init file" else - cat /etc/init.d/opennsl-modules-4.9.0-8-amd64|grep idt_init.sh + cat /etc/init.d/opennsl-modules-4.9.0-9-amd64|grep idt_init.sh if [ $? -ne 0 ];then echo "Add idt_init.sh to opennsl-modules for TD3 MAC" - sed -i '/modprobe linux-kernel-bde/i sleep 1' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/sleep/i /usr/local/bin/idt_init.sh' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/idt_init/i echo "IDT init" ' /etc/init.d/opennsl-modules-4.9.0-8-amd64 - sed -i '/IDT init/i echo 1 > /usr/local/bin/done_idt_init' /etc/init.d/opennsl-modules-4.9.0-8-amd64 + sed -i '/modprobe linux-kernel-bde/i sleep 1' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/sleep/i /usr/local/bin/idt_init.sh' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/idt_init/i echo "IDT init" ' /etc/init.d/opennsl-modules-4.9.0-9-amd64 + sed -i '/IDT init/i echo 1 > /usr/local/bin/done_idt_init' /etc/init.d/opennsl-modules-4.9.0-9-amd64 fi fi diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control index 2f97175d90c0..dff8b337a6f6 100644 --- a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: sonic-platform-alphanetworks-snh60a0-320fv2 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-alphanetworks-snh60b0-640f Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index d377e78fc4a8..9c517cbc40b1 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit d377e78fc4a85ecf86110db2a757dfcdea8f8d46 +Subproject commit 9c517cbc40b143c3d0ba32d7e996ac0618c17c5c diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index e76edfbeceed..bdcf871fef71 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-haliburton Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index 8991a2d6ed28..c9dc7e4ac5e6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -7,16 +7,16 @@ Standards-Version: 3.9.3 Package: platform-modules-z9264f Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9100 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s6100 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/control b/platform/broadcom/sonic-platform-modules-delta/debian/control index abc355924857..1f579e9c90b9 100644 --- a/platform/broadcom/sonic-platform-modules-delta/debian/control +++ b/platform/broadcom/sonic-platform-modules-delta/debian/control @@ -7,21 +7,21 @@ Standards-Version: 3.9.3 Package: platform-modules-ag9032v1 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag9064 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ag5648 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-et-6248brb Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init index 299753839493..705e6c29c2dc 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-et-6248brb.init @@ -25,7 +25,7 @@ start) modprobe dni_gpio modprobe delta_et-6248brb_platform - if [ `uname -a | awk '{print $3}'` = "4.9.0-8-amd64" ]; then + if [ `uname -a | awk '{print $3}'` = "4.9.0-9-amd64" ]; then echo "453" > "/sys/class/gpio/export" echo "454" > "/sys/class/gpio/export" echo "455" > "/sys/class/gpio/export" diff --git a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh index d83ae2e59adb..aeb3b4ee2976 100644 --- a/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh +++ b/platform/broadcom/sonic-platform-modules-delta/et-6248brb/scripts/led_status.sh @@ -7,7 +7,7 @@ FAN2_RPM="/sys/bus/i2c/devices/0-002e/fan2_input" FAN_TRAY1_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan1_led_ag" FAN_TRAY2_LED="/sys/devices/platform/delta-et6248brb-gpio.0/FAN/fan2_led_ag" -if [ `uname -a | awk '{print $3}'` = "4.9.0-8-amd64" ]; then +if [ `uname -a | awk '{print $3}'` = "4.9.0-9-amd64" ]; then SYS_LED_G="/sys/class/gpio/gpio453/value" SYS_LED_R="/sys/class/gpio/gpio454/value" PWR_LED_G="/sys/class/gpio/gpio455/value" diff --git a/platform/broadcom/sonic-platform-modules-inventec/debian/control b/platform/broadcom/sonic-platform-modules-inventec/debian/control index 952ab5d3b955..1ab84ea12d6d 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/debian/control +++ b/platform/broadcom/sonic-platform-modules-inventec/debian/control @@ -7,25 +7,25 @@ Standards-Version: 3.9.3 Package: platform-modules-d7032q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7054q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d6254qs Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d6556 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led Package: platform-modules-d7264q28b Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control index a9e0d155e6d4..8367cd16948e 100644 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/control +++ b/platform/broadcom/sonic-platform-modules-s6000/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-s6000 Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec/sonic-platform-modules-e582/debian/control b/platform/centec/sonic-platform-modules-e582/debian/control index e3563538e6b9..7a3d2c7412e0 100644 --- a/platform/centec/sonic-platform-modules-e582/debian/control +++ b/platform/centec/sonic-platform-modules-e582/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-e582-48x2q4z Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e582-48x6q Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 9d3799765098..8c8daa85ae9e 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,4 +1,4 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/6ea244309b944af3bb34a9b99ad6ed60c5dc9937/sdk +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/378cc53bef634b6ae192819d7f412fb1543faff6/sdk MLNX_SDK_VERSION = 4.3.0136 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 7ef31fa78161..2cf92d12c12f 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,5 +1,5 @@ SDK_VERSION = 2.0.5 -LINUX_VER = 4.9.0-8 +LINUX_VER = 4.9.0-9 SDK_COMMIT_ID = f2e56f NEPHOS_NPS_KERNEL = nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb $(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb" diff --git a/platform/nephos/sonic-platform-modules-accton/debian/control b/platform/nephos/sonic-platform-modules-accton/debian/control index 871b9cb004a8..f0a4f04dd8f1 100755 --- a/platform/nephos/sonic-platform-modules-accton/debian/control +++ b/platform/nephos/sonic-platform-modules-accton/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: sonic-platform-accton-as7116-54x Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/nephos/sonic-platform-modules-cig/debian/control b/platform/nephos/sonic-platform-modules-cig/debian/control index c617c76bbba3..356ce313ab63 100755 --- a/platform/nephos/sonic-platform-modules-cig/debian/control +++ b/platform/nephos/sonic-platform-modules-cig/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: sonic-platform-cig-cs6436-56p Architecture: amd64 -Depends: linux-image-4.9.0-8-amd64 +Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 3c064a678fd6..70e597876fc0 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 4.9.0-8 +KVERSION_SHORT = 4.9.0-9 KVERSION = $(KVERSION_SHORT)-amd64 -KERNEL_VERSION = 4.9.110 -KERNEL_SUBVERSION = 3+deb9u6 +KERNEL_VERSION = 4.9.168 +KERNEL_SUBVERSION = 1+deb9u3 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 39d030174388..2754b37b5327 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 39d0301743880f31e1900a719642af3acc7eacb6 +Subproject commit 2754b37b532711b0b13d50cf04b27714b0e4a11e From 7db8c4a19ac8b4042e19a1427929968f397771ad Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 21 Jun 2019 14:20:11 -0700 Subject: [PATCH 131/219] [kernel upgrade] change init file name to match kernel version (#3064) Signed-off-by: Ying Xie --- ...ules-4.9.0-8-amd64.dirs => opennsl-modules-4.9.0-9-amd64.dirs} | 0 ...ules-4.9.0-8-amd64.init => opennsl-modules-4.9.0-9-amd64.init} | 0 ....9.0-8-amd64.install => opennsl-modules-4.9.0-9-amd64.install} | 0 ....9.0-8-amd64.service => opennsl-modules-4.9.0-9-amd64.service} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename platform/broadcom/saibcm-modules/debian/{opennsl-modules-4.9.0-8-amd64.dirs => opennsl-modules-4.9.0-9-amd64.dirs} (100%) rename platform/broadcom/saibcm-modules/debian/{opennsl-modules-4.9.0-8-amd64.init => opennsl-modules-4.9.0-9-amd64.init} (100%) rename platform/broadcom/saibcm-modules/debian/{opennsl-modules-4.9.0-8-amd64.install => opennsl-modules-4.9.0-9-amd64.install} (100%) rename platform/broadcom/saibcm-modules/systemd/{opennsl-modules-4.9.0-8-amd64.service => opennsl-modules-4.9.0-9-amd64.service} (100%) diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.dirs similarity index 100% rename from platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.dirs rename to platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.dirs diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.init similarity index 100% rename from platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.init rename to platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.init diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.install similarity index 100% rename from platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-8-amd64.install rename to platform/broadcom/saibcm-modules/debian/opennsl-modules-4.9.0-9-amd64.install diff --git a/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service b/platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-9-amd64.service similarity index 100% rename from platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-8-amd64.service rename to platform/broadcom/saibcm-modules/systemd/opennsl-modules-4.9.0-9-amd64.service From a6fa4d1fcce55c477680d73f1214872d02d5cd2d Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Tue, 25 Jun 2019 17:30:15 -0700 Subject: [PATCH 132/219] [snmpd]: Restart snmpd to mitigate its crash (#3085) --- dockers/docker-snmp-sv2/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp-sv2/supervisord.conf index d80579506100..0e5db64cf287 100644 --- a/dockers/docker-snmp-sv2/supervisord.conf +++ b/dockers/docker-snmp-sv2/supervisord.conf @@ -23,7 +23,7 @@ stderr_logfile=syslog command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid priority=3 autostart=false -autorestart=false +autorestart=true stdout_logfile=syslog stderr_logfile=syslog From 588c687a2752b4ecd31468098462309e2bca1683 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 26 Jun 2019 22:02:21 -0700 Subject: [PATCH 133/219] [fast-reboot] fix fast reboot compatibility (#3083) and advance sai-redis/201811 point (#3089) * fix fast reboot compatibility (#3083) and advance sai-redis/201811 point * Repoint the submodule --- files/build_templates/docker_image_ctl.j2 | 10 +++++----- files/scripts/syncd.sh | 9 +++++---- src/sonic-sairedis | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 2afc381cb96f..788074db1a6f 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -7,15 +7,15 @@ function getMountPoint() function getBootType() { - local BOOT_TYPE - case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in - warm*) + # same code snippet in files/scripts/syncd.sh + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) TYPE='warm' ;; - fastfast) + *SONIC_BOOT_TYPE=fastfast*) TYPE='fastfast' ;; - fast*) + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) TYPE='fast' ;; *) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 0a2b9aefd0df..11d195348882 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -55,14 +55,15 @@ function wait_for_database_service() function getBootType() { - case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in - warm*) + # same code snippet in files/build_templates/docker_image_ctl.j2 + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) TYPE='warm' ;; - fastfast) + *SONIC_BOOT_TYPE=fastfast*) TYPE='fastfast' ;; - fast*) + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) TYPE='fast' ;; *) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index d027eae034d5..c350c544f34d 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit d027eae034d538febe9fdb62682745a6b39a79ee +Subproject commit c350c544f34dbb0706b9102f1f49f1d0af835796 From f2b8d6d7971977db4b6bc656fa7221ed1cfeedae Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 28 Jun 2019 23:44:07 -0700 Subject: [PATCH 134/219] [submodule] update sairedis (#3099) Fix a bug in parsing kernel argument of fast-reboot --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index c350c544f34d..f50a87ff5ef5 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit c350c544f34dbb0706b9102f1f49f1d0af835796 +Subproject commit f50a87ff5ef5e3bba1541e4f18e1e100f0f3f132 From aa8fcd9924fef748faba3db095468fb82f85fa2c Mon Sep 17 00:00:00 2001 From: Shu0T1an ChenG Date: Mon, 15 Apr 2019 18:05:51 -0700 Subject: [PATCH 135/219] [broadcom]: update saibcm-modules to sdk 6.5.14 --- .../broadcom/saibcm-modules/include/ibde.h | 22 ++ .../broadcom/saibcm-modules/include/kcom.h | 14 +- .../saibcm-modules/include/soc/devids.h | 63 ++++ .../saibcm-modules/make/Makefile.linux-gto | 8 +- .../bde/linux/kernel/linux-kernel-bde.c | 278 +++++++++++++----- .../bde/linux/user/kernel/linux-user-bde.c | 190 +++++++++++- .../bde/linux/user/kernel/linux-user-bde.h | 6 +- .../systems/bde/shared/shbde_iproc.c | 37 ++- .../linux/kernel/modules/bcm-knet/bcm-knet.c | 185 ++++++++---- .../linux/kernel/modules/include/lkm.h | 3 + 10 files changed, 635 insertions(+), 171 deletions(-) diff --git a/platform/broadcom/saibcm-modules/include/ibde.h b/platform/broadcom/saibcm-modules/include/ibde.h index bfc05e330e03..9c8956f5e3e0 100644 --- a/platform/broadcom/saibcm-modules/include/ibde.h +++ b/platform/broadcom/saibcm-modules/include/ibde.h @@ -148,6 +148,28 @@ typedef struct ibde_s { */ int (*get_cmic_ver)(int d, uint32 *ver); + /* + * Probe available devices. + * Return value : + * 0: success to probe available devices + * -1: error happens during probe + */ + int (*probe)(void); + + /* + * I2C operations on the Device, assuming it is connected by I2C to the CPU. + */ + /* Read from the internal device Address space using I2C */ + int (*i2c_device_read)( + int dev, /* The device ID to access */ + uint32 addr, /* The address to access in the internal device address space */ + uint32 *value);/* the value to be read. */ + /* Write to the internal device Address space using I2C */ + int (*i2c_device_write)( + int dev, /* The device ID to access */ + uint32 addr, /* The address to access in the internal device address space */ + uint32 value); /* the value to be written. */ + } ibde_t; diff --git a/platform/broadcom/saibcm-modules/include/kcom.h b/platform/broadcom/saibcm-modules/include/kcom.h index f66e382e4d8f..76f3e47a8de5 100644 --- a/platform/broadcom/saibcm-modules/include/kcom.h +++ b/platform/broadcom/saibcm-modules/include/kcom.h @@ -46,6 +46,7 @@ #define KCOM_M_HW_INIT 4 /* H/W initialized */ #define KCOM_M_ETH_HW_CONFIG 5 /* ETH HW config*/ #define KCOM_M_DETACH 6 /* Detach kernel module */ +#define KCOM_M_REPROBE 7 /* Reprobe device */ #define KCOM_M_NETIF_CREATE 11 /* Create network interface */ #define KCOM_M_NETIF_DESTROY 12 /* Destroy network interface */ #define KCOM_M_NETIF_LIST 13 /* Get list of network interface IDs */ @@ -59,7 +60,7 @@ #define KCOM_M_DBGPKT_GET 42 /* Get debug packet function info */ #define KCOM_M_WB_CLEANUP 51 /* Clean up for warmbooting */ -#define KCOM_VERSION 9 /* Protocol version */ +#define KCOM_VERSION 10 /* Protocol version */ /* * Message status codes @@ -305,7 +306,7 @@ typedef struct kcom_eth_hw_config_s { uint8 chan; uint32 flags; uint32 value; - } kcom_eth_hw_config_t; +} kcom_eth_hw_config_t; /* * Message types @@ -379,6 +380,14 @@ typedef struct kcom_msg_detach_s { uint32 flags; } kcom_msg_detach_t; +/* + * Reprobe switch device. + */ +typedef struct kcom_msg_reprobe_s { + kcom_msg_hdr_t hdr; + uint32 flags; +} kcom_msg_reprobe_t; + /* * Enable/Disable debugging packet function. */ @@ -498,6 +507,7 @@ typedef union kcom_msg_s { kcom_msg_hw_init_t hw_init; kcom_msg_eth_hw_config_t eth_hw_config; kcom_msg_detach_t detach; + kcom_msg_reprobe_t reprobe; kcom_msg_netif_create_t netif_create; kcom_msg_netif_destroy_t netif_destroy; kcom_msg_netif_list_t netif_list; diff --git a/platform/broadcom/saibcm-modules/include/soc/devids.h b/platform/broadcom/saibcm-modules/include/soc/devids.h index c1b350f217a5..cb072a78cbd7 100644 --- a/platform/broadcom/saibcm-modules/include/soc/devids.h +++ b/platform/broadcom/saibcm-modules/include/soc/devids.h @@ -1238,6 +1238,15 @@ #define BCM56980_DEVICE_ID 0xb980 #define BCM56980_A0_REV_ID 1 +#define BCM56980_B0_REV_ID 0x11 +#define BCM56981_DEVICE_ID 0xb981 +#define BCM56981_A0_REV_ID 1 +#define BCM56982_DEVICE_ID 0xb982 +#define BCM56982_A0_REV_ID 1 +#define BCM56983_DEVICE_ID 0xb983 +#define BCM56983_A0_REV_ID 1 +#define BCM56984_DEVICE_ID 0xb984 +#define BCM56984_A0_REV_ID 1 #define BCM56968_DEVICE_ID 0xb968 #define BCM56968_A0_REV_ID 1 @@ -1289,15 +1298,20 @@ #define BCM56670_DEVICE_ID 0xb670 #define BCM56670_A0_REV_ID 1 +#define BCM56670_B0_REV_ID 0x11 #define BCM56671_DEVICE_ID 0xb671 #define BCM56671_A0_REV_ID 1 +#define BCM56671_B0_REV_ID 0x11 #define BCM56672_DEVICE_ID 0xb672 #define BCM56672_A0_REV_ID 1 +#define BCM56672_B0_REV_ID 0x11 #define BCM56675_DEVICE_ID 0xb675 #define BCM56675_A0_REV_ID 1 +#define BCM56675_B0_REV_ID 0x11 + #define BCM56565_DEVICE_ID 0xb565 #define BCM56565_A0_REV_ID 1 @@ -1317,12 +1331,19 @@ #define BCM56760_DEVICE_ID 0xb760 #define BCM56760_A0_REV_ID 1 +#define BCM56760_A1_REV_ID 2 #define BCM56760_B0_REV_ID 0x11 #define BCM56761_DEVICE_ID 0xb761 #define BCM56761_A0_REV_ID 1 #define BCM56761_B0_REV_ID 0x11 +#define BCM56761_DEVICE_ID 0xb761 +#define BCM56761_A0_REV_ID 1 +#define BCM56761_A1_REV_ID 2 +#define BCM56761_B0_REV_ID 0x11 +#define BCM56761_B1_REV_ID 0x12 + #define BCM56762_DEVICE_ID 0xb762 #define BCM56762_A0_REV_ID 1 #define BCM56762_B0_REV_ID 0x11 @@ -1347,6 +1368,11 @@ #define BCM56068_A0_REV_ID 1 #define BCM56068_B0_REV_ID 0x11 +#define BCM56068_DEVICE_ID 0xb068 +#define BCM56068_A0_REV_ID 1 +#define BCM56068_B0_REV_ID 0x11 +#define BCM56068_B1_REV_ID 0x12 + #define BCM56069_DEVICE_ID 0xb069 #define BCM56069_A0_REV_ID 1 #define BCM56069_B0_REV_ID 0x11 @@ -1400,6 +1426,42 @@ #define BCM56873_DEVICE_ID 0xb873 #define BCM56873_A0_REV_ID 1 +#define BCM56370_DEVICE_ID 0xb370 +#define BCM56370_A0_REV_ID 1 + +#define BCM56371_DEVICE_ID 0xb371 +#define BCM56371_A0_REV_ID 1 + +#define BCM56372_DEVICE_ID 0xb372 +#define BCM56372_A0_REV_ID 1 + +#define BCM56374_DEVICE_ID 0xb374 +#define BCM56374_A0_REV_ID 1 + +#define BCM56375_DEVICE_ID 0xb375 +#define BCM56375_A0_REV_ID 1 + +#define BCM56376_DEVICE_ID 0xb376 +#define BCM56376_A0_REV_ID 1 + +#define BCM56377_DEVICE_ID 0xb377 +#define BCM56377_A0_REV_ID 1 + +#define BCM56577_DEVICE_ID 0xb577 +#define BCM56577_A0_REV_ID 1 + +#define BCM56578_DEVICE_ID 0xb578 +#define BCM56578_A0_REV_ID 1 + +#define BCM56579_DEVICE_ID 0xb579 +#define BCM56579_A0_REV_ID 1 + +#define BCM56770_DEVICE_ID 0xb770 +#define BCM56770_A0_REV_ID 1 + +#define BCM56771_DEVICE_ID 0xb771 +#define BCM56771_A0_REV_ID 1 + #define BCM53540_DEVICE_ID 0x8540 #define BCM53540_A0_REV_ID 1 #define BCM53547_DEVICE_ID 0x8547 @@ -1718,6 +1780,7 @@ #define DNXC_B0_REV_ID 0x0011 #define BCM88790_DEVICE_ID 0x8790 #define BCM88790_A0_REV_ID DNXC_A0_REV_ID +#define BCM88790_B0_REV_ID DNXC_B0_REV_ID #define BCM88791_DEVICE_ID 0x8791 #define BCM88792_DEVICE_ID 0x8792 #define BCM88793_DEVICE_ID 0x8793 diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto index cd5e8fbca195..947c20e74f93 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-gto +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-gto @@ -86,15 +86,19 @@ endif endif ifdef DPP_CHIPS -CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ +CFLAGS += -DDUNE_BCM -D__DUNE_LINUX_BCM_CPU_PCP_DMA__ CFGFLAGS += -DSOC_CM_FUNCTION endif ifdef DFE_CHIPS -CFLAGS += -DDUNE_BCM -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ +CFLAGS += -DDUNE_BCM CFGFLAGS += -DSOC_CM_FUNCTION endif +ifdef SAND_CHIPS +CFLAGS += -D__DUNE_GTO_BCM_CPU__ -D__DUNE_LINUX_BCM_CPU_PCIE__ +endif + ifdef SHADOW_PLX CFLAGS += -DBCM_PLX9656_LOCAL_BUS -DBDE_LINUX_NON_INTERRUPTIBLE -DSHADOW_SVK endif diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c index e26d35332cc8..1a04b2b52e9b 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c @@ -94,6 +94,8 @@ LKM_MOD_PARAM(nodevices, "i", int, 0); MODULE_PARM_DESC(nodevices, "Ignore all recognized devices (default no)"); +int msixcnt = 1; + /* * This usually is defined at /usr/include/linux/pci_ids.h * But this ID is newer. @@ -366,6 +368,12 @@ static int robo_switch = 0; #define VALID_DEVICE(_n) ((_n >= 0) && (_n < _ndevices)) +#if defined(IPROC_CMICD) && defined(CONFIG_OF) +#define ICFG_CHIP_ID_REG 0x10236000 +#define IHOST_CMICX_MAX_INTRS 128 +static uint32 iproc_cmicx_irqs[IHOST_CMICX_MAX_INTRS]; +#endif + /* CPU MMIO area used with CPU cards provided on demo boards */ #if (defined(BCM_PETRA_SUPPORT) || defined(BCM_DFE_SUPPORT) || defined(BCM_DNX_SUPPORT) || defined(BCM_DNXF_SUPPORT)) && (defined(__DUNE_WRX_BCM_CPU__) || defined(__DUNE_GTO_BCM_CPU__)) static void *cpu_address = NULL; @@ -696,9 +704,9 @@ iproc_cmicd_get_irqres(ibde_dev_t bde_dev, struct resource *res_irq) #include #include -extern void iproc_platform_driver_register(struct platform_driver *drv); +extern int iproc_platform_driver_register(struct platform_driver *drv); extern void iproc_platform_driver_unregister(struct platform_driver *drv); -extern void iproc_platform_device_register(struct platform_device *drv); +extern int iproc_platform_device_register(struct platform_device *drv); extern void iproc_platform_device_unregister(struct platform_device *drv); extern struct resource * @@ -711,13 +719,14 @@ iproc_platform_get_resource(struct platform_device *dev, unsigned int type, #define IPROC_CMICD_INT 194 #define IPROC_CMICD_COMPATIBLE "brcm,iproc-cmicd" +#define IPROC_CMICX_COMPATIBLE "brcm,iproc-cmicx" static int iproc_cmicd_probe(struct platform_device *pldev) { bde_ctrl_t *ctrl; uint32 size, dev_rev_id; - struct resource *memres, *irqres; + struct resource *memres, *irqres; #ifdef CONFIG_OF if (debug >= 1) { gprintk("iproc_cmicd_probe %s\n", pldev->dev.of_node ? "with device node":""); @@ -725,7 +734,7 @@ iproc_cmicd_probe(struct platform_device *pldev) #endif memres = iproc_platform_get_resource(pldev, IORESOURCE_MEM, 0); if (memres == NULL) { - gprintk("Unable to retrieve iProc CMIC resources"); + gprintk("Unable to retrieve iProc CMIC resources"); return -1; } size = memres->end - memres->start + 1; @@ -739,32 +748,62 @@ iproc_cmicd_probe(struct platform_device *pldev) /* Map CMIC block in the AXI memory space into CPU address space */ ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(memres->start, size); if (!ctrl->bde_dev.base_address) { - gprintk("Error mapping iProc CMIC registers"); + gprintk("Error mapping iProc CMIC registers"); return -1; } ctrl->phys_address = memres->start; - /* Read switch device ID from CMIC */ - dev_rev_id = *((uint32_t*)(ctrl->bde_dev.base_address + 0x10224)); +#ifdef CONFIG_OF + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + uint32 *icfg_chip_id; + icfg_chip_id = (uint32 *)IOREMAP(ICFG_CHIP_ID_REG, 2 * sizeof(uint32)); + if (icfg_chip_id == NULL) { + gprintk("Error mapping ICFG_CHIP_ID_REG\n"); + return -1; + } + ctrl->bde_dev.device = readl(icfg_chip_id) & 0xffff; + ctrl->bde_dev.rev = readl(icfg_chip_id+1) & 0xff; + iounmap(icfg_chip_id); + } else +#endif + { + /* Read switch device ID from CMIC */ + dev_rev_id = *((uint32 *)(ctrl->bde_dev.base_address + 0x10224)); #if defined(BCM_CMICM_SUPPORT) && defined(BE_HOST) - ctrl->bde_dev.device = ( (((dev_rev_id >> 16) & 0xff) << 8) | - ((dev_rev_id >> 24) & 0xff)); - ctrl->bde_dev.rev = (dev_rev_id >> 8) & 0xff ; + ctrl->bde_dev.device = ( (((dev_rev_id >> 16) & 0xff) << 8) | + ((dev_rev_id >> 24) & 0xff)); + ctrl->bde_dev.rev = (dev_rev_id >> 8) & 0xff ; #else - ctrl->bde_dev.device = dev_rev_id & 0xffff; - ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xff; + ctrl->bde_dev.device = dev_rev_id & 0xffff; + ctrl->bde_dev.rev = (dev_rev_id >> 16) & 0xff; #endif + } #ifdef CONFIG_OF if (!pldev->dev.of_node) #endif { /* Assign locally if not available from device node */ - iproc_cmicd_get_irqres(ctrl->bde_dev, &pldev->resource[0]); + iproc_cmicd_get_irqres(ctrl->bde_dev, &pldev->resource[0]); } - irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, 0); - ctrl->iLine = irqres->start; +#ifdef CONFIG_OF + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + int i; + for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) { + irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, i); + iproc_cmicx_irqs[i] = irqres->start; + if (debug >= 1) { + gprintk("iproc_cmicx_irqs[%d] = %d\n", i, iproc_cmicx_irqs[i]); + } + } + ctrl->iLine = iproc_cmicx_irqs[0]; + } else +#endif + { + irqres = iproc_platform_get_resource(pldev, IORESOURCE_IRQ, 0); + ctrl->iLine = irqres->start; + } ctrl->isr = NULL; ctrl ->isr_data = NULL; @@ -785,14 +824,15 @@ iproc_cmicd_remove(struct platform_device *pldev) } #ifdef CONFIG_OF static const struct of_device_id iproc_cmicd_of_match[] = { - { .compatible = "brcm,iproc-cmicd" }, + { .compatible = IPROC_CMICD_COMPATIBLE }, + { .compatible = IPROC_CMICX_COMPATIBLE }, {}, }; MODULE_DEVICE_TABLE(of, iproc_cmicd_of_match); #endif static char iproc_cmicd_string[] = "bcmiproc-cmicd"; -static struct platform_driver iproc_cmicd_driver = +static struct platform_driver iproc_cmicd_driver = { .probe = iproc_cmicd_probe, .remove = iproc_cmicd_remove, @@ -995,10 +1035,10 @@ iproc_cmicd_get_memregion(struct resource *res_mem) iounmap(erom_base); if (debug >= 1) { - gprintk("CMICD info by %s: cmicd_mem.start=%x, cmicd_mem.end=%x\n", + gprintk("CMICD info by %s: cmicd_mem.start=%lx, cmicd_mem.end=%lx\n", found_cmicd_dev ? "EROM" : "Default", - iproc_cmicd_resources[IPROC_CMICD_RES_MEM].start, - iproc_cmicd_resources[IPROC_CMICD_RES_MEM].end); + (unsigned long)iproc_cmicd_resources[IPROC_CMICD_RES_MEM].start, + (unsigned long)iproc_cmicd_resources[IPROC_CMICD_RES_MEM].end); } } #endif /* IPROC_CMICD */ @@ -1382,6 +1422,7 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM56672_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56675_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56568_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56670_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56760_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56761_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56762_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1546,8 +1587,24 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM56832_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56836_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56870_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM56980_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56370_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56371_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56372_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56374_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56375_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56376_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56377_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56577_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56578_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56579_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56873_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56770_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56771_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56980_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56981_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56982_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56983_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56984_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM53540_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM53547_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM53548_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1981,6 +2038,7 @@ _pci_msix_table_size(struct pci_dev *dev) if (nr_entries < 0) { nr_entries = 0; } + pci_disable_msix(dev); kfree(entries); } } @@ -1996,45 +2054,56 @@ _pci_msix_table_size(struct pci_dev *dev) static int _msi_connect(bde_ctrl_t *ctrl) { - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) int ret; if (ctrl->use_msi == PCI_USE_INT_MSIX) { int i; - ret = _pci_msix_table_size(ctrl->pci_device); + ret = _pci_msix_table_size(ctrl->pci_device); if (ret == 0) { /* MSI-X failed */ gprintk("MSI-X not supported.\n"); goto er_intx; } - ctrl->entries = kcalloc(ret, sizeof(struct msix_entry)*ret, GFP_KERNEL); + ctrl->entries = kcalloc(ret, sizeof(struct msix_entry), GFP_KERNEL); if (!ctrl->entries) { goto er_intx; } - /* We need only that much interrupt vecotrs */ - ctrl->msix_cnt = ret/4; + /* Only one vector is mapped by default */ + /* May be more in future, can be controlled using module param */ + ctrl->msix_cnt = msixcnt; if (unlikely(debug > 1)) gprintk("MSIX Table size = %d\n", ctrl->msix_cnt); for (i = 0; i < ctrl->msix_cnt; i++) ctrl->entries[i].entry = i; - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) + ret = pci_enable_msix_range(ctrl->pci_device, + ctrl->entries, ctrl->msix_cnt, ctrl->msix_cnt); +#else ret = pci_enable_msix(ctrl->pci_device, ctrl->entries, ctrl->msix_cnt); +#endif if (ret > 0) { /* Not enough vectors available , Retry MSI-X */ gprintk("Retrying with MSI-X interrupts = %d\n", ret); ctrl->msix_cnt = ret; + msixcnt = ret; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) + ret = pci_enable_msix_range(ctrl->pci_device, + ctrl->entries, ctrl->msix_cnt, ctrl->msix_cnt); +#else ret = pci_enable_msix(ctrl->pci_device, ctrl->entries, ctrl->msix_cnt); +#endif if (ret != 0) goto er_intx_free; } else if (ret < 0) { /* Error */ goto er_intx_free; } else { - gprintk("Enabled MSI-X interrupts = %d\n", ctrl->msix_cnt); + gprintk("Enabled MSI-X interrupts = %d\n", ctrl->msix_cnt); + return 0; } } #endif @@ -2049,7 +2118,7 @@ _msi_connect(bde_ctrl_t *ctrl) } } else { /* failed */ - gprintk("Not MSI/MSIC interrupt.\n"); + gprintk("Not MSI/MSIX interrupt.\n"); goto er_intx; } return 0; @@ -2068,9 +2137,12 @@ _msi_disconnect(bde_ctrl_t *ctrl) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi == PCI_USE_INT_MSIX) { - pci_disable_msix(ctrl->pci_device); - kfree(ctrl->entries); - ctrl->msix_cnt = 0; + if (ctrl->msix_cnt) { + pci_disable_msix(ctrl->pci_device); + kfree(ctrl->entries); + ctrl->entries = NULL; + ctrl->msix_cnt = 0; + } } #endif if (ctrl->use_msi == PCI_USE_INT_MSI) { @@ -2085,16 +2157,30 @@ _msi_disconnect(bde_ctrl_t *ctrl) static void -config_pci_intr_type(bde_ctrl_t *ctrl) +config_pci_intr_type(struct pci_dev *dev, bde_ctrl_t *ctrl, int iproc) { - #ifdef CONFIG_PCI_MSI int ret; + shbde_iproc_config_t icfg; + /* Each device follows global policy by default */ ctrl->use_msi = use_msi; + if (unlikely(debug > 1)) gprintk("%s: msi = %d\n", __func__, ctrl->use_msi); + /* Check IPROC version for MSIX support */ + if (iproc && ctrl->bde_dev.base_address1 && + (ctrl->use_msi == PCI_USE_INT_MSIX)) { + if (shbde_pci_iproc_version_get(&ctrl->shbde, dev, &icfg.iproc_ver, + &icfg.cmic_ver, &icfg.cmic_rev)) { + if (icfg.iproc_ver < 0xe) { + gprintk("%s: MSI-X not supported, using MSI.\n", __func__); + ctrl->use_msi = PCI_USE_INT_MSI; + } + } + } + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi == PCI_USE_INT_MSIX) { /* check for support MSIX vector */ @@ -2108,10 +2194,10 @@ config_pci_intr_type(bde_ctrl_t *ctrl) if (ctrl->use_msi == PCI_USE_INT_MSI) { /* check for support MSI vector */ - ret = pci_enable_msi(ctrl->pci_device); + ret = pci_enable_msi(ctrl->pci_device); if (ret < 0) { ctrl->use_msi = PCI_USE_INT_INTX; - gprintk("%s: Failed to enable MSI\n", __func__); + gprintk("%s: Failed to enable MSI, using INTx.\n", __func__); } else { pci_disable_msi(ctrl->pci_device); } @@ -2268,7 +2354,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) return 0; } if (_switch_ndevices >= LINUX_BDE_MAX_SWITCH_DEVICES) { - return 0;; + return 0; } if (rescan) { @@ -2550,22 +2636,8 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) } } - /* Each device follows global policy by default */ - ctrl->use_msi = use_msi; - - /* Check is MSI is properly supported in kernel for this device */ - if (ctrl->use_msi) { - if (pci_enable_msi(ctrl->pci_device) == 0) { - /* Release MSI resources until interrupt_connect is called */ - pci_disable_msi(ctrl->pci_device); - } else { - gprintk("Could not enable MSI interrupts\n"); - ctrl->use_msi = 0; - } - } - /* configure interrupt type */ - config_pci_intr_type(ctrl); + config_pci_intr_type(dev, ctrl, iproc); /* Configure iProc PCI-AXI bridge */ if (iproc && ctrl->bde_dev.base_address1) { @@ -2580,7 +2652,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) &icfg->cmic_ver, &icfg->cmic_rev); shbde_iproc_config_init(icfg, ctrl->bde_dev.device, ctrl->bde_dev.rev); - if (debug >=2) { + if (debug >= 2) { gprintk("iproc version = %x dma_hi_bits = %x\n", icfg->iproc_ver, icfg->dma_hi_bits); } icfg->use_msi = ctrl->use_msi; @@ -2734,22 +2806,22 @@ _pci_remove(struct pci_dev* dev) if (ctrl->use_msi >= PCI_USE_INT_MSIX) { int i; for (i = 0; i < ctrl->msix_cnt; i++) - free_irq(ctrl->entries[i].vector, ctrl->pci_device); + free_irq(ctrl->entries[i].vector, ctrl); } else #endif { - free_irq(ctrl->iLine, ctrl); + free_irq(ctrl->iLine, ctrl); } } #ifdef CONFIG_PCI_MSI _msi_disconnect(ctrl); #endif - ctrl->isr = NULL; - ctrl->isr_data = NULL; - ctrl->isr2 = NULL; - ctrl->isr2_data = NULL; - } + ctrl->isr = NULL; + ctrl->isr_data = NULL; + ctrl->isr2 = NULL; + ctrl->isr2_data = NULL; +} static struct pci_driver _device_driver = { probe: _pci_probe, @@ -3641,8 +3713,12 @@ _gmac_dev_create(void) static int _init(void) { - #ifdef IPROC_CMICD +#ifdef CONFIG_OF + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + iproc_platform_driver_register(&iproc_cmicd_driver); + } else +#endif if (iproc_has_cmicd()) { iproc_cmicd_get_memregion(&iproc_cmicd_resources[IPROC_CMICD_RES_MEM]); iproc_platform_driver_register(&iproc_cmicd_driver); @@ -3651,8 +3727,8 @@ _init(void) #endif { /* Register platform device if no device node in dtb */ - iproc_platform_device_register(&iproc_cmicd_pdev); - } + iproc_platform_device_register(&iproc_cmicd_pdev); + } } #endif /* IPROC_CMICD */ @@ -3662,7 +3738,7 @@ _init(void) /* Register our goodies */ _device_driver.name = LINUX_KERNEL_BDE_NAME; -#if defined(BCM_ROBO_SUPPORT) +#if defined(BCM_ROBO_SUPPORT) #if defined(IPROC_CMICD) if (_gmac_dev_create()) { return -ENODEV; @@ -3771,6 +3847,11 @@ _cleanup(void) _dma_cleanup(); #ifdef IPROC_CMICD +#ifdef CONFIG_OF + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + iproc_platform_driver_unregister(&iproc_cmicd_driver); + } else +#endif if (iproc_has_cmicd()) { #ifdef CONFIG_OF if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE)) @@ -4251,14 +4332,18 @@ _interrupt_connect(int d, if (ctrl->use_msi == PCI_USE_INT_MSIX) { int i; for (i = 0; i < ctrl->msix_cnt; i++) { - ret = request_irq(ctrl->entries[i].vector, _isr, - irq_flags, LINUX_KERNEL_BDE_NAME, ctrl); + if (unlikely(debug >= 1)) { + gprintk("%s(%d):device# = %d, irq = %d\n", + __func__, __LINE__, d, ctrl->entries[i].vector); + } + ret = request_irq(ctrl->entries[i].vector, _isr, 0, + LINUX_KERNEL_BDE_NAME, ctrl); if (ret < 0) break; } if (ret < 0) { while (i >= 0) - free_irq(ctrl->entries[i--].vector, ctrl->pci_device); + free_irq(ctrl->entries[i--].vector, ctrl); goto err_disable_msi; } @@ -4266,15 +4351,39 @@ _interrupt_connect(int d, else #endif { - ret = request_irq(ctrl->iLine, _isr, irq_flags, +#if defined(IPROC_CMICD) && defined(CONFIG_OF) + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + int i, j; + for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) { + if (unlikely(debug >= 1)) + gprintk("%s(%d):device# = %d, request_irq(%d)\n", + __func__, __LINE__, d, iproc_cmicx_irqs[i]); + ret = request_irq(iproc_cmicx_irqs[i], _isr, + irq_flags, LINUX_KERNEL_BDE_NAME, ctrl); + if (ret < 0) { + gprintk("request_irq(%d) failed(%d)\n", iproc_cmicx_irqs[i], ret); + break; + } + } + if (ret < 0) { + for (j = 0; j < i; j++) { + free_irq(iproc_cmicx_irqs[j], ctrl); + } + goto err_disable_msi; + } + } else +#endif + { + ret = request_irq(ctrl->iLine, _isr, irq_flags, LINUX_KERNEL_BDE_NAME, ctrl); - if (ret < 0) - goto err_disable_msi; + if (ret < 0) + goto err_disable_msi; - if (unlikely(debug >= 1)) - gprintk("%s(%d):device# = %d, irq_flags = %lu, irq = %d\n", + if (unlikely(debug >= 1)) + gprintk("%s(%d):device# = %d, irq_flags = %lu, irq = %d\n", __func__, __LINE__, d, irq_flags, ctrl->pci_device ? ctrl->pci_device->irq : ctrl->iLine); + } } } return 0; @@ -4292,7 +4401,7 @@ _interrupt_connect(int d, ctrl->isr2_data = NULL; return -1; - } +} static int _interrupt_disconnect(int d) @@ -4353,13 +4462,30 @@ _interrupt_disconnect(int d) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi >= PCI_USE_INT_MSIX) { int i; - for (i = 0; i < ctrl->msix_cnt; i++) - free_irq(ctrl->entries[i].vector, ctrl->pci_device); + for (i = 0; i < ctrl->msix_cnt; i++) { + if (unlikely(debug > 1)) { + gprintk("%s(%d):device# = %d, irq = %d\n", + __func__, __LINE__, d, ctrl->entries[i].vector); + } + free_irq(ctrl->entries[i].vector, ctrl); + } } else +#endif +#if defined(IPROC_CMICD) && defined(CONFIG_OF) + if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { + int i; + for (i = 0; i < IHOST_CMICX_MAX_INTRS; i++) { + if (unlikely(debug > 1)) { + gprintk("%s(%d):device# = %d, free_irq(%d)\n", + __func__, __LINE__, d, iproc_cmicx_irqs[i]); + } + free_irq(iproc_cmicx_irqs[i], ctrl); + } + } else #endif { - free_irq(ctrl->iLine, ctrl); + free_irq(ctrl->iLine, ctrl); } #ifdef CONFIG_PCI_MSI if (ctrl->use_msi >= PCI_USE_INT_MSI) { diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c index 7fc9fd166bbd..6c7c9bb95056 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c @@ -30,6 +30,9 @@ #include "linux-user-bde.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) +#include +#endif #ifdef KEYSTONE #include #endif @@ -75,21 +78,56 @@ MODULE_LICENSE("GPL"); /* CMICX defines */ #define INTC_INTR_REG_NUM (8) -#define INTC_INTR_ENABLE_REG0 (0x180130f0) -#define INTC_INTR_STATUS_REG0 (0x18013190) -#define INTC_INTR_RAW_STATUS_REG0 (0x18013140) +/* +TODO:HX5 +The INTR base address values are changed for HX5, +hence making new #defines so runtime decisions can +be made. +*/ + +#define INTC_INTR_ENABLE_REG0 (0x180130f0) +#define INTC_INTR_STATUS_REG0 (0x18013190) +#define INTC_INTR_RAW_STATUS_REG0 (0x18013140) #define INTC_INTR_ENABLE_BASE (INTC_INTR_ENABLE_REG0) #define INTC_INTR_STATUS_BASE (INTC_INTR_STATUS_REG0) #define INTC_INTR_RAW_STATUS_BASE (INTC_INTR_RAW_STATUS_REG0) -#define INTC_PDMA_INTR_REG_IND 4 +#define HX5_INTC_INTR_ENABLE_REG0 (0x102310f0) +#define HX5_INTC_INTR_STATUS_REG0 (0x10231190) +#define HX5_INTC_INTR_RAW_STATUS_REG0 (0x10231140) + +#define HX5_INTC_INTR_ENABLE_BASE (HX5_INTC_INTR_ENABLE_REG0) +#define HX5_INTC_INTR_STATUS_BASE (HX5_INTC_INTR_STATUS_REG0) +#define HX5_INTC_INTR_RAW_STATUS_BASE (HX5_INTC_INTR_RAW_STATUS_REG0) + +#define IOREMAP(addr, size) ioremap_nocache(addr, size) + +#define HX5_IHOST_GICD_ISENABLERN_0 (0x10781100) +#define HX5_IHOST_GICD_ISENABLERN_1 (0x10781104) +#define HX5_IHOST_GICD_ICENABLERN_1 (0x10781184) +#define HX5_IHOST_GICD_ICENABLERN_8 (0x107811a0) +/* Offset between ISENABLERN_1 and ICENABLERN_1 in 4-bytes */ +#define HX5_IHOST_IRQ_MASK_OFFSET 0x20 +#define HX5_IHOST_INTR_MAP_NUM (HX5_IHOST_GICD_ICENABLERN_8 - HX5_IHOST_GICD_ISENABLERN_0) +#define HX5_IHOST_INTR_STATUS_MAP_NUM (INTC_INTR_REG_NUM * (sizeof(uint32))) +#define IRQ_BIT(intr) (intr % (sizeof(uint32)*8)) +#define IRQ_MASK_INDEX(intr) (intr / (sizeof(uint32)*8)) +#define HX5_CHIP_INTR_LOW_PRIORITY 119 +#define INTR_LOW_PRIORITY_BITPOS (1 << IRQ_BIT(HX5_CHIP_INTR_LOW_PRIORITY)) +#define INTC_LOW_PRIORITY_INTR_REG_IND IRQ_MASK_INDEX(HX5_CHIP_INTR_LOW_PRIORITY) +#define INTC_PDMA_INTR_REG_IND 4 #define READ_INTC_INTR(d, reg, v) \ - (v = user_bde->iproc_read(d, reg)) + (v = user_bde->iproc_read(d, reg)) #define WRITE_INTC_INTR(d, reg, v) \ (user_bde->iproc_write(d, reg, v)) +#define IHOST_READ_INTR(d, reg, v) \ + (v = readl((reg))) +#define IHOST_WRITE_INTR(d, reg, v) \ + (writel((v), (reg))) + /* Allow override of default CMICm CMC */ #ifndef BDE_CMICM_PCIE_CMC #define BDE_CMICM_PCIE_CMC 0 @@ -103,6 +141,9 @@ MODULE_LICENSE("GPL"); /* Defines used to distinguish CMICe from CMICm */ #define CMICE_DEV_REV_ID (0x178 / sizeof(uint32)) +static uint32 *ihost_intr_status_base = NULL; +static uint32 *ihost_intr_enable_base = NULL; + static ibde_t *user_bde = NULL; typedef void (*isr_f)(void *); @@ -225,27 +266,68 @@ _cmicx_interrupt(bde_ctrl_t *ctrl) int d, ind; uint32 stat, iena, mask, fmask; bde_inst_resource_t *res; + uint32 intc_intr_status_base = 0, intc_intr_enable_base = 0; d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); res = &_bde_inst_resource[ctrl->inst]; lkbde_irq_mask_get(d, &mask, &fmask); + if ((ctrl->dev_type & BDE_SWITCH_DEV_TYPE) && + ((user_bde->get_dev(d)->device == BCM56370_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56371_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56372_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56374_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56375_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56376_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56377_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56577_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56578_DEVICE_ID) || + (user_bde->get_dev(d)->device == BCM56579_DEVICE_ID))) { + intc_intr_status_base = HX5_INTC_INTR_STATUS_BASE; + intc_intr_enable_base = HX5_INTC_INTR_ENABLE_BASE; + } else { + intc_intr_status_base = INTC_INTR_STATUS_BASE; + intc_intr_enable_base = INTC_INTR_ENABLE_BASE; + } if (fmask) { - READ_INTC_INTR(d, INTC_INTR_STATUS_BASE + 4 * INTC_PDMA_INTR_REG_IND, stat); - READ_INTC_INTR(d, INTC_INTR_ENABLE_BASE + 4 * INTC_PDMA_INTR_REG_IND, iena); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + IHOST_READ_INTR(d, ihost_intr_status_base + INTC_PDMA_INTR_REG_IND, stat); + IHOST_READ_INTR(d, ihost_intr_enable_base + INTC_PDMA_INTR_REG_IND, iena); + } else { + READ_INTC_INTR(d, intc_intr_status_base + 4 * INTC_PDMA_INTR_REG_IND, stat); + READ_INTC_INTR(d, intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, iena); + } if (stat & iena) { - WRITE_INTC_INTR(d, INTC_INTR_ENABLE_BASE + 4 * INTC_PDMA_INTR_REG_IND, 0); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_PDMA_INTR_REG_IND + + HX5_IHOST_IRQ_MASK_OFFSET, ~0); + } else { + WRITE_INTC_INTR(d, intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, 0); + } + for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { if (ind == INTC_PDMA_INTR_REG_IND) { continue; } - READ_INTC_INTR(d, INTC_INTR_STATUS_BASE + 4 * ind, stat); - READ_INTC_INTR(d, INTC_INTR_ENABLE_BASE + 4 * ind, iena); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + if (ind < INTC_LOW_PRIORITY_INTR_REG_IND) { + continue; + } + IHOST_READ_INTR(d, ihost_intr_status_base + ind, stat); + IHOST_READ_INTR(d, ihost_intr_enable_base + ind, iena); + if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) { + stat &= INTR_LOW_PRIORITY_BITPOS; + } + } else { + READ_INTC_INTR(d, intc_intr_status_base + 4 * ind, stat); + READ_INTC_INTR(d, intc_intr_enable_base + 4 * ind, iena); + } if (stat & iena) { break; } } + if (ind >= INTC_INTR_REG_NUM) { return; } @@ -260,7 +342,20 @@ _cmicx_interrupt(bde_ctrl_t *ctrl) if (fmask && ind == INTC_PDMA_INTR_REG_IND) { continue; } - WRITE_INTC_INTR(d, INTC_INTR_ENABLE_BASE + 4 * ind, 0); + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + if (ind < INTC_LOW_PRIORITY_INTR_REG_IND) { + continue; + } + if (ind == INTC_LOW_PRIORITY_INTR_REG_IND) { + IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_LOW_PRIORITY_INTR_REG_IND + + HX5_IHOST_IRQ_MASK_OFFSET, INTR_LOW_PRIORITY_BITPOS); + } else { + IHOST_WRITE_INTR(d, ihost_intr_enable_base + ind + + HX5_IHOST_IRQ_MASK_OFFSET, ~0); + } + } else { + WRITE_INTC_INTR(d, intc_intr_enable_base + 4*ind, 0); + } } /* Notify */ @@ -750,6 +845,12 @@ _devices_init(int d) uint32 ver; uint16 device_id_mask = 0xFFF0; uint16 device_id; + int state = 0; + + (void)lkbde_dev_state_get(d, &state); + if (state == BDE_DEV_STATE_REMOVED) { + return; + } ctrl = &_devices[d]; /* Initialize our control info */ @@ -849,6 +950,31 @@ _devices_init(int d) case BCM88952_DEVICE_ID: ctrl->isr = (isr_f)_cmicd_cmc0_interrupt; break; + case BCM88790_DEVICE_ID: + ctrl->isr = (isr_f)_cmicx_interrupt; + break; + case BCM56370_DEVICE_ID: + case BCM56371_DEVICE_ID: + case BCM56372_DEVICE_ID: + case BCM56374_DEVICE_ID: + case BCM56375_DEVICE_ID: + case BCM56376_DEVICE_ID: + case BCM56377_DEVICE_ID: + case BCM56577_DEVICE_ID: + case BCM56578_DEVICE_ID: + case BCM56579_DEVICE_ID: + ctrl->isr = (isr_f)_cmicx_interrupt; + if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { + if (!ihost_intr_enable_base) { + ihost_intr_enable_base = (uint32_t *)IOREMAP(HX5_IHOST_GICD_ISENABLERN_1, + HX5_IHOST_INTR_MAP_NUM); + } + if (!ihost_intr_status_base) { + ihost_intr_status_base = (uint32_t *)IOREMAP(HX5_INTC_INTR_RAW_STATUS_REG0, + HX5_IHOST_INTR_STATUS_MAP_NUM); + } + } + break; default: /* Get CMIC version */ if (user_bde->get_cmic_ver(d, &ver) != 0) { @@ -876,7 +1002,7 @@ _devices_init(int d) } break; } - /*All Ramon devices from 0x8790 to 0x879F*/ + /* All Ramon devices from 0x8790 to 0x879F */ if ((user_bde->get_dev(d)->device & BCM88790_DEVICE_ID) == BCM88790_DEVICE_ID) { ctrl->isr = (isr_f)_cmicx_interrupt; } @@ -928,10 +1054,14 @@ _init(void) init_waitqueue_head(&res->intr_wq); atomic_set(&res->intr, 0); + ihost_intr_enable_base = NULL; + ihost_intr_status_base = NULL; + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { res->inst_id |= (1 << i); _devices_init(i); } + return 0; } @@ -961,6 +1091,16 @@ _cleanup(void) linux_bde_destroy(user_bde); user_bde = NULL; } + + if (ihost_intr_enable_base) { + iounmap(ihost_intr_enable_base); + ihost_intr_enable_base = NULL; + } + if (ihost_intr_status_base) { + iounmap(ihost_intr_status_base); + ihost_intr_status_base = NULL; + } + return 0; } @@ -1088,6 +1228,7 @@ static int _device_reprobe(void) { int i; + for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { if (_devices[i].devid == 0) { _devices_init(i); @@ -1167,7 +1308,8 @@ _ioctl(unsigned int cmd, unsigned long arg) ssize_t size; const ibde_dev_t *bde_dev; int inst_id; - bde_inst_resource_t *res; + bde_inst_resource_t *res; + uint32_t *mapaddr; if (copy_from_user(&io, (void *)arg, sizeof(io))) { return -EFAULT; @@ -1396,9 +1538,22 @@ _ioctl(unsigned int cmd, unsigned long arg) } break; case LUBDE_IPROC_READ_REG: - io.d1 = user_bde->iproc_read(io.dev, io.d0); - if (io.d1 == -1) { - io.rc = LUBDE_FAIL; + if (!VALID_DEVICE(io.dev)) { + return -EINVAL; + } + if (_devices[io.dev].dev_type & BDE_AXI_DEV_TYPE) { + mapaddr = IOREMAP(io.d0, sizeof(uint32_t)); + if (mapaddr == NULL) { + io.rc = LUBDE_FAIL; + return -1; + } + io.d1 = readl(mapaddr); + iounmap(mapaddr); + } else { + io.d1 = user_bde->iproc_read(io.dev, io.d0); + if (io.d1 == -1) { + io.rc = LUBDE_FAIL; + } } break; case LUBDE_IPROC_WRITE_REG: @@ -1412,6 +1567,9 @@ _ioctl(unsigned int cmd, unsigned long arg) case LUBDE_GET_DEVICE_STATE: io.rc = lkbde_dev_state_get(io.dev, &io.d0); break; + case LUBDE_REPROBE: + io.rc = _device_reprobe(); + break; default: gprintk("Error: Invalid ioctl (%08x)\n", cmd); io.rc = LUBDE_FAIL; diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h index 621973b7a7f5..535ccac9fad9 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.h @@ -81,6 +81,7 @@ typedef struct { #define LUBDE_IPROC_WRITE_REG _IO(LUBDE_MAGIC, 28) #define LUBDE_ATTACH_INSTANCE _IO(LUBDE_MAGIC, 29) #define LUBDE_GET_DEVICE_STATE _IO(LUBDE_MAGIC, 30) +#define LUBDE_REPROBE _IO(LUBDE_MAGIC, 31) #define LUBDE_SEM_OP_CREATE 1 #define LUBDE_SEM_OP_DESTROY 2 @@ -93,9 +94,10 @@ typedef struct { /* * Version history - * 1:add LUBDE_GET_DEVICE_STATE to support PCI hot plug + * 1: add LUBDE_GET_DEVICE_STATE to support PCI hot plug + * 2: add LUBDE_REPROBE to support reprobe available devices */ -#define KBDE_VERSION 1 +#define KBDE_VERSION 2 /* This is the signal that will be used diff --git a/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c index d1e95725c5f7..e1bdcc4db0da 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c +++ b/platform/broadcom/saibcm-modules/systems/bde/shared/shbde_iproc.c @@ -40,6 +40,8 @@ #define BAR0_PAXB_OARR_2_UPPER 0x2d64 #define BAR0_DMU_PCU_PCIE_SLAVE_RESET_MODE 0x7024 +#define PAXB_0_FUNC0_IMAP1_3 0x2d88 + /* Force byte pointer for offset adjustments */ #define ROFFS(_ptr, _offset) ((unsigned char*)(_ptr) + (_offset)) @@ -47,6 +49,7 @@ #define PAXB_CONFIG_IND_ADDRr_PROTOCOL_LAYERf_MASK 0x3 #define PAXB_CONFIG_IND_ADDRr_ADDRESSf_SHFT 0 #define PAXB_CONFIG_IND_ADDRr_ADDRESSf_MASK 0x7ff +#define PAXB_0_FUNC0_IMAP1_3_ADDR_SHIFT 20 /* Register value set/get by field */ #define REG_FIELD_SET(_r, _f, _r_val, _f_val) \ @@ -273,17 +276,25 @@ shbde_iproc_paxb_init(shbde_hal_t *shbde, void *iproc_regs, reg = ROFFS(iproc_regs, BAR0_PAXB_PCIE_EP_AXI_CONFIG); iproc32_write(shbde, reg, 0x0); if(icfg->cmic_ver < 4) { /* Non-CMICX */ - reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2); - iproc32_write(shbde, reg, 0x1); - reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2_UPPER); - iproc32_write(shbde, reg, icfg->dma_hi_bits); - - /* Configure MSI interrupt page */ - if (icfg->use_msi) { - reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_FUNC0_MSI_PAGE); - data = iproc32_read(shbde, reg); - iproc32_write(shbde, reg, data | 0x1); + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2); + iproc32_write(shbde, reg, 0x1); + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_2_UPPER); + iproc32_write(shbde, reg, icfg->dma_hi_bits); + /* Configure MSI interrupt page */ + if (icfg->use_msi) { + reg = ROFFS(iproc_regs, BAR0_PAXB_OARR_FUNC0_MSI_PAGE); + data = iproc32_read(shbde, reg); + iproc32_write(shbde, reg, data | 0x1); + } } + /* Configure MSIX interrupt page, only need for iproc ver == 0x10 */ + if ((icfg->use_msi == 2) && (icfg->iproc_ver == 0x10)) { + unsigned int mask = (0x1 << PAXB_0_FUNC0_IMAP1_3_ADDR_SHIFT) - 1; + reg = ROFFS(iproc_regs, PAXB_0_FUNC0_IMAP1_3); + data = iproc32_read(shbde, reg); + data &= mask; + data |= 0x410 << PAXB_0_FUNC0_IMAP1_3_ADDR_SHIFT; + iproc32_write(shbde, reg, data); } return pci_num; } @@ -315,7 +326,8 @@ shbde_iproc_pci_read(shbde_hal_t *shbde, void *iproc_regs, /* Sub-window size is 0x1000 (4K) */ subwin_base = (addr & ~0xfff); - if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) { + if((icfg->cmic_ver >= 4) && + ((subwin_base == 0x10231000) || (subwin_base == 0x18013000))) { /* Route the INTC block access through IMAP0_6 */ reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff)); } else { @@ -361,7 +373,8 @@ shbde_iproc_pci_write(shbde_hal_t *shbde, void *iproc_regs, /* Sub-window size is 0x1000 (4K) */ subwin_base = (addr & ~0xfff); - if((icfg->cmic_ver >= 4) && (subwin_base == 0x18013000)) { + if((icfg->cmic_ver >= 4) && + ((subwin_base == 0x10231000) || (subwin_base == 0x18013000))) { /* Route the INTC block access through IMAP0_6 */ reg = ROFFS(iproc_regs, 0x6000 + (addr & 0xfff)); } else { diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c index 801f5d3e406c..6767090ec7bb 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c @@ -301,6 +301,13 @@ static int use_proxy = 0; #endif /* Compatibility */ + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)) +#define NETDEV_UPDATE_TRANS_START_TIME(dev) dev->trans_start = jiffies +#else +#define NETDEV_UPDATE_TRANS_START_TIME(dev) netif_trans_update(dev) +#endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) #define skb_copy_to_linear_data(_skb, _pkt, _len) \ eth_copy_and_sum(_skb, _pkt, _len, 0) @@ -505,6 +512,7 @@ typedef struct bkn_switch_info_s { uint32_t rcpu_sig; /* RCPU signature */ uint64_t halt_addr[NUM_DMA_CHAN]; /* DMA halt address */ uint32_t cdma_channels; /* Active channels for Continuous DMA mode */ + uint32_t poll_channels; /* Channels for polling */ uint32_t inst_id; /* Instance id of this device */ int evt_idx; /* Event queue index for this device*/ int basedev_suspended; /* Base device suspended */ @@ -536,7 +544,6 @@ typedef struct bkn_switch_info_s { int dirty; /* Index of next Rx DCB to complete */ int running; /* Rx DMA is active */ int api_active; /* BCM Rx API is active */ - int api_wait; /* Wait BCM Rx API resources */ int chain_complete; /* All DCBs in chain processed */ int sync_err; /* Chain done with incomplete DCBs (debug) */ int sync_retry; /* Total retry times for sync error (debug) */ @@ -684,7 +691,7 @@ typedef struct bkn_pkt_dnx_s { #endif /* defined(CMIC_SOFT_BYTE_SWAP) */ -#define MEMORY_BARRIER mb() +#define MEMORY_BARRIER smp_mb() /* Default random MAC address has Broadcom OUI with local admin bit set */ static u8 bkn_dev_mac[6] = { 0x02, 0x10, 0x18, 0x00, 0x00, 0x00 }; @@ -1753,7 +1760,6 @@ bkn_clean_rx_dcbs(bkn_switch_info_t *sinfo, int chan) } sinfo->rx[chan].running = 0; sinfo->rx[chan].api_active = 0; - sinfo->rx[chan].api_wait = 0; DBG_DCB_RX(("Cleaned Rx%d DCBs (%d %d).\n", chan, sinfo->rx[chan].cur, sinfo->rx[chan].dirty)); } @@ -1959,7 +1965,7 @@ bkn_api_rx_restart(bkn_switch_info_t *sinfo, int chan) sinfo->rx[chan].chain_complete = 0; start_dma = 1; if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && - sinfo->rx[chan].api_wait) { + sinfo->rx[chan].api_active) { /* HW is running already, so we just move to the next chain */ start_dma = 0; } @@ -1972,7 +1978,6 @@ bkn_api_rx_restart(bkn_switch_info_t *sinfo, int chan) dev_dma_chan_clear(sinfo, XGS_DMA_RX_CHAN + chan); dev_irq_mask_enable(sinfo, XGS_DMA_RX_CHAN + chan, 1); dev_dma_chan_start(sinfo, XGS_DMA_RX_CHAN + chan, dcb_chain->dcb_dma); - sinfo->rx[chan].api_wait = 1; } list_del(&dcb_chain->list); @@ -1992,10 +1997,6 @@ bkn_api_rx_chain_done(bkn_switch_info_t *sinfo, int chan) sinfo->rx[chan].api_dcb_chain = NULL; } bkn_api_rx_restart(sinfo, chan); - if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan) && - sinfo->rx[chan].api_dcb_chain == NULL) { - sinfo->rx[chan].api_active = 0; - } } static int @@ -2053,6 +2054,7 @@ bkn_api_rx_copy_from_skb(bkn_switch_info_t *sinfo, } } dcb[sinfo->dcb_wsize-1] = dcb_stat | SOC_DCB_KNET_DONE; + MEMORY_BARRIER; dcb_chain->dcb_cur++; @@ -2062,6 +2064,7 @@ bkn_api_rx_copy_from_skb(bkn_switch_info_t *sinfo, (sinfo->cmic_type != 'x' && dcb[1] & (1 << 18))) { /* Get the next chain if reload done */ dcb[sinfo->dcb_wsize-1] |= 1 << 31 | SOC_DCB_KNET_DONE; + MEMORY_BARRIER; bkn_api_rx_chain_done(sinfo, chan); dcb_chain = sinfo->rx[chan].api_dcb_chain; if (dcb_chain == NULL) { @@ -2090,7 +2093,7 @@ bkn_rx_refill(bkn_switch_info_t *sinfo, int chan) struct sk_buff *skb; bkn_desc_info_t *desc; uint32_t *dcb; - uint32_t encap_size = sinfo->cmic_type == 'x' ? RCPU_HDR_SIZE : RCPU_RX_ENCAP_SIZE; + uint32_t resv_size = sinfo->cmic_type == 'x' ? RCPU_HDR_SIZE : RCPU_RX_ENCAP_SIZE; int prev; if (sinfo->rx[chan].use_rx_skb == 0) { @@ -2107,11 +2110,11 @@ bkn_rx_refill(bkn_switch_info_t *sinfo, int chan) while (sinfo->rx[chan].free < MAX_RX_DCBS) { desc = &sinfo->rx[chan].desc[sinfo->rx[chan].cur]; if (desc->skb == NULL) { - skb = dev_alloc_skb(rx_buffer_size + encap_size); + skb = dev_alloc_skb(rx_buffer_size + RCPU_RX_ENCAP_SIZE); if (skb == NULL) { break; } - skb_reserve(skb, encap_size); + skb_reserve(skb, resv_size); desc->skb = skb; } else { DBG_DCB_RX(("Refill Rx%d SKB in DCB %d recycled.\n", @@ -3198,11 +3201,7 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) case KCOM_DEST_T_API: DBG_FLTR(("Send to Rx API\n")); sinfo->rx[chan].pkts_f_api++; - if (bkn_api_rx_copy_from_skb(sinfo, chan, desc) < 0) { - /* Suspend SKB Rx due to no API resources */ - sinfo->rx[chan].api_wait = 1; - return dcbs_done; - } + bkn_api_rx_copy_from_skb(sinfo, chan, desc); break; case KCOM_DEST_T_NETIF: priv = bkn_netif_lookup(sinfo, filter->kf.dest_id); @@ -3408,10 +3407,6 @@ bkn_rx_desc_done(bkn_switch_info_t *sinfo, int chan) static void bkn_rx_chain_done(bkn_switch_info_t *sinfo, int chan) { - if (sinfo->rx[chan].use_rx_skb && sinfo->rx[chan].api_wait) { - return; - } - DBG_IRQ(("Rx%d chain done\n", chan)); if (sinfo->rx[chan].chain_complete == 0) { @@ -3809,6 +3804,7 @@ static int xgs_do_dma(bkn_switch_info_t *sinfo, int budget) { int rx_dcbs_done = 0, tx_dcbs_done = 0; + int chan_done, budget_chans = 0; uint32_t dma_stat; int chan; @@ -3817,7 +3813,28 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget) for (chan = 0; chan < sinfo->rx_chans; chan++) { if (dma_stat & DS_DESC_DONE_TST(XGS_DMA_RX_CHAN + chan)) { xgs_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); - rx_dcbs_done += bkn_do_rx(sinfo, chan, budget - rx_dcbs_done); + sinfo->poll_channels |= 1 << chan; + } + } + if (!sinfo->poll_channels) { + sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; + budget_chans = budget / sinfo->rx_chans; + } else { + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + budget_chans++; + } + } + budget_chans = budget / budget_chans; + } + + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + chan_done = bkn_do_rx(sinfo, chan, budget_chans); + rx_dcbs_done += chan_done; + if (chan_done < budget_chans) { + sinfo->poll_channels &= ~(1 << chan); + } bkn_rx_desc_done(sinfo, chan); } @@ -3833,13 +3850,14 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget) bkn_tx_chain_done(sinfo, tx_dcbs_done); } - return rx_dcbs_done; + return sinfo->poll_channels ? budget : rx_dcbs_done; } static int xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) { int rx_dcbs_done = 0, tx_dcbs_done = 0; + int chan_done, budget_chans = 0; uint32_t dma_stat, irq_stat = 0; int chan; @@ -3854,7 +3872,28 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) if (dma_stat & (0x10 << (XGS_DMA_RX_CHAN + chan)) || irq_stat & (0x08000000 << (XGS_DMA_RX_CHAN + chan))) { xgsm_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); - rx_dcbs_done += bkn_do_rx(sinfo, chan, budget - rx_dcbs_done); + sinfo->poll_channels |= 1 << chan; + } + } + if (!sinfo->poll_channels) { + sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; + budget_chans = budget / sinfo->rx_chans; + } else { + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + budget_chans++; + } + } + budget_chans = budget / budget_chans; + } + + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + chan_done = bkn_do_rx(sinfo, chan, budget_chans); + rx_dcbs_done += chan_done; + if (chan_done < budget_chans) { + sinfo->poll_channels &= ~(1 << chan); + } bkn_rx_desc_done(sinfo, chan); } @@ -3879,22 +3918,45 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) bkn_tx_chain_done(sinfo, tx_dcbs_done); } - return rx_dcbs_done; + return sinfo->poll_channels ? budget : rx_dcbs_done; } static int xgsx_do_dma(bkn_switch_info_t *sinfo, int budget) { int rx_dcbs_done = 0, tx_dcbs_done = 0; + int chan_done, budget_chans = 0; uint32_t irq_stat; int chan; DEV_READ32(sinfo, CMICX_IRQ_STATr, &irq_stat); + for (chan = 0; chan < sinfo->rx_chans; chan++) { if ((irq_stat & CMICX_DS_CMC_CTRLD_INT(XGS_DMA_RX_CHAN + chan)) || (irq_stat & CMICX_DS_CMC_DESC_DONE(XGS_DMA_RX_CHAN + chan))) { xgsx_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); - rx_dcbs_done += bkn_do_rx(sinfo, chan, budget - rx_dcbs_done); + sinfo->poll_channels |= 1 << chan; + } + } + if (!sinfo->poll_channels) { + sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; + budget_chans = budget / sinfo->rx_chans; + } else { + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + budget_chans++; + } + } + budget_chans = budget / budget_chans; + } + + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (1 << chan & sinfo->poll_channels) { + chan_done = bkn_do_rx(sinfo, chan, budget_chans); + rx_dcbs_done += chan_done; + if (chan_done < budget_chans) { + sinfo->poll_channels &= ~(1 << chan); + } bkn_rx_desc_done(sinfo, chan); } @@ -3919,7 +3981,7 @@ xgsx_do_dma(bkn_switch_info_t *sinfo, int budget) bkn_tx_chain_done(sinfo, tx_dcbs_done); } - return rx_dcbs_done; + return sinfo->poll_channels ? budget : rx_dcbs_done; } static int @@ -4400,10 +4462,12 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) dev_kfree_skb_any(skb); skb = new_skb; pktdata = skb->data; + rcpulen = 0; } else { /* Add tag to RCPU header space */ DBG_SKB(("Expand into unused RCPU header\n")); - pktdata = &skb->data[rcpulen - 4]; + rcpulen -= 4; + pktdata = &skb->data[rcpulen]; for (idx = 0; idx < 12; idx++) { pktdata[idx] = pktdata[idx + 4]; } @@ -4418,7 +4482,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) } else { if (sinfo->cmic_type == 'x' && priv->port >= 0) { if (skb_header_cloned(skb) || skb_headroom(skb) < hdrlen + 4 || - ((unsigned long)skb->data % 4)) { + (sinfo->dcb_type == 36 && (unsigned long)skb->data % 4)) { /* Current SKB cannot be modified */ DBG_SKB(("Realloc Tx SKB\n")); new_skb = dev_alloc_skb(pktlen + hdrlen + 4); @@ -4502,6 +4566,8 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) spin_unlock_irqrestore(&sinfo->lock, flags); return 0; } + /* skb_padto may update the skb->data pointer */ + pktdata = &skb->data[rcpulen]; DBG_SKB(("Packet padded to %d bytes\n", pktlen)); } @@ -4696,7 +4762,6 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) * bit0 -bit15 of dcb[1] is used to save requested byte count */ if ((skb->len + 4) <= SOC_DCB_KNET_COUNT_MASK) { - pktdata = skb->data; pktlen = skb->len + 4; if (pktlen < (64 + taglen + hdrlen)) { pktlen = (64 + taglen + hdrlen); @@ -4710,6 +4775,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) } DBG_SKB(("Packet padded to %d bytes after tx callback\n", pktlen)); } + pktdata = skb->data; } else { DBG_WARN(("Tx drop: size of pkt (%d) is out of range(%d)\n", pktlen, SOC_DCB_KNET_COUNT_MASK)); @@ -4785,11 +4851,8 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) bkn_suspend_tx(sinfo); } -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4,6,0)) - dev->trans_start = jiffies; -#else - netif_trans_update(dev); -#endif + NETDEV_UPDATE_TRANS_START_TIME(dev); + spin_unlock_irqrestore(&sinfo->lock, flags); return 0; @@ -5491,14 +5554,12 @@ bkn_seq_dma_show(struct seq_file *s, void *v) seq_printf(s, "Rx%d DCB info (unit %d):\n" " api: %d\n" - " wait: %d\n" " dirty: %d\n" " cur: %d\n" " free: %d\n" " run: %d\n", chan, iter->dev_no, sinfo->rx[chan].api_active, - sinfo->rx[chan].api_wait, sinfo->rx[chan].dirty, sinfo->rx[chan].cur, sinfo->rx[chan].free, @@ -6127,6 +6188,7 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) if (sinfo->cmic_type == 'x') { dcb_chain_end->dcb_mem[woffset + 1] = DMA_TO_BUS_HI(dcb_chain->dcb_dma >> 32); } + MEMORY_BARRIER; } sinfo->tx.api_dcb_chain_end = dcb_chain; if (sinfo->tx.api_active) { @@ -6181,6 +6243,7 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) if (sinfo->cmic_type == 'x') { dcb_chain_end->dcb_mem[woffset + 1] = DMA_TO_BUS_HI(dcb_chain->dcb_dma >> 32); } + MEMORY_BARRIER; } sinfo->rx[chan].api_dcb_chain_end = dcb_chain; if (!sinfo->rx[chan].use_rx_skb) { @@ -6194,18 +6257,6 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) if (sinfo->rx[chan].api_active == 0) { bkn_api_rx_restart(sinfo, chan); - /* Resume SKB Rx due to refilled API resources */ - if (sinfo->rx[chan].use_rx_skb && sinfo->rx[chan].api_wait) { - sinfo->rx[chan].api_wait = 0; - if (CDMA_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { - bkn_do_skb_rx(sinfo, chan, 1); - } else { - bkn_do_skb_rx(sinfo, chan, MAX_RX_DCBS); - if (sinfo->rx[chan].chain_complete) { - bkn_rx_chain_done(sinfo, chan); - } - } - } } spin_unlock_irqrestore(&sinfo->lock, flags); @@ -6272,7 +6323,7 @@ bkn_knet_dev_reprobe(void) for (i = 0; i < kernel_bde->num_devices(BDE_ALL_DEVICES); i++) { sinfo = bkn_sinfo_from_unit(i); - if (sinfo == NULL ) { + if (sinfo == NULL) { /* New device found after re-probe. */ if (bkn_knet_dev_init(i) < 0) { return -1; @@ -6289,7 +6340,7 @@ bkn_knet_dev_reprobe(void) /* Assign the inst_id and evt_idx */ static int -bkn_knet_dev_inst_set(kcom_msg_version_t *kmsg) +bkn_knet_dev_inst_set(kcom_msg_reprobe_t *kmsg) { bkn_switch_info_t *sinfo; int d = kmsg->hdr.unit; @@ -6333,13 +6384,6 @@ bkn_knet_dev_inst_set(kcom_msg_version_t *kmsg) static int bkn_knet_version(kcom_msg_version_t *kmsg, int len) { - /* Support pci hot plug and multiple instance */ - if ((bkn_knet_dev_reprobe() < 0) || - (bkn_knet_dev_inst_set(kmsg) < 0)) { - kmsg->hdr.status = KCOM_E_RESOURCE; - return sizeof(kcom_msg_version_t); - } - kmsg->hdr.type = KCOM_MSG_TYPE_RSP; kmsg->version = KCOM_VERSION; kmsg->netif_max = KCOM_NETIF_MAX; @@ -6496,6 +6540,21 @@ bkn_knet_detach(kcom_msg_detach_t *kmsg, int len) return sizeof(kcom_msg_detach_t); } +static int +bkn_knet_reprobe(kcom_msg_reprobe_t *kmsg, int len) +{ + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + /* Support pci hot plug and multiple instance */ + if ((bkn_knet_dev_reprobe() < 0) || + (bkn_knet_dev_inst_set(kmsg) < 0)) { + kmsg->hdr.status = KCOM_E_RESOURCE; + return sizeof(kcom_msg_reprobe_t); + } + + return sizeof(kcom_msg_reprobe_t); +} + static int bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len) { @@ -7007,7 +7066,6 @@ bkn_knet_wb_cleanup(kcom_msg_wb_cleanup_t *kmsg, int len) } sinfo->rx[chan].api_dcb_chain_end = NULL; sinfo->rx[chan].api_active = 0; - sinfo->rx[chan].api_wait = 0; } spin_unlock_irqrestore(&sinfo->lock, flags); @@ -7055,6 +7113,11 @@ bkn_handle_cmd_req(kcom_msg_t *kmsg, int len) /* Detach kernel module */ len = bkn_knet_detach(&kmsg->detach, len); break; + case KCOM_M_REPROBE: + DBG_CMD(("KCOM_M_REPROBE\n")); + /* Reprobe device */ + len = bkn_knet_reprobe(&kmsg->reprobe, len); + break; case KCOM_M_NETIF_CREATE: DBG_CMD(("KCOM_M_NETIF_CREATE\n")); /* Create network interface */ @@ -7174,8 +7237,7 @@ bkn_get_next_dma_event(kcom_msg_dma_info_t *kmsg) } DBG_INST(("%s dev %d evt_idx %d\n",__FUNCTION__, dev_evt, sinfo->evt_idx)); - evt = &_bkn_evt[sinfo->evt_idx]; - dev_no = last_dev_no = dev_evt; + dev_no = last_dev_no; while (1) { dev_no++; sinfo = bkn_sinfo_from_unit(dev_no); @@ -7204,6 +7266,7 @@ bkn_get_next_dma_event(kcom_msg_dma_info_t *kmsg) } if (dev_no == last_dev_no) { + evt = &_bkn_evt[sinfo->evt_idx]; DBG_INST(("wait queue index %d\n",sinfo->evt_idx)); wait_event_interruptible(evt->evt_wq, evt->evt_wq_get != evt->evt_wq_put); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h index d1977076850b..a48cb540adaf 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h @@ -62,6 +62,9 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) +#include +#endif #include #include From 43853bfb695e07cc95e131f93c52ea2c3919d83f Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sat, 16 Feb 2019 10:14:18 -0800 Subject: [PATCH 136/219] change libsaithrift version to 0.9.4 --- platform/barefoot/libsaithrift-dev.mk | 23 ++++++++++++++++++----- platform/barefoot/python-saithrift.mk | 6 ------ platform/broadcom/libsaithrift-dev.mk | 2 +- platform/centec/libsaithrift-dev.mk | 23 ++++++++++++++++++----- platform/centec/python-saithrift.mk | 6 ------ platform/marvell/libsaithrift-dev.mk | 23 ++++++++++++++++++----- platform/marvell/python-saithrift.mk | 6 ------ platform/mellanox/libsaithrift-dev.mk | 2 +- platform/nephos/libsaithrift-dev.mk | 23 ++++++++++++++++++----- platform/nephos/python-saithrift.mk | 6 ------ 10 files changed, 74 insertions(+), 46 deletions(-) delete mode 100644 platform/barefoot/python-saithrift.mk delete mode 100644 platform/centec/python-saithrift.mk delete mode 100644 platform/marvell/python-saithrift.mk delete mode 100644 platform/nephos/python-saithrift.mk diff --git a/platform/barefoot/libsaithrift-dev.mk b/platform/barefoot/libsaithrift-dev.mk index c9c8cbb3adca..0289a41b2910 100644 --- a/platform/barefoot/libsaithrift-dev.mk +++ b/platform/barefoot/libsaithrift-dev.mk @@ -1,7 +1,20 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_BFN = libsaithrift-dev_0.9.4_amd64.deb -$(LIBSAITHRIFT_DEV_BFN)_SRC_PATH = $(SRC_PATH)/SAI -$(LIBSAITHRIFT_DEV_BFN)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV) -$(LIBSAITHRIFT_DEV_BFN)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI) -#SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_BFN) +SAI_VER = 0.9.4 + +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) + +PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) + +SAISERVER = saiserver_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) + +SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/barefoot/python-saithrift.mk b/platform/barefoot/python-saithrift.mk deleted file mode 100644 index ba4846402fb8..000000000000 --- a/platform/barefoot/python-saithrift.mk +++ /dev/null @@ -1,6 +0,0 @@ -# python-saithrift package - -PYTHON_SAITHRIFT_BFN = python-saithrift_0.9.4_amd64.deb -$(PYTHON_SAITHRIFT_BFN)_SRC_PATH = $(SRC_PATH)/SAI -$(PYTHON_SAITHRIFT_BFN)_DEPENDS += $(BFN_SAI_DEV) $(BFN_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -#SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_BFN) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index b041aa37aa90..543ea63e7f4e 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -1,6 +1,6 @@ # libsaithrift-dev package -SAI_VER = 1.3.5 +SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI diff --git a/platform/centec/libsaithrift-dev.mk b/platform/centec/libsaithrift-dev.mk index b0e13fa02828..fdcbfd664e1f 100644 --- a/platform/centec/libsaithrift-dev.mk +++ b/platform/centec/libsaithrift-dev.mk @@ -1,7 +1,20 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_1.3.5_amd64.deb -$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV_CENTEC)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CENTEC_SAI) -$(LIBSAITHRIFT_DEV_CENTEC)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_CENTEC) +SAI_VER = 0.9.4 + +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(CENTEC_SAI) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) + +PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) + +SAISERVER = saiserver_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) + +SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/centec/python-saithrift.mk b/platform/centec/python-saithrift.mk deleted file mode 100644 index b62beff89237..000000000000 --- a/platform/centec/python-saithrift.mk +++ /dev/null @@ -1,6 +0,0 @@ -# python-saithrift package - -PYTHON_SAITHRIFT_CENTEC = python-saithrift_1.3.5_amd64.deb -$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(PYTHON_SAITHRIFT_CENTEC)_DEPENDS += $(CENTEC_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CENTEC) diff --git a/platform/marvell/libsaithrift-dev.mk b/platform/marvell/libsaithrift-dev.mk index 270bf25b873f..d1607a1ba220 100644 --- a/platform/marvell/libsaithrift-dev.mk +++ b/platform/marvell/libsaithrift-dev.mk @@ -1,7 +1,20 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_MRVL = libsaithrift-dev_1.2.1_amd64.deb -$(LIBSAITHRIFT_DEV_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV_MRVL)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(MRVL_FPA) $(MRVL_SAI) -$(LIBSAITHRIFT_DEV_MRVL)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_MRVL) +SAI_VER = 0.9.4 + +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(MRVL_FPA) $(MRVL_SAI) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) + +PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) + +SAISERVER = saiserver_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) + +SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/marvell/python-saithrift.mk b/platform/marvell/python-saithrift.mk deleted file mode 100644 index f7bea43589ad..000000000000 --- a/platform/marvell/python-saithrift.mk +++ /dev/null @@ -1,6 +0,0 @@ -# python-saithrift package - -PYTHON_SAITHRIFT_MRVL = python-saithrift_1.2.1_amd64.deb -$(PYTHON_SAITHRIFT_MRVL)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(PYTHON_SAITHRIFT_MRVL)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_MRVL) diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index 6d67ef15411e..b0ef5746db73 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -1,6 +1,6 @@ # libsaithrift-dev package -SAI_VER = 1.3.5 +SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk index e3828eeb0f2b..6ffb4bf51205 100644 --- a/platform/nephos/libsaithrift-dev.mk +++ b/platform/nephos/libsaithrift-dev.mk @@ -1,7 +1,20 @@ # libsaithrift-dev package -LIBSAITHRIFT_DEV_NEPHOS = libsaithrift-dev_1.3.5_amd64.deb -$(LIBSAITHRIFT_DEV_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV_NEPHOS)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) -$(LIBSAITHRIFT_DEV_NEPHOS)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) -SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_NEPHOS) +SAI_VER = 0.9.4 + +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +$(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) + +PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) + +SAISERVER = saiserver_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) + +SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +$(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) +$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/nephos/python-saithrift.mk b/platform/nephos/python-saithrift.mk deleted file mode 100644 index 9305b0628a96..000000000000 --- a/platform/nephos/python-saithrift.mk +++ /dev/null @@ -1,6 +0,0 @@ -# python-saithrift package - -PYTHON_SAITHRIFT_NEPHOS = python-saithrift_1.3.5_amd64.deb -$(PYTHON_SAITHRIFT_NEPHOS)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(PYTHON_SAITHRIFT_NEPHOS)_DEPENDS += $(NEPHOS_SAI_DEV) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) -SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_NEPHOS) From 58171a857c8118cec9f7dccd6c6cc0f66ec42074 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 26 Jun 2019 17:40:06 +0000 Subject: [PATCH 137/219] [Broadcom SAI] upgrade Broadcom SAI to 3.5.2.3 --- platform/broadcom/sai.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index dc6519dc6da4..48fd1e67f660 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,9 +1,9 @@ -BRCM_SAI = libsaibcm_3.3.6.1-9_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm_3.3.6.1-9_amd64.deb?sv=2015-04-05&sr=b&sig=ZsZxC0bmXIX9PCa73BpyMatePq8m2jWvCahFx3OJ%2F8I%3D&se=2033-02-13T21%3A31%3A33Z&sp=r" +BRCM_SAI = libsaibcm_3.5.2.3_amd64.deb +$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5/jessie/libsaibcm_3.5.2.3_amd64.deb?sv=2015-04-05&sr=b&sig=OCYEP1DOHEVlfy6qjckfME%2FoD%2F914zIueu4UKgNsyQA%3D&se=2156-05-18T17%3A37%3A54Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_3.3.6.1-9_amd64.deb +BRCM_SAI_DEV = libsaibcm-dev_3.5.2.3_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.3/libsaibcm-dev_3.3.6.1-9_amd64.deb?sv=2015-04-05&sr=b&sig=RUAbTNEcmaSvNeAKz%2F8x06hPC%2BS%2BVlGPA2%2FiwHZMF4o%3D&se=2033-02-13T21%3A31%3A02Z&sp=r" +$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/3.5/jessie/libsaibcm-dev_3.5.2.3_amd64.deb?sv=2015-04-05&sr=b&sig=Ohiw%2FaNhnbB%2FKFn%2BTaZgDrG1ziGfwjwrr2l%2BoIKCmA4%3D&se=2156-05-18T17%3A38%3A34Z&sp=r" SONIC_ONLINE_DEBS += $(BRCM_SAI) $(BRCM_SAI_DEV)_DEPENDS += $(BRCM_SAI) From 8f077b8097e9c4f4d93d484d28f7c7b22cf845a2 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Thu, 27 Jun 2019 06:53:39 +0000 Subject: [PATCH 138/219] [submodule]: update sonic-swss and sonic-sairedis submodule sonic-swss * 32d3297 2019-01-24 | use sai_stat_id_t for new SAI header file (#769) sonic-sairedis * fdfcefd 2019-04-24 | [SAI] Advance submodule to v1.4.1 (#450) (HEAD -> 201811, origin/201811) [Marian Pritsak] * 006df41 2019-02-27 | [vslib]: Add support of bitmap VNET (bmtor) SAI API (#424) [Volodymyr Samotiy] * ec5e187 2019-04-23 | [SAI]: Move SAI pointer to v1.4 (#447) [Shuotian Cheng] * 6b9c32e 2019-03-04 | [SAI] Update SAI pointer (#431) [Stepan Blyshchak] * f078998 2019-02-22 | Fix compilation issues in stretch docker with gcc-6.3 (#426) [Stepan Blyshchak] * 0540e59 2019-01-31 | Update SAI pointer (#414) [Marian Pritsak] * 9084920 2019-01-18 | Update SAI pointer to latest master (#408) [Marian Pritsak] * fbfe48b 2019-06-24 | Revert "[SAI header] upgrade SAI header to version v1.3.7 (#445)" [Guohan Lu] Signed-off-by: Guohan Lu --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index f50a87ff5ef5..fdfcefd19d28 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit f50a87ff5ef5e3bba1541e4f18e1e100f0f3f132 +Subproject commit fdfcefd19d2832b0e1d1eff56b093ae85a7795d0 diff --git a/src/sonic-swss b/src/sonic-swss index 869c78aeea0d..32d3297a6b34 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 869c78aeea0d92f484d5e301a77d9879e5e51baa +Subproject commit 32d3297a6b34c5518567b9c3d35539ebf24c932f From dc0f695b6bb4bf796d8714ff0be925f42786c1e0 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Tue, 2 Jul 2019 08:33:31 +0300 Subject: [PATCH 139/219] Update SAI to v1.4, SDK to v4.3.1420 (#46) Signed-off-by: Andriy Moroz --- platform/mellanox/fw.mk | 2 +- platform/mellanox/mlnx-sai.mk | 4 ++-- platform/mellanox/sdk.mk | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 3116a4d7b10e..b8f836446224 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.1910.0928 +MLNX_FW_VERSION = 13.2000.1420 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 477a3fc64746..fd9f5b473ded 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.13.4-master -MLNX_SAI_REVISION = 6ea244309b944af3bb34a9b99ad6ed60c5dc9937 +MLNX_SAI_VERSION = SAIRel1.14.1-master +MLNX_SAI_REVISION = 80e08e8f12746801d683730a5e147cd6e77becfb export MLNX_SAI_VERSION MLNX_SAI_REVISION diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 8c8daa85ae9e..7a767bdd5e3e 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,14 +1,14 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/378cc53bef634b6ae192819d7f412fb1543faff6/sdk -MLNX_SDK_VERSION = 4.3.0136 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/8c9e1ab89529967a2b1c567952c355290508308d/sdk +MLNX_SDK_VERSION = 4.3.1420 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ - $(SXD_LIBS) $(TESTX) + $(SXD_LIBS) $(TESTX) $(WJH_LIBS) MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \ $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ $(SX_SDN_HAL_DEV) $(SX_SDN_HAL_DEV_STATIC) $(SXD_LIBS_DEV) \ - $(SXD_LIBS_DEV_STATIC) $(TESTX_DEV) + $(SXD_LIBS_DEV_STATIC) $(TESTX_DEV) $(WJH_LIBS_DEV) APPLIBS = applibs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(APPLIBS)_DEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) @@ -45,6 +45,13 @@ SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) +WJH_LIBS = wjh-libs_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +#$(WJH_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/wjh-libs +$(WJH_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) +$(WJH_LIBS)_RDEPENDS += $(SX_COMPLIB) $(PYTHON_SDK_API) +WJH_LIBS_DEV = wjh-libs-dev_1.mlnx.$(MLNX_SDK_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DEV))) + define make_url $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) From ff7fe3f8dfb687bfe8055d06b6eef8bcb19cad79 Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Wed, 3 Jul 2019 01:16:57 +0300 Subject: [PATCH 140/219] [submodule]: Update sonic-swss pointer (#3110) Included fix for PFCWD due to counter units change in SAI Signed-off-by: Andriy Moroz --- src/sonic-swss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-swss b/src/sonic-swss index 32d3297a6b34..5ef4ac9f9449 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 32d3297a6b34c5518567b9c3d35539ebf24c932f +Subproject commit 5ef4ac9f9449f6e5969671f6f52d9d7926eb72db From 24e5a62ccc04901795feb4010937da3a4c2b69fc Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Sat, 1 Jun 2019 12:31:14 -0700 Subject: [PATCH 141/219] [sonic-cfggen]: Fix for management port speed issue (#2945) --- src/sonic-config-engine/minigraph.py | 7 +++++-- .../tests/simple-sample-graph-case.xml | 13 +++++++++++++ .../tests/simple-sample-graph-metadata.xml | 13 +++++++++++++ .../tests/simple-sample-graph.xml | 12 ++++++++++++ .../tests/test_minigraph_case.py | 6 +++++- 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 9b86d024282f..b017d4820ced 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -395,8 +395,9 @@ def parse_deviceinfo(meta, hwsku): for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: - interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))) - for interface in interfaces.findall(str(QName(ns1, "EthernetInterface"))): + interfaces = device_info.find(str(QName(ns, "EthernetInterfaces"))).findall(str(QName(ns1, "EthernetInterface"))) + interfaces = interfaces + device_info.find(str(QName(ns, "ManagementInterfaces"))).findall(str(QName(ns1, "ManagementInterface"))) + for interface in interfaces: alias = interface.find(str(QName(ns, "InterfaceName"))).text speed = interface.find(str(QName(ns, "Speed"))).text desc = interface.find(str(QName(ns, "Description"))) @@ -494,6 +495,8 @@ def parse_xml(filename, platform=None, port_config_file=None): mgmt_intf_count += 1 mgmt_alias_reverse_mapping[alias] = name results['MGMT_PORT'][name] = {'alias': alias, 'admin_status': 'up'} + if alias in port_speeds_default: + results['MGMT_PORT'][name]['speed'] = port_speeds_default[alias] results['MGMT_INTERFACE'][(name, key[1])] = mgmt_intf[key] results['LOOPBACK_INTERFACE'] = lo_intfs diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index 5a776099017d..35d8f8343796 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -325,6 +325,19 @@ true 0 Force10-S6000 + + + DeviceInterface + + true + true + 1 + eth0 + false + eth0 + 1000 + + switch-T0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml index 28044f1c8780..1b1da1ff1787 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml @@ -310,6 +310,19 @@ true 0 Force10-S6000 + + + DeviceInterface + + true + true + 1 + Management1 + false + mgmt1 + 1000 + + switch-t0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index f5054bb084d3..e04f692729f0 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -342,6 +342,18 @@ true 0 Force10-S6000 + + + DeviceInterface + + true + 1 + Management1 + false + mgmt1 + 1000 + + switch-t0 diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index b58d8e05e1dd..9a859e7fb0f6 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -114,8 +114,12 @@ def test_metadata_tacacs(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}") + def test_minigraph_mgmt_port(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "MGMT_PORT"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'eth0': {'alias': 'eth0', 'admin_status': 'up', 'speed': '1000'}}") + def test_metadata_ntp(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "NTP_SERVER"' output = self.run_script(argument) self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}") - From b8bdeffd47ade9cd0870c963cd8e2fa1e7350c20 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 5 Jul 2019 08:47:42 -0700 Subject: [PATCH 142/219] [submodules]: Backport ACL/MIRROR features to 201811 branch (#3112) 0ed90ba - [policerorch]: Fix return code comparison error (#968) (1 minutes ago) bd3651f - [aclorch]: Fix matching MIRROR_DSCP throws unnecessary errors (#966) (2 minutes ago) 0af226a - [aclorch]: Add MIRROR_DSCP table type (#906) (4 weeks ago) 9005962 - [vstest]: Update the mirror session state table name (#917) (5 weeks ago) c4e3e54 - [policerorch]: Add PolicerOrch to bundle with mirror session (#889) (6 weeks ago) ee49926 - [Makefile]: Remove header files from source files (#883) (8 weeks ago) f889f80 - [aclorch]: Add ICMP type/code match for v4/v6 (#868) (8 weeks ago) 9931450 - [aclorch]: Add MIRRORv6 and MIRRORv4v6 support for ACL table (#825) (9 weeks ago) a1ab18c - [mirrororch]: Fix comments typo (#863) (9 weeks ago) sonic-swss-common 485db07 - [schema]: Add SWITCH_CAPABILITY_TABLE (#276) (6 weeks ago) 3f49b20 - [schema]: Add POLICER configuration table (#277) (6 weeks ago) 539b87d - [schema]: Add STATE_MIRROR_SESSION_TABLE_NAME (#278) (6 weeks ago) sonic-utilities dc52015 - [Sonic-utilities]: Added commands to view acl and port running configs (#557) (6 days ago) 635dc88 - [config]: Add config acl add/remove table command (#541) (4 weeks ago) dcdc922 - [show]: Add show policer command (#540) (4 weeks ago) 128462a - [config]: Add --policer option for mirror session (#537) (6 weeks ago) 38da7f3 - [acl_loader]: Add policer attribute in show mirror_session command (#538) (6 weeks ago) f95ff00 - [acl_loader]: Do not apply default DENY rule for MIRRORV6 table (#522) (6 weeks ago) Signed-off-by: Shu0T1an ChenG --- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 5ef4ac9f9449..9cf7b0133f6b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 5ef4ac9f9449f6e5969671f6f52d9d7926eb72db +Subproject commit 9cf7b0133f6b5537414ff31a9fdad863ebb2f24e diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 24c0ff7215e0..b472f6eb5915 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 24c0ff7215e0fd13e9247bda6a4f92862b8519da +Subproject commit b472f6eb59158dc7545cd0957aedf1edc848ed73 diff --git a/src/sonic-utilities b/src/sonic-utilities index a02c4eaee840..ec1e93f9c4e6 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit a02c4eaee8404352f82531d89d8e0c2dfd8a76cf +Subproject commit ec1e93f9c4e65b114302eb6fabf93084e6d2d0b8 From 9e02684b2dd79a4ea7b71467b47c8df99edfab84 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 6 Jul 2019 13:32:06 -0700 Subject: [PATCH 143/219] [201811][dockers] Upgrade rsyslog to latest version available from jessie-backports repo (#3127) Upgrade the version of rsyslog installed in Docker containers to the latest version available from jessie-backports repo (currently 8.23.0-2~bpo). Based off my change to the 201803 branch (#2709). This should eliminate some memory leaks and will prevent any regressions if moving from the 201803 branch to the 201811 branch. --- dockers/docker-base/Dockerfile.j2 | 9 ++++++--- dockers/docker-base/no-check-valid-until | 1 + ...ll_recommend_suggest => no-install-recommend-suggest} | 0 dockers/docker-base/sources.list | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 dockers/docker-base/no-check-valid-until rename dockers/docker-base/{no_install_recommend_suggest => no-install-recommend-suggest} (100%) diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 481af6e821ed..79f5b0b5eb1b 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,6 +1,6 @@ FROM debian:jessie -## Remove retired jessie-updates repo +# Remove retired jessie-updates repo RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list # Clean documentation in FROM image @@ -23,7 +23,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Configure data sources for apt/dpkg COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] COPY ["sources.list", "/etc/apt/sources.list"] -COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] +COPY ["no-check-valid-until", "no-install-recommend-suggest", "/etc/apt/apt.conf.d/"] RUN apt-get update # Pre-install fundamental packages @@ -31,9 +31,12 @@ RUN apt-get -y install \ vim-tiny \ perl \ python \ - rsyslog \ less +# Install a newer version of rsyslog from jessie-backports in hopes of +# eliminating memory leaks +RUN apt-get -y -t jessie-backports install rsyslog + COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/dockers/docker-base/no-check-valid-until b/dockers/docker-base/no-check-valid-until new file mode 100644 index 000000000000..97b9c9005181 --- /dev/null +++ b/dockers/docker-base/no-check-valid-until @@ -0,0 +1 @@ +Acquire::Check-Valid-Until "false"; diff --git a/dockers/docker-base/no_install_recommend_suggest b/dockers/docker-base/no-install-recommend-suggest similarity index 100% rename from dockers/docker-base/no_install_recommend_suggest rename to dockers/docker-base/no-install-recommend-suggest diff --git a/dockers/docker-base/sources.list b/dockers/docker-base/sources.list index 2ed195cff416..45a508420a89 100644 --- a/dockers/docker-base/sources.list +++ b/dockers/docker-base/sources.list @@ -5,3 +5,4 @@ deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-fre deb-src http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free deb http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free deb-src http://debian-archive.trafficmanager.net/debian-security/ jessie/updates main contrib non-free +deb http://archive.debian.org/debian/ jessie-backports main contrib non-free From 0bca6b8468daa6268476a70dc2adfe03644bcb8c Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Tue, 9 Jul 2019 08:55:03 -0700 Subject: [PATCH 144/219] 1) Build debug docker image for each docker (#3104) 2) Install debug tools in every debug docker image 3) Install available debug symbols in debug docker image 4) Provide additional host/docker mapping for host dirs /src & /debug 4.1) The one-image will have source code under /src 4.2) /debug is mapped as rw. User can put his core file there and use this dir to collect debug session logs too. 5) Build debug image using debug dockers 6) Source code is archived into /src of debug image 7) The welcome banner is extended to display these additional facilities in debug image. --- build_debian.sh | 22 ++++++++ build_debug_docker_j2.sh | 44 ++++++++++++++++ dbg_files.sh | 27 ++++++++++ platform/barefoot/docker-orchagent-bfn.mk | 23 +-------- platform/barefoot/docker-syncd-bfn.mk | 24 ++++----- platform/broadcom/docker-orchagent-brcm.mk | 23 +-------- platform/broadcom/docker-syncd-brcm.mk | 31 +++++------ platform/broadcom/one-image.mk | 7 ++- platform/cavium/docker-orchagent-cavm.mk | 23 +-------- platform/cavium/docker-syncd-cavm.mk | 23 ++++----- platform/centec/docker-orchagent-centec.mk | 23 +-------- platform/centec/docker-syncd-centec.mk | 21 ++++---- platform/marvell/docker-orchagent-mrvl.mk | 22 +------- platform/marvell/docker-syncd-mrvl.mk | 26 +++++----- platform/mellanox/docker-orchagent-mlnx.mk | 23 +-------- platform/mellanox/docker-syncd-mlnx.mk | 21 ++++---- platform/nephos/docker-orchagent-nephos.mk | 23 +-------- platform/nephos/docker-syncd-nephos.mk | 28 +++++----- platform/template/docker-orchagent-base.mk | 35 +++++++++++++ platform/template/docker-syncd-base.mk | 31 +++++++++++ platform/vs/docker-orchagent-vs.mk | 23 +-------- platform/vs/docker-syncd-vs.mk | 20 ++++---- platform/vs/one-image.mk | 7 ++- rules/docker-base.mk | 4 +- rules/docker-config-engine.mk | 4 ++ rules/docker-database.mk | 14 ++++- rules/docker-dhcp-relay.mk | 12 ++++- rules/docker-fpm-frr.mk | 14 ++++- rules/docker-platform-monitor.mk | 15 +++++- rules/docker-router-advertiser.mk | 13 ++++- rules/docker-teamd.mk | 15 +++++- rules/docker-telemetry.mk | 15 +++++- rules/frr.mk | 4 ++ slave.mk | 60 +++++++++++++++++----- src/sonic-frr/Makefile | 4 +- 35 files changed, 427 insertions(+), 297 deletions(-) create mode 100755 build_debug_docker_j2.sh create mode 100755 dbg_files.sh create mode 100644 platform/template/docker-orchagent-base.mk create mode 100644 platform/template/docker-syncd-base.mk diff --git a/build_debian.sh b/build_debian.sh index cf87c7bdb563..ebb25a171d7f 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -412,6 +412,28 @@ fi sudo sed -i 's/EBTABLES_LOAD_ON_START="no"/EBTABLES_LOAD_ON_START="yes"/g' ${FILESYSTEM_ROOT}/etc/default/ebtables sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc +## Debug Image specific changes +## Update motd for debug image +if [ "$DEBUG_IMG" == "y" ] +then + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '**************' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo 'Running DEBUG image' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '**************' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/src has the sources' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/src is mounted in each docker' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/debug is created for core files or temp files' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo 'Create a subdir under /debug to upload your files' >> /etc/motd" + sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/debug is mounted in each docker' >> /etc/motd" + + sudo mkdir -p $FILESYSTEM_ROOT/src + pushd src + ../dbg_files.sh | sudo tar -cvzf ../$FILESYSTEM_ROOT/src/sonic_src.tar.gz -T - + popd + + sudo mkdir -p $FILESYSTEM_ROOT/debug + +fi + ## Remove gcc and python dev pkgs sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev diff --git a/build_debug_docker_j2.sh b/build_debug_docker_j2.sh new file mode 100755 index 000000000000..3655ac037bd6 --- /dev/null +++ b/build_debug_docker_j2.sh @@ -0,0 +1,44 @@ +#! /bin/bash + +echo " +FROM $1 + +ARG docker_container_name + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +{% if $2 is defined %} +{% if $2|length %} + +COPY \ +{% for deb in $2.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in $2.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +{% endif %} +{% endif %} + +{% if $3 is defined %} +{% if $3|length %} + +RUN apt-get install -f -y \ +{% for dbg in $3.split(' ') -%} +{{ dbg }}{{' '}} +{%- endfor %} + +{% endif %} +{% endif %} + + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +" diff --git a/dbg_files.sh b/dbg_files.sh new file mode 100755 index 000000000000..d9ef601684b9 --- /dev/null +++ b/dbg_files.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Provie file paths to archive for debug image as relative to src subdir +# +SRC_DIR_LIST="\ + libteam \ + lldpd \ + libnl3 \ + radvd \ + redis \ + snmpd \ + sonic-dbsyncd \ + sonic-frr \ + sonic-platform-common \ + sonic-platform-daemons \ + sonic-py-swsssdk \ + sonic-sairedis \ + sonic-snmpagent \ + sonic-swss \ + sonic-swss-common \ + tacacs" + +for i in $SRC_DIR_LIST +do + find $i/ -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -type f +done + diff --git a/platform/barefoot/docker-orchagent-bfn.mk b/platform/barefoot/docker-orchagent-bfn.mk index fefd39691855..de6277cf39da 100644 --- a/platform/barefoot/docker-orchagent-bfn.mk +++ b/platform/barefoot/docker-orchagent-bfn.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_BFN = docker-orchagent-bfn.gz -$(DOCKER_ORCHAGENT_BFN)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_BFN)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BFN) +DOCKER_ORCHAGENT_PLATFORM_CODE = bfn +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_BFN)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_BFN)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_BFN)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_BFN)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index 22bb10763e75..a0c096144172 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -1,15 +1,13 @@ # docker image for syncd -DOCKER_SYNCD_BFN = docker-syncd-bfn.gz -$(DOCKER_SYNCD_BFN)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn -$(DOCKER_SYNCD_BFN)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_BFN)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN) -endif - -$(DOCKER_SYNCD_BFN)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BFN)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_BFN)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_BFN)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +DOCKER_SYNCD_PLATFORM_CODE = bfn +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + diff --git a/platform/broadcom/docker-orchagent-brcm.mk b/platform/broadcom/docker-orchagent-brcm.mk index dc3c31f43d5b..4dfa3059c251 100644 --- a/platform/broadcom/docker-orchagent-brcm.mk +++ b/platform/broadcom/docker-orchagent-brcm.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_BRCM = docker-orchagent-brcm.gz -$(DOCKER_ORCHAGENT_BRCM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_BRCM)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BRCM) +DOCKER_ORCHAGENT_PLATFORM_CODE = brcm +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_BRCM)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 088437060964..ba687800c8f8 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -1,21 +1,18 @@ # docker image for brcm syncd -DOCKER_SYNCD_BRCM = docker-syncd-brcm.gz -$(DOCKER_SYNCD_BRCM)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm -$(DOCKER_SYNCD_BRCM)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_BRCM)_FILES += $(DSSERVE) $(BCMCMD) -$(DOCKER_SYNCD_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM) -endif +DOCKER_SYNCD_PLATFORM_CODE = brcm +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk -$(DOCKER_SYNCD_BRCM)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BRCM)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_SYNCD_BRCM)_RUN_OPT += -v /host/warmboot:/var/warmboot +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(BCMCMD) -$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd -$(DOCKER_SYNCD_BRCM)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot + +$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd +$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 081a83e94ea9..24c320d69ddc 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -35,5 +35,10 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) -$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +ifeq ($(INSTALL_DEBUG_TOOLS),y) + $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_DBG_IMAGES) + $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) +else + $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) +endif SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/cavium/docker-orchagent-cavm.mk b/platform/cavium/docker-orchagent-cavm.mk index 282cdaa9172d..435f920c5b66 100644 --- a/platform/cavium/docker-orchagent-cavm.mk +++ b/platform/cavium/docker-orchagent-cavm.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_CAVM = docker-orchagent-cavm.gz -$(DOCKER_ORCHAGENT_CAVM)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_CAVM)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CAVM) +DOCKER_ORCHAGENT_PLATFORM_CODE = cavm +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_CAVM)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 8a3b0857dadf..52f81e1b9b27 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -1,15 +1,12 @@ # docker image for cavium syncd -DOCKER_SYNCD_CAVM = docker-syncd-cavm.gz -$(DOCKER_SYNCD_CAVM)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm -$(DOCKER_SYNCD_CAVM)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) -$(DOCKER_SYNCD_CAVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) -endif - -$(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +DOCKER_SYNCD_PLATFORM_CODE = cavm +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + diff --git a/platform/centec/docker-orchagent-centec.mk b/platform/centec/docker-orchagent-centec.mk index 891f5550bac6..1b91585e1d34 100644 --- a/platform/centec/docker-orchagent-centec.mk +++ b/platform/centec/docker-orchagent-centec.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_CENTEC = docker-orchagent-centec.gz -$(DOCKER_ORCHAGENT_CENTEC)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC) +DOCKER_ORCHAGENT_PLATFORM_CODE = centec +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_CENTEC)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index c4335ab356ac..9e1fbef160f1 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -1,16 +1,13 @@ # docker image for centec syncd -DOCKER_SYNCD_CENTEC = docker-syncd-centec.gz -$(DOCKER_SYNCD_CENTEC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec -$(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC) -endif +DOCKER_SYNCD_PLATFORM_CODE = centec +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) -$(DOCKER_SYNCD_CENTEC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-orchagent-mrvl.mk b/platform/marvell/docker-orchagent-mrvl.mk index 9c3c4c13a8f9..91e26d255370 100644 --- a/platform/marvell/docker-orchagent-mrvl.mk +++ b/platform/marvell/docker-orchagent-mrvl.mk @@ -1,23 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_MRVL = docker-orchagent-mrvl.gz -$(DOCKER_ORCHAGENT_MRVL)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_MRVL)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MRVL) +DOCKER_ORCHAGENT_PLATFORM_CODE = mrvl +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_MRVL)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf -$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro - -$(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index 4ee42e9cb904..a3f6017c012d 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -1,15 +1,15 @@ # docker image for mrvl syncd +# docker image for syncd + + +DOCKER_SYNCD_PLATFORM_CODE = mrvl +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(MRVL_FPA) $(REDIS_TOOLS) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + -DOCKER_SYNCD_MRVL = docker-syncd-mrvl.gz -$(DOCKER_SYNCD_MRVL)_PATH = $(PLATFORM_PATH)/docker-syncd-mrvl -$(DOCKER_SYNCD_MRVL)_DEPENDS += $(SYNCD) $(MRVL_FPA) $(REDIS_TOOLS) -$(DOCKER_SYNCD_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL) -endif - -$(DOCKER_SYNCD_MRVL)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-orchagent-mlnx.mk b/platform/mellanox/docker-orchagent-mlnx.mk index 5e72beb4c300..252b3cb09a52 100644 --- a/platform/mellanox/docker-orchagent-mlnx.mk +++ b/platform/mellanox/docker-orchagent-mlnx.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_MLNX = docker-orchagent-mlnx.gz -$(DOCKER_ORCHAGENT_MLNX)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_MLNX)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_MLNX) +DOCKER_ORCHAGENT_PLATFORM_CODE = mlnx +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_MLNX)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index da217492d438..347eae81d3f8 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -1,17 +1,14 @@ # docker image for mlnx syncd -DOCKER_SYNCD_MLNX = docker-syncd-mlnx.gz -$(DOCKER_SYNCD_MLNX)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx -$(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) -$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX) -endif +DOCKER_SYNCD_PLATFORM_CODE = mlnx +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) -$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MLNX)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/nephos/docker-orchagent-nephos.mk b/platform/nephos/docker-orchagent-nephos.mk index f7719b3df5dd..c6e27ef40eee 100644 --- a/platform/nephos/docker-orchagent-nephos.mk +++ b/platform/nephos/docker-orchagent-nephos.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_NEPHOS = docker-orchagent-nephos.gz -$(DOCKER_ORCHAGENT_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_NEPHOS)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_NEPHOS) +DOCKER_ORCHAGENT_PLATFORM_CODE = nephos +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_NEPHOS)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_NEPHOS)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_NEPHOS)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index a79c8524b890..be7f606cc7f9 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -1,19 +1,17 @@ # docker image for nephos syncd -DOCKER_SYNCD_NEPHOS = docker-syncd-nephos.gz -$(DOCKER_SYNCD_NEPHOS)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos -$(DOCKER_SYNCD_NEPHOS)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_NEPHOS)_FILES += $(DSSERVE) $(NPX_DIAG) -$(DOCKER_SYNCD_NEPHOS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) -ifneq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS) -endif +DOCKER_SYNCD_PLATFORM_CODE = bfn +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk -$(DOCKER_SYNCD_NEPHOS)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) -$(DOCKER_SYNCD_NEPHOS)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) + +$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(NPX_DIAG) + +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd + +$(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag diff --git a/platform/template/docker-orchagent-base.mk b/platform/template/docker-orchagent-base.mk new file mode 100644 index 000000000000..9ce0b15de2b5 --- /dev/null +++ b/platform/template/docker-orchagent-base.mk @@ -0,0 +1,35 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_BASE_STEM = docker-orchagent-$(DOCKER_ORCHAGENT_PLATFORM_CODE) +DOCKER_ORCHAGENT_BASE = $(DOCKER_ORCHAGENT_BASE_STEM).gz +DOCKER_ORCHAGENT_BASE_DBG = $(DOCKER_ORCHAGENT_BASE_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_ORCHAGENT_BASE)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) + +$(DOCKER_ORCHAGENT_BASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) +$(DOCKER_ORCHAGENT_BASE)_DBG_DEPENDS += $(SWSS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIREDIS_DBG) + +$(DOCKER_ORCHAGENT_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + +$(DOCKER_ORCHAGENT_BASE)_PATH = $(DOCKERS_PATH)/docker-orchagent + +$(DOCKER_ORCHAGENT_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + +SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BASE) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_BASE) + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_ORCHAGENT_BASE_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_ORCHAGENT_BASE_DBG) + +$(DOCKER_ORCHAGENT_BASE)_CONTAINER_NAME = swss +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw + +$(DOCKER_ORCHAGENT_BASE)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel +$(DOCKER_ORCHAGENT_BASE)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/template/docker-syncd-base.mk b/platform/template/docker-syncd-base.mk new file mode 100644 index 000000000000..7e76654c4e38 --- /dev/null +++ b/platform/template/docker-syncd-base.mk @@ -0,0 +1,31 @@ +# docker image for syncd + + +DOCKER_SYNCD_BASE_STEM = docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE) +DOCKER_SYNCD_BASE = $(DOCKER_SYNCD_BASE_STEM).gz +DOCKER_SYNCD_BASE_DBG = $(DOCKER_SYNCD_BASE_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_SYNCD_BASE)_PATH = $(PLATFORM_PATH)/docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE) + +$(DOCKER_SYNCD_BASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) + +$(DOCKER_SYNCD_BASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE) +endif + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BASE_DBG) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SYNCD_BASE_DBG) +endif + + +$(DOCKER_SYNCD_BASE)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BASE)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + diff --git a/platform/vs/docker-orchagent-vs.mk b/platform/vs/docker-orchagent-vs.mk index 185e3ce07701..5a5a8fd7f38d 100644 --- a/platform/vs/docker-orchagent-vs.mk +++ b/platform/vs/docker-orchagent-vs.mk @@ -1,24 +1,5 @@ # docker image for orchagent -DOCKER_ORCHAGENT_VS = docker-orchagent-vs.gz -$(DOCKER_ORCHAGENT_VS)_PATH = $(DOCKERS_PATH)/docker-orchagent -$(DOCKER_ORCHAGENT_VS)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(IPROUTE2) -ifeq ($(INSTALL_DEBUG_TOOLS), y) -$(DOCKER_ORCHAGENT_VS)_DEPENDS += $(SWSS_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIREDIS_DBG) -endif -$(DOCKER_ORCHAGENT_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_VS) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_VS) +DOCKER_ORCHAGENT_PLATFORM_CODE = vs +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk -$(DOCKER_ORCHAGENT_VS)_CONTAINER_NAME = swss -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += --net=host --privileged -t -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += -v /host/machine.conf:/host/machine.conf:ro -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_ORCHAGENT_VS)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw - -$(DOCKER_ORCHAGENT_VS)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_VS)_FILES += $(ARP_UPDATE_SCRIPT) diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 12fbf65468a9..7e4d48aec6cf 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -1,14 +1,16 @@ # docker image for vs syncd -DOCKER_SYNCD_VS = docker-syncd-vs.gz -$(DOCKER_SYNCD_VS)_PATH = $(PLATFORM_PATH)/docker-syncd-vs -$(DOCKER_SYNCD_VS)_DEPENDS += $(SYNCD_VS) -$(DOCKER_SYNCD_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_VS) +DOCKER_SYNCD_PLATFORM_CODE = vs +include $(PLATFORM_PATH)/../template/docker-syncd-base.mk + +$(DOCKER_SYNCD_SYNCD)_DEPENDS += $(SYNCD_VS) + +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) \ + $(LIBSAIVS_DBG) + SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_VS) -$(DOCKER_SYNCD_VS)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_VS)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_VS)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_VS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_VS)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/one-image.mk b/platform/vs/one-image.mk index 2adbf98f90e0..7ea3284954ee 100644 --- a/platform/vs/one-image.mk +++ b/platform/vs/one-image.mk @@ -3,5 +3,10 @@ SONIC_ONE_IMAGE = sonic-vs.bin $(SONIC_ONE_IMAGE)_MACHINE = vs $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +ifeq ($(INSTALL_DEBUG_TOOLS),y) + $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_DBG_IMAGES) + $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) +else + $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) +endif SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 891518790dd8..8824dfb92eb8 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -6,13 +6,11 @@ $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(BASH) $(DOCKER_BASE)_DEPENDS += $(SOCAT) -ifeq ($(INSTALL_DEBUG_TOOLS),y) GDB = gdb VIM = vim OPENSSH = openssh-client SSHPASS = sshpass STRACE = strace -$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) -endif +$(DOCKER_BASE)_DBG_IMAGE_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) SONIC_DOCKER_IMAGES += $(DOCKER_BASE) diff --git a/rules/docker-config-engine.mk b/rules/docker-config-engine.mk index f540bb66f350..ea49abd25847 100644 --- a/rules/docker-config-engine.mk +++ b/rules/docker-config-engine.mk @@ -5,4 +5,8 @@ $(DOCKER_CONFIG_ENGINE)_PATH = $(DOCKERS_PATH)/docker-config-engine $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE) $(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE) + +$(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS += $($(DOCKER_BASE)_DBG_DEPENDS) +$(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES += $($(DOCKER_BASE)_DBG_IMAGE_PACKAGES) + SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index eb7f6531f83e..4622cdc1e6c9 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -1,12 +1,24 @@ # docker image for database -DOCKER_DATABASE = docker-database.gz +DOCKER_DATABASE_STEM = docker-database +DOCKER_DATABASE = $(DOCKER_DATABASE_STEM).gz +DOCKER_DATABASE_DBG = $(DOCKER_DATABASE_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/docker-database + $(DOCKER_DATABASE)_DEPENDS += $(REDIS_TOOLS) $(REDIS_SERVER) +$(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) + +$(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DATABASE_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_DATABASE_DBG) + $(DOCKER_DATABASE)_CONTAINER_NAME = database $(DOCKER_DATABASE)_RUN_OPT += --net=host --privileged -t $(DOCKER_DATABASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 44d3904d7394..6ae73be1ea22 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -1,12 +1,22 @@ # Docker image for DHCP relay -DOCKER_DHCP_RELAY = docker-dhcp-relay.gz +DOCKER_DHCP_RELAY_STEM = docker-dhcp-relay +DOCKER_DHCP_RELAY = $(DOCKER_DHCP_RELAY_STEM).gz +DOCKER_DHCP_RELAY_DBG = $(DOCKER_DHCP_RELAY_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay + $(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) +$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) +$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) + SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) $(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay $(DOCKER_DHCP_RELAY)_RUN_OPT += --net=host --privileged -t diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index f9a858611fa1..f9d084a9abbe 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -1,11 +1,23 @@ # docker image for fpm-frr -DOCKER_FPM_FRR = docker-fpm-frr.gz +DOCKER_FPM_FRR_STEM = docker-fpm-frr +DOCKER_FPM_FRR = $(DOCKER_FPM_FRR_STEM).gz +DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr + $(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS) +$(DOCKER_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) +$(DOCKER_FRR)_DBG_DEPENDS += $(FRR_DBG) $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) + +$(DOCKER_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG) + $(DOCKER_FPM_FRR)_CONTAINER_NAME = bgp $(DOCKER_FPM_FRR)_RUN_OPT += --net=host --privileged -t $(DOCKER_FPM_FRR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index d6404e18c47f..f4748915d806 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -1,15 +1,28 @@ # Docker image for SONiC platform monitoring tools -DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz +DOCKER_PLATFORM_MONITOR_STEM = docker-platform-monitor +DOCKER_PLATFORM_MONITOR = $(DOCKER_PLATFORM_MONITOR_STEM).gz +DOCKER_PLATFORM_MONITOR_DBG = $(DOCKER_PLATFORM_MONITOR_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor + $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SONIC_LEDD) $(SONIC_XCVRD) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) + +$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) +$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS += $(LIBSWSSCOMMON_DBG) + +$(DOCKER_PLATFORM_MONITOR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_PLATFORM_MONITOR_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_PLATFORM_MONITOR_DBG) + $(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 59e0e25ca9e2..88ae10be5fe2 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -1,12 +1,23 @@ # Docker image for router advertiser -DOCKER_ROUTER_ADVERTISER = docker-router-advertiser.gz +DOCKER_ROUTER_ADVERTISER_STEM = docker-router-advertiser +DOCKER_ROUTER_ADVERTISER = $(DOCKER_ROUTER_ADVERTISER_STEM).gz +DOCKER_ROUTER_ADVERTISER_DBG = $(DOCKER_ROUTER_ADVERTISER_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/docker-router-advertiser + $(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(RADVD) $(REDIS_TOOLS) +$(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) + +$(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE) + SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_ROUTER_ADVERTISER_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_ROUTER_ADVERTISER_DBG) $(DOCKER_ROUTER_ADVERTISER)_CONTAINER_NAME = radv $(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += --net=host --privileged -t diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index f4a2c7d412df..fa76d666c7a2 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -1,12 +1,25 @@ # docker image for teamd agent -DOCKER_TEAMD = docker-teamd.gz +DOCKER_TEAMD_STEM = docker-teamd +DOCKER_TEAMD = $(DOCKER_TEAMD_STEM).gz +DOCKER_TEAMD_DBG = $(DOCKER_TEAMD_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/docker-teamd + $(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(REDIS_TOOLS) +$(DOCKER_TEAMD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) +$(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) + +$(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_TEAMD_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_TEAMD_DBG) + $(DOCKER_TEAMD)_CONTAINER_NAME = teamd $(DOCKER_TEAMD)_RUN_OPT += --net=host --privileged -t $(DOCKER_TEAMD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index fca3b8a39a70..64b7aa6fbdcf 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -1,14 +1,27 @@ # docker image for telemetry agent -DOCKER_TELEMETRY = docker-sonic-telemetry.gz +DOCKER_TELEMETRY_STEM = docker-sonic-telemetry +DOCKER_TELEMETRY = $(DOCKER_TELEMETRY_STEM).gz +DOCKER_TELEMETRY_DBG = $(DOCKER_TELEMETRY_STEM)-$(DBG_IMAGE_MARK).gz + $(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/docker-sonic-telemetry + $(DOCKER_TELEMETRY)_DEPENDS += $(REDIS_TOOLS) $(SONIC_TELEMETRY) +$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) + $(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) + SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) ifeq ($(ENABLE_SYSTEM_TELEMETRY), y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TELEMETRY) endif +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_TELEMETRY_DBG) +ifeq ($(ENABLE_SYSTEM_TELEMETRY), y) + SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_TELEMETRY_DBG) +endif + $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_RUN_OPT += --net=host --privileged -t $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/frr.mk b/rules/frr.mk index 2b7cc1fa14e4..ca2ece09cd3d 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -7,3 +7,7 @@ FRR = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb $(FRR)_DEPENDS += $(LIBSNMP_DEV) $(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr SONIC_MAKE_DEBS += $(FRR) + +FRR_DBG = frr-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_DBG))) + diff --git a/slave.mk b/slave.mk index b4b7f8de1f92..e2e3d2729ef2 100644 --- a/slave.mk +++ b/slave.mk @@ -28,6 +28,7 @@ DEBS_PATH = $(TARGET_PATH)/debs FILES_PATH = $(TARGET_PATH)/files PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels PROJECT_ROOT = $(shell pwd) +DBG_IMAGE_MARK = dbg CONFIGURED_PLATFORM := $(shell [ -f .platform ] && cat .platform || echo generic) PLATFORM_PATH = platform/$(CONFIGURED_PLATFORM) @@ -492,9 +493,40 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) +# Targets for building debug docker images +$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAGE_MARK).gz : .platform docker-start \ + $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DBG_DEPENDS)) \ + $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$*.gz)) + $(HEADER) + # Apply series of patches if exist + mkdir -p $($*.gz_PATH)/debs $(LOG) + sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/debs $(LOG) + # Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')) + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_IMAGE_PACKAGES)))\n" | awk '!a[$$0]++')) + ./build_debug_docker_j2.sh $* $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs > $($*.gz_PATH)/Dockerfile-dbg.j2 + j2 $($*.gz_PATH)/Dockerfile-dbg.j2 > $($*.gz_PATH)/Dockerfile-dbg + docker info $(LOG) + docker build \ + $(if $($*.gz_DBG_DEPENDS), --squash --no-cache) \ + --build-arg http_proxy=$(HTTP_PROXY) \ + --build-arg https_proxy=$(HTTPS_PROXY) \ + --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ + --label Tag=$(SONIC_GET_VERSION) \ + --file $($*.gz_PATH)/Dockerfile-dbg \ + -t $*-dbg $($*.gz_PATH) $(LOG) + docker save $*-dbg | gzip -c > $@ + # Clean up + if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; popd; fi + $(FOOTER) + +SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_DBG_IMAGES)) + DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ - $(SONIC_DOCKER_IMAGES))) + $(SONIC_DOCKER_IMAGES) \ + $(SONIC_DOCKER_DBG_IMAGES))) + $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz $(HEADER) docker load -i $(TARGET_PATH)/$*.gz $(LOG) @@ -551,19 +583,19 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" - export docker_container_name="$($(docker)_CONTAINER_NAME)" - $(eval $(docker)_RUN_OPT += $($(docker)_$($*_IMAGE_TYPE)_RUN_OPT)) - export docker_image_run_opt="$($(docker)_RUN_OPT)" - j2 files/build_templates/docker_image_ctl.j2 > $($(docker)_CONTAINER_NAME).sh - if [ -f files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 ]; then - j2 files/build_templates/$($(docker)_CONTAINER_NAME).service.j2 > $($(docker)_CONTAINER_NAME).service + export docker_container_name="$($(docker:-dbg.gz=.gz)_CONTAINER_NAME)" + $(eval $(docker:-dbg.gz=.gz)_RUN_OPT += $($(docker:-dbg.gz=.gz)_$($*_IMAGE_TYPE)_RUN_OPT)) + export docker_image_run_opt="$($(docker:-dbg.gz=.gz)_RUN_OPT)" + j2 files/build_templates/docker_image_ctl.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).sh + if [ -f files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then + j2 files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service fi - chmod +x $($(docker)_CONTAINER_NAME).sh + chmod +x $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).sh ) - export installer_start_scripts="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))" - export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))" - export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker)_BASE_IMAGE_FILES), $($(docker)_PATH)/base_image_files/$(file)))" + export installer_start_scripts="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME)))" + export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME)))" + export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker:-dbg.gz=.gz)_BASE_IMAGE_FILES), $($(docker:-dbg.gz=.gz)_PATH)/base_image_files/$(file)))" j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs @@ -575,6 +607,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ chmod +x sonic_debian_extension.sh, ) + DEBUG_IMG="$(INSTALL_DEBUG_TOOLS)" \ USERNAME="$(USERNAME)" \ PASSWORD="$(PASSWORD)" \ ./build_debian.sh $(LOG) @@ -586,8 +619,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ ./build_image.sh $(LOG) $(foreach docker, $($*_DOCKERS), \ - rm -f $($(docker)_CONTAINER_NAME).sh - rm -f $($(docker)_CONTAINER_NAME).service + rm -f $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).sh + rm -f $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service ) $(if $($*_DOCKERS), @@ -627,6 +660,7 @@ $(SONIC_CLEAN_FILES) : $(FILES_PATH)/%-clean : .platform SONIC_CLEAN_TARGETS += $(addsuffix -clean,$(addprefix $(TARGET_PATH)/, \ $(SONIC_DOCKER_IMAGES) \ + $(SONIC_DOCKER_DBG_IMAGES) \ $(SONIC_SIMPLE_DOCKER_IMAGES) \ $(SONIC_INSTALLERS))) $(SONIC_CLEAN_TARGETS) : $(TARGET_PATH)/%-clean : .platform diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index d5db7168bf11..1b087a78185e 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -3,6 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb +DERIVED_TARGET = $(FRR_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : @@ -35,7 +36,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # build package dpkg-buildpackage -rfakeroot -b -us -uc cd .. - mv $* $(DEST)/ + mv $(DERIVED_TARGET) $* $(DEST)/ popd +$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From 30a8d1d8f060dce02868a8a23b550f45d0e1d169 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sun, 7 Jul 2019 00:41:14 -0700 Subject: [PATCH 145/219] [sshd] Close all SSH connetions after 15 minutes of inactivity (#3031) - What I did Configure sshd to close all SSH connetions after 15 minutes of inactivity. - How I did it Set ClientAliveInterval to 900 (900 seconds = 15 minutes) and ClientAliveCountMax to 0 in /etc/ssh/sshd_config using augtool in build_debian.sh. In the process, I refactored the existing augtool command for sshd_config so as to add comments and empty lines to file for readability. - How to verify it Log into device via management port. Wait 15 minutes without sending a keystroke -- you should be automatically logged out. --- build_debian.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index ebb25a171d7f..1e4454ce0b99 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -278,8 +278,28 @@ sudo chmod u+s $FILESYSTEM_ROOT/bin/ping{,6} sudo rm -f $FILESYSTEM_ROOT/etc/ssh/ssh_host_*_key* sudo cp files/sshd/host-ssh-keygen.sh $FILESYSTEM_ROOT/usr/local/bin/ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.service -## Config sshd -sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT +# Config sshd +# 1. Set 'UseDNS' to 'no' +# 2. Configure sshd to close all SSH connetions after 15 minutes of inactivity +sudo augtool -r $FILESYSTEM_ROOT <<'EOF' +touch /files/etc/ssh/sshd_config/EmptyLineHack +rename /files/etc/ssh/sshd_config/EmptyLineHack "" +set /files/etc/ssh/sshd_config/UseDNS no +ins #comment before /files/etc/ssh/sshd_config/UseDNS +set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::UseDNS]] "Disable hostname lookups" + +rm /files/etc/ssh/sshd_config/ClientAliveInterval +rm /files/etc/ssh/sshd_config/ClientAliveCountMax +touch /files/etc/ssh/sshd_config/EmptyLineHack +rename /files/etc/ssh/sshd_config/EmptyLineHack "" +set /files/etc/ssh/sshd_config/ClientAliveInterval 900 +set /files/etc/ssh/sshd_config/ClientAliveCountMax 0 +ins #comment before /files/etc/ssh/sshd_config/ClientAliveInterval +set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::ClientAliveInterval]] "Close inactive client sessions after 15 minutes" +save +quit +EOF +# Configure sshd to listen for v4 connections; disable listening for v6 connections sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/sshd_config sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config From cf4ab3e64623762b370f8c87dd0e5ba417c8de3c Mon Sep 17 00:00:00 2001 From: paavaanan Date: Sun, 23 Jun 2019 05:45:22 +0530 Subject: [PATCH 146/219] [devices]: DellEMC Z9264f remove 115200 baud-ratesupport (#3046) --- device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf index 925a32fc0c3a..924e0fb81963 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf @@ -1,3 +1,2 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=115200 From c93230289279adfb3454bf8dd0eca90d221c3524 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Wed, 26 Jun 2019 22:46:58 +0300 Subject: [PATCH 147/219] fix fast reboot compatibility (#3083) * fix fast reboot compatibility We should handle both cases for backward-compatible with 201803: - fast-reboot - SONIC_BOOT_TYPE=fast-reboot * handle review comments * add a comment that getBootType code snippet is shared between two files --- files/build_templates/docker_image_ctl.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 788074db1a6f..426e519f1e48 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -134,6 +134,9 @@ start() { echo "Creating new {{docker_container_name}} container" {%- else %} echo "Creating new {{docker_container_name}} container with HWSKU $HWSKU" +{%- endif %} +{%- if sonic_asic_platform == "mellanox" %} + # TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version {%- endif %} docker create {{docker_image_run_opt}} \ {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} From 1115c8431dbae0755cc443b70529f6606ee78972 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 3 Jul 2019 10:38:20 -0700 Subject: [PATCH 148/219] [reboot-cause]: Move reboot cause processing to its own service, 'process-reboot-cause' (#3102) --- .../build_templates/sonic_debian_extension.j2 | 5 ++ files/image_config/platform/rc.local | 32 ------- .../process-reboot-cause/process-reboot-cause | 89 +++++++++++++++++++ .../process-reboot-cause.service | 10 +++ 4 files changed, 104 insertions(+), 32 deletions(-) create mode 100755 files/image_config/process-reboot-cause/process-reboot-cause create mode 100644 files/image_config/process-reboot-cause/process-reboot-cause.service diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 5127c5bf6a9b..9c6e8a553206 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -220,6 +220,11 @@ sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd.service $FILESYSTEM_ROOT/etc/systemd/s sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable caclmgrd.service sudo cp $IMAGE_CONFIGS/caclmgrd/caclmgrd $FILESYSTEM_ROOT/usr/bin/ +# Copy process-reboot-cause service files +sudo cp $IMAGE_CONFIGS/process-reboot-cause/process-reboot-cause.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable process-reboot-cause.service +sudo cp $IMAGE_CONFIGS/process-reboot-cause/process-reboot-cause $FILESYSTEM_ROOT/usr/bin/ + ## Install package without starting service ## ref: https://wiki.debian.org/chroot sudo tee -a $FILESYSTEM_ROOT/usr/sbin/policy-rc.d > /dev/null < $PREVIOUS_REBOOT_CAUSE_FILE - fi - - # If there is an existing REBOOT_CAUSE_FILE, copy that file to - # PREVIOUS_REBOOT_CAUSE_FILE. - if [ -f $REBOOT_CAUSE_FILE ]; then - mv -f $REBOOT_CAUSE_FILE $PREVIOUS_REBOOT_CAUSE_FILE - else - echo "Unknown reboot cause" > $PREVIOUS_REBOOT_CAUSE_FILE - fi - - # Log the previous reboot cause to the syslog - logger "Previous reboot cause: $(cat $PREVIOUS_REBOOT_CAUSE_FILE)" - - # Set the default cause for the next reboot - echo "Unexpected reboot" > $REBOOT_CAUSE_FILE -} - program_console_speed() { speed=$(cat /proc/cmdline | grep -Eo 'console=ttyS[0-9]+,[0-9]+' | cut -d "," -f2) @@ -150,9 +121,6 @@ program_console_speed() #### Begin Main Body #### -# Set up previous and next reboot cause files -process_reboot_cause - # If the machine.conf is absent, it indicates that the unit booted # into SONiC from another NOS. Extract the machine.conf from ONIE. if [ ! -e /host/machine.conf ]; then diff --git a/files/image_config/process-reboot-cause/process-reboot-cause b/files/image_config/process-reboot-cause/process-reboot-cause new file mode 100755 index 000000000000..d75924f2988e --- /dev/null +++ b/files/image_config/process-reboot-cause/process-reboot-cause @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# process-reboot-cause +# +# Program designed to run once, soon after system boot which will +# determine the cause of the previous reboot and store it to the disk, +# + +try: + import os + import pwd + import subprocess + import sys + import syslog + import sonic_platform + from sonic_daemon_base.daemon_base import Logger +except ImportError as err: + raise ImportError("%s - required module not found" % str(err)) + +VERSION = "1.0" + +SYSLOG_IDENTIFIER = "process-reboot-cause" + +# Global logger instance +logger = Logger(SYSLOG_IDENTIFIER) + +REBOOT_CAUSE_DIR = "/host/reboot-cause/" +REBOOT_CAUSE_FILE = REBOOT_CAUSE_DIR + "reboot-cause.txt" +PREVIOUS_REBOOT_CAUSE_FILE = REBOOT_CAUSE_DIR + "previous-reboot-cause.txt" + +UNKNOWN_REBOOT_CAUSE = "Unknown" + + +def main(): + logger.log_info("Starting up...") + + if not os.geteuid() == 0: + logger.log_error("User {} does not have permission to execute".format(pwd.getpwuid(os.getuid()).pw_name)) + sys.exit("This utility must be run as root") + + # Create REBOOT_CAUSE_DIR if it doesn't exist + if not os.path.exists(REBOOT_CAUSE_DIR): + os.makedirs(REBOOT_CAUSE_DIR) + + # Remove stale PREVIOUS_REBOOT_CAUSE_FILE if it exists + if os.path.exists(PREVIOUS_REBOOT_CAUSE_FILE): + os.remove(PREVIOUS_REBOOT_CAUSE_FILE) + + # Check if the previous reboot was caused by hardware + platform = sonic_platform.platform.Platform() + + chassis = platform.get_chassis() + + hardware_reboot_cause, optional_details = chassis.get_reboot_cause() + + # Set a default previous reboot cause + previous_reboot_cause = UNKNOWN_REBOOT_CAUSE + + if hardware_reboot_cause == chassis.REBOOT_CAUSE_NON_HARDWARE: + # The reboot was not caused by hardware. If there is a REBOOT_CAUSE_FILE, it will + # contain any software-related reboot info. We will use it as the previous cause. + if os.path.isfile(REBOOT_CAUSE_FILE): + cause_file = open(REBOOT_CAUSE_FILE, "r") + previous_reboot_cause = cause_file.readline().rstrip('\n') + cause_file.close() + elif hardware_reboot_cause == chassis.REBOOT_CAUSE_HARDWARE_OTHER: + previous_reboot_cause = "{} ({})".format(hardware_reboot_cause, optional_details) + else: + previous_reboot_cause = hardware_reboot_cause + + # Write the previous reboot cause to PREVIOUS_REBOOT_CAUSE_FILE + prev_cause_file = open(PREVIOUS_REBOOT_CAUSE_FILE, "w") + prev_cause_file.write(previous_reboot_cause) + prev_cause_file.close() + + # Also log the previous reboot cause to the syslog + logger.log_info("Previous reboot cause: {}".format(previous_reboot_cause)) + + # Remove the old REBOOT_CAUSE_FILE + os.remove(REBOOT_CAUSE_FILE) + + # Write a new default reboot cause file for the next reboot + cause_file = open(REBOOT_CAUSE_FILE, "w") + cause_file.write(UNKNOWN_REBOOT_CAUSE) + cause_file.close() + + +if __name__ == "__main__": + main() diff --git a/files/image_config/process-reboot-cause/process-reboot-cause.service b/files/image_config/process-reboot-cause/process-reboot-cause.service new file mode 100644 index 000000000000..a429339dbe58 --- /dev/null +++ b/files/image_config/process-reboot-cause/process-reboot-cause.service @@ -0,0 +1,10 @@ +[Unit] +Description=Reboot cause determination service +After=rc-local.service + +[Service] +Type=simple +ExecStart=/usr/bin/process-reboot-cause + +[Install] +WantedBy=multi-user.target From 4b5abd048bf54b6428c06472ab17c9ee54089c54 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 9 Jul 2019 03:29:57 +0300 Subject: [PATCH 149/219] [swss.sh]: Cleanup LAG entries in STATE DB (#3114) Signed-off-by: Stepan Blyschak --- files/scripts/swss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 5093e4c7f9fd..88bce037b9c4 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -104,7 +104,7 @@ start() { /usr/bin/docker exec database redis-cli -n 1 FLUSHDB /usr/bin/docker exec database redis-cli -n 2 FLUSHDB /usr/bin/docker exec database redis-cli -n 5 FLUSHDB - clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*'" + clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*'" fi # start service docker From c3932e501b23131e429f440ad346cf0cabdc5984 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 5 Jul 2019 17:53:49 -0700 Subject: [PATCH 150/219] [process-reboot-cause] Handle case if platform does not yet have sonic_platform implementation (#3126) --- .../process-reboot-cause/process-reboot-cause | 76 +++++++++++++------ 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/files/image_config/process-reboot-cause/process-reboot-cause b/files/image_config/process-reboot-cause/process-reboot-cause index d75924f2988e..0d5ae78137fa 100755 --- a/files/image_config/process-reboot-cause/process-reboot-cause +++ b/files/image_config/process-reboot-cause/process-reboot-cause @@ -9,11 +9,8 @@ try: import os import pwd - import subprocess import sys import syslog - import sonic_platform - from sonic_daemon_base.daemon_base import Logger except ImportError as err: raise ImportError("%s - required module not found" % str(err)) @@ -21,9 +18,6 @@ VERSION = "1.0" SYSLOG_IDENTIFIER = "process-reboot-cause" -# Global logger instance -logger = Logger(SYSLOG_IDENTIFIER) - REBOOT_CAUSE_DIR = "/host/reboot-cause/" REBOOT_CAUSE_FILE = REBOOT_CAUSE_DIR + "reboot-cause.txt" PREVIOUS_REBOOT_CAUSE_FILE = REBOOT_CAUSE_DIR + "previous-reboot-cause.txt" @@ -31,11 +25,33 @@ PREVIOUS_REBOOT_CAUSE_FILE = REBOOT_CAUSE_DIR + "previous-reboot-cause.txt" UNKNOWN_REBOOT_CAUSE = "Unknown" +# ========================== Syslog wrappers ========================== + +def log_info(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + + +def log_warning(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + +def log_error(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + + +# ============================= Functions ============================= + def main(): - logger.log_info("Starting up...") + log_info("Starting up...") if not os.geteuid() == 0: - logger.log_error("User {} does not have permission to execute".format(pwd.getpwuid(os.getuid()).pw_name)) + log_error("User {} does not have permission to execute".format(pwd.getpwuid(os.getuid()).pw_name)) sys.exit("This utility must be run as root") # Create REBOOT_CAUSE_DIR if it doesn't exist @@ -46,27 +62,43 @@ def main(): if os.path.exists(PREVIOUS_REBOOT_CAUSE_FILE): os.remove(PREVIOUS_REBOOT_CAUSE_FILE) - # Check if the previous reboot was caused by hardware - platform = sonic_platform.platform.Platform() - - chassis = platform.get_chassis() - - hardware_reboot_cause, optional_details = chassis.get_reboot_cause() # Set a default previous reboot cause previous_reboot_cause = UNKNOWN_REBOOT_CAUSE - if hardware_reboot_cause == chassis.REBOOT_CAUSE_NON_HARDWARE: - # The reboot was not caused by hardware. If there is a REBOOT_CAUSE_FILE, it will - # contain any software-related reboot info. We will use it as the previous cause. + # Until all platform vendors have provided sonic_platform packages, + # if there is no sonic_platform package installed, we only provide + # software-related reboot causes. + try: + import sonic_platform + + # Check if the previous reboot was caused by hardware + platform = sonic_platform.platform.Platform() + + chassis = platform.get_chassis() + + hardware_reboot_cause, optional_details = chassis.get_reboot_cause() + + if hardware_reboot_cause == chassis.REBOOT_CAUSE_NON_HARDWARE: + # The reboot was not caused by hardware. If there is a REBOOT_CAUSE_FILE, it will + # contain any software-related reboot info. We will use it as the previous cause. + if os.path.isfile(REBOOT_CAUSE_FILE): + cause_file = open(REBOOT_CAUSE_FILE, "r") + previous_reboot_cause = cause_file.readline().rstrip('\n') + cause_file.close() + elif hardware_reboot_cause == chassis.REBOOT_CAUSE_HARDWARE_OTHER: + previous_reboot_cause = "{} ({})".format(hardware_reboot_cause, optional_details) + else: + previous_reboot_cause = hardware_reboot_cause + except ImportError as err: + log_warning("sonic_platform package not installed. Unable to detect hardware reboot causes.") + + # If there is a REBOOT_CAUSE_FILE, it will contain any software-related + # reboot info. We will use it as the previous cause. if os.path.isfile(REBOOT_CAUSE_FILE): cause_file = open(REBOOT_CAUSE_FILE, "r") previous_reboot_cause = cause_file.readline().rstrip('\n') cause_file.close() - elif hardware_reboot_cause == chassis.REBOOT_CAUSE_HARDWARE_OTHER: - previous_reboot_cause = "{} ({})".format(hardware_reboot_cause, optional_details) - else: - previous_reboot_cause = hardware_reboot_cause # Write the previous reboot cause to PREVIOUS_REBOOT_CAUSE_FILE prev_cause_file = open(PREVIOUS_REBOOT_CAUSE_FILE, "w") @@ -74,7 +106,7 @@ def main(): prev_cause_file.close() # Also log the previous reboot cause to the syslog - logger.log_info("Previous reboot cause: {}".format(previous_reboot_cause)) + log_info("Previous reboot cause: {}".format(previous_reboot_cause)) # Remove the old REBOOT_CAUSE_FILE os.remove(REBOOT_CAUSE_FILE) From 0c77acf2eaf5962960453ecee8c5cb4d9013130d Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 9 Jul 2019 22:47:44 +0800 Subject: [PATCH 151/219] [Mellanox] Fix the memory leak in mlnx-sfpd (#3128) * fix the memory leak in on_pmpe. objects created via sx_api having convention new_ should be release explicitly via delete_. * avoid duplicate code. --- platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index 08d1f1188005..20bd14ffb4c1 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -205,36 +205,40 @@ class MlnxSfpd: pkt = new_uint8_t_arr(pkt_size) recv_info_p = new_sx_receive_info_t_p() pmpe_t = sx_event_pmpe_t() - logical_port_list = new_sx_port_log_id_t_arr(4) port_attributes_list = new_sx_port_attributes_t_arr(64) port_cnt_p = new_uint32_t_p() uint32_t_p_assign(port_cnt_p,64) label_port_list = [] - status = True module_state = 0 rc = sx_lib_host_ifc_recv(fd_p, pkt, pkt_size_p, recv_info_p) if rc != 0: log_error("sx_lib_host_ifc_recv exited with error, rc %d" % rc) status = False - return status, label_port_list, module_state - - pmpe_t = recv_info_p.event_info.pmpe - port_list_size = pmpe_t.list_size - logical_port_list = pmpe_t.log_port_list - module_state = pmpe_t.module_state - - for i in xrange(port_list_size): - logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) - rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p) - port_cnt = uint32_t_p_value(port_cnt_p) - - for i in xrange(port_cnt): - port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) - if port_attributes.log_port == logical_port: - lable_port = port_attributes.port_mapping.module_port - break - label_port_list.append(lable_port) + else: + status = True + pmpe_t = recv_info_p.event_info.pmpe + port_list_size = pmpe_t.list_size + logical_port_list = pmpe_t.log_port_list + module_state = pmpe_t.module_state + + for i in xrange(port_list_size): + logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) + rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p) + port_cnt = uint32_t_p_value(port_cnt_p) + + for i in xrange(port_cnt): + port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) + if port_attributes.log_port == logical_port: + lable_port = port_attributes.port_mapping.module_port + break + label_port_list.append(lable_port) + + delete_uint32_t_p(pkt_size_p) + delete_uint8_t_arr(pkt) + delete_sx_receive_info_t_p(recv_info_p) + delete_sx_port_attributes_t_arr(port_attributes_list) + delete_uint32_t_p(port_cnt_p) return status, label_port_list, module_state, From 11667821a6a08e2b1dc1b0b3971d38c0c793b920 Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Sat, 29 Jun 2019 10:19:12 +0530 Subject: [PATCH 152/219] [devices]: DELLEMC: Z9100,S6100 Exporting Device Last PowerOn Reason (#3059) --- .../common/dell_pmc.c | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c index b8ed4bbb082b..141f41ba4a03 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c @@ -44,8 +44,9 @@ #define SMF_ADDR_REG_OFFSET 0 #define SMF_READ_DATA_REG_OFFSET 2 #define SMF_REG_ADDR 0x200 -#define SMF_PROBE_ADDR 0x210 +#define SMF_POR_SRC_REG 0x209 #define SMF_RST_SRC_REG 0x20A +#define SMF_PROBE_ADDR 0x210 #define SIO_REG_DEVID 0x1 #define SIO_Z9100_ID 0x1 @@ -507,9 +508,7 @@ static ssize_t show_smf_version(struct device *dev, static ssize_t show_reset_reason(struct device *dev, struct device_attribute *devattr, char *buf) { - int index = to_sensor_dev_attr(devattr)->index; - unsigned int ret = 0, val = 0; - struct smf_data *data = dev_get_drvdata(dev); + unsigned int ret = 0; ret = inb(SMF_RST_SRC_REG); @@ -519,6 +518,19 @@ static ssize_t show_reset_reason(struct device *dev, return sprintf(buf, "%x\n", ret); } +/* SMF Power ON Reason */ +static ssize_t show_power_on_reason(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + unsigned int ret = 0; + + ret = inb(SMF_POR_SRC_REG); + + if(ret < 0) + return ret; + + return sprintf(buf, "%x\n", ret); +} /* FANIN ATTR */ static ssize_t @@ -1800,11 +1812,15 @@ static SENSOR_DEVICE_ATTR(smf_firmware_ver, S_IRUGO, show_smf_version, NULL, 1); /* SMF Reset Reason */ static SENSOR_DEVICE_ATTR(smf_reset_reason, S_IRUGO, show_reset_reason, NULL, 1); +/* SMF PowerOn Reason */ +static SENSOR_DEVICE_ATTR(smf_poweron_reason, S_IRUGO, + show_power_on_reason, NULL, 1); static struct attribute *smf_dell_attrs[] = { &sensor_dev_attr_smf_version.dev_attr.attr, &sensor_dev_attr_smf_firmware_ver.dev_attr.attr, &sensor_dev_attr_smf_reset_reason.dev_attr.attr, + &sensor_dev_attr_smf_poweron_reason.dev_attr.attr, &sensor_dev_attr_fan_tray_presence.dev_attr.attr, &sensor_dev_attr_fan1_airflow.dev_attr.attr, &sensor_dev_attr_fan3_airflow.dev_attr.attr, @@ -1818,7 +1834,7 @@ static struct attribute *smf_dell_attrs[] = { &sensor_dev_attr_psu1_presence.dev_attr.attr, &sensor_dev_attr_psu2_presence.dev_attr.attr, &sensor_dev_attr_current_total_power.dev_attr.attr, - NULL + NULL }; static const struct attribute_group smf_dell_group = { From 58b3c62094ec63e89fe5b9d35d0ddc698ecd3709 Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Thu, 11 Jul 2019 07:35:31 -0700 Subject: [PATCH 153/219] [nephos]: update sai and sdk support 4.9.0-9 (#3137) --- platform/nephos/sai.mk | 6 +++--- platform/nephos/sdk.mk | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 4bfa27999259..0cf8e4698e16 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,6 +1,6 @@ -SDK_VERSION = 2.0.5 -SAI_VERSION = 1.3.5 -SAI_COMMIT_ID = 575f90 +SDK_VERSION = 2.0.7 +SAI_VERSION = 1.3.6 +SAI_COMMIT_ID = 2016d4 NEPHOS_SAI = libsainps_$(SDK_VERSION)_sai_$(SAI_VERSION)_$(SAI_COMMIT_ID)_amd64.deb $(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_$(SDK_VERSION)_sai_$(SAI_VERSION)_$(SAI_COMMIT_ID)_amd64.deb" diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 2cf92d12c12f..9ca3d8754468 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,6 +1,6 @@ -SDK_VERSION = 2.0.5 +SDK_VERSION = 2.0.7 LINUX_VER = 4.9.0-9 -SDK_COMMIT_ID = f2e56f +SDK_COMMIT_ID = 4ce00c NEPHOS_NPS_KERNEL = nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb $(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb" From c78cbe72adf5692e85fa7235de138aac4ee071c1 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 11 Jul 2019 19:13:30 +0300 Subject: [PATCH 154/219] [Mellanox]: Fixed Mellanox ISSU dependency. (#3141) Signed-off-by: Nazarii Hnydyn --- platform/mellanox/docker-syncd-mlnx.mk | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 347eae81d3f8..a4eac46d48a8 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -4,11 +4,5 @@ DOCKER_SYNCD_PLATFORM_CODE = mlnx include $(PLATFORM_PATH)/../template/docker-syncd-base.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MLNX_SFPD) - -$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIMETADATA_DBG) \ - $(LIBSAIREDIS_DBG) - -$(DOCKER_SYNCD_MLNX)_RUN_OPT += -v /host/warmboot:/var/warmboot - +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) $(LIBSWSSCOMMON_DBG) $(LIBSAIMETADATA_DBG) $(LIBSAIREDIS_DBG) +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot From 264e828eb703b19db8d7c74e960e7e1604c0f8ad Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 30 Jan 2019 02:04:20 -0800 Subject: [PATCH 155/219] [kvm]: support for all hwsku in kvm switch (#2495) Signed-off-by: Guohan Lu --- .../Force10-S6000/buffers.json.j2 | 128 ---- .../Force10-S6000/lanemap.ini | 34 - .../Force10-S6000/pg_profile_lookup.ini | 17 - .../Force10-S6000/port_config.ini | 33 - .../Force10-S6000/qos.json.j2 | 1 - .../Force10-S6000/td2-s6000-32x40G.config.bcm | 646 ------------------ platform/vs/docker-sonic-vs.mk | 1 + platform/vs/docker-sonic-vs/Dockerfile.j2 | 3 +- rules/scripts.mk | 6 +- src/sonic-device-data/Makefile | 7 + .../sonic-device-data/src/sai.vs_profile | 0 11 files changed, 15 insertions(+), 861 deletions(-) delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/buffers.json.j2 delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/lanemap.ini delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/pg_profile_lookup.ini delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/port_config.ini delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/qos.json.j2 delete mode 100644 device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/td2-s6000-32x40G.config.bcm rename device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/sai.profile => src/sonic-device-data/src/sai.vs_profile (100%) diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/buffers.json.j2 deleted file mode 100644 index 551f73ca0477..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/buffers.json.j2 +++ /dev/null @@ -1,128 +0,0 @@ -{# Default values which will be used if no actual configura available #} -{% set default_cable = '300m' %} -{% set default_speed = '100G' %} -{% set default_ports_num = 32 -%} - -{# Port configuration to cable length look-up table #} -{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} -{# Roles described in the minigraph #} -{% set ports2cable = { - 'torrouter_server' : '5m', - 'leafrouter_torrouter' : '40m', - 'spinerouter_leafrouter' : '300m' - } -%} - -{%- macro cable_length(port_name) -%} - {%- set cable_len = [] -%} - {%- for local_port in DEVICE_NEIGHBOR -%} - {%- if local_port == port_name -%} - {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} - {%- set neighbor_role = neighbor.type -%} - {%- set roles1 = switch_role + '_' + neighbor_role %} - {%- set roles2 = neighbor_role + '_' + switch_role -%} - {%- set roles1 = roles1 | lower -%} - {%- set roles2 = roles2 | lower -%} - {%- if roles1 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} - {%- elif roles2 in ports2cable -%} - {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endif -%} - {%- endfor -%} - {%- if cable_len -%} - {{ cable_len.0 }} - {%- else -%} - {{ default_cable }} - {%- endif -%} -{% endmacro %} - -{%- if DEVICE_METADATA is defined %} -{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} -{%- endif -%} - -{# Generate list of ports if not defined #} -{% if PORT is not defined %} - {% set PORT = [] %} - {% for port_idx in range(0,default_ports_num) %} - {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} - {% endfor %} -{% endif -%} - -{% set port_names_list = [] %} -{% for port in PORT %} - {%- if port_names_list.append(port) %}{% endif %} -{% endfor %} -{% set port_names = port_names_list | join(',') -%} - -{ - "CABLE_LENGTH": { - "AZURE": { - {% for port in PORT %} - {% set cable = cable_length(port) -%} - "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} - - {% endfor %} - } - }, - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "12766208", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "12766208", - "type": "egress", - "mode": "static" - }, - "egress_lossy_pool": { - "size": "8072396", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "xon":"18432", - "xoff":"40560", - "size":"41808", - "dynamic_th":"-4", - "xon_offset":"2496" - }, - "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" - } - }, - "BUFFER_PG": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - } - }, - "BUFFER_QUEUE": { - "{{ port_names }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "{{ port_names }}|0-1": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - } - } -} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/lanemap.ini deleted file mode 100644 index 16a4d5b9ac78..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/lanemap.ini +++ /dev/null @@ -1,34 +0,0 @@ -; comment -# comment -eth1:29,30,31,32 -eth2:25,26,27,28 -eth3:37,38,39,40 -eth4:33,34,35,36 -eth5:41,42,43,44 -eth6:45,46,47,48 -eth7:5,6,7,8 -eth8:1,2,3,4 -eth9:9,10,11,12 -eth10:13,14,15,16 -eth11:21,22,23,24 -eth12:17,18,19,20 -eth13:49,50,51,52 -eth14:53,54,55,56 -eth15:61,62,63,64 -eth16:57,58,59,60 -eth17:65,66,67,68 -eth18:69,70,71,72 -eth19:77,78,79,80 -eth20:73,74,75,76 -eth21:105,106,107,108 -eth22:109,110,111,112 -eth23:117,118,119,120 -eth24:113,114,115,116 -eth25:121,122,123,124 -eth26:125,126,127,128 -eth27:85,86,87,88 -eth28:81,82,83,84 -eth29:89,90,91,92 -eth30:93,94,95,96 -eth31:97,98,99,100 -eth32:101,102,103,104 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/pg_profile_lookup.ini deleted file mode 100644 index 3b2a417cebcd..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 -4 2288 - 25000 5m 1248 2288 53248 -4 2288 - 40000 5m 1248 2288 66560 -4 2288 - 50000 5m 1248 2288 90272 -4 2288 - 100000 5m 1248 2288 165568 -4 2288 - 10000 40m 1248 2288 37024 -4 2288 - 25000 40m 1248 2288 53248 -4 2288 - 40000 40m 1248 2288 71552 -4 2288 - 50000 40m 1248 2288 96096 -4 2288 - 100000 40m 1248 2288 177632 -4 2288 - 10000 300m 1248 2288 46176 -4 2288 - 25000 300m 1248 2288 79040 -4 2288 - 40000 300m 1248 2288 108160 -4 2288 - 50000 300m 1248 2288 141856 -4 2288 - 100000 300m 1248 2288 268736 -4 2288 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/port_config.ini deleted file mode 100644 index 06898f1d7964..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/port_config.ini +++ /dev/null @@ -1,33 +0,0 @@ -# name lanes alias -Ethernet0 29,30,31,32 fortyGigE0/0 -Ethernet4 25,26,27,28 fortyGigE0/4 -Ethernet8 37,38,39,40 fortyGigE0/8 -Ethernet12 33,34,35,36 fortyGigE0/12 -Ethernet16 41,42,43,44 fortyGigE0/16 -Ethernet20 45,46,47,48 fortyGigE0/20 -Ethernet24 5,6,7,8 fortyGigE0/24 -Ethernet28 1,2,3,4 fortyGigE0/28 -Ethernet32 9,10,11,12 fortyGigE0/32 -Ethernet36 13,14,15,16 fortyGigE0/36 -Ethernet40 21,22,23,24 fortyGigE0/40 -Ethernet44 17,18,19,20 fortyGigE0/44 -Ethernet48 49,50,51,52 fortyGigE0/48 -Ethernet52 53,54,55,56 fortyGigE0/52 -Ethernet56 61,62,63,64 fortyGigE0/56 -Ethernet60 57,58,59,60 fortyGigE0/60 -Ethernet64 65,66,67,68 fortyGigE0/64 -Ethernet68 69,70,71,72 fortyGigE0/68 -Ethernet72 77,78,79,80 fortyGigE0/72 -Ethernet76 73,74,75,76 fortyGigE0/76 -Ethernet80 105,106,107,108 fortyGigE0/80 -Ethernet84 109,110,111,112 fortyGigE0/84 -Ethernet88 117,118,119,120 fortyGigE0/88 -Ethernet92 113,114,115,116 fortyGigE0/92 -Ethernet96 121,122,123,124 fortyGigE0/96 -Ethernet100 125,126,127,128 fortyGigE0/100 -Ethernet104 85,86,87,88 fortyGigE0/104 -Ethernet108 81,82,83,84 fortyGigE0/108 -Ethernet112 89,90,91,92 fortyGigE0/112 -Ethernet116 93,94,95,96 fortyGigE0/116 -Ethernet120 97,98,99,100 fortyGigE0/120 -Ethernet124 101,102,103,104 fortyGigE0/124 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/qos.json.j2 deleted file mode 100644 index 3e548325ea30..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/qos.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/td2-s6000-32x40G.config.bcm deleted file mode 100644 index 068b587202bd..000000000000 --- a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/td2-s6000-32x40G.config.bcm +++ /dev/null @@ -1,646 +0,0 @@ -# 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=29:40 -xgxs_rx_lane_map_1=0x213 -xgxs_tx_lane_map_1=0x213 -phy_xaui_rx_polarity_flip_1=0xc -phy_xaui_tx_polarity_flip_1=0x9 -serdes_driver_current_lane0_xe0=0x6 -serdes_driver_current_lane1_xe0=0x7 -serdes_driver_current_lane2_xe0=0x6 -serdes_driver_current_lane3_xe0=0x6 -serdes_pre_driver_current_lane0_xe0=0x6 -serdes_pre_driver_current_lane1_xe0=0x7 -serdes_pre_driver_current_lane2_xe0=0x6 -serdes_pre_driver_current_lane3_xe0=0x6 -serdes_preemphasis_lane0_xe0=0xc2f0 -serdes_preemphasis_lane1_xe0=0xd2b0 -serdes_preemphasis_lane2_xe0=0xc6e0 -serdes_preemphasis_lane3_xe0=0xc2f0 - -# xe1 (40G) -portmap_2=25:40 -xgxs_rx_lane_map_2=0x213 -xgxs_tx_lane_map_2=0x2031 -phy_xaui_rx_polarity_flip_2=0xe -phy_xaui_tx_polarity_flip_2=0x2 -serdes_driver_current_lane0_xe1=0x5 -serdes_driver_current_lane1_xe1=0x5 -serdes_driver_current_lane2_xe1=0x5 -serdes_driver_current_lane3_xe1=0x5 -serdes_pre_driver_current_lane0_xe1=0x5 -serdes_pre_driver_current_lane1_xe1=0x5 -serdes_pre_driver_current_lane2_xe1=0x5 -serdes_pre_driver_current_lane3_xe1=0x5 -serdes_preemphasis_lane0_xe1=0xcad0 -serdes_preemphasis_lane1_xe1=0xc6e0 -serdes_preemphasis_lane2_xe1=0xc6e0 -serdes_preemphasis_lane3_xe1=0xd2b0 - -# xe2 (40G) -portmap_3=37:40 -xgxs_rx_lane_map_3=0x213 -xgxs_tx_lane_map_3=0x1203 -phy_xaui_rx_polarity_flip_3=0x3 -phy_xaui_tx_polarity_flip_3=0xe -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=0xcad0 -serdes_preemphasis_lane1_xe2=0xcad0 -serdes_preemphasis_lane2_xe2=0xc2f0 -serdes_preemphasis_lane3_xe2=0xc2f0 - -# xe3 (40G) -portmap_4=33:40 -xgxs_rx_lane_map_4=0x213 -xgxs_tx_lane_map_4=0x132 -phy_xaui_rx_polarity_flip_4=0xe -phy_xaui_tx_polarity_flip_4=0x2 -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=0xc6e0 -serdes_preemphasis_lane1_xe3=0xc6e0 -serdes_preemphasis_lane2_xe3=0xc6e0 -serdes_preemphasis_lane3_xe3=0xc6e0 - -# xe4 (40G) -portmap_5=41:40 -xgxs_rx_lane_map_5=0x213 -xgxs_tx_lane_map_5=0x3021 -phy_xaui_rx_polarity_flip_5=0x3 -phy_xaui_tx_polarity_flip_5=0xb -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=0xc6e0 -serdes_preemphasis_lane1_xe4=0xc2f0 -serdes_preemphasis_lane2_xe4=0xc2f0 -serdes_preemphasis_lane3_xe4=0xcad0 - -# xe5 (40G) -portmap_6=45:40 -xgxs_rx_lane_map_6=0x213 -xgxs_tx_lane_map_6=0x213 -phy_xaui_rx_polarity_flip_6=0xe -phy_xaui_tx_polarity_flip_6=0x8 -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=0xc2f0 -serdes_preemphasis_lane1_xe5=0xc2f0 -serdes_preemphasis_lane2_xe5=0xc2f0 -serdes_preemphasis_lane3_xe5=0xc2f0 - -# xe6 (40G) -portmap_7=5:40 -xgxs_rx_lane_map_7=0x213 -xgxs_tx_lane_map_7=0x1203 -phy_xaui_rx_polarity_flip_7=0xc -phy_xaui_tx_polarity_flip_7=0x1 -serdes_driver_current_lane0_xe6=0x4 -serdes_driver_current_lane1_xe6=0x4 -serdes_driver_current_lane2_xe6=0x4 -serdes_driver_current_lane3_xe6=0x4 -serdes_pre_driver_current_lane0_xe6=0x4 -serdes_pre_driver_current_lane1_xe6=0x4 -serdes_pre_driver_current_lane2_xe6=0x4 -serdes_pre_driver_current_lane3_xe6=0x4 -serdes_preemphasis_lane0_xe6=0xc6e0 -serdes_preemphasis_lane1_xe6=0xc6e0 -serdes_preemphasis_lane2_xe6=0xc6e0 -serdes_preemphasis_lane3_xe6=0xc6e0 - -# xe7 (40G) -portmap_8=1:40 -xgxs_rx_lane_map_8=0x213 -xgxs_tx_lane_map_8=0x2031 -phy_xaui_rx_polarity_flip_8=0xe -phy_xaui_tx_polarity_flip_8=0xd -serdes_driver_current_lane0_xe7=0x5 -serdes_driver_current_lane1_xe7=0x5 -serdes_driver_current_lane2_xe7=0x5 -serdes_driver_current_lane3_xe7=0x5 -serdes_pre_driver_current_lane0_xe7=0x5 -serdes_pre_driver_current_lane1_xe7=0x5 -serdes_pre_driver_current_lane2_xe7=0x5 -serdes_pre_driver_current_lane3_xe7=0x5 -serdes_preemphasis_lane0_xe7=0xc6e0 -serdes_preemphasis_lane1_xe7=0xcad0 -serdes_preemphasis_lane2_xe7=0xc6e0 -serdes_preemphasis_lane3_xe7=0xcad0 - -# xe9 (40G) -portmap_9=9:40 -xgxs_rx_lane_map_9=0x3120 -xgxs_tx_lane_map_9=0x3021 -phy_xaui_rx_polarity_flip_9=0x0 -phy_xaui_tx_polarity_flip_9=0x4 -serdes_driver_current_lane0_xe8=0x3 -serdes_driver_current_lane1_xe8=0x3 -serdes_driver_current_lane2_xe8=0x3 -serdes_driver_current_lane3_xe8=0x3 -serdes_pre_driver_current_lane0_xe8=0x3 -serdes_pre_driver_current_lane1_xe8=0x3 -serdes_pre_driver_current_lane2_xe8=0x3 -serdes_pre_driver_current_lane3_xe8=0x3 -serdes_preemphasis_lane0_xe8=0xc2f0 -serdes_preemphasis_lane1_xe8=0xc6e0 -serdes_preemphasis_lane2_xe8=0xbf00 -serdes_preemphasis_lane3_xe8=0xc2f0 - -# xe9 (40G) -portmap_10=13:40 -xgxs_rx_lane_map_10=0x213 -xgxs_tx_lane_map_10=0x132 -phy_xaui_rx_polarity_flip_10=0xe -phy_xaui_tx_polarity_flip_10=0x0 -serdes_driver_current_lane0_xe9=0x2 -serdes_driver_current_lane1_xe9=0x3 -serdes_driver_current_lane2_xe9=0x2 -serdes_driver_current_lane3_xe9=0x2 -serdes_pre_driver_current_lane0_xe9=0x2 -serdes_pre_driver_current_lane1_xe9=0x3 -serdes_pre_driver_current_lane2_xe9=0x2 -serdes_pre_driver_current_lane3_xe9=0x2 -serdes_preemphasis_lane0_xe9=0xb270 -serdes_preemphasis_lane1_xe9=0xbb10 -serdes_preemphasis_lane2_xe9=0xb720 -serdes_preemphasis_lane3_xe9=0xb720 - -# xe10 (40G) -portmap_11=21:40 -xgxs_rx_lane_map_11=0x123 -xgxs_tx_lane_map_11=0x1203 -phy_xaui_rx_polarity_flip_11=0xc -phy_xaui_tx_polarity_flip_11=0xe -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=0xb330 -serdes_preemphasis_lane2_xe10=0xb330 -serdes_preemphasis_lane3_xe10=0xb330 - -# xe11 (40G) -portmap_12=17:40 -xgxs_rx_lane_map_12=0x213 -xgxs_tx_lane_map_12=0x132 -phy_xaui_rx_polarity_flip_12=0xe -phy_xaui_tx_polarity_flip_12=0x0 -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=0xbb10 -serdes_preemphasis_lane2_xe11=0xbb10 -serdes_preemphasis_lane3_xe11=0xbb10 - -# xe12 (40G) -portmap_13=49:40 -xgxs_rx_lane_map_13=0x1302 -xgxs_tx_lane_map_13=0x2031 -phy_xaui_rx_polarity_flip_13=0xb -phy_xaui_tx_polarity_flip_13=0x3 -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=0xa760 -serdes_preemphasis_lane1_xe12=0xa760 -serdes_preemphasis_lane2_xe12=0xa760 -serdes_preemphasis_lane3_xe12=0xa760 - -# xe13 (40G) -portmap_14=53:40 -xgxs_rx_lane_map_14=0x213 -xgxs_tx_lane_map_14=0x231 -phy_xaui_rx_polarity_flip_14=0x1 -phy_xaui_tx_polarity_flip_14=0x0 -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=0xaf40 -serdes_preemphasis_lane1_xe13=0xaf40 -serdes_preemphasis_lane2_xe13=0xaf40 -serdes_preemphasis_lane3_xe13=0xaf40 - -# xe14 (40G) -portmap_15=61:40 -xgxs_rx_lane_map_15=0x132 -xgxs_tx_lane_map_15=0x213 -phy_xaui_rx_polarity_flip_15=0x0 -phy_xaui_tx_polarity_flip_15=0x0 -serdes_driver_current_lane0_xe14=0x2 -serdes_driver_current_lane1_xe14=0x2 -serdes_driver_current_lane2_xe14=0x2 -serdes_driver_current_lane3_xe14=0x2 -serdes_pre_driver_current_lane0_xe14=0x2 -serdes_pre_driver_current_lane1_xe14=0x2 -serdes_pre_driver_current_lane2_xe14=0x2 -serdes_pre_driver_current_lane3_xe14=0x2 -serdes_preemphasis_lane0_xe14=0xa760 -serdes_preemphasis_lane1_xe14=0xa760 -serdes_preemphasis_lane2_xe14=0xa760 -serdes_preemphasis_lane3_xe14=0xa760 - -# xe15 (40G) -portmap_16=57:40 -xgxs_rx_lane_map_16=0x213 -xgxs_tx_lane_map_16=0x2031 -phy_xaui_rx_polarity_flip_16=0x1 -phy_xaui_tx_polarity_flip_16=0x0 -serdes_driver_current_lane0_xe15=0x1 -serdes_driver_current_lane1_xe15=0x1 -serdes_driver_current_lane2_xe15=0x1 -serdes_driver_current_lane3_xe15=0x1 -serdes_pre_driver_current_lane0_xe15=0x1 -serdes_pre_driver_current_lane1_xe15=0x1 -serdes_pre_driver_current_lane2_xe15=0x1 -serdes_pre_driver_current_lane3_xe15=0x1 -serdes_preemphasis_lane0_xe15=0xa760 -serdes_preemphasis_lane1_xe15=0xa760 -serdes_preemphasis_lane2_xe15=0xa760 -serdes_preemphasis_lane3_xe15=0xa760 - -# xe16 (40G) -portmap_17=65:40 -xgxs_rx_lane_map_17=0x132 -xgxs_tx_lane_map_17=0x2031 -phy_xaui_rx_polarity_flip_17=0x3 -phy_xaui_tx_polarity_flip_17=0x9 -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=0xa370 -serdes_preemphasis_lane1_xe16=0xa370 -serdes_preemphasis_lane2_xe16=0xa370 -serdes_preemphasis_lane3_xe16=0xa370 - -# xe17 (40G) -portmap_18=69:40 -xgxs_rx_lane_map_18=0x213 -xgxs_tx_lane_map_18=0x2130 -phy_xaui_rx_polarity_flip_18=0x1 -phy_xaui_tx_polarity_flip_18=0xf -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=0xa760 -serdes_preemphasis_lane1_xe17=0xa760 -serdes_preemphasis_lane2_xe17=0xa760 -serdes_preemphasis_lane3_xe17=0xa760 - -# xe19 (40G) -portmap_19=77:40 -xgxs_rx_lane_map_19=0x123 -xgxs_tx_lane_map_19=0x1203 -phy_xaui_rx_polarity_flip_19=0x3 -phy_xaui_tx_polarity_flip_19=0xe -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=0xaf40 -serdes_preemphasis_lane1_xe18=0xaf40 -serdes_preemphasis_lane2_xe18=0xaf40 -serdes_preemphasis_lane3_xe18=0xaf40 - -# xe19 (40G) -portmap_20=73:40 -xgxs_rx_lane_map_20=0x213 -xgxs_tx_lane_map_20=0x2031 -phy_xaui_rx_polarity_flip_20=0x1 -phy_xaui_tx_polarity_flip_20=0x0 -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=0xa760 -serdes_preemphasis_lane1_xe19=0xa760 -serdes_preemphasis_lane2_xe19=0xa760 -serdes_preemphasis_lane3_xe19=0xa760 - -# xe20 (40G) -portmap_21=105:40 -xgxs_rx_lane_map_21=0x1320 -xgxs_tx_lane_map_21=0x3021 -phy_xaui_rx_polarity_flip_21=0xd -phy_xaui_tx_polarity_flip_21=0xb -serdes_driver_current_lane0_xe20=0x1 -serdes_driver_current_lane1_xe20=0x1 -serdes_driver_current_lane2_xe20=0x1 -serdes_driver_current_lane3_xe20=0x1 -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=0x1 -serdes_preemphasis_lane0_xe20=0xb330 -serdes_preemphasis_lane1_xe20=0xb330 -serdes_preemphasis_lane2_xe20=0xb330 -serdes_preemphasis_lane3_xe20=0xb330 - -# xe21 (40G) -portmap_22=109:40 -xgxs_rx_lane_map_22=0x132 -xgxs_tx_lane_map_22=0x132 -phy_xaui_rx_polarity_flip_22=0x8 -phy_xaui_tx_polarity_flip_22=0x0 -serdes_driver_current_lane0_xe21=0x1 -serdes_driver_current_lane1_xe21=0x1 -serdes_driver_current_lane2_xe21=0x1 -serdes_driver_current_lane3_xe21=0x2 -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=0x2 -serdes_preemphasis_lane0_xe21=0xb330 -serdes_preemphasis_lane1_xe21=0xb330 -serdes_preemphasis_lane2_xe21=0xb330 -serdes_preemphasis_lane3_xe21=0xbff0 - -# xe22 (40G) -portmap_23=117:40 -xgxs_rx_lane_map_23=0x231 -xgxs_tx_lane_map_23=0x1203 -phy_xaui_rx_polarity_flip_23=0x3 -phy_xaui_tx_polarity_flip_23=0xe -serdes_driver_current_lane0_xe22=0x3 -serdes_driver_current_lane1_xe22=0x5 -serdes_driver_current_lane2_xe22=0x3 -serdes_driver_current_lane3_xe22=0x3 -serdes_pre_driver_current_lane0_xe22=0x3 -serdes_pre_driver_current_lane1_xe22=0x5 -serdes_pre_driver_current_lane2_xe22=0x3 -serdes_pre_driver_current_lane3_xe22=0x3 -serdes_preemphasis_lane0_xe22=0xc6e0 -serdes_preemphasis_lane1_xe22=0xc6e0 -serdes_preemphasis_lane2_xe22=0xc6e0 -serdes_preemphasis_lane3_xe22=0xc6e0 - -# xe23 (40G) -portmap_24=113:40 -xgxs_rx_lane_map_24=0x132 -xgxs_tx_lane_map_24=0x132 -phy_xaui_rx_polarity_flip_24=0x8 -phy_xaui_tx_polarity_flip_24=0x0 -serdes_driver_current_lane0_xe23=0x1 -serdes_driver_current_lane1_xe23=0x1 -serdes_driver_current_lane2_xe23=0x1 -serdes_driver_current_lane3_xe23=0x1 -serdes_pre_driver_current_lane0_xe23=0x1 -serdes_pre_driver_current_lane1_xe23=0x1 -serdes_pre_driver_current_lane2_xe23=0x1 -serdes_pre_driver_current_lane3_xe23=0x1 -serdes_preemphasis_lane0_xe23=0xbb10 -serdes_preemphasis_lane1_xe23=0xbb10 -serdes_preemphasis_lane2_xe23=0xbb10 -serdes_preemphasis_lane3_xe23=0xc2f0 - -# xe24 (40G) -portmap_25=121:40 -xgxs_rx_lane_map_25=0x1320 -xgxs_tx_lane_map_25=0x3021 -phy_xaui_rx_polarity_flip_25=0xd -phy_xaui_tx_polarity_flip_25=0xb -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=0xc6e0 - -# xe25 (40G) -portmap_26=125:40 -xgxs_rx_lane_map_26=0x132 -xgxs_tx_lane_map_26=0x132 -phy_xaui_rx_polarity_flip_26=0x8 -phy_xaui_tx_polarity_flip_26=0x0 -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=0xcec0 - -# xe26 (40G) -portmap_27=85:40 -xgxs_rx_lane_map_27=0x213 -xgxs_tx_lane_map_27=0x1203 -phy_xaui_rx_polarity_flip_27=0xc -phy_xaui_tx_polarity_flip_27=0xe -serdes_driver_current_lane0_xe26=0x4 -serdes_driver_current_lane1_xe26=0x5 -serdes_driver_current_lane2_xe26=0x4 -serdes_driver_current_lane3_xe26=0x5 -serdes_pre_driver_current_lane0_xe26=0x4 -serdes_pre_driver_current_lane1_xe26=0x5 -serdes_pre_driver_current_lane2_xe26=0x4 -serdes_pre_driver_current_lane3_xe26=0x5 -serdes_preemphasis_lane0_xe26=0xc2f0 -serdes_preemphasis_lane1_xe26=0xc6e0 -serdes_preemphasis_lane2_xe26=0xc6e0 -serdes_preemphasis_lane3_xe26=0xc6e0 - -# xe27 (40G) -portmap_28=81:40 -xgxs_rx_lane_map_28=0x1320 -xgxs_tx_lane_map_28=0x2031 -phy_xaui_rx_polarity_flip_28=0x1 -phy_xaui_tx_polarity_flip_28=0x2 -serdes_driver_current_lane0_xe27=0x2 -serdes_driver_current_lane1_xe27=0x2 -serdes_driver_current_lane2_xe27=0x2 -serdes_driver_current_lane3_xe27=0x2 -serdes_pre_driver_current_lane0_xe27=0x2 -serdes_pre_driver_current_lane1_xe27=0x2 -serdes_pre_driver_current_lane2_xe27=0x2 -serdes_pre_driver_current_lane3_xe27=0x2 -serdes_preemphasis_lane0_xe27=0xbb10 -serdes_preemphasis_lane1_xe27=0xbb10 -serdes_preemphasis_lane2_xe27=0xbf00 -serdes_preemphasis_lane3_xe27=0xbb10 - -# xe29 (40G) -portmap_29=89:40 -xgxs_rx_lane_map_29=0x1320 -xgxs_tx_lane_map_29=0x3021 -phy_xaui_rx_polarity_flip_29=0x2 -phy_xaui_tx_polarity_flip_29=0xb -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=0xcad0 -serdes_preemphasis_lane1_xe28=0xc6e0 -serdes_preemphasis_lane2_xe28=0xc6e0 -serdes_preemphasis_lane3_xe28=0xc6e0 - -# xe29 (40G) -portmap_30=93:40 -xgxs_rx_lane_map_30=0x1320 -xgxs_tx_lane_map_30=0x2031 -phy_xaui_rx_polarity_flip_30=0x1 -phy_xaui_tx_polarity_flip_30=0x2 -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=0xc2f0 -serdes_preemphasis_lane1_xe29=0xc2f0 -serdes_preemphasis_lane2_xe29=0xc2f0 -serdes_preemphasis_lane3_xe29=0xc2f0 - -# xe30 (40G) -portmap_31=97:40 -xgxs_rx_lane_map_31=0x213 -xgxs_tx_lane_map_31=0x2031 -phy_xaui_rx_polarity_flip_31=0xc -phy_xaui_tx_polarity_flip_31=0x3 -serdes_driver_current_lane0_xe30=0x5 -serdes_driver_current_lane1_xe30=0x5 -serdes_driver_current_lane2_xe30=0x5 -serdes_driver_current_lane3_xe30=0x5 -serdes_pre_driver_current_lane0_xe30=0x5 -serdes_pre_driver_current_lane1_xe30=0x5 -serdes_pre_driver_current_lane2_xe30=0x5 -serdes_pre_driver_current_lane3_xe30=0x5 -serdes_preemphasis_lane0_xe30=0xcad0 -serdes_preemphasis_lane1_xe30=0xcad0 -serdes_preemphasis_lane2_xe30=0xcad0 -serdes_preemphasis_lane3_xe30=0xcad0 - -# xe31 (40G) -portmap_32=101:40 -xgxs_rx_lane_map_32=0x1320 -xgxs_tx_lane_map_32=0x1203 -phy_xaui_rx_polarity_flip_32=0x1 -phy_xaui_tx_polarity_flip_32=0x6 -serdes_driver_current_lane0_xe31=0x6 -serdes_driver_current_lane1_xe31=0x6 -serdes_driver_current_lane2_xe31=0x6 -serdes_driver_current_lane3_xe31=0x7 -serdes_pre_driver_current_lane0_xe31=0x6 -serdes_pre_driver_current_lane1_xe31=0x6 -serdes_pre_driver_current_lane2_xe31=0x6 -serdes_pre_driver_current_lane3_xe31=0x7 -serdes_preemphasis_lane0_xe31=0xcec0 -serdes_preemphasis_lane1_xe31=0xcec0 -serdes_preemphasis_lane2_xe31=0xcad0 -serdes_preemphasis_lane3_xe31=0xc6e0 diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 6b3f9f96c07e..e3680198322c 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -31,6 +31,7 @@ endif $(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(ARP_UPDATE_SCRIPT) \ + $(BUFFERS_CONFIG_TEMPLATE) \ $(SONIC_VERSION) $(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index c26da98da2aa..6f2192d61cfe 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -86,7 +86,8 @@ COPY ["50-default.conf", "/etc/rsyslog.d/"] COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/configdb-load.sh", "/usr/bin/"] -COPY ["files/arp_update", "/usr/bin"] +COPY ["files/arp_update", "/usr/bin/"] +COPY ["files/buffers_config.j2", "/usr/share/sonic/templates/"] COPY ["files/sonic_version.yml", "/etc/sonic/"] # Workaround the tcpdump issue diff --git a/rules/scripts.mk b/rules/scripts.mk index fbefdd68d2cd..d042f7e3b253 100644 --- a/rules/scripts.mk +++ b/rules/scripts.mk @@ -5,7 +5,11 @@ $(ARP_UPDATE_SCRIPT)_PATH = files/scripts CONFIGDB_LOAD_SCRIPT = configdb-load.sh $(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts +BUFFERS_CONFIG_TEMPLATE = buffers_config.j2 +$(BUFFERS_CONFIG_TEMPLATE)_PATH = files/build_templates + SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ - $(ARP_UPDATE_SCRIPT) + $(ARP_UPDATE_SCRIPT) \ + $(BUFFERS_CONFIG_TEMPLATE) diff --git a/src/sonic-device-data/Makefile b/src/sonic-device-data/Makefile index b258db960727..ecac92b00e0e 100644 --- a/src/sonic-device-data/Makefile +++ b/src/sonic-device-data/Makefile @@ -14,6 +14,13 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : mkdir ./device cp -r -L ../../../device/*/* ./device/ + # Create hwsku for virtual switch + for d in `find -L ../../../device -maxdepth 3 -mindepth 3 -type d | grep -vE "(plugins|led-code)"`; do \ + 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 + done; + # Build the package dpkg-buildpackage -rfakeroot -b -us -uc diff --git a/device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/sai.profile b/src/sonic-device-data/src/sai.vs_profile similarity index 100% rename from device/virtual/x86_64-kvm_x86_64-r0/Force10-S6000/sai.profile rename to src/sonic-device-data/src/sai.vs_profile From 6b42f753c6150667ce10e34c95eff80c7e85a8e6 Mon Sep 17 00:00:00 2001 From: lguohan Date: Fri, 1 Feb 2019 11:18:02 -0800 Subject: [PATCH 156/219] [vs]: Force10-S6000 buffer settings for virtual switch (#2515) Signed-off-by: Guohan Lu --- .../Force10-S6000/buffers_defaults_def.j2 | 45 +++++++++++++++++++ files/build_templates/buffers_config.j2 | 2 +- platform/vs/docker-sonic-vs.mk | 1 + platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 +- platform/vs/docker-sonic-vs/start.sh | 3 +- rules/scripts.mk | 6 ++- 6 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_def.j2 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_def.j2 b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/buffers_defaults_def.j2 new file mode 100644 index 000000000000..38e34eb571e8 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/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/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 2db9372340c4..95830cd01a89 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -111,7 +111,7 @@ def { "CABLE_LENGTH": { "AZURE": { - {% for port in PORT %} + {% for port in PORT_ALL %} {%- set cable = cable_length(port) %} "{{ port }}": "{{ cable }}"{%- if not loop.last %},{% endif %} diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index e3680198322c..2baa1e6beb8e 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -32,6 +32,7 @@ endif $(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(ARP_UPDATE_SCRIPT) \ $(BUFFERS_CONFIG_TEMPLATE) \ + $(QOS_CONFIG_TEMPLATE) \ $(SONIC_VERSION) $(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 6f2192d61cfe..0d2daf93fce1 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -87,7 +87,7 @@ COPY ["start.sh", "orchagent.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/configdb-load.sh", "/usr/bin/"] COPY ["files/arp_update", "/usr/bin/"] -COPY ["files/buffers_config.j2", "/usr/share/sonic/templates/"] +COPY ["files/buffers_config.j2", "files/qos_config.j2", "/usr/share/sonic/templates/"] COPY ["files/sonic_version.yml", "/etc/sonic/"] # Workaround the tcpdump issue diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index b13f5febff3a..63e5f3534ef5 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -18,8 +18,9 @@ if [ -f /etc/sonic/config_db.json ]; then else # generate and merge buffers configuration into config file sonic-cfggen -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json + sonic-cfggen -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json sonic-cfggen -p /usr/share/sonic/hwsku/port_config.ini -k $HWSKU --print-data > /tmp/ports.json - sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json + sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/qos.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json fi mkdir -p /etc/swss/config.d/ diff --git a/rules/scripts.mk b/rules/scripts.mk index d042f7e3b253..6010b10b832b 100644 --- a/rules/scripts.mk +++ b/rules/scripts.mk @@ -8,8 +8,12 @@ $(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts BUFFERS_CONFIG_TEMPLATE = buffers_config.j2 $(BUFFERS_CONFIG_TEMPLATE)_PATH = files/build_templates +QOS_CONFIG_TEMPLATE = qos_config.j2 +$(QOS_CONFIG_TEMPLATE)_PATH = files/build_templates + SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(ARP_UPDATE_SCRIPT) \ - $(BUFFERS_CONFIG_TEMPLATE) + $(BUFFERS_CONFIG_TEMPLATE) \ + $(QOS_CONFIG_TEMPLATE) From 0952b42f6d2fbed7ac88422602b0783137a44d99 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Sun, 14 Jul 2019 00:48:04 +0000 Subject: [PATCH 157/219] [submodule]: update sonic-sairedis install SAI extension header files into /usr/include/sai --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index fdfcefd19d28..18ad5f925041 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit fdfcefd19d2832b0e1d1eff56b093ae85a7795d0 +Subproject commit 18ad5f9250419c3a514701ae648839fd32f4d240 From 87617233eb1fe0fc3ec0727db7911904cb8232b3 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Mon, 15 Jul 2019 19:53:04 +0000 Subject: [PATCH 158/219] [docker-syncd-vs]: fix syncd target for docker-syncd-vs. The bug is introduced in commit 0bca6b8468daa6268476a70dc2adfe03644bcb8c Signed-off-by: Guohan Lu --- platform/vs/docker-syncd-vs.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 7e4d48aec6cf..75cf705d6ecc 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -3,7 +3,7 @@ DOCKER_SYNCD_PLATFORM_CODE = vs include $(PLATFORM_PATH)/../template/docker-syncd-base.mk -$(DOCKER_SYNCD_SYNCD)_DEPENDS += $(SYNCD_VS) +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD_VS) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSWSSCOMMON_DBG) \ From 050787e20ebb223b853a46678a4a34d78b4fd472 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 15 Jul 2019 20:20:15 -0700 Subject: [PATCH 159/219] [201811] advance sub module heads (#3135) Submodule src/sonic-platform-common 42119e1..5d7954e: > [ChassisBase] Make reboot cause constant strings human-readable (#35) > Add .gitignore file (#28) > [sonic_platform_base] Add sonic_sfp and sonic_eeprom to sonic_platform_base (#27) > Enhance new platform API (#19) > fix typo in platform API base class (#25) Submodule src/sonic-swss 9cf7b01..1e99c93: > Set timer only when interval changes. Not in each firing of the timer. (#945) Submodule src/sonic-utilities ec1e93f..24958f1: > [fast reboot] stop removing opennsl module before reboot (#560) Submodule src/sonic-swss-common b472f6e..d6140fa: > timerfd:read failure - Record in logs as error. (#295) > do not abort when read timerfd return 0 and errno = 0 (#291) > Add an assert to logger, which will log a message and abort. (#286) Signed-off-by: Ying Xie --- src/sonic-platform-common | 2 +- src/sonic-swss | 2 +- src/sonic-swss-common | 2 +- src/sonic-utilities | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 42119e19030e..5d7954ee8d1b 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 42119e19030e33e8857f31f7a88d079fbe8edea9 +Subproject commit 5d7954ee8d1b70aaa6d8db1c9ed0f441c293c3c9 diff --git a/src/sonic-swss b/src/sonic-swss index 9cf7b0133f6b..1e99c935d35b 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 9cf7b0133f6b5537414ff31a9fdad863ebb2f24e +Subproject commit 1e99c935d35ba1ccf78607f1258a009a646af74f diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b472f6eb5915..d6140fa3e355 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b472f6eb59158dc7545cd0957aedf1edc848ed73 +Subproject commit d6140fa3e3559784d6471384e55e98495e0b042e diff --git a/src/sonic-utilities b/src/sonic-utilities index ec1e93f9c4e6..24958f1c79f9 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit ec1e93f9c4e65b114302eb6fabf93084e6d2d0b8 +Subproject commit 24958f1c79f9f12cb69bd8950c6a06fa153117a3 From c620cabd415f339fd2a85ae30750a8dc7cd1cc6f Mon Sep 17 00:00:00 2001 From: Harish Venkatraman Date: Sat, 16 Feb 2019 09:59:51 -0800 Subject: [PATCH 160/219] [dell/Z9100] Fix for optics not detected in fanout mode (#2496) * [dell/Z9100] Fix for optics not detected in fanout mode This commit fixes the issue of optics not detected error while running sfputil show eeprom command. The root casuse was the value of port index from port_config.ini for fan out scenario. The port index should be starting from 0 and not 1. Platform cpld registers are assuming the port numbers to start from 0 (lowermost bit), sfputils.py uses this port number in get_presence function. Since the indexing passed is wrong the optics was not detected and gave SFP EEPROM not detected message. Signed-off-by: Harish Venkatraman * [dell/z9100] Fix for optics not detected in fanout mode This commit fixes the issue of optics not detected error while running sfputil show eeprom command. The root cause was wrong port_index in fan out scenarios. Earlier fix of changing the port_config.ini is reverted and changes made in z9100 platform specific sfputil.py file. The port number is decrement and tested for both 100G and 50G fanout cases. Tested for the following show commands and test was succesful show interfaces status, show interfaces transceiver eeprom, show interfaces transceiver lpmode, show interface tranceiver presence. Signed-off-by: Harish Venkatraman --- .../plugins/sfputil.py | 177 +++++++----------- 1 file changed, 68 insertions(+), 109 deletions(-) diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py index 77d75f71f578..78c2c1183a51 100644 --- a/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_z9100_c2538-r0/plugins/sfputil.py @@ -16,15 +16,15 @@ class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 0 - PORT_END = 31 + PORT_START = 1 + PORT_END = 32 PORTS_IN_BLOCK = 32 - IOM_1_PORT_START = 0 - IOM_1_PORT_END = 11 - IOM_2_PORT_START = 12 - IOM_2_PORT_END = 21 - IOM_3_PORT_START = 22 - IOM_3_PORT_END = 31 + IOM_1_PORT_START = 1 + IOM_1_PORT_END = 12 + IOM_2_PORT_START = 13 + IOM_2_PORT_END = 22 + IOM_3_PORT_START = 23 + IOM_3_PORT_END = 32 BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/" OIR_FD_PATH = "/sys/devices/platform/dell_ich.0/sci_int_gpio_sus6" @@ -33,38 +33,39 @@ class SfpUtil(SfpUtilBase): epoll = -1 _port_to_eeprom_mapping = {} _port_to_i2c_mapping = { - 0: [9, 18], - 1: [9, 19], - 2: [9, 20], - 3: [9, 21], - 4: [9, 22], - 5: [9, 23], - 6: [9, 24], - 7: [9, 25], - 8: [8, 26], - 9: [8, 27], - 10: [8, 28], - 11: [8, 29], - 12: [8, 31], # reordered - 13: [8, 30], - 14: [8, 33], # reordered - 15: [8, 32], - 16: [7, 34], - 17: [7, 35], - 18: [7, 36], - 19: [7, 37], - 20: [7, 38], - 21: [7, 39], - 22: [7, 40], - 23: [7, 41], - 24: [6, 42], - 25: [6, 43], - 26: [6, 44], - 27: [6, 45], - 28: [6, 46], - 29: [6, 47], - 30: [6, 48], - 31: [6, 49] + 0: [0, 00], # Dummy Entry + 1: [9, 18], + 2: [9, 19], + 3: [9, 20], + 4: [9, 21], + 5: [9, 22], + 6: [9, 23], + 7: [9, 24], + 8: [9, 25], + 9: [8, 26], + 10: [8, 27], + 11: [8, 28], + 12: [8, 29], + 13: [8, 31], # reordered + 14: [8, 30], + 15: [8, 33], # reordered + 16: [8, 32], + 17: [7, 34], + 18: [7, 35], + 19: [7, 36], + 20: [7, 37], + 21: [7, 38], + 22: [7, 39], + 23: [7, 40], + 24: [7, 41], + 25: [6, 42], + 26: [6, 43], + 27: [6, 44], + 28: [6, 45], + 29: [6, 46], + 30: [6, 47], + 31: [6, 48], + 32: [6, 49] } @property @@ -127,13 +128,10 @@ def __del__(self): self.epoll.close() self.oir_fd.close() - def get_presence(self, port_num): - - global i2c_line - + def normalize_port(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: - return False + return -1, -1 # port_num and i2c match if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: i2c_line = 14 @@ -144,6 +142,24 @@ def get_presence(self, port_num): port_num <= self.iom3_port_end): i2c_line = 16 + # Rationalize port settings + if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: + port_num = port_num - 1 + elif port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: + port_num = (port_num - 1) % 12 + elif (port_num >= self.iom3_port_start and + port_num <= self.iom3_port_end): + port_num = (port_num - 1) % 22 + + return i2c_line, port_num + + + def get_presence(self, port_num): + + i2c_line, port_num = self.normalize_port(port_num) + if port_num == -1: + return False + try: qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_modprs" reg_file = open(qsfp_path, "r") @@ -161,13 +177,6 @@ def get_presence(self, port_num): # content is a string containing the hex representation of the register reg_value = int(content, 16) - # Rationalize port settings - if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: - port_num = port_num % 12 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - port_num = port_num % 22 - # Mask off the bit corresponding to our port mask = (1 << port_num) @@ -179,20 +188,10 @@ def get_presence(self, port_num): def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: + i2c_line, port_num = self.normalize_port(port_num) + if port_num == -1: return False - # port_num and i2c match - if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: - i2c_line = 14 - elif (port_num >= self.iom2_port_start and - port_num <= self.iom2_port_end): - i2c_line = 15 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - i2c_line = 16 - try: qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" reg_file = open(qsfp_path, "r") @@ -210,13 +209,6 @@ def get_low_power_mode(self, port_num): # content is a string containing the hex representation of the register reg_value = int(content, 16) - # Rationalize port settings - if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: - port_num = port_num % 12 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - port_num = port_num % 22 - # Mask off the bit corresponding to our port mask = (1 << port_num) @@ -228,24 +220,15 @@ def get_low_power_mode(self, port_num): def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: + i2c_line, port_num = self.normalize_port(port_num) + if port_num == -1: return False - # port_num and i2c match - if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: - i2c_line = 14 - elif (port_num >= self.iom2_port_start and - port_num <= self.iom2_port_end): - i2c_line = 15 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - i2c_line = 16 - try: qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" reg_file = open(qsfp_path, "r+") + except IOError as e: print "Error: unable to open file: %s" % str(e) return False @@ -259,13 +242,6 @@ def set_low_power_mode(self, port_num, lpmode): # content is a string containing the hex representation of the register reg_value = int(content, 16) - # Rationalize port settings - if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: - port_num = port_num % 12 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - port_num = port_num % 22 - # Mask off the bit corresponding to our port mask = (1 << port_num) # LPMode is active high; set or clear the bit accordingly @@ -285,20 +261,10 @@ def set_low_power_mode(self, port_num, lpmode): def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: + i2c_line, port_num = self.normalize_port(port_num) + if port_num == -1: return False - # port_num and i2c match - if port_num >= self.iom1_port_start and port_num <= self.iom1_port_end: - i2c_line = 14 - elif (port_num >= self.iom2_port_start and - port_num <= self.iom2_port_end): - i2c_line = 15 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - i2c_line = 16 - try: qsfp_path = self.BASE_VAL_PATH.format(i2c_line)+"qsfp_lpmode" reg_file = open(qsfp_path, "r+") @@ -312,13 +278,6 @@ def reset(self, port_num): # File content is a string containing the hex representation of th reg_value = int(content, 16) - # Rationalize port settings - if port_num >= self.iom2_port_start and port_num <= self.iom2_port_end: - port_num = port_num % 12 - elif (port_num >= self.iom3_port_start and - port_num <= self.iom3_port_end): - port_num = port_num % 22 - # Mask off the bit corresponding to our port mask = (1 << port_num) From cd32a9fd928ae9a5609cd18f01369ebfbbed2188 Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Sun, 17 Feb 2019 01:20:15 +0530 Subject: [PATCH 161/219] [devices]: Reset I2C MUX in S6000 while invoking platform reboot (#2567) --- .../x86_64-dell_s6000_s1220-r0/installer.conf | 2 + .../platform_reboot | 10 +++ .../modules/dell_s6000_platform.c | 64 ++++++++++++++++++- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf index 107095cdad7c..45888b61d375 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf +++ b/device/dell/x86_64-dell_s6000_s1220-r0/installer.conf @@ -7,8 +7,10 @@ echo "Replace ONIE reboot with Dell reset commands" # set I2C GPIO mux [ -d /sys/class/gpio/gpio1 ] || echo 1 > /sys/class/gpio/export [ -d /sys/class/gpio/gpio2 ] || echo 2 > /sys/class/gpio/export +[ -d /sys/class/gpio/gpio10 ] || echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio1/direction echo out > /sys/class/gpio/gpio2/direction +echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio1/value echo 0 > /sys/class/gpio/gpio2/value diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot b/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot index 875a52787752..6af6ac48dffd 100755 --- a/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot +++ b/device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot @@ -1,3 +1,13 @@ #!/bin/sh +# Export GPIO10 if needed +[ -d /sys/class/gpio/gpio10 ] || echo 10 > /sys/class/gpio/export +echo out > /sys/class/gpio/gpio10/direction + +#Toggle GPIO10 pin (to reset MUX) +echo 1 > /sys/class/gpio/gpio10/value +echo 0 > /sys/class/gpio/gpio10/value + + +#Power Reset echo 1 > /sys/devices/platform/dell-s6000-cpld.0/power_reset diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c index cbd56c579dd2..5e205973d674 100644 --- a/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c +++ b/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c @@ -419,7 +419,14 @@ static ssize_t set_power_reset(struct device *dev, struct device_attribute *deva static ssize_t get_power_reset(struct device *dev, struct device_attribute *devattr, char *buf) { - return sprintf(buf, "0\n"); + uint8_t ret = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, 0x1); + if (ret < 0) + return sprintf(buf, "read error"); + + return sprintf(buf, "0x%x\n", ret); } static ssize_t get_fan_prs(struct device *dev, struct device_attribute *devattr, char *buf) @@ -1006,6 +1013,55 @@ static ssize_t set_fan2_led(struct device *dev, struct device_attribute *devattr return count; } +static ssize_t get_system_cpld_ver(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + uint8_t ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, 0x0); + if (ret < 0) + return sprintf(buf, "read error"); + + data = ret & (0x0f); + + return sprintf(buf, "0x%x\n", data); +} + +static ssize_t get_master_cpld_ver(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + uint8_t ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x1); + if (ret < 0) + return sprintf(buf, "read error"); + + data = ret & (0x0f); + + return sprintf(buf, "0x%x\n", data); +} + +static ssize_t get_slave_cpld_ver(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + uint8_t ret; + u32 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0xa); + if (ret < 0) + return sprintf(buf, "read error"); + + data = ret & (0x0f); + + return sprintf(buf, "0x%x\n", data); +} + + static DEVICE_ATTR(qsfp_modsel, S_IRUGO, get_modsel, NULL); static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); @@ -1024,6 +1080,9 @@ static DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_fan_led, set_fan_led); static DEVICE_ATTR(fan0_led, S_IRUGO | S_IWUSR, get_fan0_led, set_fan0_led); static DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, get_fan1_led, set_fan1_led); static DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, get_fan2_led, set_fan2_led); +static DEVICE_ATTR(system_cpld_ver, S_IRUGO, get_system_cpld_ver, NULL); +static DEVICE_ATTR(master_cpld_ver, S_IRUGO, get_master_cpld_ver, NULL); +static DEVICE_ATTR(slave_cpld_ver, S_IRUGO, get_slave_cpld_ver, NULL); static struct attribute *s6000_cpld_attrs[] = { &dev_attr_qsfp_modsel.attr, @@ -1044,6 +1103,9 @@ static struct attribute *s6000_cpld_attrs[] = { &dev_attr_fan0_led.attr, &dev_attr_fan1_led.attr, &dev_attr_fan2_led.attr, + &dev_attr_system_cpld_ver.attr, + &dev_attr_master_cpld_ver.attr, + &dev_attr_slave_cpld_ver.attr, NULL, }; From a79dd716c40699081519db8a7ad2248e9c4d5e41 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 15 Jul 2019 20:21:02 -0700 Subject: [PATCH 162/219] [database] save configuration after DB migration (#3143) - Make sure that migrated DB contents persisted for next boot - Make sure that db saved after warm reboot. Signed-off-by: Ying Xie --- files/build_templates/docker_image_ctl.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 426e519f1e48..2d35598de9fb 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -63,6 +63,11 @@ function postStartAction() if [[ -x /usr/bin/db_migrator.py ]]; then # Migrate the DB to the latest schema version if needed /usr/bin/db_migrator.py -o migrate + + # Save in memory config_db to config_db.json for 2 reasons: + # 1. Persist the DB migration result. + # 2. Save in memory DB after warm reboot. + /usr/bin/config save -y fi {%- elif docker_container_name == "swss" %} docker exec swss rm -f /ready # remove cruft From d5aa1d58b4799cdca2c48d497c4a4229205c201b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 15 Jul 2019 21:01:00 -0700 Subject: [PATCH 163/219] [201811][utilities] advance utililies sub module head (#3162) Submodule src/sonic-utilities 24958f1..b86abe0: > [show] Don't abort in InterfaceAliasConverter ctor if PORT table doesn't exist (#571) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index 24958f1c79f9..b86abe08fb3e 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 24958f1c79f9f12cb69bd8950c6a06fa153117a3 +Subproject commit b86abe08fb3ef87be471d101a771ee52705d8838 From 0ef7e3be18d8f91d31ccb8237ec844f86ca17769 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 16 May 2019 07:22:56 +0800 Subject: [PATCH 164/219] [sonic-cfggen] fix name conflict between sonic_platform package and sonic_platform.py (#2875) * fix name conflict between sonic_platfrom package and sonic_platform.py * update sonic-utility submodule to pickup lastest fix * Revert "update sonic-utility submodule to pickup lastest fix" This reverts commit f66aa99738e06373bc2e141f420eab71839ff4e8. * update sonic-utility sub module --- src/sonic-config-engine/setup.py | 2 +- src/sonic-config-engine/sonic-cfggen | 6 +++--- .../{sonic_platform.py => sonic_device_util.py} | 10 +++++++--- src/sonic-utilities | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) rename src/sonic-config-engine/{sonic_platform.py => sonic_device_util.py} (90%) diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index 8375b6af89ad..7ca810ce6a54 100755 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -16,7 +16,7 @@ def get_test_suite(): author='Taoyu Li', author_email='taoyl@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_platform', 'config_samples'], + py_modules=['portconfig', 'minigraph', 'openconfig_acl', 'sonic_device_util', 'config_samples'], scripts=['sonic-cfggen'], install_requires=['lxml', 'jinja2>=2.10', 'netaddr', 'ipaddr', 'pyyaml', 'pyangbind==0.6.0'], test_suite='setup.get_test_suite', diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index f923cc4bc6c2..e1fbd508258e 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -28,9 +28,9 @@ from minigraph import minigraph_encoder from minigraph import parse_xml from minigraph import parse_device_desc_xml from portconfig import get_port_config -from sonic_platform import get_machine_info -from sonic_platform import get_platform_info -from sonic_platform import get_system_mac +from sonic_device_util import get_machine_info +from sonic_device_util import get_platform_info +from sonic_device_util import get_system_mac from config_samples import generate_sample_config from config_samples import get_available_config from swsssdk import ConfigDBConnector diff --git a/src/sonic-config-engine/sonic_platform.py b/src/sonic-config-engine/sonic_device_util.py similarity index 90% rename from src/sonic-config-engine/sonic_platform.py rename to src/sonic-config-engine/sonic_device_util.py index 20890d765cab..16026a60afa2 100644 --- a/src/sonic-config-engine/sonic_platform.py +++ b/src/sonic-config-engine/sonic_device_util.py @@ -5,13 +5,17 @@ DOCUMENTATION = ''' --- -module: sonic_platform +module: sonic_device_util version_added: "1.9" -short_description: Retrive platform related facts for a device. +short_description: Retrieve device related facts for a device. description: - - Retrieve platform related facts from config files. + - Retrieve device related facts from config files. ''' +''' +TODO: this file shall be renamed and moved to other places in future +to have it shared with multiple applications. +''' def get_machine_info(): if not os.path.isfile('/host/machine.conf'): return None diff --git a/src/sonic-utilities b/src/sonic-utilities index b86abe08fb3e..d12734e74c64 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b86abe08fb3ef87be471d101a771ee52705d8838 +Subproject commit d12734e74c64e9540483700230d04ba41a39af9f From e1129c9dff49272031cee30d31a2903bdaedd4a2 Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Thu, 11 Jul 2019 14:28:30 -0700 Subject: [PATCH 165/219] [submodule]: Update sonic-quagga (#3136) --- src/sonic-quagga | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-quagga b/src/sonic-quagga index b1d01a2dd841..99d9ca8e3291 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit b1d01a2dd841f76e73067171702f7c6321793c49 +Subproject commit 99d9ca8e3291cead8a3f15ff2cb15cf53d70a896 From 0869fd3925d470c0315d45b07ab68fddf10258f5 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Tue, 16 Jul 2019 08:34:11 -0700 Subject: [PATCH 166/219] [baseimage]: Fix process-reboot-cause possibly throwing OSError (#3159) In case of going from previous iteration of SONiC, and the last reboot was hardware, REBOOT_CAUSE_FILE may not be present and the service may throw an error. --- files/image_config/process-reboot-cause/process-reboot-cause | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/image_config/process-reboot-cause/process-reboot-cause b/files/image_config/process-reboot-cause/process-reboot-cause index 0d5ae78137fa..81c496a025ce 100755 --- a/files/image_config/process-reboot-cause/process-reboot-cause +++ b/files/image_config/process-reboot-cause/process-reboot-cause @@ -109,7 +109,8 @@ def main(): log_info("Previous reboot cause: {}".format(previous_reboot_cause)) # Remove the old REBOOT_CAUSE_FILE - os.remove(REBOOT_CAUSE_FILE) + if os.path.exists(REBOOT_CAUSE_FILE): + os.remove(REBOOT_CAUSE_FILE) # Write a new default reboot cause file for the next reboot cause_file = open(REBOOT_CAUSE_FILE, "w") From 0603accdae1e4672d30179621caeb450120e8e9c Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Wed, 17 Jul 2019 08:41:22 -0700 Subject: [PATCH 167/219] [build]: Fix docker-syncd-``-rpc.mk (#3174) Adopt to new define used for docker-syncd Simplify/streamline through template. --- platform/barefoot/docker-syncd-bfn-rpc.mk | 14 ++------------ platform/broadcom/docker-syncd-brcm-rpc.mk | 19 +++++-------------- platform/cavium/docker-syncd-cavm-rpc.mk | 16 ++++------------ platform/centec/docker-syncd-centec-rpc.mk | 16 +++------------- platform/marvell/docker-syncd-mrvl-rpc.mk | 14 ++------------ platform/mellanox/docker-syncd-mlnx-rpc.mk | 18 +++++------------- platform/nephos/docker-syncd-nephos-rpc.mk | 19 +++++-------------- platform/template/docker-syncd-base-rpc.mk | 16 ++++++++++++++++ 8 files changed, 42 insertions(+), 90 deletions(-) create mode 100644 platform/template/docker-syncd-base-rpc.mk diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 61f5570c1612..8c9cedbc9e6a 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -1,15 +1,5 @@ # docker image for syncd with rpc -DOCKER_SYNCD_BFN_RPC = docker-syncd-bfn-rpc.gz -$(DOCKER_SYNCD_BFN_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn-rpc -$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) -$(DOCKER_SYNCD_BFN_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BFN) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = bfn +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index fa7c0fb797c7..4ca1904f947f 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -1,17 +1,8 @@ # docker image for brcm syncd with rpc -DOCKER_SYNCD_BRCM_RPC = docker-syncd-brcm-rpc.gz -$(DOCKER_SYNCD_BRCM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-brcm-rpc -$(DOCKER_SYNCD_BRCM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) -$(DOCKER_SYNCD_BRCM_RPC)_FILES += $(DSSERVE) $(BCMCMD) -$(DOCKER_SYNCD_BRCM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BRCM) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = brcm +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_BASE_RPC)_FILES += $(DSSERVE) $(BCMCMD) + +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index e0136f5324b6..77ae09be5536 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -1,15 +1,7 @@ # docker image for cavium syncd with rpc -DOCKER_SYNCD_CAVM_RPC = docker-syncd-cavm-rpc.gz -$(DOCKER_SYNCD_CAVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-cavm-rpc -$(DOCKER_SYNCD_CAVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) -$(DOCKER_SYNCD_CAVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CAVM) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = cavm +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk + +$(DOCKER_SYNCD_BASE_RPC)_DEPENDS += $(CAVM_LIBSAI) $(XP_TOOLS) $(REDIS_TOOLS) -$(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 1798a034980d..c9b76df0ff84 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -1,16 +1,6 @@ # docker image for centec syncd with rpc -DOCKER_SYNCD_CENTEC_RPC = docker-syncd-centec-rpc.gz -$(DOCKER_SYNCD_CENTEC_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec-rpc -$(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) -$(DOCKER_SYNCD_CENTEC_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_CENTEC) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = centec +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index d4002a3d645f..cb181e194a70 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -1,15 +1,5 @@ # docker image for mrvl syncd with rpc -DOCKER_SYNCD_MRVL_RPC = docker-syncd-mrvl-rpc.gz -$(DOCKER_SYNCD_MRVL_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mrvl-rpc -$(DOCKER_SYNCD_MRVL_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) -$(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MRVL) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = mrvl +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index fc0f6239d548..bc32c3d15ad4 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -1,16 +1,8 @@ # docker image for mlnx syncd with rpc -DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz -$(DOCKER_SYNCD_MLNX_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-mlnx-rpc -$(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(MLNX_SFPD) -$(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = mlnx +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot +$(DOCKER_SYNCD_BASE_RPC)_DEPENDS += $(MLNX_SFPD) + +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index e891d0b1a68d..23890a58a5cf 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -1,17 +1,8 @@ # docker image for nephos syncd with rpc -DOCKER_SYNCD_NEPHOS_RPC = docker-syncd-nephos-rpc.gz -$(DOCKER_SYNCD_NEPHOS_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-nephos-rpc -$(DOCKER_SYNCD_NEPHOS_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) -$(DOCKER_SYNCD_NEPHOS_RPC)_FILES += $(DSSERVE) $(NPX_DIAG) -$(DOCKER_SYNCD_NEPHOS_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_NEPHOS) -SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) -ifeq ($(ENABLE_SYNCD_RPC),y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) -endif +DOCKER_SYNCD_PLATFORM_CODE = nephos +include $(PLATFORM_PATH)/../template/docker-syncd-base-rpc.mk -$(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t -$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf -$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd -$(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_BASE_RPC)_FILES += $(DSSERVE) $(NPX_DIAG) + +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/template/docker-syncd-base-rpc.mk b/platform/template/docker-syncd-base-rpc.mk new file mode 100644 index 000000000000..2de7fb6c3f9c --- /dev/null +++ b/platform/template/docker-syncd-base-rpc.mk @@ -0,0 +1,16 @@ +# docker image for any platform syncd with rpc + +DOCKER_SYNCD_BASE = docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE).gz +DOCKER_SYNCD_BASE_RPC = docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE)-rpc.gz +$(DOCKER_SYNCD_BASE_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-$(DOCKER_SYNCD_PLATFORM_CODE)-rpc +$(DOCKER_SYNCD_BASE_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_BASE_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BASE_RPC) +endif + +$(DOCKER_SYNCD_BASE_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_BASE_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro From ae3ae7d1cfefcf6008d02810d27393159bdcc3c7 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Wed, 17 Jul 2019 18:46:08 +0300 Subject: [PATCH 168/219] [Mellanox] update SDK/FW (#3169) Integrating official Mellanox SDK/FW release as a pre condition for getting new Mellanox SAI release with hash changes (inner field) and 3k VXLAN scale. As well as bug fix for Spectrum LP mode. Signed-off-by: Mykola Faryma --- platform/mellanox/fw.mk | 2 +- platform/mellanox/sdk.mk | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index b8f836446224..a3f04aad3811 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,6 +1,6 @@ # mellanox firmware -MLNX_FW_VERSION = 13.2000.1420 +MLNX_FW_VERSION = 13.2000.1634 MLNX_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_FW_VERSION))-EVB.mfa $(MLNX_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_FW_FILE) SONIC_ONLINE_FILES += $(MLNX_FW_FILE) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 7a767bdd5e3e..03a2d63cbad4 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ -MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/8c9e1ab89529967a2b1c567952c355290508308d/sdk -MLNX_SDK_VERSION = 4.3.1420 +MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/310eb922e133ecb3243e10efa4440fabe0ca73c7/sdk +MLNX_SDK_VERSION = 4.3.1634 MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SX_SDN_HAL) \ $(SXD_LIBS) $(TESTX) $(WJH_LIBS) From ea81f4056b3d137ae799f9f003df8d732cd8d92b Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 17 Jul 2019 16:19:01 -0700 Subject: [PATCH 169/219] [201811] Install mcelog package to host OS; log machine check exceptions (MCE) to syslog (#3160) --- build_debian.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 1e4454ce0b99..44ff8bac92a6 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -243,7 +243,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in python-scapy \ tcptraceroute \ mtr-tiny \ - locales + locales \ + mcelog #Adds a locale to a debian system in non-interactive mode sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ @@ -377,6 +378,9 @@ set /files/etc/sysctl.conf/net.core.rmem_max 2097152 set /files/etc/sysctl.conf/net.core.wmem_max 2097152 " -r $FILESYSTEM_ROOT +# Configure mcelog to log machine checks to syslog +sudo sed -i 's/^#syslog = yes/syslog = yes/' $FILESYSTEM_ROOT/etc/mcelog/mcelog.conf + ## docker-py is needed by Ansible docker module sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT easy_install pip sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0' From b1181291cee5f2f7c98a82acaeea21b5b4d3ddf4 Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Wed, 17 Jul 2019 03:44:43 +0530 Subject: [PATCH 170/219] [devices]: DellEMC S6100 Enabling Polling Mode for Miim Operation (#3133) --- .../Force10-S6100/th-s6100-64x40G-t0.config.bcm | 1 + .../Force10-S6100/th-s6100-64x40G-t1.config.bcm | 1 + 2 files changed, 2 insertions(+) diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm index 5132d448c91d..2820853905ec 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm @@ -10,6 +10,7 @@ lpm_ipv6_128b_reserved=0 ipv6_lpm_128b_enable=1 l2xmsg_mode=1 oversubscribe_mode=1 +miim_intr_enable=0 phy_gearbox_enable=1 phy_84752=1 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm index b6a4e6076a34..df22bcf23ed1 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm @@ -10,6 +10,7 @@ lpm_ipv6_128b_reserved=0 ipv6_lpm_128b_enable=1 l2xmsg_mode=1 oversubscribe_mode=1 +miim_intr_enable=0 phy_gearbox_enable=1 phy_84752=1 From c79774767e1223fe0e2b4d68001b0224495f7335 Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Wed, 17 Jul 2019 16:04:01 -0700 Subject: [PATCH 171/219] Fix for LLDP portname exposed as MAC address bug (#3152) * Subscribe to both ConfigDB and AppDB to get notifications to apply LLDP port config * the operstate file is not consistent Removing this since it is not serving any purpose * Remove check for PortInitDone and PortConfigDone This is not prteset in Config DB * Remove checking State DB for port creation * Check for key to be present before fetching it * Addressing review comments --- dockers/docker-lldp-sv2/lldpmgrd | 104 ++++++++++++++++++------------- 1 file changed, 62 insertions(+), 42 deletions(-) mode change 100755 => 100644 dockers/docker-lldp-sv2/lldpmgrd diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd old mode 100755 new mode 100644 index 62ed6904fb13..d66072602a88 --- a/dockers/docker-lldp-sv2/lldpmgrd +++ b/dockers/docker-lldp-sv2/lldpmgrd @@ -71,18 +71,6 @@ def signal_handler(sig, frame): else: log_warning("Caught unhandled signal '" + sig + "'") -# ========================== Helpers ================================== - -def is_port_exist(port_name): - filename = "/sys/class/net/%s/operstate" % port_name - if os.path.exists(filename): - with open(filename) as fp: - state = fp.read() - return "up" in state - else: - filename = "/sys/class/net/%s/ifindex" % port_name - return os.path.exists(filename) - # ============================== Classes ============================== class LldpManager(object): @@ -101,20 +89,43 @@ class LldpManager(object): REDIS_TIMEOUT_MS = 0 def __init__(self): - # Open a handle to the State database - self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB, - self.REDIS_HOSTNAME, - self.REDIS_PORT, - self.REDIS_TIMEOUT_MS) - # Open a handle to the Config database self.config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, self.REDIS_HOSTNAME, self.REDIS_PORT, self.REDIS_TIMEOUT_MS) + # Open a handle to the Application database + self.appl_db = swsscommon.DBConnector(swsscommon.APPL_DB, + self.REDIS_HOSTNAME, + self.REDIS_PORT, + self.REDIS_TIMEOUT_MS) + self.pending_cmds = {} + def is_port_up(self, port_name): + """ + Determine if a port is up or down by looking into the oper-status for the port in + PORT TABLE in the Application DB + """ + # Retrieve all entires for this port from the Port table + port_table = swsscommon.Table(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) + (status, fvp) = port_table.get(port_name) + if status: + # Convert list of tuples to a dictionary + port_table_dict = dict(fvp) + + # Get the oper-status for the port + if port_table_dict.has_key("oper_status"): + port_oper_status = port_table_dict.get("oper_status") + log_info("Port name {} oper status: {}".format(port_name, port_oper_status)) + return port_oper_status == "up" + else: + return False + else: + log_error("Port '{}' not found in {} table in App DB".format(port_name, swsscommon.APP_PORT_TABLE_NAME)) + return False + def generate_pending_lldp_config_cmd_for_port(self, port_name): """ For port `port_name`, look up the description and alias in the Config database, @@ -157,11 +168,6 @@ class LldpManager(object): to_delete = [] for (port_name, cmd) in self.pending_cmds.iteritems(): - if not is_port_exist(port_name): - # it doesn't make any sense to configure lldpd if the target port does not exist - # let's postpone the command for the next iteration - continue - log_debug("Running command: '{}'".format(cmd)) proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -185,37 +191,51 @@ class LldpManager(object): def run(self): """ Subscribes to notifications of changes in the PORT table - of the Redis State database. - Subscribe to STATE_DB - get notified of the creation of an interface + of the Redis Config/Application database. + Subscribe to APP_DB - get port oper status Subscribe to CONFIG_DB - get notified of port config changes Update LLDP configuration accordingly. """ # Set select timeout to 10 seconds SELECT_TIMEOUT_MS = 1000 * 10 - # Subscribe to PORT table notifications in the State DB sel = swsscommon.Select() - sst = swsscommon.SubscriberStateTable(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) - sel.addSelectable(sst) - sst = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) - sel.addSelectable(sst) - # Listen for changes to the PORT table in the STATE_DB and CONFIG_DB + # Subscribe to PORT table notifications in the Config DB + sst_confdb = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) + sel.addSelectable(sst_confdb) + + # Subscribe to PORT table notifications in the App DB + sst_appdb = swsscommon.SubscriberStateTable(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) + sel.addSelectable(sst_appdb) + + # Listen for changes to the PORT table in the CONFIG_DB and APP_DB while True: (state, c) = sel.select(SELECT_TIMEOUT_MS) if state == swsscommon.Select.OBJECT: - (key, op, fvp) = sst.pop() - - fvp_dict = dict(fvp) - - # handle creation - if op == "SET" and fvp_dict.get("state") == "ok": - self.generate_pending_lldp_config_cmd_for_port(key) - - # handle config change - if op in ["SET", "DEL"] and (fvp_dict.get("alias") or fvp_dict.get("description")) : - self.generate_pending_lldp_config_cmd_for_port(key) + (key, op, fvp) = sst_confdb.pop() + if fvp: + fvp_dict = dict(fvp) + + # handle config change + if (fvp_dict.has_key("alias") or fvp_dict.has_key("description")) and (op in ["SET", "DEL"]): + if self.is_port_up(key): + self.generate_pending_lldp_config_cmd_for_port(key) + else: + self.pending_cmds.pop(key, None) + + (key, op, fvp) = sst_appdb.pop() + if (key != "PortInitDone") and (key != "PortConfigDone"): + if fvp: + fvp_dict = dict(fvp) + + # handle port status change + if fvp_dict.has_key("oper_status"): + if "up" in fvp_dict.get("oper_status"): + self.generate_pending_lldp_config_cmd_for_port(key) + else: + self.pending_cmds.pop(key, None) # Process all pending commands self.process_pending_cmds() From 3375fb2262397a0e488aa5e32796466a1a7fb178 Mon Sep 17 00:00:00 2001 From: Sumukha Tumkur Vani Date: Thu, 18 Jul 2019 14:30:43 -0700 Subject: [PATCH 172/219] Reverting permission changes on lldpmgrd (#3184) The permissions got changed inadverently in this PR: https://github.com/Azure/sonic-buildimage/pull/3152 --- dockers/docker-lldp-sv2/lldpmgrd | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dockers/docker-lldp-sv2/lldpmgrd diff --git a/dockers/docker-lldp-sv2/lldpmgrd b/dockers/docker-lldp-sv2/lldpmgrd old mode 100644 new mode 100755 From d2e6daa3e4da6b84d198791b532b625693d53192 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 19 Jul 2019 23:11:09 -0700 Subject: [PATCH 173/219] [201811][sairedis][swss] advance sub modules head (#3189) * [201811][sairedis][swss] advance sub modules head Submodule src/sonic-sairedis 18ad5f9..4c75b7f: > Fixed conditional operator. (#487) Submodule src/sonic-swss 1e99c93..cd12d48: > [teamsyncd]: Add information for LAG membership changes (#982) > Fix vlan incremental config and add vs test cases (#799) Signed-off-by: Ying Xie * [swss] include more swss changes Submodule src/sonic-swss cd12d48..f44029d: > [MirrorOrch]: Init the next hop ip with 0 instead of default constructor (#953) > [AclOrch]: Fix the acl mirror counter doubled by inactive mirror and active again (#952) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 18ad5f925041..4c75b7f6a47d 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 18ad5f9250419c3a514701ae648839fd32f4d240 +Subproject commit 4c75b7f6a47d44ceb033deea7c2c711a9d27cb7a diff --git a/src/sonic-swss b/src/sonic-swss index 1e99c935d35b..f44029d2b1f9 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 1e99c935d35ba1ccf78607f1258a009a646af74f +Subproject commit f44029d2b1f92064dfccaa7d3eb8d362ba72447b From bba61eb838935b5c65951b7caa39b22f44ba7907 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Mon, 22 Jul 2019 16:06:43 -0700 Subject: [PATCH 174/219] 201811: Debug Image only fix: Let individual make files dictate the source path (#3202) --- dbg_files.sh | 22 ++-------------------- rules/frr.mk | 5 +++++ rules/libnl3.mk | 5 +++++ rules/libteam.mk | 6 ++++++ rules/lldpd.mk | 6 ++++++ rules/radvd.mk | 7 +++++++ rules/redis.mk | 6 ++++++ rules/sairedis.mk | 7 +++++++ rules/snmpd.mk | 6 ++++++ rules/swss-common.mk | 6 ++++++ rules/swss.mk | 6 ++++++ rules/tacacs.mk | 7 +++++++ slave.mk | 2 ++ 13 files changed, 71 insertions(+), 20 deletions(-) diff --git a/dbg_files.sh b/dbg_files.sh index d9ef601684b9..1515639bc9d7 100755 --- a/dbg_files.sh +++ b/dbg_files.sh @@ -1,26 +1,8 @@ #!/bin/bash -# Provie file paths to archive for debug image as relative to src subdir +# Provide file paths to archive for debug image as relative to src subdir # -SRC_DIR_LIST="\ - libteam \ - lldpd \ - libnl3 \ - radvd \ - redis \ - snmpd \ - sonic-dbsyncd \ - sonic-frr \ - sonic-platform-common \ - sonic-platform-daemons \ - sonic-py-swsssdk \ - sonic-sairedis \ - sonic-snmpagent \ - sonic-swss \ - sonic-swss-common \ - tacacs" - -for i in $SRC_DIR_LIST +for i in $debug_src_archive do find $i/ -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -type f done diff --git a/rules/frr.mk b/rules/frr.mk index ca2ece09cd3d..80f22f978b2b 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -11,3 +11,8 @@ SONIC_MAKE_DEBS += $(FRR) FRR_DBG = frr-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb $(eval $(call add_derived_package,$(FRR),$(FRR_DBG))) +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += sonic-frr + diff --git a/rules/libnl3.mk b/rules/libnl3.mk index 30e27c5c5157..dfe51093b07c 100644 --- a/rules/libnl3.mk +++ b/rules/libnl3.mk @@ -46,3 +46,8 @@ $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI))) LIBNL_CLI_DEV = libnl-cli-3-dev_$(LIBNL3_VERSION)_amd64.deb $(LIBNL_CLI_DEV)_DEPENDS += $(LIBNL_CLI) $(LIBNL_GENL3_DEV) $(LIBNL_NF3_DEV) $(LIBNL_ROUTE3_DEV) $(eval $(call add_derived_package,$(LIBNL3),$(LIBNL_CLI_DEV))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += libnl3 diff --git a/rules/libteam.mk b/rules/libteam.mk index 9aecb07ce86a..747f5dde4033 100644 --- a/rules/libteam.mk +++ b/rules/libteam.mk @@ -19,3 +19,9 @@ $(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAMDCT))) LIBTEAM_UTILS = libteam-utils_$(LIBTEAM_VERSION)_amd64.deb $(LIBTEAM_UTILS)_DEPENDS += $(LIBTEAMDCT) $(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += libteam + diff --git a/rules/lldpd.mk b/rules/lldpd.mk index 0e0d13721f83..a6e609cb0a9a 100644 --- a/rules/lldpd.mk +++ b/rules/lldpd.mk @@ -15,3 +15,9 @@ $(eval $(call add_derived_package,$(LLDPD),$(LIBLLDPCTL))) export LLDPD_VERSION export LLDPD export LIBLLDPCTL + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += lldpd + diff --git a/rules/radvd.mk b/rules/radvd.mk index 682f1d5e7595..ccd2a7505dd1 100644 --- a/rules/radvd.mk +++ b/rules/radvd.mk @@ -7,3 +7,10 @@ export RADVD_VERSION RADVD = radvd_$(RADVD_VERSION)_amd64.deb $(RADVD)_SRC_PATH = $(SRC_PATH)/radvd SONIC_MAKE_DEBS += $(RADVD) + + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += radvd + diff --git a/rules/redis.mk b/rules/redis.mk index 1adf209f6a6c..f44016fdb63e 100644 --- a/rules/redis.mk +++ b/rules/redis.mk @@ -13,3 +13,9 @@ REDIS_SENTINEL = redis-sentinel_$(REDIS_VERSION)_amd64.deb $(REDIS_SENTINEL)_DEPENDS += $(REDIS_SERVER) $(REDIS_SENTINEL)_RDEPENDS += $(REDIS_SERVER) $(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SENTINEL))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += redis + diff --git a/rules/sairedis.mk b/rules/sairedis.mk index fc481e620cd7..c85baf22f5ec 100644 --- a/rules/sairedis.mk +++ b/rules/sairedis.mk @@ -59,3 +59,10 @@ LIBSAIMETADATA_DBG = libsaimetadata-dbg_1.0.0_amd64.deb $(LIBSAIMETADATA_DBG)_DEPENDS += $(LIBSAIMETADATA) $(LIBSAIMETADATA_DBG)_RDEPENDS += $(LIBSAIMETADATA) $(eval $(call add_derived_package,$(LIBSAIREDIS),$(LIBSAIMETADATA_DBG))) + + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += sonic-sairedis + diff --git a/rules/snmpd.mk b/rules/snmpd.mk index b7635cc7e032..3a625d30e441 100644 --- a/rules/snmpd.mk +++ b/rules/snmpd.mk @@ -53,3 +53,9 @@ TKMIB = tkmib_$(SNMPD_VERSION_FULL)_all.deb $(TKMIB)_DEPENDS += $(LIBSNMP_PERL) $(TKMIB)_RDEPENDS += $(LIBSNMP_PERL) $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(TKMIB))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += snmpd + diff --git a/rules/swss-common.mk b/rules/swss-common.mk index 623410d4cdab..60564820f9b7 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -19,3 +19,9 @@ LIBSWSSCOMMON_DBG = libswsscommon-dbg_1.0.0_amd64.deb $(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON) $(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON) $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DBG))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += sonic-swss-common + diff --git a/rules/swss.mk b/rules/swss.mk index 429eb63ae822..a8919aee6e21 100644 --- a/rules/swss.mk +++ b/rules/swss.mk @@ -11,3 +11,9 @@ SWSS_DBG = swss-dbg_1.0.0_amd64.deb $(SWSS_DBG)_DEPENDS += $(SWSS) $(SWSS_DBG)_RDEPENDS += $(SWSS) $(eval $(call add_derived_package,$(SWSS),$(SWSS_DBG))) + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += sonic-swss + diff --git a/rules/tacacs.mk b/rules/tacacs.mk index 2d08710550f9..8b7e0a20161f 100644 --- a/rules/tacacs.mk +++ b/rules/tacacs.mk @@ -30,3 +30,10 @@ $(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS) SONIC_STRETCH_DEBS += $(LIBPAM_TACPLUS) $(LIBNSS_TACPLUS) + + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +# +DBG_SRC_ARCHIVE += tacacs + diff --git a/slave.mk b/slave.mk index e2e3d2729ef2..99f4559b11c1 100644 --- a/slave.mk +++ b/slave.mk @@ -607,6 +607,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ chmod +x sonic_debian_extension.sh, ) + export debug_src_archive="$(DBG_SRC_ARCHIVE)" + DEBUG_IMG="$(INSTALL_DEBUG_TOOLS)" \ USERNAME="$(USERNAME)" \ PASSWORD="$(PASSWORD)" \ From f1478818a14e1d1fdbb6b8ae7af7be4147911418 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 22 Jul 2019 14:13:50 -0700 Subject: [PATCH 175/219] Revert "[database] save configuration after DB migration (#3143)" (#3199) This reverts commit b5a4527cb0ae6c314329a4ee4b060f14264ddb02. --- files/build_templates/docker_image_ctl.j2 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 2d35598de9fb..426e519f1e48 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -63,11 +63,6 @@ function postStartAction() if [[ -x /usr/bin/db_migrator.py ]]; then # Migrate the DB to the latest schema version if needed /usr/bin/db_migrator.py -o migrate - - # Save in memory config_db to config_db.json for 2 reasons: - # 1. Persist the DB migration result. - # 2. Save in memory DB after warm reboot. - /usr/bin/config save -y fi {%- elif docker_container_name == "swss" %} docker exec swss rm -f /ready # remove cruft From 7a9d04ee7387ecb7122fd03cc2ffb21369113a61 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 23 Jul 2019 22:05:35 +0800 Subject: [PATCH 176/219] [Mellanox] Backporting reboot cause to 201811 (#3198) * backport new platform api to 201811, reboot cause part * install new platform api on host * 1. remove chassis's dependency on sonic_platform_daemon. 2. add some mellanox-specific hardware reboot causes. 3. fix typo in files/image_config/process-reboot-cause/process-reboot-cause. * 1. add dependency of sonic_platform for base image 2. handle the case of reboot cause file not found * adjust log message. --- .../build_templates/sonic_debian_extension.j2 | 6 + .../process-reboot-cause/process-reboot-cause | 2 +- platform/mellanox/mlnx-platform-api.mk | 8 ++ platform/mellanox/mlnx-platform-api/setup.py | 30 +++++ .../sonic_platform/__init__.py | 0 .../sonic_platform/chassis.py | 110 ++++++++++++++++++ .../sonic_platform/platform.py | 19 +++ platform/mellanox/rules.mk | 1 + slave.mk | 3 +- 9 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 platform/mellanox/mlnx-platform-api.mk create mode 100644 platform/mellanox/mlnx-platform-api/setup.py create mode 100644 platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py create mode 100644 platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py create mode 100644 platform/mellanox/mlnx-platform-api/sonic_platform/platform.py diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 9c6e8a553206..3b40bd87774e 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -333,6 +333,12 @@ sudo cp target/files/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/etc/mlnx/issu-version sudo cp target/files/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh + +# Install mlnx-sonic-platform Python 2 package +MLNX_PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{mlnx_platform_api_py2_wheel_path}}) +sudo cp {{mlnx_platform_api_py2_wheel_path}} $FILESYSTEM_ROOT/$MLNX_PLATFORM_COMMON_PY2_WHEEL_NAME +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install $MLNX_PLATFORM_COMMON_PY2_WHEEL_NAME +sudo rm -rf $FILESYSTEM_ROOT/$MLNX_PLATFORM_COMMON_PY2_WHEEL_NAME {% endif %} {%- if SONIC_ROUTING_STACK == "frr" %} diff --git a/files/image_config/process-reboot-cause/process-reboot-cause b/files/image_config/process-reboot-cause/process-reboot-cause index 81c496a025ce..964244b01d29 100755 --- a/files/image_config/process-reboot-cause/process-reboot-cause +++ b/files/image_config/process-reboot-cause/process-reboot-cause @@ -70,7 +70,7 @@ def main(): # if there is no sonic_platform package installed, we only provide # software-related reboot causes. try: - import sonic_platform + import sonic_platform.platform # Check if the previous reboot was caused by hardware platform = sonic_platform.platform.Platform() diff --git a/platform/mellanox/mlnx-platform-api.mk b/platform/mellanox/mlnx-platform-api.mk new file mode 100644 index 000000000000..4b70e59debc1 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api.mk @@ -0,0 +1,8 @@ +# SONIC_PLATFORM_API_PY2 package + +SONIC_PLATFORM_API_PY2 = mlnx_platform_api-1.0-py2-none-any.whl +$(SONIC_PLATFORM_API_PY2)_SRC_PATH = $(PLATFORM_PATH)/mlnx-platform-api +$(SONIC_PLATFORM_API_PY2)_PYTHON_VERSION = 2 +SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2) + +export mlnx_platform_api_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_API_PY2))" diff --git a/platform/mellanox/mlnx-platform-api/setup.py b/platform/mellanox/mlnx-platform-api/setup.py new file mode 100644 index 000000000000..12809c4085ed --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/setup.py @@ -0,0 +1,30 @@ +from setuptools import setup + +setup( + name='mlnx-platform-api', + version='1.0', + description='SONiC platform API implementation on Mellanox platform', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + maintainer='Kevin Wang', + maintainer_email='kevinw@mellanox.com', + packages=[ + 'sonic_platform', + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py b/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py new file mode 100644 index 000000000000..73279102691c --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from os.path import join + import io + import re + import subprocess + import syslog +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +HWMGMT_SYSTEM_ROOT = '/var/run/hw-management/system/' + +#reboot cause related definitions +REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT + +REBOOT_CAUSE_POWER_LOSS_FILE = 'reset_main_pwr_fail' +REBOOT_CAUSE_AUX_POWER_LOSS_FILE = 'reset_aux_pwr_or_ref' +REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC_FILE = 'reset_asic_thermal' +REBOOT_CAUSE_WATCHDOG_FILE = 'reset_hotswap_or_wd' +REBOOT_CAUSE_MLNX_FIRMWARE_RESET = 'reset_fw_reset' +REBOOT_CAUSE_LONG_PB = 'reset_long_pb' +REBOOT_CAUSE_SHORT_PB = 'reset_short_pb' + +REBOOT_CAUSE_FILE_LENGTH = 1 + +# ========================== Syslog wrappers ========================== +SYSLOG_IDENTIFIER = "mlnx-chassis" +def log_warning(msg, also_print_to_console=False): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_WARNING, msg) + syslog.closelog() + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + super(Chassis, self).__init__() + + def _read_generic_file(self, filename, len): + """ + Read a generic file, returns the contents of the file + """ + result = '' + try: + fileobj = io.open(filename) + result = fileobj.read(len) + fileobj.close() + return result + except Exception as e: + log_warning("Fail to read file {} due to {}".format(filename, repr(e))) + return '' + + def _verify_reboot_cause(self, filename): + ''' + Open and read the reboot cause file in + /var/run/hwmanagement/system (which is defined as REBOOT_CAUSE_ROOT) + If a reboot cause file doesn't exists, returns '0'. + ''' + try: + return bool(int(self._read_generic_file(join(REBOOT_CAUSE_ROOT, filename), REBOOT_CAUSE_FILE_LENGTH).rstrip('\n'))) + except: + return False + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + #read reboot causes files in the following order + minor_cause = '' + if self._verify_reboot_cause(REBOOT_CAUSE_POWER_LOSS_FILE): + major_cause = self.REBOOT_CAUSE_POWER_LOSS + elif self._verify_reboot_cause(REBOOT_CAUSE_AUX_POWER_LOSS_FILE): + major_cause = self.REBOOT_CAUSE_POWER_LOSS + elif self._verify_reboot_cause(REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC_FILE): + major_cause = self.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC + elif self._verify_reboot_cause(REBOOT_CAUSE_WATCHDOG_FILE): + major_cause = self.REBOOT_CAUSE_WATCHDOG + else: + major_cause = self.REBOOT_CAUSE_HARDWARE_OTHER + if self._verify_reboot_cause(REBOOT_CAUSE_MLNX_FIRMWARE_RESET): + minor_cause = "Reset by ASIC firmware" + elif self._verify_reboot_cause(REBOOT_CAUSE_LONG_PB): + minor_cause = "Reset by long press on power button" + elif self._verify_reboot_cause(REBOOT_CAUSE_SHORT_PB): + minor_cause = "Reset by short press on power button" + else: + major_cause = self.REBOOT_CAUSE_NON_HARDWARE + + return major_cause, minor_cause + diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py new file mode 100644 index 000000000000..5a081bd27f83 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# implementation of new platform api +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() \ No newline at end of file diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 1c0072bec3ce..afd52a3459b1 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -3,6 +3,7 @@ include $(PLATFORM_PATH)/fw.mk include $(PLATFORM_PATH)/mft.mk include $(PLATFORM_PATH)/mlnx-sai.mk include $(PLATFORM_PATH)/hw-management.mk +include $(PLATFORM_PATH)/mlnx-platform-api.mk include $(PLATFORM_PATH)/docker-syncd-mlnx.mk include $(PLATFORM_PATH)/docker-syncd-mlnx-rpc.mk include $(PLATFORM_PATH)/docker-orchagent-mlnx.mk diff --git a/slave.mk b/slave.mk index 99f4559b11c1..d32f37f6128a 100644 --- a/slave.mk +++ b/slave.mk @@ -558,7 +558,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) \ - $$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2)) + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2)) \ + $$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_API_PY2)) $(HEADER) # Pass initramfs and linux kernel explicitly. They are used for all platforms export initramfs_tools="$(DEBS_PATH)/$(INITRAMFS_TOOLS)" From 148df177bac70297a70a6aaa95b04ccc088d9e1b Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Wed, 24 Jul 2019 03:52:16 +0530 Subject: [PATCH 177/219] [devices]: DELL Platform 2.0 API Infra and Reboot Reason support in Z9100 & S6100 (#3147) --- dockers/docker-platform-monitor/start.sh | 18 ++++ .../debian/platform-modules-s6100.install | 1 + .../debian/platform-modules-z9100.install | 1 + .../sonic-platform-modules-dell/debian/rules | 12 +++ .../s6100/scripts/s6100_platform.sh | 11 +++ .../s6100/setup.py | 30 +++++++ .../s6100/sonic_platform/__init__.py | 2 + .../s6100/sonic_platform/chassis.py | 82 +++++++++++++++++++ .../z9100/scripts/z9100_platform.sh | 9 ++ .../z9100/setup.py | 1 + .../z9100/sonic_platform/__init__.py | 1 + .../z9100/sonic_platform/chassis.py | 82 +++++++++++++++++++ 12 files changed, 250 insertions(+) create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py create mode 120000 platform/broadcom/sonic-platform-modules-dell/z9100/setup.py create mode 120000 platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py diff --git a/dockers/docker-platform-monitor/start.sh b/dockers/docker-platform-monitor/start.sh index 30699694b6d2..3575c3d66eee 100755 --- a/dockers/docker-platform-monitor/start.sh +++ b/dockers/docker-platform-monitor/start.sh @@ -25,6 +25,24 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then supervisorctl start fancontrol fi + +# If the sonic-platform package is not installed, try to install it +pip show sonic-platform > /dev/null 2>&1 +if [ $? -ne 0 ]; then + SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl" + echo "sonic-platform package not installed, attempting to install..." + if [ -e ${SONIC_PLATFORM_WHEEL} ]; then + pip install ${SONIC_PLATFORM_WHEEL} + if [ $? -eq 0 ]; then + echo "Successfully installed ${SONIC_PLATFORM_WHEEL}" + else + echo "Error: Failed to install ${SONIC_PLATFORM_WHEEL}" + fi + else + echo "Error: Unable to locate ${SONIC_PLATFORM_WHEEL}" + fi +fi + supervisorctl start ledd supervisorctl start xcvrd diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index 9be9da0ab428..054d44bb8a9f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -8,3 +8,4 @@ common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin s6100/scripts/sensors usr/bin s6100/systemd/platform-modules-s6100.service etc/systemd/system +s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index 4e141c762c22..08f27cce47d3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -7,5 +7,6 @@ common/fstrim.service etc/systemd/system common/platform_reboot usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/scripts/platform_sensors.py usr/local/bin z9100/scripts/sensors usr/bin +z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/cfg/z9100-modules.conf etc/modules-load.d z9100/systemd/platform-modules-z9100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index 860e46bf7005..7ec14a23f215 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -16,9 +16,15 @@ override_dh_auto_build: if [ $$mod = "s6100" ]; then \ cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ + cd $(MOD_SRC_DIR)/$${mod}; \ + python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd $(MOD_SRC_DIR); \ elif [ $$mod = "z9100" ]; then \ cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ + cd $(MOD_SRC_DIR)/$${mod}; \ + python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd $(MOD_SRC_DIR); \ fi; \ echo "making man page alias $$mod -> $$mod APIs";\ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ @@ -40,9 +46,15 @@ override_dh_clean: if [ $$mod = "s6100" ]; then \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ elif [ $$mod = "z9100" ]; then \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ fi; \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ done) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index 1ac6ce93bc1d..3b455a9bf933 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -217,6 +217,14 @@ reset_muxes() { io_rd_wr.py --set --val 0xff --offset 0x20b } +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) + echo "pip install result = $rv" +} + init_devnum if [[ "$1" == "init" ]]; then @@ -235,6 +243,9 @@ if [[ "$1" == "init" ]]; then switch_board_qsfp "new_device" switch_board_qsfp_lpmode "disable" xcvr_presence_interrupts "enable" + + install_python_api_package + elif [[ "$1" == "deinit" ]]; then xcvr_presence_interrupts "disable" switch_board_sfp "delete_device" diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/setup.py b/platform/broadcom/sonic-platform-modules-dell/s6100/setup.py new file mode 100755 index 000000000000..eb95775c6677 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/setup.py @@ -0,0 +1,30 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on DellEmc Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + maintainer='DellEMC', + maintainer_email='dell-sonic@dell.com', + packages=[ + 'sonic_platform', + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py new file mode 100755 index 000000000000..139597f9cb07 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py @@ -0,0 +1,2 @@ + + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py new file mode 100755 index 000000000000..6245f8efdc0d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +############################################################################# +# DELLEMC +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.chassis_base import ChassisBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Chassis(ChassisBase): + """ + DELLEMC Platform-specific Chassis class + """ + + HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" + HWMON_NODE = os.listdir(HWMON_DIR)[0] + MAILBOX_DIR = HWMON_DIR + HWMON_NODE + + reset_reason_dict = {} + reset_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS + reset_reason_dict[33] = ChassisBase.REBOOT_CAUSE_WATCHDOG + reset_reason_dict[44] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + reset_reason_dict[55] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + + power_reason_dict = {} + power_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS + power_reason_dict[22] = ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU + power_reason_dict[33] = ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC + power_reason_dict[44] = ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED + + def __init__(self): + ChassisBase.__init__(self) + + def get_pmc_register(self, reg_name): + rv = 'ERR' + mb_reg_file = self.MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return rv + + try: + with open(mb_reg_file, 'r') as fd: + rv = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + """ + reset_reason = int(self.get_pmc_register('smf_reset_reason')) + power_reason = int(self.get_pmc_register('smf_poweron_reason')) + + # Reset_Reason = 11 ==> PowerLoss + # So return the reboot reason from Last Power_Reason Dictionary + # If Reset_Reason is not 11 return from Reset_Reason dictionary + # Also check if power_reason, reset_reason are valid values by + # checking key presence in dictionary else return + # REBOOT_CAUSE_HARDWARE_OTHER as the Power_Reason and Reset_Reason + # registers returned invalid data + if (reset_reason == 11): + if (power_reason in self.power_reason_dict): + return (self.power_reason_dict[power_reason], None) + else: + if (reset_reason in self.reset_reason_dict): + return (self.reset_reason_dict[reset_reason], None) + + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index 3cc48e52110f..a98da8ff2fbc 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -200,6 +200,14 @@ init_switch_port_led() { } +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) + echo "pip install result = $rv" +} + init_devnum if [[ "$1" == "init" ]]; then @@ -220,6 +228,7 @@ if [[ "$1" == "init" ]]; then #Copy led_proc_init.soc init_switch_port_led + install_python_api_package value=0x0 echo $value > /sys/class/i2c-adapter/i2c-14/14-003e/qsfp_lpmode diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/setup.py b/platform/broadcom/sonic-platform-modules-dell/z9100/setup.py new file mode 120000 index 000000000000..4f6de9941d96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/setup.py @@ -0,0 +1 @@ +../s6100/setup.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py new file mode 120000 index 000000000000..9972084d4dfb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py @@ -0,0 +1 @@ +../../s6100/sonic_platform/__init__.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py new file mode 100755 index 000000000000..6245f8efdc0d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +############################################################################# +# DELLEMC +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.chassis_base import ChassisBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Chassis(ChassisBase): + """ + DELLEMC Platform-specific Chassis class + """ + + HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" + HWMON_NODE = os.listdir(HWMON_DIR)[0] + MAILBOX_DIR = HWMON_DIR + HWMON_NODE + + reset_reason_dict = {} + reset_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS + reset_reason_dict[33] = ChassisBase.REBOOT_CAUSE_WATCHDOG + reset_reason_dict[44] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + reset_reason_dict[55] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + + power_reason_dict = {} + power_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS + power_reason_dict[22] = ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU + power_reason_dict[33] = ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC + power_reason_dict[44] = ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED + + def __init__(self): + ChassisBase.__init__(self) + + def get_pmc_register(self, reg_name): + rv = 'ERR' + mb_reg_file = self.MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + print mb_reg_file, 'not found !' + return rv + + try: + with open(mb_reg_file, 'r') as fd: + rv = fd.read() + except Exception as error: + logging.error("Unable to open ", mb_reg_file, "file !") + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + """ + reset_reason = int(self.get_pmc_register('smf_reset_reason')) + power_reason = int(self.get_pmc_register('smf_poweron_reason')) + + # Reset_Reason = 11 ==> PowerLoss + # So return the reboot reason from Last Power_Reason Dictionary + # If Reset_Reason is not 11 return from Reset_Reason dictionary + # Also check if power_reason, reset_reason are valid values by + # checking key presence in dictionary else return + # REBOOT_CAUSE_HARDWARE_OTHER as the Power_Reason and Reset_Reason + # registers returned invalid data + if (reset_reason == 11): + if (power_reason in self.power_reason_dict): + return (self.power_reason_dict[power_reason], None) + else: + if (reset_reason in self.reset_reason_dict): + return (self.reset_reason_dict[reset_reason], None) + + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + From 9476eaf518877dd85f655472e015516c6860d155 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Wed, 24 Jul 2019 09:44:14 -0700 Subject: [PATCH 178/219] [docker-engine]: Update docker engine to 18.09.8 (#3211) Signed-off-by: Neetha John --- build_debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 44ff8bac92a6..82cc1137c8cf 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -29,7 +29,7 @@ set -x -e ## docker engine version (with platform) -DOCKER_VERSION=5:18.09.2~3-0~debian-stretch +DOCKER_VERSION=5:18.09.8~3-0~debian-stretch LINUX_KERNEL_VERSION=4.9.0-9 ## Working directory to prepare the file system From bce8fee86a3d8d53ca7e8d5ec86a2b154b5a9edc Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 24 Jul 2019 09:45:24 -0700 Subject: [PATCH 179/219] [config-engine]: Add admin_status up to l2switch.json template (#3210) Bring up all ports by default by adding the admin_status:up to each of the ports. Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/data/l2switch.j2 | 15 +- .../tests/sample_output/l2switch.json | 163 +++++++++++++++++- src/sonic-config-engine/tests/test_j2files.py | 2 +- 3 files changed, 177 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/data/l2switch.j2 b/src/sonic-config-engine/data/l2switch.j2 index ee24f5ebd19d..c9f166b6798b 100644 --- a/src/sonic-config-engine/data/l2switch.j2 +++ b/src/sonic-config-engine/data/l2switch.j2 @@ -1,6 +1,19 @@ { "DEVICE_METADATA": {{ DEVICE_METADATA | tojson }}, - "PORT": {{ PORT | tojson }}, + {% set ns = {'firstPrinted': False} -%} + "PORT": { + {%- for key,value in PORT.iteritems() -%} + {%- if ns.firstPrinted %},{% endif %} + + "{{ key }}": { + "alias": "{{ value.alias }}", + "lanes": "{{ value.lanes }}", + "admin_status": "up" + } + {%- if ns.update({'firstPrinted': True}) %}{% endif -%} + {%- endfor %} + + }, "VLAN": { "Vlan1000": { "vlanid": "1000" diff --git a/src/sonic-config-engine/tests/sample_output/l2switch.json b/src/sonic-config-engine/tests/sample_output/l2switch.json index e8af54869e02..fd83589153ea 100644 --- a/src/sonic-config-engine/tests/sample_output/l2switch.json +++ b/src/sonic-config-engine/tests/sample_output/l2switch.json @@ -1,6 +1,167 @@ { "DEVICE_METADATA": {"localhost": {"hwsku": "Mellanox-SN2700"}}, - "PORT": {"Ethernet0": {"alias": "fortyGigE0/0", "lanes": "29,30,31,32"}, "Ethernet100": {"alias": "fortyGigE0/100", "lanes": "125,126,127,128"}, "Ethernet104": {"alias": "fortyGigE0/104", "lanes": "85,86,87,88"}, "Ethernet108": {"alias": "fortyGigE0/108", "lanes": "81,82,83,84"}, "Ethernet112": {"alias": "fortyGigE0/112", "lanes": "89,90,91,92"}, "Ethernet116": {"alias": "fortyGigE0/116", "lanes": "93,94,95,96"}, "Ethernet12": {"alias": "fortyGigE0/12", "lanes": "33,34,35,36"}, "Ethernet120": {"alias": "fortyGigE0/120", "lanes": "97,98,99,100"}, "Ethernet124": {"alias": "fortyGigE0/124", "lanes": "101,102,103,104"}, "Ethernet16": {"alias": "fortyGigE0/16", "lanes": "41,42,43,44"}, "Ethernet20": {"alias": "fortyGigE0/20", "lanes": "45,46,47,48"}, "Ethernet24": {"alias": "fortyGigE0/24", "lanes": "5,6,7,8"}, "Ethernet28": {"alias": "fortyGigE0/28", "lanes": "1,2,3,4"}, "Ethernet32": {"alias": "fortyGigE0/32", "lanes": "9,10,11,12"}, "Ethernet36": {"alias": "fortyGigE0/36", "lanes": "13,14,15,16"}, "Ethernet4": {"alias": "fortyGigE0/4", "lanes": "25,26,27,28"}, "Ethernet40": {"alias": "fortyGigE0/40", "lanes": "21,22,23,24"}, "Ethernet44": {"alias": "fortyGigE0/44", "lanes": "17,18,19,20"}, "Ethernet48": {"alias": "fortyGigE0/48", "lanes": "49,50,51,52"}, "Ethernet52": {"alias": "fortyGigE0/52", "lanes": "53,54,55,56"}, "Ethernet56": {"alias": "fortyGigE0/56", "lanes": "61,62,63,64"}, "Ethernet60": {"alias": "fortyGigE0/60", "lanes": "57,58,59,60"}, "Ethernet64": {"alias": "fortyGigE0/64", "lanes": "65,66,67,68"}, "Ethernet68": {"alias": "fortyGigE0/68", "lanes": "69,70,71,72"}, "Ethernet72": {"alias": "fortyGigE0/72", "lanes": "77,78,79,80"}, "Ethernet76": {"alias": "fortyGigE0/76", "lanes": "73,74,75,76"}, "Ethernet8": {"alias": "fortyGigE0/8", "lanes": "37,38,39,40"}, "Ethernet80": {"alias": "fortyGigE0/80", "lanes": "105,106,107,108"}, "Ethernet84": {"alias": "fortyGigE0/84", "lanes": "109,110,111,112"}, "Ethernet88": {"alias": "fortyGigE0/88", "lanes": "117,118,119,120"}, "Ethernet92": {"alias": "fortyGigE0/92", "lanes": "113,114,115,116"}, "Ethernet96": {"alias": "fortyGigE0/96", "lanes": "121,122,123,124"}}, + "PORT": { + "Ethernet0": { + "alias": "fortyGigE0/0", + "lanes": "29,30,31,32", + "admin_status": "up" + }, + "Ethernet4": { + "alias": "fortyGigE0/4", + "lanes": "25,26,27,28", + "admin_status": "up" + }, + "Ethernet8": { + "alias": "fortyGigE0/8", + "lanes": "37,38,39,40", + "admin_status": "up" + }, + "Ethernet12": { + "alias": "fortyGigE0/12", + "lanes": "33,34,35,36", + "admin_status": "up" + }, + "Ethernet16": { + "alias": "fortyGigE0/16", + "lanes": "41,42,43,44", + "admin_status": "up" + }, + "Ethernet20": { + "alias": "fortyGigE0/20", + "lanes": "45,46,47,48", + "admin_status": "up" + }, + "Ethernet24": { + "alias": "fortyGigE0/24", + "lanes": "5,6,7,8", + "admin_status": "up" + }, + "Ethernet28": { + "alias": "fortyGigE0/28", + "lanes": "1,2,3,4", + "admin_status": "up" + }, + "Ethernet32": { + "alias": "fortyGigE0/32", + "lanes": "9,10,11,12", + "admin_status": "up" + }, + "Ethernet36": { + "alias": "fortyGigE0/36", + "lanes": "13,14,15,16", + "admin_status": "up" + }, + "Ethernet40": { + "alias": "fortyGigE0/40", + "lanes": "21,22,23,24", + "admin_status": "up" + }, + "Ethernet44": { + "alias": "fortyGigE0/44", + "lanes": "17,18,19,20", + "admin_status": "up" + }, + "Ethernet48": { + "alias": "fortyGigE0/48", + "lanes": "49,50,51,52", + "admin_status": "up" + }, + "Ethernet52": { + "alias": "fortyGigE0/52", + "lanes": "53,54,55,56", + "admin_status": "up" + }, + "Ethernet56": { + "alias": "fortyGigE0/56", + "lanes": "61,62,63,64", + "admin_status": "up" + }, + "Ethernet60": { + "alias": "fortyGigE0/60", + "lanes": "57,58,59,60", + "admin_status": "up" + }, + "Ethernet64": { + "alias": "fortyGigE0/64", + "lanes": "65,66,67,68", + "admin_status": "up" + }, + "Ethernet68": { + "alias": "fortyGigE0/68", + "lanes": "69,70,71,72", + "admin_status": "up" + }, + "Ethernet72": { + "alias": "fortyGigE0/72", + "lanes": "77,78,79,80", + "admin_status": "up" + }, + "Ethernet76": { + "alias": "fortyGigE0/76", + "lanes": "73,74,75,76", + "admin_status": "up" + }, + "Ethernet80": { + "alias": "fortyGigE0/80", + "lanes": "105,106,107,108", + "admin_status": "up" + }, + "Ethernet84": { + "alias": "fortyGigE0/84", + "lanes": "109,110,111,112", + "admin_status": "up" + }, + "Ethernet88": { + "alias": "fortyGigE0/88", + "lanes": "117,118,119,120", + "admin_status": "up" + }, + "Ethernet92": { + "alias": "fortyGigE0/92", + "lanes": "113,114,115,116", + "admin_status": "up" + }, + "Ethernet96": { + "alias": "fortyGigE0/96", + "lanes": "121,122,123,124", + "admin_status": "up" + }, + "Ethernet100": { + "alias": "fortyGigE0/100", + "lanes": "125,126,127,128", + "admin_status": "up" + }, + "Ethernet104": { + "alias": "fortyGigE0/104", + "lanes": "85,86,87,88", + "admin_status": "up" + }, + "Ethernet108": { + "alias": "fortyGigE0/108", + "lanes": "81,82,83,84", + "admin_status": "up" + }, + "Ethernet112": { + "alias": "fortyGigE0/112", + "lanes": "89,90,91,92", + "admin_status": "up" + }, + "Ethernet116": { + "alias": "fortyGigE0/116", + "lanes": "93,94,95,96", + "admin_status": "up" + }, + "Ethernet120": { + "alias": "fortyGigE0/120", + "lanes": "97,98,99,100", + "admin_status": "up" + }, + "Ethernet124": { + "alias": "fortyGigE0/124", + "lanes": "101,102,103,104", + "admin_status": "up" + } + }, "VLAN": { "Vlan1000": { "vlanid": "1000" diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index ce7f56eccff6..8718e1e422e3 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -86,7 +86,7 @@ def test_ipinip(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', 'ipinip.json') assert filecmp.cmp(sample_output_file, self.output_file) - def test_sku_render_template(self): + def test_l2switch_template(self): argument = '-k Mellanox-SN2700 -t ' + os.path.join(self.test_dir, '../data/l2switch.j2') + ' -p ' + self.t0_port_config + ' > ' + self.output_file self.run_script(argument) From 7cf90ec441c961faca5dc6ff87a3547d98e9acfd Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 24 Jul 2019 09:59:47 -0700 Subject: [PATCH 180/219] [warm reboot] save configuration after warm reboot (#3200) * [warm reboot] save configuration after warm reboot After warm reboot, save a copy of in memory database to config_db.json, upgrade procedure might have removed config_db.json to force new image to reload minigraph. However, reload minigraph is skipped during warm reboot. Missing config_db.json would cause device to fault in next non-upgrading cold/fast reboot. Signed-off-by: Ying Xie * Update finalize-warmboot.sh --- files/image_config/warmboot-finalizer/finalize-warmboot.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh index 653a00291f72..00e4e1b7f3f9 100755 --- a/files/image_config/warmboot-finalizer/finalize-warmboot.sh +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -78,6 +78,11 @@ if [[ x"${WARM_BOOT}" != x"true" ]]; then exit 0 fi +# No need to wait for the reconciliation process. Database has been loaded +# and migrated. This is good enough to save a copy. +debug "Save in-memory database after warm reboot ..." +config save -y + list=${COMP_LIST} # Wait up to 5 minutes From 29bbd868629cf638b092b3dcd0eff96f7893a68f Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Mon, 29 Jul 2019 18:10:26 -0700 Subject: [PATCH 181/219] [services] Restart SwSS service upon unexpected critical process exit (#2845) (#2852) --- dockers/docker-dhcp-relay/wait_for_intf.sh.j2 | 38 +++++++------- dockers/docker-orchagent/Dockerfile.j2 | 2 + dockers/docker-orchagent/critical_processes | 9 ++++ dockers/docker-orchagent/supervisord.conf | 8 ++- files/build_templates/dhcp_relay.service.j2 | 2 +- files/build_templates/radv.service.j2 | 2 +- files/build_templates/snmp.service.j2 | 3 ++ files/build_templates/swss.service.j2 | 4 ++ files/build_templates/teamd.service.j2 | 4 +- files/image_config/systemd/journald.conf | 2 +- files/scripts/supervisor-proc-exit-listener | 45 +++++++++++++++++ platform/template/docker-orchagent-base.mk | 2 +- rules/docker-dhcp-relay.mk | 2 +- rules/scripts.mk | 8 +-- .../tests/sample_output/wait_for_intf.sh | 50 +++++++++---------- 15 files changed, 124 insertions(+), 57 deletions(-) create mode 100644 dockers/docker-orchagent/critical_processes create mode 100755 files/scripts/supervisor-proc-exit-listener diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index 037dc66ead63..23133706cb6c 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -1,42 +1,40 @@ #!/usr/bin/env bash -function wait_until_iface_ready -{ - IFACE=$1 +STATE_DB_IDX="6" - echo "Waiting until interface $IFACE is up..." - - # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show dev $IFACE up > /dev/null 2>&1; do - sleep 1 - done +PORT_TABLE_PREFIX="PORT_TABLE" +VLAN_TABLE_PREFIX="VLAN_TABLE" +LAG_TABLE_PREFIX="LAG_TABLE" - echo "Interface $IFACE is up" +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 - echo "Waiting until interface $IFACE has an IPv4 address..." + echo "Waiting until interface $IFACE is ready..." - # Wait until the interface gets assigned an IPv4 address + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") while true; do - IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) - - if [ -n "$IP" ]; then + RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then break fi sleep 1 done - echo "Interface $IFACE is configured with IP $IP" + echo "Interface ${IFACE} is ready!" } -# Wait for all interfaces to come up and have IPv4 addresses assigned +# Wait for all interfaces to be up and ready {% for (name, prefix) in INTERFACE %} -wait_until_iface_ready {{ name }} +wait_until_iface_ready ${PORT_TABLE_PREFIX} {{ name }} {% endfor %} {% for (name, prefix) in VLAN_INTERFACE %} -wait_until_iface_ready {{ name }} +wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} {% endfor %} {% for (name, prefix) in PORTCHANNEL_INTERFACE %} -wait_until_iface_ready {{ name }} +wait_until_iface_ready ${LAG_TABLE_PREFIX} {{ name }} {% endfor %} diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 4fcbe08ab7ac..54088db30e5e 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -40,6 +40,8 @@ COPY ["files/arp_update", "/usr/bin"] COPY ["enable_counters.py", "/usr/bin"] COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["critical_processes", "/etc/supervisor/"] ## Copy all Jinja2 template files into the templates folder COPY ["*.j2", "/usr/share/sonic/templates/"] diff --git a/dockers/docker-orchagent/critical_processes b/dockers/docker-orchagent/critical_processes new file mode 100644 index 000000000000..fcf497d42259 --- /dev/null +++ b/dockers/docker-orchagent/critical_processes @@ -0,0 +1,9 @@ +orchagent +portsyncd +neighsyncd +vlanmgrd +intfmgrd +portmgrd +buffermgrd +vrfmgrd +nbrmgrd diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index e6bfba3cb283..b8d143a17a33 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -3,6 +3,12 @@ logfile_maxbytes=1MB logfile_backups=2 nodaemon=true +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected + [program:start.sh] command=/usr/bin/start.sh priority=1 @@ -15,7 +21,7 @@ stderr_logfile=syslog command=/usr/sbin/rsyslogd -n priority=2 autostart=false -autorestart=false +autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog diff --git a/files/build_templates/dhcp_relay.service.j2 b/files/build_templates/dhcp_relay.service.j2 index 5a462e53973d..7ec133c87af7 100644 --- a/files/build_templates/dhcp_relay.service.j2 +++ b/files/build_templates/dhcp_relay.service.j2 @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] -WantedBy=multi-user.target teamd.service +WantedBy=multi-user.target swss.service teamd.service diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 8cda2fdd0afb..4f1c67e661b0 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target swss.service diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index 416156d5a891..43f46bd2b9c0 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -9,3 +9,6 @@ Before=ntp-config.service ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop + +[Install] +WantedBy=multi-user.target swss.service diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 4fe55a9e957d..0490528afb9e 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -9,6 +9,8 @@ Requires=nps-modules-4.9.0-9-amd64.service After=database.service updategraph.service After=interfaces-config.service Before=ntp-config.service +StartLimitIntervalSec=1200 +StartLimitBurst=3 [Service] User=root @@ -16,6 +18,8 @@ Environment=sonic_asic_platform={{ sonic_asic_platform }} ExecStartPre=/usr/local/bin/swss.sh start ExecStart=/usr/local/bin/swss.sh wait ExecStop=/usr/local/bin/swss.sh stop +Restart=always +RestartSec=30 [Install] WantedBy=multi-user.target diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 8034698ecc07..58c858effb36 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=TEAMD container -Requires=updategraph.service +Requires=updategraph.service swss.service After=updategraph.service swss.service Before=ntp-config.service @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target swss.service diff --git a/files/image_config/systemd/journald.conf b/files/image_config/systemd/journald.conf index 0f3d1b5ec25b..214bd099a285 100644 --- a/files/image_config/systemd/journald.conf +++ b/files/image_config/systemd/journald.conf @@ -13,7 +13,7 @@ #Seal=yes #SplitMode=uid #SyncIntervalSec=5m -#RateLimitInterval=30s +#RateLimitIntervalSec=30s #RateLimitBurst=1000 SystemMaxUse=50M #SystemKeepFree= diff --git a/files/scripts/supervisor-proc-exit-listener b/files/scripts/supervisor-proc-exit-listener new file mode 100755 index 000000000000..6bc62fc400c8 --- /dev/null +++ b/files/scripts/supervisor-proc-exit-listener @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import os +import signal +import sys +import syslog + +from supervisor import childutils + +# Contents of file should be the names of critical processes (as defined in +# supervisor.conf file), one per line +CRITICAL_PROCESSES_FILE = '/etc/supervisor/critical_processes' + +def main(): + # Read the list of critical processes from a file + with open(CRITICAL_PROCESSES_FILE, 'r') as f: + critical_processes = [line.rstrip('\n') for line in f] + + while True: + # Transition from ACKNOWLEDGED to READY + childutils.listener.ready() + + line = sys.stdin.readline() + headers = childutils.get_headers(line) + payload = sys.stdin.read(int(headers['len'])) + + # Transition from READY to ACKNOWLEDGED + childutils.listener.ok() + + # We only care about PROCESS_STATE_EXITED events + if headers['eventname'] == 'PROCESS_STATE_EXITED': + payload_headers, payload_data = childutils.eventdata(payload + '\n') + + expected = int(payload_headers['expected']) + processname = payload_headers['processname'] + + # If a critical process exited unexpectedly, terminate supervisor + if expected == 0 and processname in critical_processes: + MSG_FORMAT_STR = "Process {} exited unxepectedly. Terminating supervisor..." + msg = MSG_FORMAT_STR.format(payload_headers['processname']) + syslog.syslog(syslog.LOG_INFO, msg) + os.kill(os.getppid(), signal.SIGTERM) + +if __name__ == "__main__": + main() diff --git a/platform/template/docker-orchagent-base.mk b/platform/template/docker-orchagent-base.mk index 9ce0b15de2b5..04b49ebfdcbb 100644 --- a/platform/template/docker-orchagent-base.mk +++ b/platform/template/docker-orchagent-base.mk @@ -32,4 +32,4 @@ $(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ORCHAGENT_BASE)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT_BASE)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel -$(DOCKER_ORCHAGENT_BASE)_FILES += $(ARP_UPDATE_SCRIPT) +$(DOCKER_ORCHAGENT_BASE)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 6ae73be1ea22..4119c6f553f8 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -6,7 +6,7 @@ DOCKER_DHCP_RELAY_DBG = $(DOCKER_DHCP_RELAY_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay -$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) +$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(REDIS_TOOLS) $(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE)_DBG_DEPENDS) $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE)_DBG_IMAGE_PACKAGES) diff --git a/rules/scripts.mk b/rules/scripts.mk index 6010b10b832b..5ff558d3d6af 100644 --- a/rules/scripts.mk +++ b/rules/scripts.mk @@ -11,9 +11,11 @@ $(BUFFERS_CONFIG_TEMPLATE)_PATH = files/build_templates QOS_CONFIG_TEMPLATE = qos_config.j2 $(QOS_CONFIG_TEMPLATE)_PATH = files/build_templates +SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT = supervisor-proc-exit-listener +$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)_PATH = files/scripts + SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(ARP_UPDATE_SCRIPT) \ $(BUFFERS_CONFIG_TEMPLATE) \ - $(QOS_CONFIG_TEMPLATE) - - + $(QOS_CONFIG_TEMPLATE) \ + $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh index 0f06235eb0dc..383f7cb389e9 100644 --- a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -1,43 +1,41 @@ #!/usr/bin/env bash -function wait_until_iface_ready -{ - IFACE=$1 +STATE_DB_IDX="6" - echo "Waiting until interface $IFACE is up..." - - # Wait for the interface to come up (i.e., 'ip link show' returns 0) - until ip link show dev $IFACE up > /dev/null 2>&1; do - sleep 1 - done +PORT_TABLE_PREFIX="PORT_TABLE" +VLAN_TABLE_PREFIX="VLAN_TABLE" +LAG_TABLE_PREFIX="LAG_TABLE" - echo "Interface $IFACE is up" +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 - echo "Waiting until interface $IFACE has an IPv4 address..." + echo "Waiting until interface $IFACE is ready..." - # Wait until the interface gets assigned an IPv4 address + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") while true; do - IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1) - - if [ -n "$IP" ]; then + RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then break fi sleep 1 done - echo "Interface $IFACE is configured with IP $IP" + echo "Interface ${IFACE} is ready!" } -# Wait for all interfaces to come up and have IPv4 addresses assigned -wait_until_iface_ready Vlan1000 -wait_until_iface_ready PortChannel01 -wait_until_iface_ready PortChannel01 -wait_until_iface_ready PortChannel02 -wait_until_iface_ready PortChannel02 -wait_until_iface_ready PortChannel03 -wait_until_iface_ready PortChannel03 -wait_until_iface_ready PortChannel04 -wait_until_iface_ready PortChannel04 +# Wait for all interfaces to be up and ready +wait_until_iface_ready ${VLAN_TABLE_PREFIX} Vlan1000 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04 +wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04 From f314e3f885813d27a34cf7ec2116f7c4fad83bc4 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Mon, 29 Jul 2019 21:56:59 -0700 Subject: [PATCH 182/219] [device/arista] Update arista drivers submodules (#3170) * [device/arista] Update arista drivers submodules * Change driver name in fancontrol --- device/arista/x86_64-arista_7170_64c/fancontrol | 2 +- device/arista/x86_64-arista_7260cx3_64/fancontrol | 2 +- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/device/arista/x86_64-arista_7170_64c/fancontrol b/device/arista/x86_64-arista_7170_64c/fancontrol index 90a078b7c419..7236dbf4d18d 100644 --- a/device/arista/x86_64-arista_7170_64c/fancontrol +++ b/device/arista/x86_64-arista_7170_64c/fancontrol @@ -1,6 +1,6 @@ INTERVAL=5 DEVPATH=hwmon2=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-8/8-004c hwmon4=devices/pci0000:ff/0000:ff:0b.3/i2c-93/93-0060 -DEVNAME=hwmon2=max6658 hwmon4=rook_cpld +DEVNAME=hwmon2=max6658 hwmon4=la_cpld FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input MINTEMP=hwmon4/pwm4=50 hwmon4/pwm3=50 hwmon4/pwm2=50 hwmon4/pwm1=50 diff --git a/device/arista/x86_64-arista_7260cx3_64/fancontrol b/device/arista/x86_64-arista_7260cx3_64/fancontrol index 2397d6d700c0..eb64fb3e670e 100644 --- a/device/arista/x86_64-arista_7260cx3_64/fancontrol +++ b/device/arista/x86_64-arista_7260cx3_64/fancontrol @@ -1,6 +1,6 @@ INTERVAL=5 DEVPATH=hwmon2=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-1/1-004c hwmon4=devices/pci0000:ff/0000:ff:0b.3/i2c-85/85-0060 -DEVNAME=hwmon2=max6658 hwmon4=rook_cpld +DEVNAME=hwmon2=max6658 hwmon4=la_cpld FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input MINTEMP=hwmon4/pwm4=50 hwmon4/pwm3=50 hwmon4/pwm2=50 hwmon4/pwm1=50 diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 9c517cbc40b1..643914ebcdd5 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 9c517cbc40b143c3d0ba32d7e996ac0618c17c5c +Subproject commit 643914ebcdd500a1ac0e46a1f78be490ade85996 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 9c517cbc40b1..643914ebcdd5 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 9c517cbc40b143c3d0ba32d7e996ac0618c17c5c +Subproject commit 643914ebcdd500a1ac0e46a1f78be490ade85996 From 1ddfa130a6697fd82e4068de8b49d6b666fc0236 Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Tue, 30 Jul 2019 18:00:09 -0700 Subject: [PATCH 183/219] Update sonic-platform-modules-arista for 201811 (#3232) --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 643914ebcdd5..584f1c50937d 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 643914ebcdd500a1ac0e46a1f78be490ade85996 +Subproject commit 584f1c50937da7dfc1acc7283be1baf3b3c821fd diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 643914ebcdd5..584f1c50937d 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 643914ebcdd500a1ac0e46a1f78be490ade85996 +Subproject commit 584f1c50937da7dfc1acc7283be1baf3b3c821fd From 7f526b8dd7844a96cb600a86bc07f2447a0067da Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 1 Aug 2019 06:01:59 +0800 Subject: [PATCH 184/219] update 201811 brach submodule (#3246) --- src/sonic-linux-kernel | 2 +- src/sonic-platform-daemons | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 2754b37b5327..73fc8478c0b1 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 2754b37b532711b0b13d50cf04b27714b0e4a11e +Subproject commit 73fc8478c0b154209e9eaf51a70f19c44b2a4851 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index bc23ab0b0b87..42f64d8f61b8 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit bc23ab0b0b87b3ed022a7728c069e580b70bf23d +Subproject commit 42f64d8f61b83fdef07c6ac24b2d67f820e1e745 From d45d00d1a03004a44b72b291ca11d9ea934c98c8 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 31 Jul 2019 16:37:48 -0700 Subject: [PATCH 185/219] [201811][sairedis] advance sub-module head (#3247) Submodule src/sonic-sairedis 4c75b7f..54c8e78: > [saisdkdump]: Fix dump generation crash (#493) > Fix bug: Restore sai log levels from LOGLEVEL_DB after saiDiscover (#491) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 4c75b7f6a47d..54c8e78d712f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 4c75b7f6a47d44ceb033deea7c2c711a9d27cb7a +Subproject commit 54c8e78d712fb0d8a56f032a39eb746b2b5976af From da57e8db36f68f1abf6f5c38197b4027a8f69ab8 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 31 Jul 2019 16:44:17 -0700 Subject: [PATCH 186/219] Revert back to 'import sonic_platform' (#3249) --- files/image_config/process-reboot-cause/process-reboot-cause | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/process-reboot-cause/process-reboot-cause b/files/image_config/process-reboot-cause/process-reboot-cause index 964244b01d29..81c496a025ce 100755 --- a/files/image_config/process-reboot-cause/process-reboot-cause +++ b/files/image_config/process-reboot-cause/process-reboot-cause @@ -70,7 +70,7 @@ def main(): # if there is no sonic_platform package installed, we only provide # software-related reboot causes. try: - import sonic_platform.platform + import sonic_platform # Check if the previous reboot was caused by hardware platform = sonic_platform.platform.Platform() From 3cdfb4341d6790371af8eb209b322e946209ec65 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 31 Jul 2019 16:44:35 -0700 Subject: [PATCH 187/219] [libteam]: Fix libteam race condition when interface is created and enslaved (#3250) The race condition could happen like this: When an interface is enslaved into the port channel immediately after it is created, the order of creating the ifinfo and linking the ifinfo to the port is not guaranteed. Please check the patch commit message to get full details. Signed-off-by: Shu0T1an ChenG --- ...ith_port-race-condition-with-newlink.patch | 45 +++++++++++++++++++ src/libteam/series | 1 + 2 files changed, 46 insertions(+) create mode 100644 src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch diff --git a/src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch b/src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch new file mode 100644 index 000000000000..bab3a9108325 --- /dev/null +++ b/src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch @@ -0,0 +1,45 @@ +From 9a27e9b85afbbf6235e61c2426481e49a2139219 Mon Sep 17 00:00:00 2001 +From: Shu0T1an ChenG +Date: Tue, 15 Jan 2019 12:23:02 -0800 +Subject: [PATCH] Fix ifinfo_link_with_port race condition with newlink + +The race condition could happen like this: +When an interface is enslaved into the port channel immediately after +it is created, the order of creating the ifinfo and linking the ifinfo to +the port is not guaranteed. + +The team handler will listen to both netlink message to track new links +get created to allocate the ifinfo and add the ifinfo into its linked list, +and the team port change message to link the new port with ifinfo found +in its linkedin list. However, when the ifinfo is not yet created, the error +message "Failed to link port with ifinfo" is thrown with member port failed +to be added into the team handler's port list. + +This fix adds a condition to check if ifinfo_link_with_port is linking ifinfo +to a port or to the team interface itself. If it is a port, ifinfo_find_create +function is used to fix the race condition. + +Signed-off-by: Shu0T1an ChenG +--- + libteam/ifinfo.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c +index 44de4ca..444e0cd 100644 +--- a/libteam/ifinfo.c ++++ b/libteam/ifinfo.c +@@ -429,7 +429,10 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, + { + struct team_ifinfo *ifinfo; + +- ifinfo = ifinfo_find(th, ifindex); ++ if (port) ++ ifinfo = ifinfo_find_create(th, ifindex); ++ else ++ ifinfo = ifinfo_find(th, ifindex); + if (!ifinfo) + return -ENOENT; + if (ifinfo->linked) +-- +2.1.4 + diff --git a/src/libteam/series b/src/libteam/series index ed89005c17c0..d1fec73c1fad 100644 --- a/src/libteam/series +++ b/src/libteam/series @@ -9,3 +9,4 @@ 0013-teamd-lacp-port-admin-down-recv-not-processing.patch 0014-Send-LACP-PDU-immediately-if-our-state-changed.patch 0015-libteam-Add-warm_reboot-mode.patch +0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch From a103f734526bb2c93d87ba8182066c1007f794e3 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 31 Jul 2019 19:14:49 -0700 Subject: [PATCH 188/219] [201811][linux-kernel] advance sub module head (#3254) Submodule src/sonic-linux-kernel 73fc847..eea4da7: > [kernel source] download kernel source files from azure storage (#95) Signed-off-by: Ying Xie --- src/sonic-linux-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 73fc8478c0b1..eea4da7acd15 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 73fc8478c0b154209e9eaf51a70f19c44b2a4851 +Subproject commit eea4da7acd15be5766a4ab7db3feb6561fd2b5b4 From c07c48218b0d8ce359c32ebd06b16ae568bac8ce Mon Sep 17 00:00:00 2001 From: Andriy Moroz Date: Fri, 2 Aug 2019 07:27:36 +0300 Subject: [PATCH 189/219] [Mellanox] Update SAI to fix 50G FEC issue (#3266) Signed-off-by: Andriy Moroz --- platform/mellanox/mlnx-sai.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index fd9f5b473ded..2027dea4eba0 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,7 +1,7 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.14.1-master -MLNX_SAI_REVISION = 80e08e8f12746801d683730a5e147cd6e77becfb +MLNX_SAI_VERSION = SAIRel1.14.2-master +MLNX_SAI_REVISION = 6178b6ab8c6757cc7b3b8f631c52d9b584d8c6f4 export MLNX_SAI_VERSION MLNX_SAI_REVISION From ca38147744a059eec80adad0a71a7ada182c5720 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Sat, 3 Aug 2019 00:58:53 +0800 Subject: [PATCH 190/219] [Mellanox] enhance the reboot cause handling on 201811 (#3253) * [Mellanox/mlnx-platform-api] enable mellanox's platform-api to be loaded as a whole. * [chassis] update reboot-cause handling code to adapt the hw-management currently running on 201811 * [chassis]handle the case that reboot cause file can be any dir matching pattern "hwmonX". --- .../sonic_platform/__init__.py | 2 ++ .../sonic_platform/chassis.py | 28 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py b/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py index e69de29bb2d1..d94d4c9ec820 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["platform", "chassis"] +from sonic_platform import * \ No newline at end of file diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 73279102691c..4a819243ea72 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -13,6 +13,8 @@ try: from sonic_platform_base.chassis_base import ChassisBase from os.path import join + from glob import glob + import os import io import re import subprocess @@ -20,10 +22,13 @@ except ImportError as e: raise ImportError (str(e) + "- required module not found") +# The default dir for reboot cause files HWMGMT_SYSTEM_ROOT = '/var/run/hw-management/system/' +# The hwmon root dir used in case of the hw-mgmt v1.x.x is used. +HWMON_ROOT_PATTERN = '/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*' #reboot cause related definitions -REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT +REBOOT_CAUSE_ROOT = None REBOOT_CAUSE_POWER_LOSS_FILE = 'reset_main_pwr_fail' REBOOT_CAUSE_AUX_POWER_LOSS_FILE = 'reset_aux_pwr_or_ref' @@ -37,18 +42,37 @@ # ========================== Syslog wrappers ========================== SYSLOG_IDENTIFIER = "mlnx-chassis" -def log_warning(msg, also_print_to_console=False): +def log_warning(msg): syslog.openlog(SYSLOG_IDENTIFIER) syslog.syslog(syslog.LOG_WARNING, msg) syslog.closelog() +def log_info(msg): + syslog.openlog(SYSLOG_IDENTIFIER) + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() class Chassis(ChassisBase): """Platform-specific Chassis class""" def __init__(self): + global REBOOT_CAUSE_ROOT super(Chassis, self).__init__() + # adaptively reboot cause root dir initialization + REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT + if not os.path.exists(REBOOT_CAUSE_ROOT): + log_warning("reboot cause dir {} doesn't exist, trying other alternatives".format(REBOOT_CAUSE_ROOT)) + possible_reboot_cause_dir_list = glob(HWMON_ROOT_PATTERN) + if possible_reboot_cause_dir_list is None or len(possible_reboot_cause_dir_list) == 0: + log_warning("can't find reboot cause files in {}".format(HWMON_ROOT_PATTERN)) + else: + REBOOT_CAUSE_ROOT = possible_reboot_cause_dir_list[0] + if len(possible_reboot_cause_dir_list) > 1: + log_warning("found multiple reboot cause dir {}, pick the first one".format(possible_reboot_cause_dir_list)) + else: + log_info("pick {} as reboot cause file".format(REBOOT_CAUSE_ROOT)) + def _read_generic_file(self, filename, len): """ Read a generic file, returns the contents of the file From 170c397c001ceba70591cf68d64b3824edb6e74f Mon Sep 17 00:00:00 2001 From: Karthik Gengan <50580882+gengankarthik@users.noreply.github.com> Date: Sat, 3 Aug 2019 05:07:39 +0530 Subject: [PATCH 191/219] [2018011] Remapping S6000 platform files under Vendor (DellEmc) specific directory (#3274) --- platform/broadcom/platform-modules-dell.mk | 16 ++++-- platform/broadcom/platform-modules-s6000.mk | 13 ----- platform/broadcom/rules.mk | 1 - .../debian/control | 6 ++- .../debian/platform-modules-s6000.init | 0 .../debian/platform-modules-s6000.install | 2 + .../debian/platform-modules-s6000.postinst | 7 +++ .../sonic-platform-modules-dell/debian/rules | 6 ++- .../s6000}/LICENSE | 0 .../s6000}/MAINTAINERS | 0 .../s6000}/README.md | 0 .../s6000}/modules/Makefile | 0 .../s6000}/modules/dell_s6000_platform.c | 0 .../s6000}/scripts/reset-qsfp | 0 .../s6000}/scripts/set-fan-speed | 0 .../systemd/platform-modules-s6000.service | 0 .../sonic-platform-modules-s6000/.gitignore | 50 ------------------- .../debian/changelog | 5 -- .../debian/compat | 1 - .../debian/control | 12 ----- .../debian/copyright | 16 ------ .../debian/platform-modules-s6000.install | 1 - .../sonic-platform-modules-s6000/debian/rules | 32 ------------ 23 files changed, 32 insertions(+), 136 deletions(-) delete mode 100644 platform/broadcom/platform-modules-s6000.mk rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell}/debian/platform-modules-s6000.init (100%) create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install create mode 100644 platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/LICENSE (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/MAINTAINERS (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/README.md (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/modules/Makefile (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/modules/dell_s6000_platform.c (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/scripts/reset-qsfp (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/scripts/set-fan-speed (100%) rename platform/broadcom/{sonic-platform-modules-s6000 => sonic-platform-modules-dell/s6000}/systemd/platform-modules-s6000.service (100%) delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/.gitignore delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/changelog delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/compat delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/control delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/copyright delete mode 100644 platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install delete mode 100755 platform/broadcom/sonic-platform-modules-s6000/debian/rules diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index a2d051ffd911..5c8032c8b436 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -1,26 +1,36 @@ -# Dell Z9100, S6100, Z9264F Platform modules +# Dell S6000, Z9100, S6100, Z9264F Platform modules -DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 +DELL_S6000_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 DELL_S6100_PLATFORM_MODULE_VERSION = 1.1 +DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 -export DELL_Z9264F_PLATFORM_MODULE_VERSION +export DELL_S6000_PLATFORM_MODULE_VERSION export DELL_Z9100_PLATFORM_MODULE_VERSION export DELL_S6100_PLATFORM_MODULE_VERSION +export DELL_Z9264F_PLATFORM_MODULE_VERSION + +# Dell Z9100 Platform modules DELL_Z9100_PLATFORM_MODULE = platform-modules-z9100_$(DELL_Z9100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9100_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-dell $(DELL_Z9100_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(DELL_Z9100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_z9100_c2538-r0 SONIC_DPKG_DEBS += $(DELL_Z9100_PLATFORM_MODULE) +# Dell S6100 Platform modules DELL_S6100_PLATFORM_MODULE = platform-modules-s6100_$(DELL_S6100_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_S6100_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6100_c2538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6100_PLATFORM_MODULE))) +# Dell Z9264F Platform modules DELL_Z9264F_PLATFORM_MODULE = platform-modules-z9264f_$(DELL_Z9264F_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_Z9264F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_z9264f_c3538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_Z9264F_PLATFORM_MODULE))) +# Dell S6000 Platform modules +DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 +$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6000_PLATFORM_MODULE))) SONIC_STRETCH_DEBS += $(DELL_Z9100_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-s6000.mk b/platform/broadcom/platform-modules-s6000.mk deleted file mode 100644 index 00cd2cadf2d3..000000000000 --- a/platform/broadcom/platform-modules-s6000.mk +++ /dev/null @@ -1,13 +0,0 @@ -# Dell S6000 Platform modules - -DELL_S6000_PLATFORM_MODULE_VERSION = 1.0 - -export DELL_S6000_PLATFORM_MODULE_VERSION - -DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE_VERSION)_amd64.deb -$(DELL_S6000_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-s6000 -$(DELL_S6000_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 -SONIC_DPKG_DEBS += $(DELL_S6000_PLATFORM_MODULE) - -SONIC_STRETCH_DEBS += $(DELL_S6000_PLATFORM_MODULE) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index b8fb9ff4ac96..d73faf028592 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -1,6 +1,5 @@ include $(PLATFORM_PATH)/sai-modules.mk include $(PLATFORM_PATH)/sai.mk -include $(PLATFORM_PATH)/platform-modules-s6000.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index c9dc7e4ac5e6..ce91991064b5 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -5,7 +5,7 @@ Maintainer: Dell Team Build-Depends: debhelper (>= 8.0.0), bzip2 Standards-Version: 3.9.3 -Package: platform-modules-z9264f +Package: platform-modules-s6000 Architecture: amd64 Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp @@ -20,3 +20,7 @@ Architecture: amd64 Depends: linux-image-4.9.0-9-amd64 Description: kernel modules for platform devices such as fan, led, sfp +Package: platform-modules-z9264f +Architecture: amd64 +Depends: linux-image-4.9.0-9-2-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.init rename to platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install new file mode 100644 index 000000000000..63eeddf04e96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -0,0 +1,2 @@ +s6000/systemd/platform-modules-s6000.service etc/systemd/system +common/io_rd_wr.py usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst new file mode 100644 index 000000000000..a9b90fa86f3a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst @@ -0,0 +1,7 @@ +# postinst script for S6000 + +# Enable Dell-S6000-platform-service +depmod -a +systemctl enable platform-modules-s6000.service +systemctl start platform-modules-s6000.service +#DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index 7ec14a23f215..55b336c7413e 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= s6100 z9100 z9264f +MODULE_DIRS:= s6000 z9100 s6100 z9264f COMMON_DIR := common %: @@ -36,6 +36,10 @@ override_dh_auto_install: $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + if [ $$mod = "s6000" ]; then \ + dh_installdirs -pplatform-modules-$${mod} usr/local/bin ; \ + cp -r $(MOD_SRC_DIR)/$${mod}/scripts/* debian/platform-modules-$${mod}/usr/local/bin; \ + fi; \ done) override_dh_usrlocal: diff --git a/platform/broadcom/sonic-platform-modules-s6000/LICENSE b/platform/broadcom/sonic-platform-modules-dell/s6000/LICENSE similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/LICENSE rename to platform/broadcom/sonic-platform-modules-dell/s6000/LICENSE diff --git a/platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS b/platform/broadcom/sonic-platform-modules-dell/s6000/MAINTAINERS similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/MAINTAINERS rename to platform/broadcom/sonic-platform-modules-dell/s6000/MAINTAINERS diff --git a/platform/broadcom/sonic-platform-modules-s6000/README.md b/platform/broadcom/sonic-platform-modules-dell/s6000/README.md similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/README.md rename to platform/broadcom/sonic-platform-modules-dell/s6000/README.md diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/Makefile similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/modules/Makefile rename to platform/broadcom/sonic-platform-modules-dell/s6000/modules/Makefile diff --git a/platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/modules/dell_s6000_platform.c rename to platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/reset-qsfp similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/scripts/reset-qsfp rename to platform/broadcom/sonic-platform-modules-dell/s6000/scripts/reset-qsfp diff --git a/platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/scripts/set-fan-speed rename to platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed diff --git a/platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service b/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service similarity index 100% rename from platform/broadcom/sonic-platform-modules-s6000/systemd/platform-modules-s6000.service rename to platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service diff --git a/platform/broadcom/sonic-platform-modules-s6000/.gitignore b/platform/broadcom/sonic-platform-modules-s6000/.gitignore deleted file mode 100644 index 7f287d538227..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/.gitignore +++ /dev/null @@ -1,50 +0,0 @@ -# Object files -*.o -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su - -# Kernel Module Compile Results -*.mod* -*.cmd -*.o.d -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf - -# Debian packaging -*.debhelper.log -*.postinst.debhelper -*.postrm.debhelper -*.prerm.debhelper -*.substvars diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/changelog b/platform/broadcom/sonic-platform-modules-s6000/debian/changelog deleted file mode 100644 index 0a6b7820bdeb..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -platform-modules-s6000 (1.0) unstable; urgency=low - - * Initial release - - -- Shuotian Cheng Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/compat b/platform/broadcom/sonic-platform-modules-s6000/debian/compat deleted file mode 100644 index 45a4fb75db86..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/control b/platform/broadcom/sonic-platform-modules-s6000/debian/control deleted file mode 100644 index 8367cd16948e..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/control +++ /dev/null @@ -1,12 +0,0 @@ -Source: platform-modules-s6000 -Section: main -Priority: extra -Maintainer: Shuotian Cheng -Build-Depends: debhelper (>= 8.0.0), bzip2 -Standards-Version: 3.9.3 - -Package: platform-modules-s6000 -Architecture: amd64 -Depends: linux-image-4.9.0-9-amd64 -Description: kernel modules for platform devices such as fan, led, sfp - diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/copyright b/platform/broadcom/sonic-platform-modules-s6000/debian/copyright deleted file mode 100644 index 6fbc5a7f6ca0..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Provides linux sysfs interface to Dell S6000 platform hardware peripherals -Copyright (C) 2016 Microsoft - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install deleted file mode 100644 index a059f39ff3c4..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/platform-modules-s6000.install +++ /dev/null @@ -1 +0,0 @@ -systemd/platform-modules-s6000.service lib/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-s6000/debian/rules b/platform/broadcom/sonic-platform-modules-s6000/debian/rules deleted file mode 100755 index 5473743ea38d..000000000000 --- a/platform/broadcom/sonic-platform-modules-s6000/debian/rules +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/make -f - -export INSTALL_MOD_DIR:=extra - -PACKAGE_NAME := platform-modules-s6000 -KVERSION ?= $(shell uname -r) -KERNEL_SRC := /lib/modules/$(KVERSION) -MODULE_SRC := $(shell pwd)/modules -SCRIPT_SRC := $(shell pwd)/scripts - -%: - dh $@ --with=systemd - -override_dh_auto_build: - make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) - -override_dh_auto_install: - dh_installdirs -p$(PACKAGE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR) - cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) - dh_installdirs -p$(PACKAGE_NAME) usr/local/bin - cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin - -override_dh_usrlocal: - -override_dh_pysupport: - -override_dh_clean: - dh_clean - rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd - rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order - rm -rf $(MODULE_SRC)/.tmp_versions - From 36c9d9943423ddc38fca2ebed5acd5a8f25547ee Mon Sep 17 00:00:00 2001 From: lguohan Date: Tue, 6 Aug 2019 23:04:00 -0700 Subject: [PATCH 192/219] [build]: enable docker in ram option for small disk device (#3279) when device disk is small, do not unzip dockerfs.tar.gz on disk. keep the tar file on the disk, unzip to tmpfs in the initrd phase. enabled this for 7050-qx32 Signed-off-by: Guohan Lu --- files/Aboot/boot0.j2 | 18 +++++++++++------- files/initramfs-tools/arista-convertfs.j2 | 11 ++++++++--- files/initramfs-tools/union-mount.j2 | 12 ++++++++++-- installer/x86_64/install.sh | 19 ++++++++++++------- onie-image.conf | 3 +++ 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index f1d017a82fcd..85e2a598ce24 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -137,8 +137,10 @@ extract_image() { rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` info "Extracting $dockerfs from swi" - ## vfat does not support symbol link - if [ "$rootfs_type" != "vfat" ]; then + ## Unpacking dockerfs delayed + ## 1. when disk is vfat as it does not support symbolic link + ## 2. when disk is small, expand it into ramfs during initrd + if [ "$rootfs_type" != "vfat" -a x"$docker_inram" != x"on" ]; then mkdir -p "$image_path/{{ DOCKERFS_DIR }}" if [ -n "$install" ]; then @@ -151,7 +153,7 @@ extract_image() { else ## save dockerfs archive in the image directory unzip -oq "$swipath" "$dockerfs" -d "$image_path" - info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type" + info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type or docker_inram is on" fi ## use new reduced-size boot swi @@ -198,7 +200,8 @@ platform_specific() { if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 flash_size=2000 - echo "modprobe.blacklist=radeon,sp5100_tco acpi=off" >>/tmp/append + docker_inram=on + echo "modprobe.blacklist=radeon,sp5100_tco acpi=off docker_inram=on" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s @@ -296,6 +299,7 @@ write_boot_configs() { fi fi + mkdir -p "$image_path" mv /tmp/append $cmdline_image [ -e ${target_path}/machine.conf ] || write_machine_config } @@ -391,12 +395,12 @@ if $do_install; then clean_flash fi - info "Installing image under $image_path" - extract_image - info "Generating boot-config, machine.conf and cmdline" write_boot_configs + info "Installing image under $image_path" + extract_image + run_hooks post-install else info "Using previously installed image" diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 7b315b7725c6..00fe5aa2cfe8 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -130,6 +130,9 @@ for x in "$@"; do x1="${x#loop=}" image_dir="${x1%/*}" ;; + docker_inram=*) + docker_inram="${x#docker_inram=}" + ;; esac done @@ -217,9 +220,11 @@ err_msg="Error: mounting $root_dev to $root_mnt failed" cmd="mount -t ext4 $root_dev $root_mnt" run_cmd "$cmd" "$err_msg" -err_msg="Error: extract docker directory" -cmd="[ -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && mkdir -p $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }}" -run_cmd "$cmd" "$err_msg" +if [ x"$docker_inram" != x"on" ]; then + err_msg="Error: extract docker directory" + cmd="[ -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && mkdir -p $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }}" + run_cmd "$cmd" "$err_msg" +fi err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 6369b8449681..87a33e053230 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -20,9 +20,17 @@ mount -n -o lowerdir=${rootmnt},upperdir=${rootmnt}/host/$image_dir/rw,workdir=$ [ -b ${ROOT} ] || mdev -s ## Mount the raw partition again mount ${ROOT} ${rootmnt}/host -## Mount the working directory of docker engine in the raw partition, bypass the overlay + mkdir -p ${rootmnt}/var/lib/docker -mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker +if [ -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} ]; then + ## mount tmpfs and extract docker into it + mount -t tmpfs -o rw,nodev,size={{ DOCKER_RAMFS_SIZE }} tmpfs ${rootmnt}/var/lib/docker + tar xz --numeric-owner -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C ${rootmnt}/var/lib/docker +else + ## Mount the working directory of docker engine in the raw partition, bypass the overlay + mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker +fi + ## Mount the boot directory in the raw partition, bypass the overlay mkdir -p ${rootmnt}/boot mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 040636cf1ec5..c7d6be55a62e 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -479,15 +479,20 @@ else fi # Decompress the file for the file system directly to the partition -unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir - -if [ "$install_env" = "onie" ]; then - TAR_EXTRA_OPTION="--numeric-owner" +if [ x"$docker_inram" = x"on" ]; then + # when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd + unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir else - TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" + unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir + + if [ "$install_env" = "onie" ]; then + TAR_EXTRA_OPTION="--numeric-owner" + else + TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" + fi + mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR + unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR fi -mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR -unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR if [ "$install_env" = "onie" ]; then # Store machine description in target file system diff --git a/onie-image.conf b/onie-image.conf index 1d7c6f1e8aa5..eb5868047089 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -24,6 +24,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz ## docker directory on the root filesystem DOCKERFS_DIR=docker +## docker ramfs disk space +DOCKER_RAMFS_SIZE=800M + ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin From ba3d85e71fd58d8961e2c31043c11a5c50ae8a7f Mon Sep 17 00:00:00 2001 From: sridhar-ravindran <45350577+sridhar-ravindran@users.noreply.github.com> Date: Wed, 7 Aug 2019 23:38:03 +0530 Subject: [PATCH 193/219] [DELLEMC][S6000] 201811 Porting of Platform 2.0 Reboot Reason (#3156) (#3286) --- .../debian/platform-modules-s6000.init | 84 +++------------- .../debian/platform-modules-s6000.install | 4 + .../sonic-platform-modules-dell/debian/rules | 8 ++ .../s6000/modules/dell_s6000_platform.c | 23 +++++ .../s6000/scripts/s6000_platform.sh | 98 +++++++++++++++++++ .../s6000/setup.py | 1 + .../s6000/sonic_platform/__init__.py | 2 + .../s6000/sonic_platform/chassis.py | 61 ++++++++++++ .../s6000/sonic_platform/platform.py | 26 +++++ .../systemd/platform-modules-s6000.service | 4 +- .../s6100/scripts/s6100_platform.sh | 9 +- .../s6100/sonic_platform/__init__.py | 3 +- .../s6100/sonic_platform/platform.py | 26 +++++ .../z9100/scripts/z9100_platform.sh | 9 +- .../z9100/sonic_platform/__init__.py | 4 +- .../z9100/sonic_platform/platform.py | 26 +++++ 16 files changed, 310 insertions(+), 78 deletions(-) create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh create mode 120000 platform/broadcom/sonic-platform-modules-dell/s6000/setup.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py mode change 120000 => 100755 platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py create mode 100755 platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/platform.py diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init index f16f7e01ef6e..94bddb6afe20 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.init @@ -11,89 +11,29 @@ # Short-Description: Setup S6000 board. ### END INIT INFO -add_i2c_devices() { - - echo 24c02 0x50 > /sys/class/i2c-adapter/i2c-1/new_device - echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-1/new_device - echo dni_dps460 0x58 > /sys/class/i2c-adapter/i2c-1/new_device - echo dni_dps460 0x59 > /sys/class/i2c-adapter/i2c-1/new_device - echo jc42 0x18 > /sys/class/i2c-adapter/i2c-10/new_device - echo emc1403 0x4d > /sys/class/i2c-adapter/i2c-10/new_device - echo spd 0x50 > /sys/class/i2c-adapter/i2c-10/new_device - echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-10/new_device - echo max6620 0x29 > /sys/class/i2c-adapter/i2c-11/new_device - echo max6620 0x2a > /sys/class/i2c-adapter/i2c-11/new_device - echo ltc4215 0x40 > /sys/class/i2c-adapter/i2c-11/new_device - echo ltc4215 0x42 > /sys/class/i2c-adapter/i2c-11/new_device - echo tmp75 0x4c > /sys/class/i2c-adapter/i2c-11/new_device - echo tmp75 0x4d > /sys/class/i2c-adapter/i2c-11/new_device - echo tmp75 0x4e > /sys/class/i2c-adapter/i2c-11/new_device - echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-11/new_device - echo 24c02 0x52 > /sys/class/i2c-adapter/i2c-11/new_device - echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-11/new_device - for i in `seq 0 31`; do - echo sff8436 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/new_device - done -} - -remove_i2c_devices() { - echo 0x50 > /sys/class/i2c-adapter/i2c-1/delete_device - echo 0x51 > /sys/class/i2c-adapter/i2c-1/delete_device - echo 0x58 > /sys/class/i2c-adapter/i2c-1/delete_device - echo 0x59 > /sys/class/i2c-adapter/i2c-1/delete_device - echo 0x18 > /sys/class/i2c-adapter/i2c-10/delete_device - echo 0x4d > /sys/class/i2c-adapter/i2c-10/delete_device - echo 0x50 > /sys/class/i2c-adapter/i2c-10/delete_device - echo 0x53 > /sys/class/i2c-adapter/i2c-10/delete_device - echo 0x29 > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x2a > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x40 > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x42 > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x4c > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x4d > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x4e > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x51 > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x52 > /sys/class/i2c-adapter/i2c-11/delete_device - echo 0x53 > /sys/class/i2c-adapter/i2c-11/delete_device - for i in `seq 0 31`; do - echo 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/delete_device - done -} - case "$1" in start) - echo -n "Setting up board... " - - depmod -a - modprobe i2c_mux_gpio - modprobe dell_s6000_platform + echo -n "Setting up board... " - add_i2c_devices + /usr/local/bin/s6000_platform.sh init - /usr/local/bin/set-fan-speed 15000 - /usr/local/bin/reset-qsfp - - echo "done." - ;; + echo "done." + ;; stop) - echo "done." - - remove_i2c_devices + /usr/local/bin/s6000_platform.sh deinit + echo "done." - rmmod dell_s6000_platform - rmmod i2c_mux_gpio - ;; + ;; force-reload|restart) - echo "Not supported" - ;; + echo "Not supported" + ;; *) - echo "Usage: /etc/init.d/platform-modules-s6000.init {start|stop}" - exit 1 - ;; + echo "Usage: /etc/init.d/platform-modules-s6000.init {start|stop}" + exit 1 + ;; esac exit 0 - diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install index 63eeddf04e96..c2dcb5dc03a9 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -1,2 +1,6 @@ +s6000/scripts/s6000_platform.sh usr/local/bin +s6000/scripts/reset-qsfp usr/local/bin +s6000/scripts/set-fan-speed usr/local/bin s6000/systemd/platform-modules-s6000.service etc/systemd/system common/io_rd_wr.py usr/local/bin +s6000/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index 55b336c7413e..4db58cc74449 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -25,6 +25,10 @@ override_dh_auto_build: cd $(MOD_SRC_DIR)/$${mod}; \ python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ + elif [ $$mod = "s6000" ]; then \ + cd $(MOD_SRC_DIR)/$${mod}; \ + python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd $(MOD_SRC_DIR); \ fi; \ echo "making man page alias $$mod -> $$mod APIs";\ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ @@ -59,6 +63,10 @@ override_dh_clean: rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ + elif [ $$mod = "s6000" ]; then \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ fi; \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ done) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c index 5e205973d674..8c0a13e8e1ca 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #define S6000_MUX_BASE_NR 10 #define QSFP_MODULE_BASE_NR 20 @@ -20,6 +22,7 @@ #define QSFP_MODULE_NUM 16 #define QSFP_DEVICE_NUM 2 +#define RTC_NVRAM_REBOOT_REASON_OFFSET 0x49 static void device_release(struct device *dev) { @@ -1061,6 +1064,24 @@ static ssize_t get_slave_cpld_ver(struct device *dev, return sprintf(buf, "0x%x\n", data); } +static ssize_t get_reboot_reason(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + uint8_t data = 0; + + /* Last Reboot reason in saved in RTC NVRAM offset 0x49 + * We write the reboot reason into nvram offset, + * as part of platform_reboot implementation from userspace. + + * COLD_RESET = 0xE # Cold Reset (value) + * WARM_RESET = 0x6 # Warm Reset (value) + */ + + /* Read it from this offset, and export it as last_reboot_reason */ + data = nvram_read_byte(RTC_NVRAM_REBOOT_REASON_OFFSET); + + return sprintf(buf, "0x%x\n", data); +} static DEVICE_ATTR(qsfp_modsel, S_IRUGO, get_modsel, NULL); static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); @@ -1083,6 +1104,7 @@ static DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, get_fan2_led, set_fan2_led); static DEVICE_ATTR(system_cpld_ver, S_IRUGO, get_system_cpld_ver, NULL); static DEVICE_ATTR(master_cpld_ver, S_IRUGO, get_master_cpld_ver, NULL); static DEVICE_ATTR(slave_cpld_ver, S_IRUGO, get_slave_cpld_ver, NULL); +static DEVICE_ATTR(last_reboot_reason, S_IRUGO, get_reboot_reason, NULL); static struct attribute *s6000_cpld_attrs[] = { &dev_attr_qsfp_modsel.attr, @@ -1106,6 +1128,7 @@ static struct attribute *s6000_cpld_attrs[] = { &dev_attr_system_cpld_ver.attr, &dev_attr_master_cpld_ver.attr, &dev_attr_slave_cpld_ver.attr, + &dev_attr_last_reboot_reason.attr, NULL, }; diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh new file mode 100755 index 000000000000..316fbaec5fee --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S6000 board. +### END INIT INFO + +add_i2c_devices() { + + echo 24c02 0x50 > /sys/class/i2c-adapter/i2c-1/new_device + echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-1/new_device + echo dni_dps460 0x58 > /sys/class/i2c-adapter/i2c-1/new_device + echo dni_dps460 0x59 > /sys/class/i2c-adapter/i2c-1/new_device + echo jc42 0x18 > /sys/class/i2c-adapter/i2c-10/new_device + echo emc1403 0x4d > /sys/class/i2c-adapter/i2c-10/new_device + echo spd 0x50 > /sys/class/i2c-adapter/i2c-10/new_device + echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-10/new_device + echo max6620 0x29 > /sys/class/i2c-adapter/i2c-11/new_device + echo max6620 0x2a > /sys/class/i2c-adapter/i2c-11/new_device + echo ltc4215 0x40 > /sys/class/i2c-adapter/i2c-11/new_device + echo ltc4215 0x42 > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4c > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4d > /sys/class/i2c-adapter/i2c-11/new_device + echo tmp75 0x4e > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x51 > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x52 > /sys/class/i2c-adapter/i2c-11/new_device + echo 24c02 0x53 > /sys/class/i2c-adapter/i2c-11/new_device + for i in `seq 0 31`; do + echo sff8436 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/new_device + done +} + +remove_i2c_devices() { + echo 0x50 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x51 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x58 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x59 > /sys/class/i2c-adapter/i2c-1/delete_device + echo 0x18 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x4d > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x50 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x53 > /sys/class/i2c-adapter/i2c-10/delete_device + echo 0x29 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x2a > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x40 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x42 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4c > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4d > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x4e > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x51 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x52 > /sys/class/i2c-adapter/i2c-11/delete_device + echo 0x53 > /sys/class/i2c-adapter/i2c-11/delete_device + for i in `seq 0 31`; do + echo 0x50 > /sys/class/i2c-adapter/i2c-$((20+i))/delete_device + done +} + +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + if [ -e $device/$platform/sonic_platform-1.0-py2-none-any.whl ]; then + rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) + fi +} + +remove_python_api_package() { + rv=$(pip show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv = $(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi +} + +if [[ "$1" == "init" ]]; then + depmod -a + modprobe nvram + modprobe i2c_mux_gpio + modprobe dell_s6000_platform + install_python_api_package + + add_i2c_devices + + /usr/local/bin/set-fan-speed 15000 + /usr/local/bin/reset-qsfp +elif [[ "$1" == "deinit" ]]; then + remove_i2c_devices + rmmod dell_s6000_platform + rmmod nvram + rmmod i2c_mux_gpio + remove_python_api_package +else + echo "s6000_platform : Invalid option !" +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/setup.py b/platform/broadcom/sonic-platform-modules-dell/s6000/setup.py new file mode 120000 index 000000000000..4f6de9941d96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/setup.py @@ -0,0 +1 @@ +../s6100/setup.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py new file mode 100755 index 000000000000..d82f3749319c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["platform", "chassis"] +from sonic_platform import * diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py new file mode 100755 index 000000000000..b1046d9310f8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.chassis_base import ChassisBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Chassis(ChassisBase): + """ + DELLEMC Platform-specific Chassis class + """ + + MAILBOX_DIR = "/sys/devices/platform/dell-s6000-cpld.0" + + reset_reason_dict = {} + reset_reason_dict[0xe] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + reset_reason_dict[0x6] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE + + def __init__(self): + ChassisBase.__init__(self) + + def get_register(self, reg_name): + rv = 'ERR' + mb_reg_file = self.MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + return rv + + try: + with open(mb_reg_file, 'r') as fd: + rv = fd.read() + except Exception as error: + rv = 'ERR' + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + """ + reset_reason = int(self.get_register('last_reboot_reason'), base=16) + + # In S6000, We track the reboot reason by writing the reason in + # NVRAM. Only Warmboot and Coldboot reason are supported here. + + if (reset_reason in self.reset_reason_dict): + return (self.reset_reason_dict[reset_reason], None) + + return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py new file mode 100755 index 000000000000..426db717281b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """ + DELLEMC Platform-specific class + """ + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service b/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service index 246dee9b64f3..b55a466890bd 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/platform-modules-s6000.service @@ -5,8 +5,8 @@ Before=pmon.service [Service] Type=oneshot -ExecStart=-/etc/init.d/platform-modules-s6000 start -ExecStop=-/etc/init.d/platform-modules-s6000 stop +ExecStart=/usr/local/bin/s6000_platform.sh init +ExecStop=/usr/local/bin/s6000_platform.sh deinit RemainAfterExit=yes [Install] diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index 3b455a9bf933..71a5d269fec0 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -222,7 +222,13 @@ install_python_api_package() { platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - echo "pip install result = $rv" +} + +remove_python_api_package() { + rv=$(pip show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv = $(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi } init_devnum @@ -261,6 +267,7 @@ elif [[ "$1" == "deinit" ]]; then modprobe -r i2c-mux-pca954x modprobe -r i2c-dev modprobe -r dell_ich + remove_python_api_package else echo "s6100_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py index 139597f9cb07..4bfefa0fb636 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py @@ -1,2 +1,3 @@ - +__all__ = ["platform", "chassis"] +from sonic_platform import * diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py new file mode 100755 index 000000000000..426db717281b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """ + DELLEMC Platform-specific class + """ + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index a98da8ff2fbc..276acd882f14 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -205,7 +205,13 @@ install_python_api_package() { platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - echo "pip install result = $rv" +} + +remove_python_api_package() { + rv=$(pip show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv = $(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi } init_devnum @@ -250,6 +256,7 @@ elif [[ "$1" == "deinit" ]]; then modprobe -r i2c-mux-pca954x modprobe -r i2c-dev modprobe -r dell_ich + remove_python_api_package else echo "z9100_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py deleted file mode 120000 index 9972084d4dfb..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py +++ /dev/null @@ -1 +0,0 @@ -../../s6100/sonic_platform/__init__.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py new file mode 100755 index 000000000000..4bfefa0fb636 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis"] +from sonic_platform import * + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/platform.py new file mode 100755 index 000000000000..426db717281b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/platform.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """ + DELLEMC Platform-specific class + """ + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + From c29e2e28da0b60c969d0393f4437bfb31e963f39 Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Thu, 8 Aug 2019 00:30:21 +0800 Subject: [PATCH 194/219] [Mellanox sfputil] update get_transceiver_change_event to support more event (#3261) --- .../x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 38 +++++++++++++++++-- src/sonic-platform-common | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 531e06f13205..db1bea8a47f9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -6,7 +6,8 @@ try: import time import subprocess - from sonic_sfp.sfputilbase import SfpUtilBase + from sonic_sfp.sfputilbase import * + import syslog except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -18,6 +19,12 @@ # parameters for SFP presence SFP_STATUS_INSERTED = '1' +# system level event/error +EVENT_ON_ALL_SFP = '-1' +SYSTEM_NOT_READY = 'system_not_ready' +SYSTEM_READY = 'system_become_ready' +SYSTEM_FAIL = 'system_fail' + GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" # magic code defnition for port number, qsfp port position of each hwsku @@ -25,6 +32,16 @@ hwsku_dict = {'ACS-MSN2700': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1),(0, 18, 21, 22, 1)] +def log_info(msg, also_print_to_console=False): + syslog.openlog("sfputil") + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + +def log_err(msg, also_print_to_console=False): + syslog.openlog("sfputil") + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -72,6 +89,7 @@ def __init__(self): self.PORT_END = port_position_tuple[2] self.PORTS_IN_BLOCK = port_position_tuple[3] self.EEPROM_OFFSET = port_position_tuple[4] + self.mlnx_sfpd_started = False for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = self.qsfp_sysfs_path + "qsfp{}".format(x + self.EEPROM_OFFSET) @@ -171,10 +189,24 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel_object = swsscommon.Select.OBJECT self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - # Check the liveness of mlnx-sfpd, if it failed, return false + # Check the liveness of mlnx-sfpd, if it failed, return system_fail event + # If mlnx-sfpd not started, return system_not_ready event keys = self.sfpd_status_tbl.getKeys() if 'LIVENESS' not in keys: - return False, phy_port_dict + if self.mlnx_sfpd_started: + log_err("mlnx-sfpd exited, return false to notify xcvrd.") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_FAIL + return False, phy_port_dict + else: + log_info("mlnx-sfpd not ready, return false to notify xcvrd.") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_NOT_READY + return False, phy_port_dict + else: + if not self.mlnx_sfpd_started: + self.mlnx_sfpd_started = True + log_info("mlnx-sfpd is running") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_READY + return False, phy_port_dict if timeout: (state, c) = self.db_sel.select(timeout) diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 5d7954ee8d1b..b972e84c17d5 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 5d7954ee8d1b70aaa6d8db1c9ed0f441c293c3c9 +Subproject commit b972e84c17d5f7e1bb378cc9a31b9da9c22a2311 From a41d9a5d3f29e5f310908c32edadf7c141574035 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 8 Aug 2019 15:45:17 -0700 Subject: [PATCH 195/219] [service dependent] describe non-warm-reboot dependency outside systemd (#3311) * [service dependent] describe non-warm-reboot dependency outside systemctl When dependency was described with systemctl, it will kick in all the time, including under warm reboot/restart scenarios. This is not what we always want. For components that are capable of warm reboot/start, they need to describe dependency in service files. Signed-off-by: Ying Xie * [service] teamd service should not require swss service Adding require swss will cause teamd to be killed by systemctl when swss stops. This is not what we want in warm reboot. Signed-off-by: Ying Xie * refactoring code * rename functions to match other functions in the file --- files/build_templates/teamd.service.j2 | 4 ++-- files/scripts/swss.sh | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 58c858effb36..8034698ecc07 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=TEAMD container -Requires=updategraph.service swss.service +Requires=updategraph.service After=updategraph.service swss.service Before=ntp-config.service @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] -WantedBy=multi-user.target swss.service +WantedBy=multi-user.target diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 88bce037b9c4..7b6ae6b5dbfe 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -2,6 +2,7 @@ SERVICE="swss" PEER="syncd" +DEPENDENT="teamd" DEBUGLOG="/tmp/swss-syncd-debug.log" LOCKFILE="/tmp/swss-syncd-lock" @@ -78,11 +79,24 @@ function clean_up_tables() end" 0 } -startPeerService() { +start_peer_and_dependent_services() { check_warm_boot if [[ x"$WARM_BOOT" != x"true" ]]; then /bin/systemctl start ${PEER} + for dep in ${DEPENDENT}; do + /bin/systemctl start ${dep} + done + fi +} + +stop_peer_and_dependent_services() { + # if warm start enabled or peer lock exists, don't stop peer service docker + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl stop ${PEER} + for dep in ${DEPENDENT}; do + /bin/systemctl stop ${dep} + done fi } @@ -116,7 +130,7 @@ start() { } wait() { - startPeerService + start_peer_and_dependent_services /usr/bin/${SERVICE}.sh wait } @@ -135,10 +149,7 @@ stop() { # Unlock has to happen before reaching out to peer service unlock_service_state_change - # if warm start enabled or peer lock exists, don't stop peer service docker - if [[ x"$WARM_BOOT" != x"true" ]]; then - /bin/systemctl stop ${PEER} - fi + stop_peer_and_dependent_services } case "$1" in From f08d184c26dd661f4d5936895d879ffef9587cf4 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 13 Aug 2019 09:05:10 -0700 Subject: [PATCH 196/219] [201811][utilities] advance sub-module head (#3330) Submodule src/sonic-utilities d12734e..f28b720: > Revert "Removed 'show interfaces alias'. (#412)" (#603) Signed-off-by: Ying Xie --- src/sonic-utilities | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-utilities b/src/sonic-utilities index d12734e74c64..f28b7203d5a8 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit d12734e74c64e9540483700230d04ba41a39af9f +Subproject commit f28b7203d5a85e377a8c40c4fe4dc78c9103be4d From 076e6609f07cedc754f815841e3e8fa3406da44c Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Thu, 11 Apr 2019 07:58:05 -0700 Subject: [PATCH 197/219] [docker-fpm-frr]: Fix FRR config script to render frr.conf (#2770) --- dockers/docker-fpm-frr/config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-fpm-frr/config.sh b/dockers/docker-fpm-frr/config.sh index 5e481d0c8516..de18a4fbb00a 100755 --- a/dockers/docker-fpm-frr/config.sh +++ b/dockers/docker-fpm-frr/config.sh @@ -5,7 +5,7 @@ mkdir -p /etc/frr CONFIG_TYPE=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["docker_routing_config_mode"]'` if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "unified" ]; then - sonic-cfggen -d -t /usr/share/sonic/templates/frr.conf.j2 >/etc/frr/frr.conf + sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/frr.conf.j2 >/etc/frr/frr.conf fi sonic-cfggen -d -t /usr/share/sonic/templates/isolate.j2 >/usr/sbin/bgp-isolate From b3ef09c837103fca86937aa9344f04f2203041b0 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 13 Aug 2019 17:31:25 -0700 Subject: [PATCH 198/219] [mmu] add mmu_init_config to HWSKU Arista-7260CX3-Q64 (#3334) Signed-off-by: Ying Xie --- .../Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm index 8a6c1a28e54f..27a06a6035ec 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/th2-a7260cx3-64-64x40G.config.bcm @@ -1012,3 +1012,5 @@ serdes_preemphasis_114=0x61c01 serdes_preemphasis_115=0x61c01 serdes_preemphasis_116=0x105004 serdes_preemphasis_117=0x105004 + +mmu_init_config="MSFT-TH2-Tier0" From b8d5e6c31718cdae5c8114dd2ea505cd14ca0307 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 13 Aug 2019 21:32:51 -0700 Subject: [PATCH 199/219] [201811][sairedis] update sub module head (#3335) Submodule src/sonic-sairedis 54c8e78..992cdc0: > Do not store invalid OIDs from FDB notification into ASIC DB (#503) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 54c8e78d712f..992cdc02aac6 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 54c8e78d712fb0d8a56f032a39eb746b2b5976af +Subproject commit 992cdc02aac687d8ff8caa9b61e58f347eeb1edb From db209067f69c6c04883dfd2ea33151d7caf5a990 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 13 Aug 2019 21:35:08 -0700 Subject: [PATCH 200/219] [libteam]: Move libteam from 1.26 to 1.28 (#3332) Sync 201811 branch libteam with master's latest version Signed-off-by: Shu0T1an ChenG --- rules/libteam.mk | 3 +- ...m-Add-team_get_port_enabled-function.patch | 59 ---- ...-same-hwaddr-to-lag-port-to-avoid-di.patch | 36 --- ...-port-state-according-to-partners-sy.patch | 71 ---- ...nize-ifinfo-after-lost-RTNLGRP_LINK-.patch | 302 ------------------ ...cess-lacpdu-before-the-port-ifinfo-i.patch | 47 --- ...-port-admin-down-recv-not-processing.patch | 23 -- src/libteam/Makefile | 8 +- ...ily-remove-redundant-debug-messages.patch} | 10 +- ...-will-send-lacp-update-right-after-.patch} | 44 +-- ...ack-support-for-single-member-port-.patch} | 19 +- ...-same-hwaddr-to-lag-port-to-avoid-di.patch | 36 +++ ...ult-buffer-size-from-98304-to-983040.patch | 31 ++ ...tively-shutdown-port-channel-has-mem.patch | 37 +++ ...DU-immediately-if-our-state-changed.patch} | 17 +- .../0008-libteam-Add-warm_reboot-mode.patch} | 92 ++++-- ...th_port-race-condition-with-newlink.patch} | 0 src/libteam/patch/series | 9 + src/libteam/series | 12 - 19 files changed, 228 insertions(+), 628 deletions(-) delete mode 100644 src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch delete mode 100644 src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch delete mode 100644 src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch delete mode 100644 src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch delete mode 100644 src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch delete mode 100644 src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch rename src/libteam/{0002-libteam-Temporarily-remove-redundant-debug-mes.patch => patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch} (70%) rename src/libteam/{0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch => patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch} (67%) rename src/libteam/{0004-libteam-Add-lacp-fallback-support-for-single-member-.patch => patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch} (84%) create mode 100644 src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch create mode 100644 src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch create mode 100644 src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch rename src/libteam/{0014-Send-LACP-PDU-immediately-if-our-state-changed.patch => patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch} (59%) rename src/libteam/{0015-libteam-Add-warm_reboot-mode.patch => patch/0008-libteam-Add-warm_reboot-mode.patch} (90%) rename src/libteam/{0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch => patch/0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch} (100%) create mode 100644 src/libteam/patch/series delete mode 100644 src/libteam/series diff --git a/rules/libteam.mk b/rules/libteam.mk index 747f5dde4033..5510d9427767 100644 --- a/rules/libteam.mk +++ b/rules/libteam.mk @@ -1,6 +1,6 @@ # libteam packages -LIBTEAM_VERSION = 1.26-1 +LIBTEAM_VERSION = 1.28-1 export LIBTEAM_VERSION @@ -24,4 +24,3 @@ $(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS))) # are archived into debug one image to facilitate debugging. # DBG_SRC_ARCHIVE += libteam - diff --git a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch b/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch deleted file mode 100644 index 9bf08ce61308..000000000000 --- a/src/libteam/0001-libteam-Add-team_get_port_enabled-function.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2f9248dd07d51361bc0a93ef70d0f8ac2631af35 Mon Sep 17 00:00:00 2001 -From: Shuotian Cheng -Date: Fri, 20 Jan 2017 12:10:13 -0800 -Subject: [PATCH] libteam: Add team_get_port_enabled function - ---- - include/team.h | 2 ++ - libteam/libteam.c | 22 ++++++++++++++++++++++ - 2 files changed, 24 insertions(+) - -diff --git a/include/team.h b/include/team.h -index 20ebcf6..9ae517d 100644 ---- a/include/team.h -+++ b/include/team.h -@@ -68,6 +68,8 @@ int team_get_bpf_hash_func(struct team_handle *th, struct sock_fprog *fp); - int team_set_bpf_hash_func(struct team_handle *th, const struct sock_fprog *fp); - int team_set_port_enabled(struct team_handle *th, - uint32_t port_ifindex, bool val); -+int team_get_port_enabled(struct team_handle *th, -+ uint32_t port_ifindex, bool *enabled); - int team_set_port_user_linkup_enabled(struct team_handle *th, - uint32_t port_ifindex, bool val); - int team_get_port_user_linkup(struct team_handle *th, -diff --git a/libteam/libteam.c b/libteam/libteam.c -index ac187aa..106e5cf 100644 ---- a/libteam/libteam.c -+++ b/libteam/libteam.c -@@ -1295,6 +1295,28 @@ int team_set_port_enabled(struct team_handle *th, - /** - * @param th libteam library context - * @param port_ifindex port interface index -+ * @param enabled where the enabled state will be stored -+ * -+ * @details Gets enabled state for port identified by port_ifindex -+ * -+ * @return Zero on success or negative number in case of an error. -+ **/ -+TEAM_EXPORT -+int team_get_port_enabled(struct team_handle *th, -+ uint32_t port_ifindex, bool *enabled) -+{ -+ struct team_option *option; -+ -+ option = team_get_option(th, "np", "enabled", port_ifindex); -+ if (!option) -+ return -ENOENT; -+ *enabled = team_get_option_value_bool(option); -+ return 0; -+} -+ -+/** -+ * @param th libteam library context -+ * @param port_ifindex port interface index - * @param val boolean value - * - * @details Enables or disable user linkup for port identified by port_ifindex --- -2.1.4 - diff --git a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch deleted file mode 100644 index f6c8a832d593..000000000000 --- a/src/libteam/0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 43e512b114176feb1828ff0a75f0224f2b219a2d Mon Sep 17 00:00:00 2001 -From: Jipan Yang -Date: Sun, 24 Feb 2019 00:04:15 -0800 -Subject: [PATCH] Skip setting the same hwaddr to lag port to avoid disrupting - neighbor entries - -Signed-off-by: Jipan Yang ---- - teamd/teamd.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/teamd/teamd.c b/teamd/teamd.c -index c987333..0f8993e 100644 ---- a/teamd/teamd.c -+++ b/teamd/teamd.c -@@ -828,7 +828,16 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) - err = -EINVAL; - goto free_hwaddr; - } -- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); -+ -+ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) -+ { -+ err = 0; -+ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); -+ } -+ else -+ { -+ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); -+ } - if (!err) - ctx->hwaddr_explicit = true; - free_hwaddr: --- -2.9.2 - diff --git a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch b/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch deleted file mode 100644 index 4cef90ea1920..000000000000 --- a/src/libteam/0010-teamd-lacp-update-port-state-according-to-partners-sy.patch +++ /dev/null @@ -1,71 +0,0 @@ -commit 15b56de0f309c942f0f3a588f40944d078db97f9 -Author: Pavel Shirshov -Date: Tue Apr 16 12:18:12 2019 -0700 - - teamd: lacp: update port state according to partner's sync bit - - Backport of - https://github.com/jpirko/libteam/commit/54f137c10579bf97800c61ebb13e732aa1d843e6#diff-f17610bfcc2bafe661a9f3ba496ebf12 - - According to 6.4.15 of IEEE 802.1AX-2014, Figure 6-22, the state that the - port is selected moves MUX state from DETACHED to ATTACHED. - - But ATTACHED state does not mean that the port can send and receive user - frames. COLLECTING_DISTRIBUTION state is the state that the port can send - and receive user frames. To move MUX state from ATTACHED to - COLLECTING_DISTRIBUTION, the partner state should be sync as well as the - port selected. - - In function lacp_port_actor_update(), only INFO_STATE_SYNCHRONIZATION - should be set to the actor.state when the port is selected. - INFO_STATE_COLLECTING and INFO_STATE_DISTRIBUTING should be set to false - with ATTACHED mode and set to true when INFO_STATE_SYNCHRONIZATION of - partner.state is set. - - In function lacp_port_should_be_{enabled, disabled}(), we also need to - check the INFO_STATE_SYNCHRONIZATION bit of partner.state. - - Signed-off-by: Hangbin Liu - Signed-off-by: Jiri Pirko - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 81324de..813b604 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -356,7 +356,8 @@ static int lacp_port_should_be_enabled(struct lacp_port *lacp_port) - struct lacp *lacp = lacp_port->lacp; - - if (lacp_port_selected(lacp_port) && -- lacp_port->agg_lead == lacp->selected_agg_lead) -+ lacp_port->agg_lead == lacp->selected_agg_lead && -+ lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) - return true; - return false; - } -@@ -366,7 +367,8 @@ static int lacp_port_should_be_disabled(struct lacp_port *lacp_port) - struct lacp *lacp = lacp_port->lacp; - - if (!lacp_port_selected(lacp_port) || -- lacp_port->agg_lead != lacp->selected_agg_lead) -+ lacp_port->agg_lead != lacp->selected_agg_lead || -+ !(lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION)) - return true; - return false; - } -@@ -936,9 +938,14 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) - state |= INFO_STATE_LACP_ACTIVITY; - if (lacp_port->lacp->cfg.fast_rate) - state |= INFO_STATE_LACP_TIMEOUT; -- if (lacp_port_selected(lacp_port)) -+ if (lacp_port_selected(lacp_port) && -+ lacp_port_agg_selected(lacp_port)) { - state |= INFO_STATE_SYNCHRONIZATION; -- state |= INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING; -+ state &= ~(INFO_STATE_COLLECTING | INFO_STATE_DISTRIBUTING); -+ if (lacp_port->partner.state & INFO_STATE_SYNCHRONIZATION) -+ state |= INFO_STATE_COLLECTING | -+ INFO_STATE_DISTRIBUTING; -+ } - if (lacp_port->state == PORT_STATE_EXPIRED) - state |= INFO_STATE_EXPIRED; - if (lacp_port->state == PORT_STATE_DEFAULTED) diff --git a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch b/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch deleted file mode 100644 index a53369fb7376..000000000000 --- a/src/libteam/0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch +++ /dev/null @@ -1,302 +0,0 @@ -commit 046fb6ba0aec8246075b18d787daec43201566fa -Author: Antti Tiainen -Date: Mon Feb 6 15:41:05 2017 +0200 - - libteam: resynchronize ifinfo after lost RTNLGRP_LINK notifications - - When there's a large number of interfaces (e.g. vlans), teamd loses - link notifications as it cannot read them as fast as kernel is - broadcasting them. This often prevents teamd starting properly if - started concurrently when other links are being set up. It can also - fail when it's up and running, especially in the cases where the team - device itself has a lot of vlans under it. - - This can easily be reproduces by simple example (in SMP system) by - manually adding team device with a bunch of vlans, putting it up, - and starting teamd with --take-over option: - - root@debian:~# ip link add name team0 type team - root@debian:~# for i in `seq 100 150` ; do - > ip link add link team0 name team0.$i type vlan id $i ; done - root@debian:~# ip link set team0 up - root@debian:~# cat teamd.conf - { - "device": "team0", - "runner": { - "name": "activebackup" - }, - "ports": { - "eth1": {}, - "eth2": {} - } - } - root@debian:~# teamd -o -N -f teamd.conf - - At this point, teamd will not give any error messages or other - indication that something is wrong. But state will not look healthy: - - root@debian:~# teamdctl team0 state - setup: - runner: activebackup - ports: - eth1 - link watches: - link summary: up - instance[link_watch_0]: - name: ethtool - link: up - down count: 0 - Failed to parse JSON port dump. - command call failed (Invalid argument) - - If checking state dump, it will show that port eth2 is missing info. - Running strace to teamd will reveal that there's one recvmsgs() that - returned -1 with errno ENOBUFS. What happened in this example was - that when teamd started, all vlans got carrier up, and kernel flooded - notifications faster than teamd could read them. It then lost events - related to port eth2 getting enslaved and up. - - The socket that joins RTNLGRP_LINK notifications uses default libnl - 32k buffer size. Netlink messages are large (over 1k), and this buffer - gets easily full. Kernel neither knows nor cares were notification - broadcasts delivered. This cannot be fixed by simply increasing the - buffer size, as there's no size that is guaranteed to work in every - use case, and this can require several megabytes of buffer (a way over - normal rmem_max limit) if there are hunderds of vlans. - - Only way to recover from this is to refresh all ifinfo list, as it's - invalidated at this point. It cannot easily work around of this by - just refreshing team device and its ports, because library side might - not have ports linked due to events missed, and it doesn't know about - teamd configuration. - - Checks now return value of nl_recvmsgs_default() for event socket. In - case of ENOBUFS (which libnl nicely changes to ENOMEM), refreshes - all ifinfo list. get_ifinfo_list() also checks now for removed interfaces - in case of missed dellink event. Currently all TEAM_IFINFO_CHANGE - handlers processed events one by one, so it had to be changed to support - multiple ifinfo changes. For this, ifinfo changed flags are cleared - and removed entries destroyed only after all handlers have been called. - - Also, increased nl_cli.sock_event receive buffers to 96k like all other - sockets. Added possibility to change this via environment variable. - - Signed-off-by: Antti Tiainen - Signed-off-by: Jiri Pirko - -diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 72155ae..5c32a9c 100644 ---- a/libteam/ifinfo.c -+++ b/libteam/ifinfo.c -@@ -72,6 +72,10 @@ struct team_ifinfo { - #define CHANGED_PHYS_PORT_ID (1 << 5) - #define CHANGED_PHYS_PORT_ID_LEN (1 << 6) - #define CHANGED_ADMIN_STATE (1 << 7) -+/* This is only used when tagging interfaces for finding -+ * removed, and thus not included to CHANGED_ANY. -+ */ -+#define CHANGED_REFRESHING (1 << 8) - #define CHANGED_ANY (CHANGED_REMOVED | CHANGED_HWADDR | \ - CHANGED_HWADDR_LEN | CHANGED_IFNAME | \ - CHANGED_MASTER_IFINDEX | CHANGED_PHYS_PORT_ID | \ -@@ -202,7 +206,7 @@ static struct team_ifinfo *ifinfo_find(struct team_handle *th, uint32_t ifindex) - return NULL; - } - --static void clear_last_changed(struct team_handle *th) -+void ifinfo_clear_changed(struct team_handle *th) - { - struct team_ifinfo *ifinfo; - -@@ -236,7 +240,7 @@ static void ifinfo_destroy(struct team_ifinfo *ifinfo) - free(ifinfo); - } - --static void ifinfo_destroy_removed(struct team_handle *th) -+void ifinfo_destroy_removed(struct team_handle *th) - { - struct team_ifinfo *ifinfo, *tmp; - -@@ -254,8 +258,6 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) - uint32_t ifindex; - int err; - -- ifinfo_destroy_removed(th); -- - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -269,7 +271,7 @@ static void obj_input_newlink(struct nl_object *obj, void *arg, bool event) - return; - } - -- clear_last_changed(th); -+ clear_changed(ifinfo); - ifinfo_update(ifinfo, link); - - if (event) -@@ -292,8 +294,6 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) - uint32_t ifindex; - int err; - -- ifinfo_destroy_removed(th); -- - link = (struct rtnl_link *) obj; - - ifindex = rtnl_link_get_ifindex(link); -@@ -311,7 +311,7 @@ static void event_handler_obj_input_dellink(struct nl_object *obj, void *arg) - return; - } - -- clear_last_changed(th); -+ clear_changed(ifinfo); - set_changed(ifinfo, CHANGED_REMOVED); - set_call_change_handlers(th, TEAM_IFINFO_CHANGE); - } -@@ -367,6 +367,14 @@ int get_ifinfo_list(struct team_handle *th) - }; - int ret; - int retry = 1; -+ struct team_ifinfo *ifinfo; -+ -+ /* Tag all ifinfo, this is cleared in newlink handler. -+ * Any interface that has this after dump is processed -+ * has been removed. -+ */ -+ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) -+ set_changed(ifinfo, CHANGED_REFRESHING); - - while (retry) { - retry = 0; -@@ -395,6 +403,15 @@ int get_ifinfo_list(struct team_handle *th) - retry = 1; - } - } -+ -+ list_for_each_node_entry(ifinfo, &th->ifinfo_list, list) { -+ if (is_changed(ifinfo, CHANGED_REFRESHING)) { -+ clear_changed(ifinfo); -+ set_changed(ifinfo, CHANGED_REMOVED); -+ set_call_change_handlers(th, TEAM_IFINFO_CHANGE); -+ } -+ } -+ - ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE); - if (ret < 0) - err(th, "get_ifinfo_list: check_call_change_handers failed"); -diff --git a/libteam/libteam.c b/libteam/libteam.c -index 106e5cf..afe05cb 100644 ---- a/libteam/libteam.c -+++ b/libteam/libteam.c -@@ -236,6 +236,10 @@ int check_call_change_handlers(struct team_handle *th, - break; - } - } -+ if (call_type_mask & TEAM_IFINFO_CHANGE) { -+ ifinfo_destroy_removed(th); -+ ifinfo_clear_changed(th); -+ } - th->change_handler.pending_type_mask &= ~call_type_mask; - return err; - } -@@ -546,6 +550,11 @@ int team_destroy(struct team_handle *th) - #endif - /* \endcond */ - -+/* libnl uses default 32k socket receive buffer size, -+ * whicn can get too small. Use 96k for all sockets. -+ */ -+#define NETLINK_RCVBUF 983040 -+ - /** - * @param th libteam library context - * @param ifindex team device interface index -@@ -561,6 +570,8 @@ int team_init(struct team_handle *th, uint32_t ifindex) - int err; - int grp_id; - int val; -+ int eventbufsize; -+ const char *env; - - if (!ifindex) { - err(th, "Passed interface index %d is not valid.", ifindex); -@@ -589,12 +600,12 @@ int team_init(struct team_handle *th, uint32_t ifindex) - return -errno; - } - -- err = nl_socket_set_buffer_size(th->nl_sock, 98304, 0); -+ err = nl_socket_set_buffer_size(th->nl_sock, NETLINK_RCVBUF, 0); - if (err) { - err(th, "Failed to set buffer size of netlink sock."); - return -nl2syserr(err); - } -- err = nl_socket_set_buffer_size(th->nl_sock_event, 98304, 0); -+ err = nl_socket_set_buffer_size(th->nl_sock_event, NETLINK_RCVBUF, 0); - if (err) { - err(th, "Failed to set buffer size of netlink event sock."); - return -nl2syserr(err); -@@ -627,6 +638,25 @@ int team_init(struct team_handle *th, uint32_t ifindex) - nl_socket_modify_cb(th->nl_cli.sock_event, NL_CB_VALID, - NL_CB_CUSTOM, cli_event_handler, th); - nl_cli_connect(th->nl_cli.sock_event, NETLINK_ROUTE); -+ -+ env = getenv("TEAM_EVENT_BUFSIZE"); -+ if (env) { -+ eventbufsize = strtol(env, NULL, 10); -+ /* ignore other errors, libnl forces minimum 32k and -+ * too large values are truncated to system rmem_max -+ */ -+ if (eventbufsize < 0) -+ eventbufsize = 0; -+ } else { -+ eventbufsize = NETLINK_RCVBUF; -+ } -+ -+ err = nl_socket_set_buffer_size(th->nl_cli.sock_event, eventbufsize, 0); -+ if (err) { -+ err(th, "Failed to set cli event socket buffer size."); -+ return err; -+ } -+ - err = nl_socket_add_membership(th->nl_cli.sock_event, RTNLGRP_LINK); - if (err < 0) { - err(th, "Failed to add netlink membership."); -@@ -767,7 +797,23 @@ static int get_cli_sock_event_fd(struct team_handle *th) - - static int cli_sock_event_handler(struct team_handle *th) - { -- nl_recvmsgs_default(th->nl_cli.sock_event); -+ int err; -+ -+ err = nl_recvmsgs_default(th->nl_cli.sock_event); -+ err = -nl2syserr(err); -+ -+ /* libnl thinks ENOBUFS and ENOMEM are same. Hope it was ENOBUFS. */ -+ if (err == -ENOMEM) { -+ warn(th, "Lost link notifications from kernel."); -+ /* There's no way to know what events were lost and no -+ * way to get them again. Refresh all. -+ */ -+ err = get_ifinfo_list(th); -+ } -+ -+ if (err) -+ return err; -+ - return check_call_change_handlers(th, TEAM_IFINFO_CHANGE); - } - -diff --git a/libteam/team_private.h b/libteam/team_private.h -index a07632f..a5eb0be 100644 ---- a/libteam/team_private.h -+++ b/libteam/team_private.h -@@ -115,6 +115,9 @@ int ifinfo_link_with_port(struct team_handle *th, uint32_t ifindex, - int ifinfo_link(struct team_handle *th, uint32_t ifindex, - struct team_ifinfo **p_ifinfo); - void ifinfo_unlink(struct team_ifinfo *ifinfo); -+void ifinfo_clear_changed(struct team_handle *th); -+void ifinfo_destroy_removed(struct team_handle *th); -+int get_ifinfo_list(struct team_handle *th); - int get_options_handler(struct nl_msg *msg, void *arg); - int option_list_alloc(struct team_handle *th); - int option_list_init(struct team_handle *th); diff --git a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch b/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch deleted file mode 100644 index 3779ae186351..000000000000 --- a/src/libteam/0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 28ccb37eb388e7e3d214a9b05011f8421f0d65ac Mon Sep 17 00:00:00 2001 -From: Ying Xie -Date: Fri, 26 Apr 2019 23:30:38 +0000 -Subject: [PATCH] teamd: do not process lacpdu before the port ifinfo is set - -Now the port ifinfo will be set in obj_input_newlink when a RTM_NEWLINK -event is received. - -But when a port is being added, if a lacpdu gets received on this port -before the RTM_NEWLINK event, lacpdu_recv will process the packet with -incorrect port ifinfo. - -In Patrick's case, as ifinfo->master_ifindex was 0, it would skip this -port in teamd_for_each_tdport, which caused lacp_port->agg_lead not to -be updated in lacp_switch_agg_lead. Later the lacp_port actor would go -to a unexpected state. - -This patch is to avoid it by checking teamd_port_present in lacpdu_recv -so that it would not process lacpdu before the port ifinfo is set. - -Reported-by: Patrick Talbert -Tested-by: Patrick Talbert -Signed-off-by: Xin Long -Reviewed-by: Marcelo Ricardo Leitner -Signed-off-by: Jiri Pirko ---- - teamd/teamd_runner_lacp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 813b604..d6e5840 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1102,6 +1102,9 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - if (err <= 0) - return err; - -+ if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) -+ return 0; -+ - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; - --- -2.7.4 - diff --git a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch b/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch deleted file mode 100644 index e5f26637ee5d..000000000000 --- a/src/libteam/0013-teamd-lacp-port-admin-down-recv-not-processing.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index d6e5840..2144334 100644 ---- a/teamd/teamd_runner_lacp.c -+++ b/teamd/teamd_runner_lacp.c -@@ -1096,6 +1096,7 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - struct lacpdu lacpdu; - struct sockaddr_ll ll_from; - int err; -+ bool admin_state; - - err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, - (struct sockaddr *) &ll_from, sizeof(ll_from)); -@@ -1105,6 +1106,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) - if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) - return 0; - -+ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); -+ if (!admin_state) -+ return 0; -+ - if (!lacpdu_check(&lacpdu)) { - teamd_log_warn("malformed LACP PDU came."); - return 0; diff --git a/src/libteam/Makefile b/src/libteam/Makefile index 256680d34943..dade8f949aaa 100644 --- a/src/libteam/Makefile +++ b/src/libteam/Makefile @@ -12,17 +12,19 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf ./libteam git clone https://github.com/jpirko/libteam.git pushd ./libteam - git checkout -b teamd -f v1.26 + git checkout -b teamd -f 5c5e498bff9 # Apply patch series stg init - stg import -s ../series + stg import -s ../patch/series popd # Obtain debian packaging git clone https://salsa.debian.org/debian/libteam.git tmp pushd ./tmp - git checkout -f da006f2 # v1.26 + git checkout -f 7188c361 # v1.28-1 + # Revert dependency on higher version of debhelper + git revert 57166478 --quiet -n popd mv tmp/debian libteam/ diff --git a/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch b/src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch similarity index 70% rename from src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch rename to src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch index a640f40e6e07..d922c91c425e 100644 --- a/src/libteam/0002-libteam-Temporarily-remove-redundant-debug-mes.patch +++ b/src/libteam/patch/0001-libteam-Temporarily-remove-redundant-debug-messages.patch @@ -1,17 +1,17 @@ -From a5c8f3f41c575ebb7018e67cb3d1f724f0685850 Mon Sep 17 00:00:00 2001 +From 10602c2b1184aa0c6907b5a7f06fcba8a7141148 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Mon, 27 Feb 2017 14:21:09 -0800 -Subject: [PATCH] libteam: Temporarily remove redundant debug messages +Subject: [PATCH 1/8] libteam: Temporarily remove redundant debug messages --- teamd/teamd_runner_lacp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 9c77fae..5e37a4c 100644 +index d292d69..7c91aed 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -922,8 +922,6 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) +@@ -929,8 +929,6 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) state |= INFO_STATE_DEFAULTED; if (teamd_port_count(lacp_port->ctx) > 0) state |= INFO_STATE_AGGREGATION; @@ -21,5 +21,5 @@ index 9c77fae..5e37a4c 100644 } -- -2.1.4 +2.7.4 diff --git a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch b/src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch similarity index 67% rename from src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch rename to src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch index 1cae8bad21aa..c4e78257103d 100644 --- a/src/libteam/0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +++ b/src/libteam/patch/0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch @@ -1,21 +1,23 @@ -From 417e9dfdccbbee2cf86e46e994e8ece3433b46a4 Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Wed, 20 Sep 2017 00:34:07 +0000 -Subject: [PATCH] [teamd] lacp runner will send lacp update right after it - received SIGINT signal +From 0ce56490a44191c4b17a75cc21aa6a5bdc535f1d Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 11:58:19 +0800 +Subject: [PATCH 2/8] [teamd] lacp runner will send lacp update right after it + received SIGINT signal From: Pavel Shirshov + Date: Wed, 20 Sep 2017 00:34:07 +0000 +Signed-off-by: yorke --- teamd/teamd.c | 1 + teamd/teamd.h | 3 +++ teamd/teamd_events.c | 13 +++++++++++++ - teamd/teamd_runner_lacp.c | 10 ++++++++++ - 4 files changed, 27 insertions(+) + teamd/teamd_runner_lacp.c | 11 +++++++++++ + 4 files changed, 28 insertions(+) diff --git a/teamd/teamd.c b/teamd/teamd.c -index aac2511..c987333 100644 +index 6c47312..58d4fc8 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c -@@ -386,6 +386,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) +@@ -392,6 +392,7 @@ static int teamd_run_loop_run(struct teamd_context *ctx) case 'q': if (quit_in_progress) return -EBUSY; @@ -24,13 +26,13 @@ index aac2511..c987333 100644 if (err) return err; diff --git a/teamd/teamd.h b/teamd/teamd.h -index 5dbfb9b..ef0fb1c 100644 +index 01bd022..e71a5dc 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h -@@ -189,11 +189,14 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); - int (*port_ifname_changed)(struct teamd_context *ctx, - struct teamd_port *tdport, void *priv); +@@ -193,11 +193,14 @@ struct teamd_event_watch_ops { + int (*port_master_ifindex_changed)(struct teamd_context *ctx, + struct teamd_port *tdport, + void *priv); + void (*refresh)(struct teamd_context *ctx, + struct teamd_port *tdport, void *priv); int (*option_changed)(struct teamd_context *ctx, @@ -43,7 +45,7 @@ index 5dbfb9b..ef0fb1c 100644 struct teamd_port *tdport); void teamd_event_port_removed(struct teamd_context *ctx, diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 1a95974..5c2ef56 100644 +index 65aa46a..221803e 100644 --- a/teamd/teamd_events.c +++ b/teamd/teamd_events.c @@ -34,6 +34,19 @@ struct event_watch_item { @@ -67,25 +69,27 @@ index 1a95974..5c2ef56 100644 struct teamd_port *tdport) { diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 9c77fae..e38c291 100644 +index 7c91aed..4dbd015 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1383,12 +1383,22 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, +@@ -1421,6 +1421,16 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, return lacp_port_link_update(lacp_port); } -+static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) ++static void lacp_event_watch_refresh(struct teamd_context *ctx, ++ struct teamd_port *tdport, void *priv) +{ + struct lacp *lacp = priv; -+ + struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); ++ + if (lacp_port_selected(lacp_port)) + (void) lacpdu_send(lacp_port); +} + static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, - .port_added = lacp_event_watch_port_added, + .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, +@@ -1428,6 +1438,7 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { .port_removed = lacp_event_watch_port_removed, .port_changed = lacp_event_watch_port_changed, .admin_state_changed = lacp_event_watch_admin_state_changed, diff --git a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch b/src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch similarity index 84% rename from src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch rename to src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch index 3139f83f33a4..8559e476aec1 100644 --- a/src/libteam/0004-libteam-Add-lacp-fallback-support-for-single-member-.patch +++ b/src/libteam/patch/0003-libteam-Add-fallback-support-for-single-member-port-.patch @@ -1,16 +1,17 @@ -From ec966f9a0229bd7226e3abe15b56659b36af9d66 Mon Sep 17 00:00:00 2001 -From: Haiyang Zheng -Date: Fri, 15 Dec 2017 21:07:53 -0800 -Subject: [patch libteam] [libteam] Add fallback support for single-member-port - LAG +From 9b40af58575a89d06be51cfbb5a2265a59826110 Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 12:02:36 +0800 +Subject: [PATCH 3/8] [libteam] Add fallback support for single-member-port LAG + From: Haiyang Zheng Date: Fri, 15 Dec + 2017 21:07:53 -0800 -Signed-off-by: Haiyang Zheng +Signed-off-by: yorke --- teamd/teamd_runner_lacp.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 9c77fae..a3646a6 100644 +index 4dbd015..9836824 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -138,6 +138,8 @@ struct lacp { @@ -70,7 +71,7 @@ index 9c77fae..a3646a6 100644 return false; return true; } -@@ -1452,6 +1475,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, +@@ -1502,6 +1525,16 @@ static int lacp_state_fast_rate_get(struct teamd_context *ctx, return 0; } @@ -87,7 +88,7 @@ index 9c77fae..a3646a6 100644 static int lacp_state_select_policy_get(struct teamd_context *ctx, struct team_state_gsc *gsc, void *priv) -@@ -1479,6 +1512,11 @@ static const struct teamd_state_val lacp_state_vals[] = { +@@ -1529,6 +1562,11 @@ static const struct teamd_state_val lacp_state_vals[] = { .getter = lacp_state_fast_rate_get, }, { diff --git a/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch b/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch new file mode 100644 index 000000000000..3d99132b92dc --- /dev/null +++ b/src/libteam/patch/0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch @@ -0,0 +1,36 @@ +From e18cbe5a6c76366923a8ace830c89056a1542745 Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 12:06:00 +0800 +Subject: [PATCH 4/8] Skip setting the same hwaddr to lag port to avoid + disrupting From: Jipan Yang Date: Sun, + 24 Feb 2019 00:04:15 -0800 + +Signed-off-by: yorke +--- + teamd/teamd.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/teamd/teamd.c b/teamd/teamd.c +index 58d4fc8..9dc85b5 100644 +--- a/teamd/teamd.c ++++ b/teamd/teamd.c +@@ -834,7 +834,15 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) + err = -EINVAL; + goto free_hwaddr; + } +- err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ ++ if(!memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) { ++ err = 0; ++ teamd_log_dbg("Skip setting same hwaddr string: \"%s\".", hwaddr_str); ++ } ++ else{ ++ err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); ++ } ++ + if (!err) + ctx->hwaddr_explicit = true; + free_hwaddr: +-- +2.7.4 + diff --git a/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch b/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch new file mode 100644 index 000000000000..517b86992e27 --- /dev/null +++ b/src/libteam/patch/0005-Increase-default-buffer-size-from-98304-to-983040.patch @@ -0,0 +1,31 @@ +From 39e5b0a15bf276dffa6b8c61594ee945248a4e27 Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 12:32:33 +0800 +Subject: [PATCH 5/8] Increase default buffer size from 98304 to 983040 + From: Pavel Shirshov + https://github.com/Azure/sonic-buildimage/pull/2822 + +Signed-off-by: yorke +--- + libteam/libteam.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libteam/libteam.c b/libteam/libteam.c +index 9c9c93a..2cc80ca 100644 +--- a/libteam/libteam.c ++++ b/libteam/libteam.c +@@ -551,9 +551,9 @@ int team_destroy(struct team_handle *th) + /* \endcond */ + + /* libnl uses default 32k socket receive buffer size, +- * which can get too small. Use 192k for all sockets. ++ * which can get too small. Use 960k for all sockets. + */ +-#define NETLINK_RCVBUF 196608 ++#define NETLINK_RCVBUF 983040 + + /** + * @param th libteam library context +-- +2.7.4 + diff --git a/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch b/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch new file mode 100644 index 000000000000..344dbc8d2609 --- /dev/null +++ b/src/libteam/patch/0006-teamd-Administratively-shutdown-port-channel-has-mem.patch @@ -0,0 +1,37 @@ +From f1eec95dd0475591897a781eba15d8d8ce370a6a Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 13:21:07 +0800 +Subject: [PATCH 6/8] [teamd]: Administratively shutdown port channel has + member ports in deselected state and traffic is not forwarded From: + phanindra-tv https://github.com/Azure/sonic-buildimage/pull/2882 + +Signed-off-by: yorke +--- + teamd/teamd_runner_lacp.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c +index 9836824..7bf3700 100644 +--- a/teamd/teamd_runner_lacp.c ++++ b/teamd/teamd_runner_lacp.c +@@ -1101,12 +1101,17 @@ static int lacpdu_recv(struct lacp_port *lacp_port) + struct lacpdu lacpdu; + struct sockaddr_ll ll_from; + int err; ++ bool admin_state; + + err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, + (struct sockaddr *) &ll_from, sizeof(ll_from)); + if (err <= 0) + return err; + ++ admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); ++ if (!admin_state) ++ return 0; ++ + if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) + return 0; + +-- +2.7.4 + diff --git a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch b/src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch similarity index 59% rename from src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch rename to src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch index b4c9c68f8aca..d26e2a74ea42 100644 --- a/src/libteam/0014-Send-LACP-PDU-immediately-if-our-state-changed.patch +++ b/src/libteam/patch/0007-Send-LACP-PDU-immediately-if-our-state-changed.patch @@ -1,17 +1,20 @@ -From 0e0ee4a68b118d540d9ef5836a55483fcfb8771b Mon Sep 17 00:00:00 2001 -From: Pavel Shirshov -Date: Wed, 29 May 2019 19:15:20 +0000 -Subject: [PATCH] Send LACP PDU immediately if our state changed +From b82da0dc94ca34b039396328a8c2fcb61aa73c0f Mon Sep 17 00:00:00 2001 +From: yorke +Date: Mon, 3 Jun 2019 13:27:26 +0800 +Subject: [PATCH 7/8] Send LACP PDU immediately if our state changed From: + Pavel Shirshov Date: Wed, 29 May 2019 19:15:20 + +0000 +Signed-off-by: yorke --- teamd/teamd_runner_lacp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 2144334..0930b22 100644 +index 7bf3700..4016b15 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c -@@ -1012,8 +1012,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1017,8 +1017,7 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, return err; lacp_port_actor_update(lacp_port); @@ -21,7 +24,7 @@ index 2144334..0930b22 100644 return lacpdu_send(lacp_port); } -@@ -1131,9 +1130,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1136,9 +1135,10 @@ static int lacpdu_recv(struct lacp_port *lacp_port) if (err) return err; diff --git a/src/libteam/0015-libteam-Add-warm_reboot-mode.patch b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch similarity index 90% rename from src/libteam/0015-libteam-Add-warm_reboot-mode.patch rename to src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch index e6f2a3257198..10770b8740b5 100644 --- a/src/libteam/0015-libteam-Add-warm_reboot-mode.patch +++ b/src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch @@ -1,5 +1,18 @@ +From a21a3dec9f9b9d825a0229e2963e07862395bbba Mon Sep 17 00:00:00 2001 +From: Pavel Shirshov +Date: Fri, 14 Jun 2019 14:20:05 -0700 +Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure + +--- + libteam/ifinfo.c | 6 +- + teamd/teamd.c | 42 +++- + teamd/teamd.h | 6 + + teamd/teamd_events.c | 13 ++ + teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++--- + 5 files changed, 498 insertions(+), 43 deletions(-) + diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c -index 5c32a9c..c418243 100644 +index 46d56a2..b86d34c 100644 --- a/libteam/ifinfo.c +++ b/libteam/ifinfo.c @@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link) @@ -21,10 +34,10 @@ index 5c32a9c..c418243 100644 } } diff --git a/teamd/teamd.c b/teamd/teamd.c -index 0f8993e..ad91fe5 100644 +index 9dc85b5..96794e8 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c -@@ -116,7 +116,9 @@ static void print_help(const struct teamd_context *ctx) { +@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) { " -D --dbus-enable Enable D-Bus interface\n" " -Z --zmq-enable=ADDRESS Enable ZeroMQ interface\n" " -U --usock-enable Enable UNIX domain socket interface\n" @@ -35,7 +48,7 @@ index 0f8993e..ad91fe5 100644 ctx->argv0); printf("Available runners: "); for (i = 0; i < TEAMD_RUNNER_LIST_SIZE; i++) { -@@ -149,10 +151,12 @@ static int parse_command_line(struct teamd_context *ctx, +@@ -151,10 +153,12 @@ static int parse_command_line(struct teamd_context *ctx, { "zmq-enable", required_argument, NULL, 'Z' }, { "usock-enable", no_argument, NULL, 'U' }, { "usock-disable", no_argument, NULL, 'u' }, @@ -44,12 +57,12 @@ index 0f8993e..ad91fe5 100644 { NULL, 0, NULL, 0 } }; -- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:Uu", -+ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:groNt:nDZ:UuwL:", +- while ((opt = getopt_long(argc, argv, "hdkevf:c:p:gl:roNt:nDZ:Uu", ++ while ((opt = getopt_long(argc, argv, "hdkevf:c:p:gl:roNt:nDZ:UuwL:", long_options, NULL)) >= 0) { switch(opt) { -@@ -230,11 +234,27 @@ static int parse_command_line(struct teamd_context *ctx, +@@ -236,11 +240,27 @@ static int parse_command_line(struct teamd_context *ctx, case 'u': ctx->usock.enabled = false; break; @@ -77,7 +90,7 @@ index 0f8993e..ad91fe5 100644 if (optind < argc) { fprintf(stderr, "Too many arguments\n"); return -1; -@@ -384,8 +404,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) +@@ -390,8 +410,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx) if (err != -1) { switch(ctrl_byte) { case 'q': @@ -92,7 +105,7 @@ index 0f8993e..ad91fe5 100644 teamd_refresh_ports(ctx); err = teamd_flush_ports(ctx); if (err) -@@ -428,6 +454,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) +@@ -434,6 +460,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err) teamd_run_loop_sent_ctrl_byte(ctx, 'q'); } @@ -105,7 +118,7 @@ index 0f8993e..ad91fe5 100644 void teamd_run_loop_restart(struct teamd_context *ctx) { teamd_run_loop_sent_ctrl_byte(ctx, 'r'); -@@ -694,6 +726,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, +@@ -700,6 +732,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events, teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM."); teamd_run_loop_quit(ctx, 0); break; @@ -116,7 +129,7 @@ index 0f8993e..ad91fe5 100644 } return 0; } -@@ -1516,7 +1552,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) +@@ -1531,7 +1567,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret) return -errno; } @@ -126,10 +139,10 @@ index 0f8993e..ad91fe5 100644 daemon_retval_send(errno); err = -errno; diff --git a/teamd/teamd.h b/teamd/teamd.h -index ef0fb1c..72330f1 100644 +index e71a5dc..418214d 100644 --- a/teamd/teamd.h +++ b/teamd/teamd.h -@@ -125,6 +125,9 @@ struct teamd_context { +@@ -126,6 +126,9 @@ struct teamd_context { char * hwaddr; uint32_t hwaddr_len; bool hwaddr_explicit; @@ -139,8 +152,8 @@ index ef0fb1c..72330f1 100644 struct { struct list_item callback_list; int ctrl_pipe_r; -@@ -191,12 +194,15 @@ struct teamd_event_watch_ops { - struct teamd_port *tdport, void *priv); +@@ -195,12 +198,15 @@ struct teamd_event_watch_ops { + void *priv); void (*refresh)(struct teamd_context *ctx, struct teamd_port *tdport, void *priv); + void (*port_flush_data)(struct teamd_context *ctx, @@ -156,7 +169,7 @@ index ef0fb1c..72330f1 100644 struct teamd_port *tdport); void teamd_event_port_removed(struct teamd_context *ctx, diff --git a/teamd/teamd_events.c b/teamd/teamd_events.c -index 5c2ef56..50e5a08 100644 +index 221803e..bd4dcc1 100644 --- a/teamd/teamd_events.c +++ b/teamd/teamd_events.c @@ -47,6 +47,19 @@ void teamd_refresh_ports(struct teamd_context *ctx) @@ -180,7 +193,7 @@ index 5c2ef56..50e5a08 100644 struct teamd_port *tdport) { diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c -index 0930b22..dc87448 100644 +index 4016b15..81be5b7 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -31,6 +31,7 @@ @@ -560,7 +573,7 @@ index 0930b22..dc87448 100644 lacp_port_actor_system_update(lacp_port); } -@@ -1001,6 +1299,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, +@@ -1006,6 +1304,13 @@ static int lacp_port_set_state(struct lacp_port *lacp_port, break; } @@ -574,7 +587,7 @@ index 0930b22..dc87448 100644 teamd_log_info("%s: Changed port state: \"%s\" -> \"%s\"", lacp_port->tdport->ifname, lacp_port_state_name[lacp_port->state], -@@ -1090,34 +1395,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) +@@ -1095,34 +1400,23 @@ static int lacpdu_send(struct lacp_port *lacp_port) return err; } @@ -585,19 +598,19 @@ index 0930b22..dc87448 100644 - struct sockaddr_ll ll_from; int err; - bool admin_state; - +- - err = teamd_recvfrom(lacp_port->sock, &lacpdu, sizeof(lacpdu), 0, - (struct sockaddr *) &ll_from, sizeof(ll_from)); - if (err <= 0) - return err; - -- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) -- return 0; -- - admin_state = team_get_ifinfo_admin_state(lacp_port->ctx->ifinfo); - if (!admin_state) - return 0; - +- if (!teamd_port_present(lacp_port->ctx, lacp_port->tdport)) +- return 0; + - if (!lacpdu_check(&lacpdu)) { + if (!lacpdu_check(lacpdu)) { teamd_log_warn("malformed LACP PDU came."); @@ -617,7 +630,7 @@ index 0930b22..dc87448 100644 err = lacp_port_partner_update(lacp_port); if (err) return err; -@@ -1133,21 +1427,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port) +@@ -1138,21 +1432,56 @@ static int lacpdu_recv(struct lacp_port *lacp_port) lacp_port_actor_update(lacp_port); /* Check if the other side has correct info about us */ @@ -677,7 +690,7 @@ index 0930b22..dc87448 100644 static int lacp_callback_timeout(struct teamd_context *ctx, int events, void *priv) { -@@ -1253,6 +1582,8 @@ static int lacp_port_added(struct teamd_context *ctx, +@@ -1258,6 +1587,8 @@ static int lacp_port_added(struct teamd_context *ctx, struct lacp *lacp = creator_priv; int err; @@ -686,7 +699,7 @@ index 0930b22..dc87448 100644 lacp_port->ctx = ctx; lacp_port->tdport = tdport; lacp_port->lacp = lacp; -@@ -1299,6 +1630,13 @@ static int lacp_port_added(struct teamd_context *ctx, +@@ -1304,6 +1635,13 @@ static int lacp_port_added(struct teamd_context *ctx, goto periodic_callback_del; } @@ -700,7 +713,7 @@ index 0930b22..dc87448 100644 /* Newly added ports are disabled */ err = team_set_port_enabled(ctx->th, tdport->ifindex, false); if (err) { -@@ -1336,7 +1674,13 @@ static void lacp_port_removed(struct teamd_context *ctx, +@@ -1341,7 +1679,13 @@ static void lacp_port_removed(struct teamd_context *ctx, { struct lacp_port *lacp_port = priv; @@ -715,7 +728,19 @@ index 0930b22..dc87448 100644 teamd_loop_callback_del(ctx, LACP_TIMEOUT_CB_NAME, lacp_port); teamd_loop_callback_del(ctx, LACP_PERIODIC_CB_NAME, lacp_port); teamd_loop_callback_del(ctx, LACP_SOCKET_CB_NAME, lacp_port); -@@ -1428,6 +1772,42 @@ static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_por +@@ -1449,16 +1793,51 @@ static int lacp_event_watch_port_changed(struct teamd_context *ctx, + return lacp_port_link_update(lacp_port); + } + +-static void lacp_event_watch_refresh(struct teamd_context *ctx, +- struct teamd_port *tdport, void *priv) ++static void lacp_event_watch_refresh(struct teamd_context *ctx, struct teamd_port *tdport, void *priv) + { + struct lacp *lacp = priv; +- struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + ++ struct lacp_port *lacp_port = lacp_port_get(lacp, tdport); + if (lacp_port_selected(lacp_port)) (void) lacpdu_send(lacp_port); } @@ -757,8 +782,8 @@ index 0930b22..dc87448 100644 + static const struct teamd_event_watch_ops lacp_event_watch_ops = { .hwaddr_changed = lacp_event_watch_hwaddr_changed, - .port_added = lacp_event_watch_port_added, -@@ -1435,21 +1815,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { + .port_hwaddr_changed = lacp_event_watch_port_hwaddr_changed, +@@ -1467,21 +1846,35 @@ static const struct teamd_event_watch_ops lacp_event_watch_ops = { .port_changed = lacp_event_watch_port_changed, .admin_state_changed = lacp_event_watch_admin_state_changed, .refresh = lacp_event_watch_refresh, @@ -799,7 +824,7 @@ index 0930b22..dc87448 100644 return 0; } -@@ -1917,6 +2311,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) +@@ -1949,6 +2342,12 @@ static int lacp_init(struct teamd_context *ctx, void *priv) } lacp->ctx = ctx; @@ -812,7 +837,7 @@ index 0930b22..dc87448 100644 err = teamd_hash_func_set(ctx); if (err) return err; -@@ -1958,10 +2358,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) +@@ -1990,10 +2389,13 @@ static void lacp_fini(struct teamd_context *ctx, void *priv) { struct lacp *lacp = priv; @@ -827,3 +852,6 @@ index 0930b22..dc87448 100644 } const struct teamd_runner teamd_runner_lacp = { +-- +2.17.1.windows.2 + diff --git a/src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch b/src/libteam/patch/0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch similarity index 100% rename from src/libteam/0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch rename to src/libteam/patch/0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch diff --git a/src/libteam/patch/series b/src/libteam/patch/series new file mode 100644 index 000000000000..c30bdc7dd861 --- /dev/null +++ b/src/libteam/patch/series @@ -0,0 +1,9 @@ +0001-libteam-Temporarily-remove-redundant-debug-messages.patch +0002-teamd-lacp-runner-will-send-lacp-update-right-after-.patch +0003-libteam-Add-fallback-support-for-single-member-port-.patch +0004-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch +0005-Increase-default-buffer-size-from-98304-to-983040.patch +0006-teamd-Administratively-shutdown-port-channel-has-mem.patch +0007-Send-LACP-PDU-immediately-if-our-state-changed.patch +0008-libteam-Add-warm_reboot-mode.patch +0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch diff --git a/src/libteam/series b/src/libteam/series deleted file mode 100644 index d1fec73c1fad..000000000000 --- a/src/libteam/series +++ /dev/null @@ -1,12 +0,0 @@ -0001-libteam-Add-team_get_port_enabled-function.patch -0002-libteam-Temporarily-remove-redundant-debug-mes.patch -0003-teamd-lacp-runner-will-send-lacp-update-right-after-.patch -0004-libteam-Add-lacp-fallback-support-for-single-member-.patch -0007-Skip-setting-the-same-hwaddr-to-lag-port-to-avoid-di.patch -0010-teamd-lacp-update-port-state-according-to-partners-sy.patch -0011-libteam-resynchronize-ifinfo-after-lost-RTNLGRP_LINK-.patch -0012-teamd-do-not-process-lacpdu-before-the-port-ifinfo-i.patch -0013-teamd-lacp-port-admin-down-recv-not-processing.patch -0014-Send-LACP-PDU-immediately-if-our-state-changed.patch -0015-libteam-Add-warm_reboot-mode.patch -0016-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch From b80d60c2773af7e0a180b4dfc10e33d519c29a30 Mon Sep 17 00:00:00 2001 From: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com> Date: Fri, 9 Aug 2019 11:46:46 -0700 Subject: [PATCH 201/219] Fix to ensure that tacacs servers are ordered (reverse) by priority in pam.d's config. (#3322) Present: Servers are listed in the same order as in redis-db Fix: Save the sort o/p, hence use sorted list to write into pam.d's conf. As well convert priority to integer for use by sort. --- files/image_config/hostcfgd/hostcfgd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index ae51af5cc8e4..0543a55539fe 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -104,7 +104,7 @@ class AaaCfg(object): server['ip'] = addr server.update(self.tacplus_servers[addr]) servers_conf.append(server) - sorted(servers_conf, key=lambda t: t['priority'], reverse=True) + servers_conf = sorted(servers_conf, key=lambda t: int(t['priority']), reverse=True) template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE) env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) From c17cd19e49db0b8b6b3862c370e7b85719291b4a Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Fri, 9 Aug 2019 01:17:48 +0800 Subject: [PATCH 202/219] [Mellanox] mlnx-sfpd init flow enhancement (#3294) * fix sfpd initialize issue * fix review comments * rephrase the output log * fix retry counter * change the retry time to 10, means set max waiting time 1024s * fix mlnx-sfpd init flow with new solution * [mlnx-sfpd] address comments 1. wait for 5 seconds * 30 times, 150 seconds totally. use constant wait time for each retry. 2. use try/except structure so that error can be handled in a graceful way * [mlnx-sfpd] wait 5 seconds after SDK_DAEMON_READY_FILE exists to make sure SDK is fully up. * [mlnx-sfpd]simplify initialization by using deinitialize on initializing failure --- platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd | 104 ++++++++++++------ 1 file changed, 73 insertions(+), 31 deletions(-) diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index 20bd14ffb4c1..b11403b31514 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -30,6 +30,8 @@ STATUS_UNKNOWN = '2' SFPD_LIVENESS_EXPIRE_SECS = 30 +SDK_DAEMON_READY_FILE = '/tmp/sdk_ready' + sfp_value_status_dict = { SDK_SFP_STATE_IN: STATUS_PLUGIN, SDK_SFP_STATE_OUT: STATUS_PLUGOUT, @@ -64,7 +66,8 @@ def log_error(msg, also_print_to_console=False): class MlnxSfpd: ''' Listen to plugin/plugout cable events ''' - SX_OPEN_RETRIES = 20 + SX_OPEN_RETRIES = 30 + SX_OPEN_TIMEOUT = 5 SELECT_TIMEOUT = 1 def __init__(self): @@ -75,7 +78,6 @@ class MlnxSfpd: # Allocate SDK fd and user channel structures self.rx_fd_p = new_sx_fd_t_p() self.user_channel_p = new_sx_user_channel_t_p() - self.state_db = SonicV2Connector(host=REDIS_HOSTIP) # Register our signal handlers @@ -98,37 +100,78 @@ class MlnxSfpd: def initialize(self): self.state_db.connect("STATE_DB") - # open SDK API handle - # retry at most SX_OPEN_RETRIES times to wait - # until SDK is started during system startup - retry = 1 - while True: - rc, self.handle = sx_api_open(None) - if rc == SX_STATUS_SUCCESS: - break - - log_warning("failed to open SDK API handle... retrying {}".format(retry)) + swid_cnt_p = None - time.sleep(2 ** retry) - retry += 1 - - if retry > self.SX_OPEN_RETRIES: - raise RuntimeError("failed to open SDK API handle after {} retries".format(retry)) - - rc = sx_api_host_ifc_open(self.handle, self.rx_fd_p) - if rc != SX_STATUS_SUCCESS: - raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc)) + try: + # Wait for SDK daemon to be started with detect the sdk_ready file + retry = 0 + while not os.path.exists(SDK_DAEMON_READY_FILE): + if retry >= self.SX_OPEN_RETRIES: + raise RuntimeError("SDK daemon failed to start after {} retries and {} seconds waiting, exiting..." + .format(retry, self.SX_OPEN_TIMEOUT * self.SX_OPEN_RETRIES)) + else: + log_info("SDK daemon not started yet, retry {} times".format(retry)) + retry = retry + 1 + time.sleep(self.SX_OPEN_TIMEOUT) - self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD - self.user_channel_p.channel.fd = self.rx_fd_p + # to make sure SDK daemon has started + time.sleep(self.SX_OPEN_TIMEOUT) - rc = sx_api_host_ifc_trap_id_register_set(self.handle, - SX_ACCESS_CMD_REGISTER, - self.swid, - SX_TRAP_ID_PMPE, - self.user_channel_p) - if rc != SX_STATUS_SUCCESS: - raise RuntimeError("sx_api_host_ifc_trap_id_register_set exited with error, rc {}".format(c)) + # After SDK daemon started, sx_api_open and sx_api_host_ifc_open is ready for call + rc, self.handle = sx_api_open(None) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("failed to call sx_api_open with rc {}, exiting...".format(rc)) + + rc = sx_api_host_ifc_open(self.handle, self.rx_fd_p) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("failed to call sx_api_host_ifc_open with rc {}, exiting...".format(rc)) + + self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD + self.user_channel_p.channel.fd = self.rx_fd_p + + # Wait for switch to be created and initialized inside SDK + retry = 0 + swid_cnt_p = new_uint32_t_p() + uint32_t_p_assign(swid_cnt_p, 0) + swid_cnt = 0 + while True: + if retry >= self.SX_OPEN_RETRIES: + raise RuntimeError("switch not created after {} retries and {} seconds waiting, exiting..." + .format(retry, self.SX_OPEN_RETRIES * self.SX_OPEN_TIMEOUT)) + else: + rc = sx_api_port_swid_list_get(self.handle, None, swid_cnt_p) + if rc == SX_STATUS_SUCCESS: + swid_cnt = uint32_t_p_value(swid_cnt_p) + if swid_cnt > 0: + delete_uint32_t_p(swid_cnt_p) + swid_cnt_p = None + break + else: + log_info("switch not created yet, swid_cnt {}, retry {} times and wait for {} seconds" + .format(swid_cnt, retry, self.SX_OPEN_TIMEOUT * retry)) + else: + raise RuntimeError("sx_api_port_swid_list_get fail with rc {}, retry {} times and wait for {} seconds". + format(rc, retry, self.SX_OPEN_TIMEOUT * retry)) + + retry = retry + 1 + time.sleep(self.SX_OPEN_TIMEOUT) + + # After switch was created inside SDK, sx_api_host_ifc_trap_id_register_set is ready to call + rc = sx_api_host_ifc_trap_id_register_set(self.handle, + SX_ACCESS_CMD_REGISTER, + self.swid, + SX_TRAP_ID_PMPE, + self.user_channel_p) + + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("sx_api_host_ifc_trap_id_register_set failed with rc {}, exiting...".format(rc)) + + self.running = True + except Exception as e: + log_error("mlnx-sfpd initialization failed due to {}, exiting...".format(repr(e))) + if swid_cnt_p is not None: + delete_uint32_t_p(swid_cnt_p) + self.deinitialize() def deinitialize(self): # remove mlnx-sfpd liveness key in DB if not expired yet @@ -156,7 +199,6 @@ class MlnxSfpd: log_error("sx_api_close exited with error, rc {}".format(rc)) def run(self): - self.running = True while self.running: try: From 7e6f29d7ab76a7002b087e9897318037fb7071fa Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 15 Aug 2019 02:22:16 -0700 Subject: [PATCH 203/219] [device/Arista] Update drivers submodules (#3338) - Improve smbus reliability for all platforms - Delay processing of the reboot cause to reduce critical path - Add support of get_change_event for PSUs --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 584f1c50937d..a2213dd18e6f 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 584f1c50937da7dfc1acc7283be1baf3b3c821fd +Subproject commit a2213dd18e6f6c6f4786f7f9275cd7b4b016bd71 diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 584f1c50937d..a2213dd18e6f 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 584f1c50937da7dfc1acc7283be1baf3b3c821fd +Subproject commit a2213dd18e6f6c6f4786f7f9275cd7b4b016bd71 From 2b8eca5ebb355ea862e56df2264b140535a5fad0 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 15 Aug 2019 00:45:54 -0700 Subject: [PATCH 204/219] [control plane assistant] stop control plane assistant after warm reboot (#3337) Delay saving configuration so that the control assistant configurations won't be persisted. Signed-off-by: Ying Xie --- .../warmboot-finalizer/finalize-warmboot.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/files/image_config/warmboot-finalizer/finalize-warmboot.sh b/files/image_config/warmboot-finalizer/finalize-warmboot.sh index 00e4e1b7f3f9..32c9c8444cc3 100755 --- a/files/image_config/warmboot-finalizer/finalize-warmboot.sh +++ b/files/image_config/warmboot-finalizer/finalize-warmboot.sh @@ -68,6 +68,14 @@ function finalize_warm_boot() sudo config warm_restart disable } +function stop_control_plane_assistant() +{ + if [[ -x ${ASSISTANT_SCRIPT} ]]; then + debug "Tearing down control plane assistant ..." + ${ASSISTANT_SCRIPT} -m reset + fi +} + wait_for_database_service @@ -78,11 +86,6 @@ if [[ x"${WARM_BOOT}" != x"true" ]]; then exit 0 fi -# No need to wait for the reconciliation process. Database has been loaded -# and migrated. This is good enough to save a copy. -debug "Save in-memory database after warm reboot ..." -config save -y - list=${COMP_LIST} # Wait up to 5 minutes @@ -94,6 +97,12 @@ for i in `seq 60`; do sleep 5 done +stop_control_plane_assistant + +# Save DB after stopped control plane assistant to avoid extra entries +debug "Save in-memory database after warm reboot ..." +config save -y + if [[ -n "${list}" ]]; then debug "Some components didn't finish reconcile: ${list} ..." fi From 64063b234d74bc7f62495e42470069f8dc760771 Mon Sep 17 00:00:00 2001 From: lguohan Date: Thu, 15 Aug 2019 00:32:58 -0700 Subject: [PATCH 205/219] [baseimage]: install ndisc6 package (#3344) ndisc6 gathers a few diagnostic tools for IPv6 networks including: - ndisc6, which performs ICMPv6 Neighbor Discovery in userland, - rdisc6, which performs ICMPv6 Router Discovery in userland, - rltraceroute6, a UDP/ICMP IPv6 implementation of traceroute, - tcptraceroute6, a TCP/IPv6-based traceroute implementation, - tcpspray6, a TCP/IP Discard/Echo bandwidth meter, - addrinfo, easy script interface for hostname and address resolution, - dnssort, DNS sorting script. Signed-off-by: Guohan Lu --- build_debian.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 82cc1137c8cf..477dc1bf9c75 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -244,7 +244,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in tcptraceroute \ mtr-tiny \ locales \ - mcelog + mcelog \ + ndisc6 #Adds a locale to a debian system in non-interactive mode sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ From d23f51e4ce1656ff0f3f8a97bba8aff7db51da40 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 16 Aug 2019 12:08:05 -0700 Subject: [PATCH 206/219] [201811] advance sairedis, swss and utilities sub module heads (#3345) * [201811] advance sairedis, swss and utilities sub module heads Submodule src/sonic-utilities f28b720..0a3455b: > [neighbor_advertise]: Use the existing MIRROR ACL table (#605) > [neighbor_advertiser] Use full vlan name for vxlan tunnel map programming (#604) Submodule src/sonic-swss f44029d..950e9db: > [orchagent] Add support for Innovium platform (#1026) > [policerorch]: Add the capability to update policer rate/size (#1017) Submodule src/sonic-sairedis 992cdc0..4ee82cb: > [syncd] Add support for Innovium platform (#496) Signed-off-by: Ying Xie * [201811][utilities] advance sub module head Submodule src/sonic-utilities 0a3455b..7460f5c: > [fast/warm reboot] kill radv docker before stopping BGP (#608) Signed-off-by: Ying Xie --- src/sonic-sairedis | 2 +- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 992cdc02aac6..4ee82cb0a804 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 992cdc02aac687d8ff8caa9b61e58f347eeb1edb +Subproject commit 4ee82cb0a804e801524972afac102c18abaa710d diff --git a/src/sonic-swss b/src/sonic-swss index f44029d2b1f9..950e9db345b7 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit f44029d2b1f92064dfccaa7d3eb8d362ba72447b +Subproject commit 950e9db345b763b4853a8a1bc828c42c4563dce8 diff --git a/src/sonic-utilities b/src/sonic-utilities index f28b7203d5a8..7460f5c11b05 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit f28b7203d5a85e377a8c40c4fe4dc78c9103be4d +Subproject commit 7460f5c11b052cf0e610e668551c8bc6826269fb From b5ebfc835e1b17f1bf9a191ed93adae9289f6565 Mon Sep 17 00:00:00 2001 From: Tony Titus <49417625+tonytitus@users.noreply.github.com> Date: Fri, 16 Aug 2019 12:35:01 -0700 Subject: [PATCH 207/219] [innovium]: Initial commit (#3243) (#3347) [build] Add ipmitool [dockers] Add innovium platform in orchagent + ipmitool in snmp [platform/innovium] Add innovium platform [device/celestica] Add x86_64-cel_midstone-r0 device for innovium [device/delta] Add x86_64-delta_et-c032if-r0 device for innovium [sonic-slave-stretch] Add texi2html Signed-off-by: Tony Titus ttitus@innovium.com --- build_debian.sh | 3 +- .../Midstone-200i/buffers.json.j2 | 120 + .../config_64x100G_midstone200i.yaml | 639 +++++ .../Midstone-200i/inno.config.yaml | 7 + .../Midstone-200i/innovium.77700_B | 59 + .../Midstone-200i/port_config.ini | 65 + .../Midstone-200i/qos.json.j2 | 120 + .../Midstone-200i/sai.profile | 1 + .../Midstone-200i_128x100/buffers.json.j2 | 120 + .../config_128x100G_midstone200i.yaml | 1100 +++++++++ .../Midstone-200i_128x100/inno.config.yaml | 7 + .../Midstone-200i_128x100/innovium.77700_B | 59 + .../Midstone-200i_128x100/port_config.ini | 131 + .../Midstone-200i_128x100/qos.json.j2 | 120 + .../Midstone-200i_128x100/sai.profile | 1 + .../Midstone-200i_32x400/buffers.json.j2 | 120 + .../config_32x400G_midstone200i.yaml | 429 ++++ .../Midstone-200i_32x400/inno.config.yaml | 7 + .../Midstone-200i_32x400/innovium.77700_A | 59 + .../Midstone-200i_32x400/port_config.ini | 35 + .../Midstone-200i_32x400/qos.json.j2 | 120 + .../Midstone-200i_32x400/sai.profile | 1 + .../Midstone-200i_64x100/buffers.json.j2 | 120 + .../config_64x100G_nrz_midstone200i.yaml | 785 ++++++ .../Midstone-200i_64x100/inno.config.yaml | 7 + .../Midstone-200i_64x100/innovium.77700_B | 59 + .../Midstone-200i_64x100/port_config.ini | 67 + .../Midstone-200i_64x100/qos.json.j2 | 120 + .../Midstone-200i_64x100/sai.profile | 1 + .../Midstone-200i_64x100nrz/buffers.json.j2 | 121 + .../config_64x100G_nrz_midstone200i.yaml | 767 ++++++ .../Midstone-200i_64x100nrz/inno.config.yaml | 7 + .../Midstone-200i_64x100nrz/innovium.77700_B | 59 + .../Midstone-200i_64x100nrz/port_config.ini | 65 + .../Midstone-200i_64x100nrz/qos.json.j2 | 102 + .../Midstone-200i_64x100nrz/sai.profile | 1 + .../Midstone-200i_64x200/buffers.json.j2 | 120 + .../config_64x200G_midstone200i.yaml | 653 +++++ .../Midstone-200i_64x200/inno.config.yaml | 7 + .../Midstone-200i_64x200/innovium.77700_B | 59 + .../Midstone-200i_64x200/port_config.ini | 67 + .../Midstone-200i_64x200/qos.json.j2 | 120 + .../Midstone-200i_64x200/sai.profile | 1 + .../x86_64-cel_midstone-r0/default_sku | 1 + .../x86_64-cel_midstone-r0/fancontrol | 0 .../x86_64-cel_midstone-r0/installer.conf | 3 + .../x86_64-cel_midstone-r0/plugins/eeprom.py | 22 + .../x86_64-cel_midstone-r0/plugins/psuutil.py | 61 + .../x86_64-cel_midstone-r0/plugins/sfputil.py | 205 ++ .../x86_64-cel_midstone-r0/sensors.conf | 2 + .../Delta-et-c032if/buffers.json.j2 | 120 + .../config_32x400G_Delta-et-c032if.yaml | 429 ++++ .../Delta-et-c032if/inno.config.yaml | 7 + .../Delta-et-c032if/innovium.77700_A | 59 + .../Delta-et-c032if/port_config.ini | 35 + .../Delta-et-c032if/qos.json.j2 | 120 + .../Delta-et-c032if/sai.profile | 1 + .../Delta-et-c032if_128x100/buffers.json.j2 | 120 + .../config_128x100G_Delta-et-c032if.yaml | 1102 +++++++++ .../Delta-et-c032if_128x100/inno.config.yaml | 7 + .../Delta-et-c032if_128x100/innovium.77700_B | 59 + .../Delta-et-c032if_128x100/port_config.ini | 131 + .../Delta-et-c032if_128x100/qos.json.j2 | 120 + .../Delta-et-c032if_128x100/sai.profile | 1 + .../Delta-et-c032if_32x100/buffers.json.j2 | 120 + .../config_32x100G_Delta-et-c032if.yaml | 415 ++++ .../Delta-et-c032if_32x100/inno.config.yaml | 7 + .../Delta-et-c032if_32x100/innovium.77700_A | 59 + .../Delta-et-c032if_32x100/innovium.77700_B | 59 + .../Delta-et-c032if_32x100/port_config.ini | 33 + .../Delta-et-c032if_32x100/qos.json.j2 | 120 + .../Delta-et-c032if_32x100/sai.profile | 1 + .../Delta-et-c032if_32x200/buffers.json.j2 | 120 + .../config_32x200G_Delta-et-c032if.yaml | 429 ++++ .../Delta-et-c032if_32x200/inno.config.yaml | 7 + .../Delta-et-c032if_32x200/innovium.77700_B | 59 + .../Delta-et-c032if_32x200/port_config.ini | 35 + .../Delta-et-c032if_32x200/qos.json.j2 | 120 + .../Delta-et-c032if_32x200/sai.profile | 1 + .../Delta-et-c032if_32x400/buffers.json.j2 | 120 + .../config_32x400G_Delta-et-c032if.yaml | 429 ++++ .../Delta-et-c032if_32x400/inno.config.yaml | 7 + .../Delta-et-c032if_32x400/innovium.77700_A | 59 + .../Delta-et-c032if_32x400/innovium.77700_B | 59 + .../Delta-et-c032if_32x400/port_config.ini | 35 + .../Delta-et-c032if_32x400/qos.json.j2 | 120 + .../Delta-et-c032if_32x400/sai.profile | 1 + .../Delta-et-c032if_64x100/buffers.json.j2 | 120 + .../config_64x100G_Delta-et-c032if.yaml | 653 +++++ .../Delta-et-c032if_64x100/inno.config.yaml | 7 + .../Delta-et-c032if_64x100/innovium.77700_B | 59 + .../Delta-et-c032if_64x100/port_config.ini | 67 + .../Delta-et-c032if_64x100/qos.json.j2 | 120 + .../Delta-et-c032if_64x100/sai.profile | 1 + .../Delta-et-c032if_64x200/buffers.json.j2 | 120 + .../config_64x200G_Delta-et-c032if.yaml | 653 +++++ .../Delta-et-c032if_64x200/inno.config.yaml | 7 + .../Delta-et-c032if_64x200/innovium.77700_B | 59 + .../Delta-et-c032if_64x200/port_config.ini | 67 + .../Delta-et-c032if_64x200/qos.json.j2 | 120 + .../Delta-et-c032if_64x200/sai.profile | 1 + .../x86_64-delta_et-c032if-r0/default_sku | 1 + .../x86_64-delta_et-c032if-r0/installer.conf | 3 + .../led_proc_init.soc | 10 + .../plugins/eeprom.py | 32 + .../plugins/psuutil.py | 78 + .../plugins/sfputil.py | 255 ++ .../x86_64-delta_et-c032if-r0/sensors.conf | 4 + dockers/docker-orchagent/orchagent.sh | 2 + dockers/docker-snmp-sv2/Dockerfile.j2 | 2 +- platform/innovium/docker-orchagent-invm.mk | 5 + platform/innovium/docker-ptf-invm.mk | 7 + platform/innovium/docker-syncd-invm-rpc.mk | 17 + .../docker-syncd-invm-rpc/Dockerfile.j2 | 53 + .../docker-syncd-invm-rpc/ptf_nn_agent.conf | 10 + platform/innovium/docker-syncd-invm.mk | 17 + .../innovium/docker-syncd-invm/Dockerfile.j2 | 34 + platform/innovium/docker-syncd-invm/start.sh | 7 + .../docker-syncd-invm/supervisord.conf | 28 + platform/innovium/invm-sai.mk | 14 + platform/innovium/libsaithrift-dev.mk | 7 + platform/innovium/one-image.mk | 10 + platform/innovium/platform-modules-cel.mk | 12 + platform/innovium/platform-modules-delta.mk | 13 + platform/innovium/platform.conf | 0 platform/innovium/python-saithrift.mk | 6 + platform/innovium/rules.mk | 21 + .../sonic-platform-modules-cel/.gitignore | 33 + .../sonic-platform-modules-cel/LICENSE | 15 + .../sonic-platform-modules-cel/README.md | 1 + .../debian/changelog | 28 + .../sonic-platform-modules-cel/debian/compat | 1 + .../sonic-platform-modules-cel/debian/control | 11 + .../platform-modules-midstone-200i.init | 52 + .../platform-modules-midstone-200i.install | 2 + .../platform-modules-midstone-200i.postinst | 3 + .../sonic-platform-modules-cel/debian/rules | 32 + .../cfg/midstone-200i-modules.conf | 15 + .../midstone-200i/modules/200i_cpld.c | 854 +++++++ .../midstone-200i/modules/200i_wdt.c | 363 +++ .../midstone-200i/modules/Makefile | 1 + .../midstone-200i/modules/mc24lc64t.c | 142 ++ .../platform-modules-midstone-200i.service | 13 + .../sonic-platform-modules-delta/LICENSE | 16 + .../common/modules/dni_emc2305.c | 381 +++ .../debian/changelog | 5 + .../debian/compat | 1 + .../debian/control | 13 + .../debian/platform-modules-et-c032if.init | 40 + .../debian/platform-modules-et-c032if.install | 3 + .../sonic-platform-modules-delta/debian/rules | 33 + .../et-c032if/cfg/et-c032if-modules.conf | 13 + .../et-c032if/modules/Makefile | 2 + .../modules/delta_et-c032if_platform.c | 2102 +++++++++++++++++ .../scripts/et-c032if_platform_init.sh | 9 + .../platform-modules-et-c032if.service | 13 + 156 files changed, 18548 insertions(+), 2 deletions(-) create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/config_64x100G_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/innovium.77700_B create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i/sai.profile create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/config_128x100G_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/innovium.77700_B create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/sai.profile create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/config_32x400G_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/innovium.77700_A create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/sai.profile create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/config_64x100G_nrz_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/innovium.77700_B create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/sai.profile create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/config_64x100G_nrz_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/innovium.77700_B create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/sai.profile create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/config_64x200G_midstone200i.yaml create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/inno.config.yaml create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/innovium.77700_B create mode 100644 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/port_config.ini create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 create mode 100755 device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/sai.profile create mode 100755 device/celestica/x86_64-cel_midstone-r0/default_sku create mode 100755 device/celestica/x86_64-cel_midstone-r0/fancontrol create mode 100755 device/celestica/x86_64-cel_midstone-r0/installer.conf create mode 100755 device/celestica/x86_64-cel_midstone-r0/plugins/eeprom.py create mode 100644 device/celestica/x86_64-cel_midstone-r0/plugins/psuutil.py create mode 100755 device/celestica/x86_64-cel_midstone-r0/plugins/sfputil.py create mode 100755 device/celestica/x86_64-cel_midstone-r0/sensors.conf create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/config_32x400G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/innovium.77700_A create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/config_128x100G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/innovium.77700_B create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/config_32x100G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_A create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_B create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/config_32x200G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/innovium.77700_B create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/config_32x400G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_A create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_B create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/config_64x100G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/innovium.77700_B create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/config_64x200G_Delta-et-c032if.yaml create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/inno.config.yaml create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/innovium.77700_B create mode 100644 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/port_config.ini create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 create mode 100755 device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/sai.profile create mode 100644 device/delta/x86_64-delta_et-c032if-r0/default_sku create mode 100644 device/delta/x86_64-delta_et-c032if-r0/installer.conf create mode 100644 device/delta/x86_64-delta_et-c032if-r0/led_proc_init.soc create mode 100644 device/delta/x86_64-delta_et-c032if-r0/plugins/eeprom.py create mode 100644 device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py create mode 100644 device/delta/x86_64-delta_et-c032if-r0/plugins/sfputil.py create mode 100644 device/delta/x86_64-delta_et-c032if-r0/sensors.conf create mode 100755 platform/innovium/docker-orchagent-invm.mk create mode 100755 platform/innovium/docker-ptf-invm.mk create mode 100755 platform/innovium/docker-syncd-invm-rpc.mk create mode 100755 platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 create mode 100755 platform/innovium/docker-syncd-invm-rpc/ptf_nn_agent.conf create mode 100755 platform/innovium/docker-syncd-invm.mk create mode 100755 platform/innovium/docker-syncd-invm/Dockerfile.j2 create mode 100755 platform/innovium/docker-syncd-invm/start.sh create mode 100755 platform/innovium/docker-syncd-invm/supervisord.conf create mode 100755 platform/innovium/invm-sai.mk create mode 100755 platform/innovium/libsaithrift-dev.mk create mode 100755 platform/innovium/one-image.mk create mode 100755 platform/innovium/platform-modules-cel.mk create mode 100644 platform/innovium/platform-modules-delta.mk create mode 100755 platform/innovium/platform.conf create mode 100755 platform/innovium/python-saithrift.mk create mode 100755 platform/innovium/rules.mk create mode 100755 platform/innovium/sonic-platform-modules-cel/.gitignore create mode 100755 platform/innovium/sonic-platform-modules-cel/LICENSE create mode 100755 platform/innovium/sonic-platform-modules-cel/README.md create mode 100755 platform/innovium/sonic-platform-modules-cel/debian/changelog create mode 100755 platform/innovium/sonic-platform-modules-cel/debian/compat create mode 100755 platform/innovium/sonic-platform-modules-cel/debian/control create mode 100755 platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.init create mode 100644 platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.install create mode 100644 platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.postinst create mode 100755 platform/innovium/sonic-platform-modules-cel/debian/rules create mode 100755 platform/innovium/sonic-platform-modules-cel/midstone-200i/cfg/midstone-200i-modules.conf create mode 100755 platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_cpld.c create mode 100755 platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_wdt.c create mode 100755 platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/Makefile create mode 100755 platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/mc24lc64t.c create mode 100644 platform/innovium/sonic-platform-modules-cel/midstone-200i/systemd/platform-modules-midstone-200i.service create mode 100644 platform/innovium/sonic-platform-modules-delta/LICENSE create mode 100644 platform/innovium/sonic-platform-modules-delta/common/modules/dni_emc2305.c create mode 100644 platform/innovium/sonic-platform-modules-delta/debian/changelog create mode 100644 platform/innovium/sonic-platform-modules-delta/debian/compat create mode 100644 platform/innovium/sonic-platform-modules-delta/debian/control create mode 100755 platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.init create mode 100644 platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.install create mode 100755 platform/innovium/sonic-platform-modules-delta/debian/rules create mode 100644 platform/innovium/sonic-platform-modules-delta/et-c032if/cfg/et-c032if-modules.conf create mode 100644 platform/innovium/sonic-platform-modules-delta/et-c032if/modules/Makefile create mode 100644 platform/innovium/sonic-platform-modules-delta/et-c032if/modules/delta_et-c032if_platform.c create mode 100644 platform/innovium/sonic-platform-modules-delta/et-c032if/scripts/et-c032if_platform_init.sh create mode 100644 platform/innovium/sonic-platform-modules-delta/systemd/platform-modules-et-c032if.service diff --git a/build_debian.sh b/build_debian.sh index 477dc1bf9c75..ecb3767d2807 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -245,7 +245,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in mtr-tiny \ locales \ mcelog \ - ndisc6 + ndisc6 \ + ipmitool #Adds a locale to a debian system in non-interactive mode sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 new file mode 100644 index 000000000000..45cebf3b7144 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/config_64x100G_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/config_64x100G_midstone200i.yaml new file mode 100755 index 000000000000..0b7e1a2db9d6 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/config_64x100G_midstone200i.yaml @@ -0,0 +1,639 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "128" + type: "cpu" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "2" + lanes: "4:4" + serdes_group: "31" + speed: "100G" + sysport: "2" + type: "eth" + - fec: "KRFEC" + id: "3" + lanes: "4:4" + serdes_group: "30" + speed: "100G" + sysport: "3" + type: "eth" + - fec: "KRFEC" + id: "4" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "4" + type: "eth" + - fec: "KRFEC" + id: "5" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "5" + type: "eth" + - fec: "KRFEC" + id: "6" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "6" + type: "eth" + - fec: "KRFEC" + id: "7" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "7" + type: "eth" + - fec: "KRFEC" + id: "8" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "8" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KRFEC" + id: "10" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "10" + type: "eth" + - fec: "KRFEC" + id: "11" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "11" + type: "eth" + - fec: "KRFEC" + id: "12" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "12" + type: "eth" + - fec: "KRFEC" + id: "13" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "KRFEC" + id: "14" + lanes: "4:4" + serdes_group: "25" + speed: "100G" + sysport: "14" + type: "eth" + - fec: "KRFEC" + id: "15" + lanes: "4:4" + serdes_group: "24" + speed: "100G" + sysport: "15" + type: "eth" + - fec: "KRFEC" + id: "16" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "16" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "18" + lanes: "4:4" + serdes_group: "23" + speed: "100G" + sysport: "18" + type: "eth" + - fec: "KRFEC" + id: "19" + lanes: "4:4" + serdes_group: "22" + speed: "100G" + sysport: "19" + type: "eth" + - fec: "KRFEC" + id: "20" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "20" + type: "eth" + - fec: "KRFEC" + id: "21" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KRFEC" + id: "22" + lanes: "4:4" + serdes_group: "21" + speed: "100G" + sysport: "22" + type: "eth" + - fec: "KRFEC" + id: "23" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "23" + type: "eth" + - fec: "KRFEC" + id: "24" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "24" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "26" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "26" + type: "eth" + - fec: "KRFEC" + id: "27" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "27" + type: "eth" + - fec: "KRFEC" + id: "28" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "28" + type: "eth" + - fec: "KRFEC" + id: "29" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KRFEC" + id: "30" + lanes: "4:4" + serdes_group: "17" + speed: "100G" + sysport: "30" + type: "eth" + - fec: "KRFEC" + id: "31" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "31" + type: "eth" + - fec: "KRFEC" + id: "32" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "32" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "34" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "34" + type: "eth" + - fec: "KRFEC" + id: "35" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "35" + type: "eth" + - fec: "KRFEC" + id: "36" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "36" + type: "eth" + - fec: "KRFEC" + id: "37" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KRFEC" + id: "38" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "38" + type: "eth" + - fec: "KRFEC" + id: "39" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "39" + type: "eth" + - fec: "KRFEC" + id: "40" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "40" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "42" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "42" + type: "eth" + - fec: "KRFEC" + id: "43" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "43" + type: "eth" + - fec: "KRFEC" + id: "44" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "44" + type: "eth" + - fec: "KRFEC" + id: "45" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KRFEC" + id: "46" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "46" + type: "eth" + - fec: "KRFEC" + id: "47" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "47" + type: "eth" + - fec: "KRFEC" + id: "48" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "48" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "50" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "50" + type: "eth" + - fec: "KRFEC" + id: "51" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "51" + type: "eth" + - fec: "KRFEC" + id: "52" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "52" + type: "eth" + - fec: "KRFEC" + id: "53" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KRFEC" + id: "54" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "54" + type: "eth" + - fec: "KRFEC" + id: "55" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "55" + type: "eth" + - fec: "KRFEC" + id: "56" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "56" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "58" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "58" + type: "eth" + - fec: "KRFEC" + id: "59" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "59" + type: "eth" + - fec: "KRFEC" + id: "60" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "60" + type: "eth" + - fec: "KRFEC" + id: "61" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KRFEC" + id: "62" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "62" + type: "eth" + - fec: "KRFEC" + id: "63" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "63" + type: "eth" + - fec: "KRFEC" + id: "64" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "64" + type: "eth" + isg: + - id: "0" + tx_polarity: "00101001" + rx_polarity: "01110001" + lane_swap: "01234567" + - id: "1" + tx_polarity: "10111111" + rx_polarity: "11100100" + lane_swap: "01234567" + - id: "2" + tx_polarity: "00100010" + rx_polarity: "00010001" + lane_swap: "01234567" + - id: "3" + tx_polarity: "00101010" + rx_polarity: "11011101" + lane_swap: "01234567" + - id: "4" + tx_polarity: "10111110" + rx_polarity: "10010101" + lane_swap: "01234567" + - id: "5" + tx_polarity: "01101000" + rx_polarity: "10111001" + lane_swap: "01234567" + - id: "6" + tx_polarity: "01110110" + rx_polarity: "01110011" + lane_swap: "01234567" + - id: "7" + tx_polarity: "01001000" + rx_polarity: "10111001" + lane_swap: "01234567" + - id: "8" + tx_polarity: "11000100" + rx_polarity: "01000000" + lane_swap: "01234567" + - id: "9" + tx_polarity: "10001010" + rx_polarity: "10100100" + lane_swap: "01234567" + - id: "10" + tx_polarity: "11000110" + rx_polarity: "00011101" + lane_swap: "01234567" + - id: "11" + tx_polarity: "01000111" + rx_polarity: "00000101" + lane_swap: "01234567" + - id: "12" + tx_polarity: "01111000" + rx_polarity: "11100000" + lane_swap: "01234567" + - id: "13" + tx_polarity: "10011111" + rx_polarity: "00101111" + lane_swap: "01234567" + - id: "14" + tx_polarity: "00101001" + rx_polarity: "00011000" + lane_swap: "01234567" + - id: "15" + tx_polarity: "10110111" + rx_polarity: "00110110" + lane_swap: "01234567" + - id: "16" + tx_polarity: "00101001" + rx_polarity: "00000111" + lane_swap: "01234567" + - id: "17" + tx_polarity: "10100111" + rx_polarity: "10001000" + lane_swap: "01234567" + - id: "18" + tx_polarity: "00011001" + rx_polarity: "11111110" + lane_swap: "01234567" + - id: "19" + tx_polarity: "10010101" + rx_polarity: "10011010" + lane_swap: "01234567" + - id: "20" + tx_polarity: "00101001" + rx_polarity: "01100000" + lane_swap: "01234567" + - id: "21" + tx_polarity: "10010111" + rx_polarity: "01111001" + lane_swap: "01234567" + - id: "22" + tx_polarity: "00101001" + rx_polarity: "11010011" + lane_swap: "01234567" + - id: "23" + tx_polarity: "10110111" + rx_polarity: "01111011" + lane_swap: "01234567" + - id: "24" + tx_polarity: "00101001" + rx_polarity: "11101011" + lane_swap: "01234567" + - id: "25" + tx_polarity: "10110111" + rx_polarity: "11010111" + lane_swap: "01234567" + - id: "26" + tx_polarity: "00100001" + rx_polarity: "00101101" + lane_swap: "01234567" + - id: "27" + tx_polarity: "11000111" + rx_polarity: "11011001" + lane_swap: "01234567" + - id: "28" + tx_polarity: "00100001" + rx_polarity: "01010011" + lane_swap: "01234567" + - id: "29" + tx_polarity: "10110111" + rx_polarity: "01111001" + lane_swap: "01234567" + - id: "30" + tx_polarity: "00101001" + rx_polarity: "00110001" + lane_swap: "01234567" + - id: "31" + tx_polarity: "10110101" + rx_polarity: "01101101" + lane_swap: "01234567" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/inno.config.yaml new file mode 100755 index 000000000000..b2a079136abc --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x100G_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/innovium.77700_B b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/port_config.ini new file mode 100755 index 000000000000..c9b30d768d57 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/port_config.ini @@ -0,0 +1,65 @@ +# name lanes speed index mtu +Ethernet0 249,250,251,252 100000 1 9126 +Ethernet4 253,254,255,256 100000 2 9126 +Ethernet8 245,246,247,248 100000 3 9126 +Ethernet12 241,242,243,244 100000 4 9126 +Ethernet16 233,234,235,236 100000 5 9126 +Ethernet20 237,238,239,240 100000 6 9126 +Ethernet24 229,230,231,232 100000 7 9126 +Ethernet28 225,226,227,228 100000 8 9126 +Ethernet32 217,218,219,220 100000 9 9126 +Ethernet36 221,222,223,224 100000 10 9126 +Ethernet40 213,214,215,216 100000 11 9126 +Ethernet44 209,210,211,212 100000 12 9126 +Ethernet48 201,202,203,204 100000 13 9126 +Ethernet52 205,206,207,208 100000 14 9126 +Ethernet56 197,198,199,200 100000 15 9126 +Ethernet60 193,194,195,196 100000 16 9126 +Ethernet64 185,186,187,188 100000 17 9126 +Ethernet68 189,190,191,192 100000 18 9126 +Ethernet72 181,182,183,184 100000 19 9126 +Ethernet76 177,178,179,180 100000 20 9126 +Ethernet80 169,170,171,172 100000 21 9126 +Ethernet84 173,174,175,176 100000 22 9126 +Ethernet88 165,166,167,168 100000 23 9126 +Ethernet92 161,162,163,164 100000 24 9126 +Ethernet96 153,154,155,156 100000 25 9126 +Ethernet100 157,158,159,160 100000 26 9126 +Ethernet104 149,150,151,152 100000 27 9126 +Ethernet108 145,146,147,148 100000 28 9126 +Ethernet112 137,138,139,140 100000 29 9126 +Ethernet116 141,142,143,144 100000 30 9126 +Ethernet120 133,134,135,136 100000 31 9126 +Ethernet124 129,130,131,132 100000 32 9126 +Ethernet128 121,122,123,124 100000 33 9126 +Ethernet132 125,126,127,128 100000 34 9126 +Ethernet136 117,118,119,120 100000 35 9126 +Ethernet140 113,114,115,116 100000 36 9126 +Ethernet144 105,106,107,108 100000 37 9126 +Ethernet148 109,110,111,112 100000 38 9126 +Ethernet152 101,102,103,104 100000 39 9126 +Ethernet156 97,98,99,100 100000 40 9126 +Ethernet160 89,90,91,92 100000 41 9126 +Ethernet164 93,94,95,96 100000 42 9126 +Ethernet168 85,86,87,88 100000 43 9126 +Ethernet172 81,82,83,84 100000 44 9126 +Ethernet176 73,74,75,76 100000 45 9126 +Ethernet180 77,78,79,80 100000 46 9126 +Ethernet184 69,70,71,72 100000 47 9126 +Ethernet188 65,66,67,68 100000 48 9126 +Ethernet192 57,58,59,60 100000 49 9126 +Ethernet196 61,62,63,64 100000 50 9126 +Ethernet200 53,54,55,56 100000 51 9126 +Ethernet204 49,50,51,52 100000 52 9126 +Ethernet208 41,42,43,44 100000 53 9126 +Ethernet212 45,46,47,48 100000 54 9126 +Ethernet216 37,38,39,40 100000 55 9126 +Ethernet220 33,34,35,36 100000 56 9126 +Ethernet224 25,26,27,28 100000 57 9126 +Ethernet228 29,30,31,32 100000 58 9126 +Ethernet232 21,22,23,24 100000 59 9126 +Ethernet236 17,18,19,20 100000 60 9126 +Ethernet240 9,10,11,12 100000 61 9126 +Ethernet244 13,14,15,16 100000 62 9126 +Ethernet248 5,6,7,8 100000 63 9126 +Ethernet252 1,2,3,4 100000 64 9126 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 new file mode 100755 index 000000000000..16f9b42a2166 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 64 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 new file mode 100644 index 000000000000..9529fbf52fb5 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 128 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*2)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/config_128x100G_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/config_128x100G_midstone200i.yaml new file mode 100644 index 000000000000..342d223a96e1 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/config_128x100G_midstone200i.yaml @@ -0,0 +1,1100 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:2" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "251" + lanes: "2:2" + serdes_group: "31" + speed: "100G" + sysport: "251" + type: "eth" + - fec: "KPFEC" + id: "253" + lanes: "4:2" + serdes_group: "31" + speed: "100G" + sysport: "253" + type: "eth" + - fec: "KPFEC" + id: "255" + lanes: "6:2" + serdes_group: "31" + speed: "100G" + sysport: "255" + type: "eth" + - fec: "KPFEC" + id: "245" + lanes: "4:2" + serdes_group: "30" + speed: "100G" + sysport: "245" + type: "eth" + - fec: "KPFEC" + id: "247" + lanes: "6:2" + serdes_group: "30" + speed: "100G" + sysport: "247" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:2" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "243" + lanes: "2:2" + serdes_group: "30" + speed: "100G" + sysport: "243" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:2" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "235" + lanes: "2:2" + serdes_group: "29" + speed: "100G" + sysport: "235" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:2" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "239" + lanes: "6:2" + serdes_group: "29" + speed: "100G" + sysport: "239" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:2" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "231" + lanes: "6:2" + serdes_group: "28" + speed: "100G" + sysport: "231" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:2" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "227" + lanes: "2:2" + serdes_group: "28" + speed: "100G" + sysport: "227" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:2" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "219" + lanes: "2:2" + serdes_group: "27" + speed: "100G" + sysport: "219" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:2" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "223" + lanes: "6:2" + serdes_group: "27" + speed: "100G" + sysport: "223" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:2" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "215" + lanes: "6:2" + serdes_group: "26" + speed: "100G" + sysport: "215" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:2" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "211" + lanes: "2:2" + serdes_group: "26" + speed: "100G" + sysport: "211" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:2" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "203" + lanes: "2:2" + serdes_group: "25" + speed: "100G" + sysport: "203" + type: "eth" + - fec: "KPFEC" + id: "205" + lanes: "4:2" + serdes_group: "25" + speed: "100G" + sysport: "205" + type: "eth" + - fec: "KPFEC" + id: "207" + lanes: "6:2" + serdes_group: "25" + speed: "100G" + sysport: "207" + type: "eth" + - fec: "KPFEC" + id: "197" + lanes: "4:2" + serdes_group: "24" + speed: "100G" + sysport: "197" + type: "eth" + - fec: "KPFEC" + id: "199" + lanes: "6:2" + serdes_group: "24" + speed: "100G" + sysport: "199" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:2" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "195" + lanes: "2:2" + serdes_group: "24" + speed: "100G" + sysport: "195" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:2" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "187" + lanes: "2:2" + serdes_group: "23" + speed: "100G" + sysport: "187" + type: "eth" + - fec: "KPFEC" + id: "189" + lanes: "4:2" + serdes_group: "23" + speed: "100G" + sysport: "189" + type: "eth" + - fec: "KPFEC" + id: "191" + lanes: "6:2" + serdes_group: "23" + speed: "100G" + sysport: "191" + type: "eth" + - fec: "KPFEC" + id: "181" + lanes: "4:2" + serdes_group: "22" + speed: "100G" + sysport: "181" + type: "eth" + - fec: "KPFEC" + id: "183" + lanes: "6:2" + serdes_group: "22" + speed: "100G" + sysport: "183" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:2" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "179" + lanes: "2:2" + serdes_group: "22" + speed: "100G" + sysport: "179" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:2" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "171" + lanes: "2:2" + serdes_group: "21" + speed: "100G" + sysport: "171" + type: "eth" + - fec: "KPFEC" + id: "173" + lanes: "4:2" + serdes_group: "21" + speed: "100G" + sysport: "173" + type: "eth" + - fec: "KPFEC" + id: "175" + lanes: "6:2" + serdes_group: "21" + speed: "100G" + sysport: "175" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:2" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "167" + lanes: "6:2" + serdes_group: "20" + speed: "100G" + sysport: "167" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:2" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "163" + lanes: "2:2" + serdes_group: "20" + speed: "100G" + sysport: "163" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:2" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "155" + lanes: "2:2" + serdes_group: "19" + speed: "100G" + sysport: "155" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:2" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "159" + lanes: "6:2" + serdes_group: "19" + speed: "100G" + sysport: "159" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:2" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "151" + lanes: "6:2" + serdes_group: "18" + speed: "100G" + sysport: "151" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:2" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "147" + lanes: "2:2" + serdes_group: "18" + speed: "100G" + sysport: "147" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:2" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "139" + lanes: "2:2" + serdes_group: "17" + speed: "100G" + sysport: "139" + type: "eth" + - fec: "KPFEC" + id: "141" + lanes: "4:2" + serdes_group: "17" + speed: "100G" + sysport: "141" + type: "eth" + - fec: "KPFEC" + id: "143" + lanes: "6:2" + serdes_group: "17" + speed: "100G" + sysport: "143" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:2" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "135" + lanes: "6:2" + serdes_group: "16" + speed: "100G" + sysport: "135" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:2" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "131" + lanes: "2:2" + serdes_group: "16" + speed: "100G" + sysport: "131" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:2" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "123" + lanes: "2:2" + serdes_group: "15" + speed: "100G" + sysport: "123" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:2" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "127" + lanes: "6:2" + serdes_group: "15" + speed: "100G" + sysport: "127" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:2" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "119" + lanes: "6:2" + serdes_group: "14" + speed: "100G" + sysport: "119" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:2" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "115" + lanes: "2:2" + serdes_group: "14" + speed: "100G" + sysport: "115" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:2" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "107" + lanes: "2:2" + serdes_group: "13" + speed: "100G" + sysport: "107" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:2" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "111" + lanes: "6:2" + serdes_group: "13" + speed: "100G" + sysport: "111" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:2" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "103" + lanes: "6:2" + serdes_group: "12" + speed: "100G" + sysport: "103" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:2" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "99" + lanes: "2:2" + serdes_group: "12" + speed: "100G" + sysport: "99" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:2" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "91" + lanes: "2:2" + serdes_group: "11" + speed: "100G" + sysport: "91" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:2" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "95" + lanes: "6:2" + serdes_group: "11" + speed: "100G" + sysport: "95" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:2" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KPFEC" + id: "87" + lanes: "6:2" + serdes_group: "10" + speed: "100G" + sysport: "87" + type: "eth" + - fec: "KPFEC" + id: "87" + lanes: "0:2" + serdes_group: "10" + speed: "100G" + sysport: "87" + type: "eth" + - fec: "KPFEC" + id: "83" + lanes: "2:2" + serdes_group: "10" + speed: "100G" + sysport: "83" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:2" + serdes_group: "9" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "75" + lanes: "2:2" + serdes_group: "9" + speed: "100G" + sysport: "75" + type: "eth" + - fec: "KPFEC" + id: "91" + lanes: "4:2" + serdes_group: "9" + speed: "100G" + sysport: "91" + type: "eth" + - fec: "KPFEC" + id: "79" + lanes: "6:2" + serdes_group: "9" + speed: "100G" + sysport: "79" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:2" + serdes_group: "8" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "71" + lanes: "6:2" + serdes_group: "8" + speed: "100G" + sysport: "71" + type: "eth" + - fec: "KPFEC" + id: "95" + lanes: "0:2" + serdes_group: "8" + speed: "100G" + sysport: "95" + type: "eth" + - fec: "KPFEC" + id: "67" + lanes: "2:2" + serdes_group: "8" + speed: "100G" + sysport: "67" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:2" + serdes_group: "7" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "59" + lanes: "2:2" + serdes_group: "7" + speed: "100G" + sysport: "59" + type: "eth" + - fec: "KPFEC" + id: "99" + lanes: "4:2" + serdes_group: "7" + speed: "100G" + sysport: "99" + type: "eth" + - fec: "KPFEC" + id: "63" + lanes: "6:2" + serdes_group: "7" + speed: "100G" + sysport: "63" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:2" + serdes_group: "6" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "55" + lanes: "6:2" + serdes_group: "6" + speed: "100G" + sysport: "55" + type: "eth" + - fec: "KPFEC" + id: "103" + lanes: "0:2" + serdes_group: "6" + speed: "100G" + sysport: "103" + type: "eth" + - fec: "KPFEC" + id: "51" + lanes: "2:2" + serdes_group: "6" + speed: "100G" + sysport: "51" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:2" + serdes_group: "5" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "43" + lanes: "2:2" + serdes_group: "5" + speed: "100G" + sysport: "43" + type: "eth" + - fec: "KPFEC" + id: "107" + lanes: "4:2" + serdes_group: "5" + speed: "100G" + sysport: "107" + type: "eth" + - fec: "KPFEC" + id: "47" + lanes: "6:2" + serdes_group: "5" + speed: "100G" + sysport: "47" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:2" + serdes_group: "4" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "39" + lanes: "6:2" + serdes_group: "4" + speed: "100G" + sysport: "39" + type: "eth" + - fec: "KPFEC" + id: "111" + lanes: "0:2" + serdes_group: "4" + speed: "100G" + sysport: "111" + type: "eth" + - fec: "KPFEC" + id: "35" + lanes: "2:2" + serdes_group: "4" + speed: "100G" + sysport: "35" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:2" + serdes_group: "3" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "27" + lanes: "2:2" + serdes_group: "3" + speed: "100G" + sysport: "27" + type: "eth" + - fec: "KPFEC" + id: "115" + lanes: "4:2" + serdes_group: "3" + speed: "100G" + sysport: "115" + type: "eth" + - fec: "KPFEC" + id: "31" + lanes: "6:2" + serdes_group: "3" + speed: "100G" + sysport: "31" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:2" + serdes_group: "2" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "23" + lanes: "6:2" + serdes_group: "2" + speed: "100G" + sysport: "23" + type: "eth" + - fec: "KPFEC" + id: "119" + lanes: "0:2" + serdes_group: "2" + speed: "100G" + sysport: "119" + type: "eth" + - fec: "KPFEC" + id: "19" + lanes: "2:2" + serdes_group: "2" + speed: "100G" + sysport: "19" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:2" + serdes_group: "1" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "11" + lanes: "2:2" + serdes_group: "1" + speed: "100G" + sysport: "11" + type: "eth" + - fec: "KPFEC" + id: "123" + lanes: "4:2" + serdes_group: "1" + speed: "100G" + sysport: "123" + type: "eth" + - fec: "KPFEC" + id: "15" + lanes: "6:2" + serdes_group: "1" + speed: "100G" + sysport: "15" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:2" + serdes_group: "0" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "7" + lanes: "6:2" + serdes_group: "0" + speed: "100G" + sysport: "7" + type: "eth" + - fec: "KPFEC" + id: "127" + lanes: "0:2" + serdes_group: "0" + speed: "100G" + sysport: "127" + type: "eth" + - fec: "KPFEC" + id: "3" + lanes: "2:2" + serdes_group: "0" + speed: "100G" + sysport: "3" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "01110001" + tx_polarity: "00101001" + - id: "1" + lane_swap: "01234567" + rx_polarity: "11100100" + tx_polarity: "10111111" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00010001" + tx_polarity: "00100010" + - id: "3" + lane_swap: "01234567" + rx_polarity: "11011101" + tx_polarity: "00101010" + - id: "4" + lane_swap: "01234567" + rx_polarity: "10010101" + tx_polarity: "10111110" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01101000" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01110011" + tx_polarity: "01110110" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01001000" + - id: "8" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11000100" + - id: "9" + lane_swap: "01234567" + rx_polarity: "10100100" + tx_polarity: "10001010" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00011101" + tx_polarity: "11000110" + - id: "11" + lane_swap: "01234567" + rx_polarity: "00000101" + tx_polarity: "01000111" + - id: "12" + lane_swap: "01234567" + rx_polarity: "11100000" + tx_polarity: "01111000" + - id: "13" + lane_swap: "01234567" + rx_polarity: "00101111" + tx_polarity: "10011111" + - id: "14" + lane_swap: "01234567" + rx_polarity: "00011000" + tx_polarity: "00101001" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00110110" + tx_polarity: "10110111" + - id: "16" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00101001" + - id: "17" + lane_swap: "01234567" + rx_polarity: "10001000" + tx_polarity: "10100111" + - id: "18" + lane_swap: "01234567" + rx_polarity: "11111110" + tx_polarity: "00011001" + - id: "19" + lane_swap: "01234567" + rx_polarity: "10011010" + tx_polarity: "10010101" + - id: "20" + lane_swap: "01234567" + rx_polarity: "01100000" + tx_polarity: "00101001" + - id: "21" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10010111" + - id: "22" + lane_swap: "01234567" + rx_polarity: "11010011" + tx_polarity: "00101001" + - id: "23" + lane_swap: "01234567" + rx_polarity: "01111011" + tx_polarity: "10110111" + - id: "24" + lane_swap: "01234567" + rx_polarity: "11101011" + tx_polarity: "00101001" + - id: "25" + lane_swap: "01234567" + rx_polarity: "11010111" + tx_polarity: "10110111" + - id: "26" + lane_swap: "01234567" + rx_polarity: "00101101" + tx_polarity: "00100001" + - id: "27" + lane_swap: "01234567" + rx_polarity: "11011001" + tx_polarity: "11000111" + - id: "28" + lane_swap: "01234567" + rx_polarity: "01010011" + tx_polarity: "00100001" + - id: "29" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10110111" + - id: "30" + lane_swap: "01234567" + rx_polarity: "00110001" + tx_polarity: "00101001" + - id: "31" + lane_swap: "01234567" + rx_polarity: "01101101" + tx_polarity: "10110101" + - id: "32" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00000000" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/inno.config.yaml new file mode 100755 index 000000000000..66e43d312efb --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_128x100G_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/innovium.77700_B b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/port_config.ini new file mode 100644 index 000000000000..9366905c4eba --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/port_config.ini @@ -0,0 +1,131 @@ +# name lanes speed index mtu +Ethernet0 249,250 100000 0 9126 +Ethernet2 251,252 100000 0 9126 +Ethernet4 253,254 100000 1 9126 +Ethernet6 255,256 100000 1 9126 +Ethernet8 245,246 100000 2 9126 +Ethernet10 247,248 100000 2 9126 +Ethernet12 241,242 100000 3 9126 +Ethernet14 243,244 100000 3 9126 +Ethernet16 233,234 100000 4 9126 +Ethernet18 235,236 100000 4 9126 +Ethernet20 237,238 100000 5 9126 +Ethernet22 239,240 100000 5 9126 +Ethernet24 229,230 100000 6 9126 +Ethernet26 231,232 100000 6 9126 +Ethernet28 225,226 100000 7 9126 +Ethernet30 227,228 100000 7 9126 +Ethernet32 217,218 100000 8 9126 +Ethernet34 219,220 100000 8 9126 +Ethernet36 221,222 100000 9 9126 +Ethernet38 223,224 100000 9 9126 +Ethernet40 213,214 100000 10 9126 +Ethernet42 215,216 100000 10 9126 +Ethernet44 209,210 100000 11 9126 +Ethernet46 211,212 100000 11 9126 +Ethernet48 201,202 100000 12 9126 +Ethernet50 203,204 100000 12 9126 +Ethernet52 205,206 100000 13 9126 +Ethernet54 207,208 100000 13 9126 +Ethernet56 197,198 100000 14 9126 +Ethernet58 199,200 100000 14 9126 +Ethernet60 193,194 100000 15 9126 +Ethernet62 195,196 100000 15 9126 +Ethernet64 185,186 100000 16 9126 +Ethernet66 187,188 100000 16 9126 +Ethernet68 189,190 100000 17 9126 +Ethernet70 191,192 100000 17 9126 +Ethernet72 181,182 100000 18 9126 +Ethernet74 183,184 100000 18 9126 +Ethernet76 177,178 100000 19 9126 +Ethernet78 179,180 100000 19 9126 +Ethernet80 169,170 100000 20 9126 +Ethernet82 171,172 100000 20 9126 +Ethernet84 173,174 100000 21 9126 +Ethernet86 175,176 100000 21 9126 +Ethernet88 165,166 100000 22 9126 +Ethernet90 167,168 100000 22 9126 +Ethernet92 161,162 100000 23 9126 +Ethernet94 163,164 100000 23 9126 +Ethernet96 153,154 100000 24 9126 +Ethernet98 155,156 100000 24 9126 +Ethernet100 157,158 100000 25 9126 +Ethernet102 159,160 100000 25 9126 +Ethernet104 149,150 100000 26 9126 +Ethernet106 151,152 100000 26 9126 +Ethernet108 145,146 100000 27 9126 +Ethernet110 147,148 100000 27 9126 +Ethernet112 137,138 100000 28 9126 +Ethernet114 139,140 100000 28 9126 +Ethernet116 141,142 100000 29 9126 +Ethernet118 143,144 100000 29 9126 +Ethernet120 133,134 100000 30 9126 +Ethernet122 135,136 100000 30 9126 +Ethernet124 129,130 100000 31 9126 +Ethernet126 131,132 100000 31 9126 +Ethernet128 121,122 100000 32 9126 +Ethernet130 123,124 100000 32 9126 +Ethernet132 125,126 100000 33 9126 +Ethernet134 127,128 100000 33 9126 +Ethernet136 117,118 100000 34 9126 +Ethernet138 119,120 100000 34 9126 +Ethernet140 113,114 100000 35 9126 +Ethernet142 115,116 100000 35 9126 +Ethernet144 105,106 100000 36 9126 +Ethernet146 107,108 100000 36 9126 +Ethernet148 109,110 100000 37 9126 +Ethernet150 111,112 100000 37 9126 +Ethernet152 101,102 100000 38 9126 +Ethernet154 103,104 100000 38 9126 +Ethernet156 97,98 100000 39 9126 +Ethernet158 99,100 100000 39 9126 +Ethernet160 89,90 100000 40 9126 +Ethernet162 91,92 100000 40 9126 +Ethernet164 93,94 100000 41 9126 +Ethernet166 95,96 100000 41 9126 +Ethernet168 85,86 100000 42 9126 +Ethernet170 87,88 100000 42 9126 +Ethernet172 81,82 100000 43 9126 +Ethernet174 83,84 100000 43 9126 +Ethernet176 73,74 100000 44 9126 +Ethernet178 75,76 100000 44 9126 +Ethernet180 77,78 100000 45 9126 +Ethernet182 79,80 100000 45 9126 +Ethernet184 69,70 100000 46 9126 +Ethernet186 71,72 100000 46 9126 +Ethernet188 65,66 100000 47 9126 +Ethernet190 67,68 100000 47 9126 +Ethernet192 57,58 100000 48 9126 +Ethernet194 59,60 100000 48 9126 +Ethernet196 61,62 100000 49 9126 +Ethernet198 63,64 100000 49 9126 +Ethernet200 53,54 100000 50 9126 +Ethernet202 55,56 100000 50 9126 +Ethernet204 49,50 100000 51 9126 +Ethernet206 51,52 100000 51 9126 +Ethernet208 41,42 100000 52 9126 +Ethernet210 43,44 100000 52 9126 +Ethernet212 45,46 100000 53 9126 +Ethernet214 47,48 100000 53 9126 +Ethernet216 37,38 100000 54 9126 +Ethernet218 39,40 100000 54 9126 +Ethernet220 33,34 100000 55 9126 +Ethernet222 35,36 100000 55 9126 +Ethernet224 25,26 100000 56 9126 +Ethernet226 27,28 100000 56 9126 +Ethernet228 29,30 100000 57 9126 +Ethernet230 31,32 100000 57 9126 +Ethernet232 21,22 100000 58 9126 +Ethernet234 23,24 100000 58 9126 +Ethernet236 17,18 100000 59 9126 +Ethernet238 19,20 100000 59 9126 +Ethernet240 9,10 100000 60 9126 +Ethernet242 11,12 100000 60 9126 +Ethernet244 13,14 100000 61 9126 +Ethernet246 15,16 100000 61 9126 +Ethernet248 5,6 100000 62 9126 +Ethernet250 7,8 100000 62 9126 +Ethernet252 1,2 100000 63 9126 +Ethernet254 3,4 100000 63 9126 +Ethernet256 257 10000 64 9126 +Ethernet257 258 10000 65 9126 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 new file mode 100755 index 000000000000..733bd51dc86f --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 128 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*2)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_128x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 new file mode 100644 index 000000000000..4fca9cbcd156 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/config_32x400G_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/config_32x400G_midstone200i.yaml new file mode 100644 index 000000000000..6c387ee17c23 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/config_32x400G_midstone200i.yaml @@ -0,0 +1,429 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_A" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "257" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:8" + serdes_group: "27" + speed: "400G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:8" + serdes_group: "26" + speed: "400G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:8" + serdes_group: "25" + speed: "400G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:8" + serdes_group: "24" + speed: "400G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:8" + serdes_group: "23" + speed: "400G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:8" + serdes_group: "22" + speed: "400G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:8" + serdes_group: "21" + speed: "400G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:8" + serdes_group: "20" + speed: "400G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:8" + serdes_group: "19" + speed: "400G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:8" + serdes_group: "18" + speed: "400G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:8" + serdes_group: "17" + speed: "400G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:8" + serdes_group: "16" + speed: "400G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:8" + serdes_group: "15" + speed: "400G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:8" + serdes_group: "14" + speed: "400G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:8" + serdes_group: "12" + speed: "400G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:8" + serdes_group: "11" + speed: "400G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:8" + serdes_group: "10" + speed: "400G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:8" + serdes_group: "9" + speed: "400G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:8" + serdes_group: "8" + speed: "400G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:8" + serdes_group: "7" + speed: "400G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:8" + serdes_group: "6" + speed: "400G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:8" + serdes_group: "5" + speed: "400G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:8" + serdes_group: "4" + speed: "400G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:8" + serdes_group: "3" + speed: "400G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:8" + serdes_group: "2" + speed: "400G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:8" + serdes_group: "1" + speed: "400G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:8" + serdes_group: "0" + speed: "400G" + sysport: "1" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "01110001" + tx_polarity: "00101001" + - id: "1" + lane_swap: "01234567" + rx_polarity: "11100100" + tx_polarity: "10111111" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00010001" + tx_polarity: "00100010" + - id: "3" + lane_swap: "01234567" + rx_polarity: "11011101" + tx_polarity: "00101010" + - id: "4" + lane_swap: "01234567" + rx_polarity: "10010101" + tx_polarity: "10111110" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01101000" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01110011" + tx_polarity: "01110110" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01001000" + - id: "8" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11000100" + - id: "9" + lane_swap: "01234567" + rx_polarity: "10100100" + tx_polarity: "10001010" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00011101" + tx_polarity: "11000110" + - id: "11" + lane_swap: "01234567" + rx_polarity: "00000101" + tx_polarity: "01000111" + - id: "12" + lane_swap: "01234567" + rx_polarity: "11100000" + tx_polarity: "01111000" + - id: "13" + lane_swap: "01234567" + rx_polarity: "00101111" + tx_polarity: "10011111" + - id: "14" + lane_swap: "01234567" + rx_polarity: "00011000" + tx_polarity: "00101001" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00110110" + tx_polarity: "10110111" + - id: "16" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00101001" + - id: "17" + lane_swap: "01234567" + rx_polarity: "10001000" + tx_polarity: "10100111" + - id: "18" + lane_swap: "01234567" + rx_polarity: "11111110" + tx_polarity: "00011001" + - id: "19" + lane_swap: "01234567" + rx_polarity: "10011010" + tx_polarity: "10010101" + - id: "20" + lane_swap: "01234567" + rx_polarity: "01100000" + tx_polarity: "00101001" + - id: "21" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10010111" + - id: "22" + lane_swap: "01234567" + rx_polarity: "11010011" + tx_polarity: "00101001" + - id: "23" + lane_swap: "01234567" + rx_polarity: "01111011" + tx_polarity: "10110111" + - id: "24" + lane_swap: "01234567" + rx_polarity: "11101011" + tx_polarity: "00101001" + - id: "25" + lane_swap: "01234567" + rx_polarity: "11010111" + tx_polarity: "10110111" + - id: "26" + lane_swap: "01234567" + rx_polarity: "00101101" + tx_polarity: "00100001" + - id: "27" + lane_swap: "01234567" + rx_polarity: "11011001" + tx_polarity: "11000111" + - id: "28" + lane_swap: "01234567" + rx_polarity: "01010011" + tx_polarity: "00100001" + - id: "29" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10110111" + - id: "30" + lane_swap: "01234567" + rx_polarity: "00110001" + tx_polarity: "00101001" + - id: "31" + lane_swap: "01234567" + rx_polarity: "01101101" + tx_polarity: "10110101" + - id: "32" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00000000" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/inno.config.yaml new file mode 100755 index 000000000000..bf1c8f41009f --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x400G_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/innovium.77700_A b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/innovium.77700_A new file mode 100644 index 000000000000..84aa41983606 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/port_config.ini new file mode 100644 index 000000000000..c8ded273cca8 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/port_config.ini @@ -0,0 +1,35 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 400000 0 9126 rs +Ethernet8 241,242,243,244 400000 2 9126 rs +Ethernet16 233,234,235,236 400000 4 9126 rs +Ethernet24 225,226,227,228 400000 6 9126 rs +Ethernet32 217,218,219,220 400000 8 9126 rs +Ethernet40 209,210,211,212 400000 10 9126 rs +Ethernet48 201,202,203,204 400000 12 9126 rs +Ethernet56 193,194,195,196 400000 14 9126 rs +Ethernet64 185,186,187,188 400000 16 9126 rs +Ethernet72 177,178,179,180 400000 18 9126 rs +Ethernet80 169,170,171,172 400000 20 9126 rs +Ethernet88 161,162,163,164 400000 22 9126 rs +Ethernet96 153,154,155,156 400000 24 9126 rs +Ethernet104 145,146,147,148 400000 26 9126 rs +Ethernet112 137,138,139,140 400000 28 9126 rs +Ethernet120 129,130,131,132 400000 30 9126 rs +Ethernet128 121,122,123,124 400000 32 9126 rs +Ethernet136 113,114,115,116 400000 34 9126 rs +Ethernet144 105,106,107,108 400000 36 9126 rs +Ethernet152 97,98,99,100 400000 38 9126 rs +Ethernet160 89,90,91,92 400000 40 9126 rs +Ethernet168 81,82,83,84 400000 42 9126 rs +Ethernet176 73,74,75,76 400000 44 9126 rs +Ethernet184 65,66,67,68 400000 46 9126 rs +Ethernet192 57,58,59,60 400000 48 9126 rs +Ethernet200 49,50,51,52 400000 50 9126 rs +Ethernet208 41,42,43,44 400000 52 9126 rs +Ethernet216 33,34,35,36 400000 54 9126 rs +Ethernet224 25,26,27,28 400000 56 9126 rs +Ethernet232 17,18,19,20 400000 58 9126 rs +Ethernet240 9,10,11,12 400000 60 9126 rs +Ethernet248 1,2,3,4 400000 62 9126 rs +Ethernet256 257 10000 64 9126 none +Ethernet257 258 10000 65 9126 none diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 new file mode 100755 index 000000000000..6c734d46ff2f --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 32 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_32x400/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 new file mode 100644 index 000000000000..45cebf3b7144 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/config_64x100G_nrz_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/config_64x100G_nrz_midstone200i.yaml new file mode 100644 index 000000000000..813d012ca3d5 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/config_64x100G_nrz_midstone200i.yaml @@ -0,0 +1,785 @@ +ifcs: + options: + log_level: "off" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "253" + lanes: "4:4" + serdes_group: "31" + speed: "100G" + sysport: "253" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "245" + lanes: "4:4" + serdes_group: "30" + speed: "100G" + sysport: "245" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "205" + lanes: "4:4" + serdes_group: "25" + speed: "100G" + sysport: "205" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "197" + lanes: "4:4" + serdes_group: "24" + speed: "100G" + sysport: "197" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "189" + lanes: "4:4" + serdes_group: "23" + speed: "100G" + sysport: "189" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "181" + lanes: "4:4" + serdes_group: "22" + speed: "100G" + sysport: "181" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "173" + lanes: "4:4" + serdes_group: "21" + speed: "100G" + sysport: "173" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "141" + lanes: "4:4" + serdes_group: "17" + speed: "100G" + sysport: "141" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "53" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "53" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "57" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "61" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "61" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + admin_state: "true" + loopback: "none" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + admin_state: "true" + loopback: "none" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "01110001" + tx_polarity: "00101001" + - id: "1" + lane_swap: "01234567" + rx_polarity: "11100100" + tx_polarity: "10111111" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00010001" + tx_polarity: "00100010" + - id: "3" + lane_swap: "01234567" + rx_polarity: "11011101" + tx_polarity: "00101010" + - id: "4" + lane_swap: "01234567" + rx_polarity: "10010101" + tx_polarity: "10111110" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01101000" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01110011" + tx_polarity: "01110110" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01001000" + - id: "8" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11000100" + - id: "9" + lane_swap: "01234567" + rx_polarity: "10100100" + tx_polarity: "10001010" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00011101" + tx_polarity: "11000110" + - id: "11" + lane_swap: "01234567" + rx_polarity: "00000101" + tx_polarity: "01000111" + - id: "12" + lane_swap: "01234567" + rx_polarity: "11100000" + tx_polarity: "01111000" + - id: "13" + lane_swap: "01234567" + rx_polarity: "00101111" + tx_polarity: "10011111" + - id: "14" + lane_swap: "01234567" + rx_polarity: "00011000" + tx_polarity: "00101001" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00110110" + tx_polarity: "10110111" + - id: "16" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00101001" + - id: "17" + lane_swap: "01234567" + rx_polarity: "10001000" + tx_polarity: "10100111" + - id: "18" + lane_swap: "01234567" + rx_polarity: "11111110" + tx_polarity: "00011001" + - id: "19" + lane_swap: "01234567" + rx_polarity: "10011010" + tx_polarity: "10010101" + - id: "20" + lane_swap: "01234567" + rx_polarity: "01100000" + tx_polarity: "00101001" + - id: "21" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10010111" + - id: "22" + lane_swap: "01234567" + rx_polarity: "11010011" + tx_polarity: "00101001" + - id: "23" + lane_swap: "01234567" + rx_polarity: "01111011" + tx_polarity: "10110111" + - id: "24" + lane_swap: "01234567" + rx_polarity: "11101011" + tx_polarity: "00101001" + - id: "25" + lane_swap: "01234567" + rx_polarity: "11010111" + tx_polarity: "10110111" + - id: "26" + lane_swap: "01234567" + rx_polarity: "00101101" + tx_polarity: "00100001" + - id: "27" + lane_swap: "01234567" + rx_polarity: "11011001" + tx_polarity: "11000111" + - id: "28" + lane_swap: "01234567" + rx_polarity: "01010011" + tx_polarity: "00100001" + - id: "29" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10110111" + - id: "30" + lane_swap: "01234567" + rx_polarity: "00110001" + tx_polarity: "00101001" + - id: "31" + lane_swap: "01234567" + rx_polarity: "01101101" + tx_polarity: "10110101" + - id: "32" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00000000" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/inno.config.yaml new file mode 100755 index 000000000000..7dea4565d8e6 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x100G_nrz_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/innovium.77700_B b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/port_config.ini new file mode 100644 index 000000000000..cb862ff9b523 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/port_config.ini @@ -0,0 +1,67 @@ +# name lanes speed index mtu +Ethernet0 249,250,251,252 100000 0 9126 +Ethernet4 253,254,255,256 100000 1 9126 +Ethernet8 245,246,247,248 100000 2 9126 +Ethernet12 241,242,243,244 100000 3 9126 +Ethernet16 233,234,235,236 100000 4 9126 +Ethernet20 237,238,239,240 100000 5 9126 +Ethernet24 229,230,231,232 100000 6 9126 +Ethernet28 225,226,227,228 100000 7 9126 +Ethernet32 217,218,219,220 100000 8 9126 +Ethernet36 221,222,223,224 100000 9 9126 +Ethernet40 213,214,215,216 100000 10 9126 +Ethernet44 209,210,211,212 100000 11 9126 +Ethernet48 201,202,203,204 100000 12 9126 +Ethernet52 205,206,207,208 100000 13 9126 +Ethernet56 197,198,199,200 100000 14 9126 +Ethernet60 193,194,195,196 100000 15 9126 +Ethernet64 185,186,187,188 100000 16 9126 +Ethernet68 189,190,191,192 100000 17 9126 +Ethernet72 181,182,183,184 100000 18 9126 +Ethernet76 177,178,179,180 100000 19 9126 +Ethernet80 169,170,171,172 100000 20 9126 +Ethernet84 173,174,175,176 100000 21 9126 +Ethernet88 165,166,167,168 100000 22 9126 +Ethernet92 161,162,163,164 100000 23 9126 +Ethernet96 153,154,155,156 100000 24 9126 +Ethernet100 157,158,159,160 100000 25 9126 +Ethernet104 149,150,151,152 100000 26 9126 +Ethernet108 145,146,147,148 100000 27 9126 +Ethernet112 137,138,139,140 100000 28 9126 +Ethernet116 141,142,143,144 100000 29 9126 +Ethernet120 133,134,135,136 100000 30 9126 +Ethernet124 129,130,131,132 100000 31 9126 +Ethernet128 121,122,123,124 100000 32 9126 +Ethernet132 125,126,127,128 100000 33 9126 +Ethernet136 117,118,119,120 100000 34 9126 +Ethernet140 113,114,115,116 100000 35 9126 +Ethernet144 105,106,107,108 100000 36 9126 +Ethernet148 109,110,111,112 100000 37 9126 +Ethernet152 101,102,103,104 100000 38 9126 +Ethernet156 97,98,99,100 100000 39 9126 +Ethernet160 89,90,91,92 100000 40 9126 +Ethernet164 93,94,95,96 100000 41 9126 +Ethernet168 85,86,87,88 100000 42 9126 +Ethernet172 81,82,83,84 100000 43 9126 +Ethernet176 73,74,75,76 100000 44 9126 +Ethernet180 77,78,79,80 100000 45 9126 +Ethernet184 69,70,71,72 100000 46 9126 +Ethernet188 65,66,67,68 100000 47 9126 +Ethernet192 57,58,59,60 100000 48 9126 +Ethernet196 61,62,63,64 100000 49 9126 +Ethernet200 53,54,55,56 100000 50 9126 +Ethernet204 49,50,51,52 100000 51 9126 +Ethernet208 41,42,43,44 100000 52 9126 +Ethernet212 45,46,47,48 100000 53 9126 +Ethernet216 37,38,39,40 100000 54 9126 +Ethernet220 33,34,35,36 100000 55 9126 +Ethernet224 25,26,27,28 100000 56 9126 +Ethernet228 29,30,31,32 100000 57 9126 +Ethernet232 21,22,23,24 100000 58 9126 +Ethernet236 17,18,19,20 100000 59 9126 +Ethernet240 9,10,11,12 100000 60 9126 +Ethernet244 13,14,15,16 100000 61 9126 +Ethernet248 5,6,7,8 100000 62 9126 +Ethernet252 1,2,3,4 100000 63 9126 +Ethernet256 257 10000 64 9126 +Ethernet257 258 10000 65 9126 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 new file mode 100755 index 000000000000..16f9b42a2166 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 64 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 new file mode 100644 index 000000000000..0285e389fd63 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/buffers.json.j2 @@ -0,0 +1,121 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_speed = '100G' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/config_64x100G_nrz_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/config_64x100G_nrz_midstone200i.yaml new file mode 100644 index 000000000000..8fb6a114a46c --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/config_64x100G_nrz_midstone200i.yaml @@ -0,0 +1,767 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "bootstrap_lossless" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "65" + type: "cpu" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "1" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "2" + lanes: "4:4" + serdes_group: "31" + speed: "100G" + sysport: "2" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "3" + lanes: "4:4" + serdes_group: "30" + speed: "100G" + sysport: "3" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "4" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "4" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "5" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "5" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "6" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "6" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "7" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "7" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "8" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "8" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "9" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "10" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "10" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "11" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "11" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "12" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "12" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "13" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "13" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "14" + lanes: "4:4" + serdes_group: "25" + speed: "100G" + sysport: "14" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "15" + lanes: "4:4" + serdes_group: "24" + speed: "100G" + sysport: "15" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "16" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "16" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "17" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "18" + lanes: "4:4" + serdes_group: "23" + speed: "100G" + sysport: "18" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "19" + lanes: "4:4" + serdes_group: "22" + speed: "100G" + sysport: "19" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "20" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "20" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "21" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "21" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "22" + lanes: "4:4" + serdes_group: "21" + speed: "100G" + sysport: "22" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "23" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "23" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "24" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "24" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "25" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "26" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "26" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "27" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "27" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "28" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "28" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "29" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "29" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "30" + lanes: "4:4" + serdes_group: "17" + speed: "100G" + sysport: "30" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "31" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "31" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "32" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "32" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "33" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "34" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "34" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "35" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "35" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "36" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "36" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "37" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "37" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "38" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "38" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "39" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "39" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "40" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "40" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "41" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "42" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "42" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "43" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "43" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "44" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "44" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "45" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "45" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "46" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "46" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "47" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "47" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "48" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "48" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "49" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "50" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "50" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "51" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "51" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "52" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "52" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "53" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "53" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "54" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "54" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "55" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "55" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "56" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "56" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "57" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "58" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "58" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "59" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "59" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "60" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "60" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "61" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "61" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "62" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "62" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "63" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "63" + type: "eth" + admin_state: "true" + loopback: "none" + - fec: "KRFEC" + id: "64" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "64" + type: "eth" + admin_state: "true" + loopback: "none" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "01110001" + tx_polarity: "00101001" + - id: "1" + lane_swap: "01234567" + rx_polarity: "11100100" + tx_polarity: "10111111" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00010001" + tx_polarity: "00100010" + - id: "3" + lane_swap: "01234567" + rx_polarity: "11011101" + tx_polarity: "00101010" + - id: "4" + lane_swap: "01234567" + rx_polarity: "10010101" + tx_polarity: "10111110" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01101000" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01110011" + tx_polarity: "01110110" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01001000" + - id: "8" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11000100" + - id: "9" + lane_swap: "01234567" + rx_polarity: "10100100" + tx_polarity: "10001010" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00011101" + tx_polarity: "11000110" + - id: "11" + lane_swap: "01234567" + rx_polarity: "00000101" + tx_polarity: "01000111" + - id: "12" + lane_swap: "01234567" + rx_polarity: "11100000" + tx_polarity: "01111000" + - id: "13" + lane_swap: "01234567" + rx_polarity: "00101111" + tx_polarity: "10011111" + - id: "14" + lane_swap: "01234567" + rx_polarity: "00011000" + tx_polarity: "00101001" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00110110" + tx_polarity: "10110111" + - id: "16" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00101001" + - id: "17" + lane_swap: "01234567" + rx_polarity: "10001000" + tx_polarity: "10100111" + - id: "18" + lane_swap: "01234567" + rx_polarity: "11111110" + tx_polarity: "00011001" + - id: "19" + lane_swap: "01234567" + rx_polarity: "10011010" + tx_polarity: "10010101" + - id: "20" + lane_swap: "01234567" + rx_polarity: "01100000" + tx_polarity: "00101001" + - id: "21" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10010111" + - id: "22" + lane_swap: "01234567" + rx_polarity: "11010011" + tx_polarity: "00101001" + - id: "23" + lane_swap: "01234567" + rx_polarity: "01111011" + tx_polarity: "10110111" + - id: "24" + lane_swap: "01234567" + rx_polarity: "11101011" + tx_polarity: "00101001" + - id: "25" + lane_swap: "01234567" + rx_polarity: "11010111" + tx_polarity: "10110111" + - id: "26" + lane_swap: "01234567" + rx_polarity: "00101101" + tx_polarity: "00100001" + - id: "27" + lane_swap: "01234567" + rx_polarity: "11011001" + tx_polarity: "11000111" + - id: "28" + lane_swap: "01234567" + rx_polarity: "01010011" + tx_polarity: "00100001" + - id: "29" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10110111" + - id: "30" + lane_swap: "01234567" + rx_polarity: "00110001" + tx_polarity: "00101001" + - id: "31" + lane_swap: "01234567" + rx_polarity: "01101101" + tx_polarity: "10110101" + - id: "32" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00000000" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/inno.config.yaml new file mode 100755 index 000000000000..490de1ca3fdc --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x100G_nrz_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/innovium.77700_B b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/port_config.ini new file mode 100644 index 000000000000..462950d390b6 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/port_config.ini @@ -0,0 +1,65 @@ +# name lanes speed mtu +Ethernet0 249,250,251,252 100000 9126 +Ethernet4 253,254,255,256 100000 9126 +Ethernet8 245,246,247,248 100000 9126 +Ethernet12 241,242,243,244 100000 9126 +Ethernet16 233,234,235,236 100000 9126 +Ethernet20 237,238,239,240 100000 9126 +Ethernet24 229,230,231,232 100000 9126 +Ethernet28 225,226,227,228 100000 9126 +Ethernet32 217,218,219,220 100000 9126 +Ethernet36 221,222,223,224 100000 9126 +Ethernet40 213,214,215,216 100000 9126 +Ethernet44 209,210,211,212 100000 9126 +Ethernet48 201,202,203,204 100000 9126 +Ethernet52 205,206,207,208 100000 9126 +Ethernet56 197,198,199,200 100000 9126 +Ethernet60 193,194,195,196 100000 9126 +Ethernet64 185,186,187,188 100000 9126 +Ethernet68 189,190,191,192 100000 9126 +Ethernet72 181,182,183,184 100000 9126 +Ethernet76 177,178,179,180 100000 9126 +Ethernet80 169,170,171,172 100000 9126 +Ethernet84 173,174,175,176 100000 9126 +Ethernet88 165,166,167,168 100000 9126 +Ethernet92 161,162,163,164 100000 9126 +Ethernet96 153,154,155,156 100000 9126 +Ethernet100 157,158,159,160 100000 9126 +Ethernet104 149,150,151,152 100000 9126 +Ethernet108 145,146,147,148 100000 9126 +Ethernet112 137,138,139,140 100000 9126 +Ethernet116 141,142,143,144 100000 9126 +Ethernet120 133,134,135,136 100000 9126 +Ethernet124 129,130,131,132 100000 9126 +Ethernet128 121,122,123,124 100000 9126 +Ethernet132 125,126,127,128 100000 9126 +Ethernet136 117,118,119,120 100000 9126 +Ethernet140 113,114,115,116 100000 9126 +Ethernet144 105,106,107,108 100000 9126 +Ethernet148 109,110,111,112 100000 9126 +Ethernet152 101,102,103,104 100000 9126 +Ethernet156 97,98,99,100 100000 9126 +Ethernet160 89,90,91,92 100000 9126 +Ethernet164 93,94,95,96 100000 9126 +Ethernet168 85,86,87,88 100000 9126 +Ethernet172 81,82,83,84 100000 9126 +Ethernet176 73,74,75,76 100000 9126 +Ethernet180 77,78,79,80 100000 9126 +Ethernet184 69,70,71,72 100000 9126 +Ethernet188 65,66,67,68 100000 9126 +Ethernet192 57,58,59,60 100000 9126 +Ethernet196 61,62,63,64 100000 9126 +Ethernet200 53,54,55,56 100000 9126 +Ethernet204 49,50,51,52 100000 9126 +Ethernet208 41,42,43,44 100000 9126 +Ethernet212 45,46,47,48 100000 9126 +Ethernet216 37,38,39,40 100000 9126 +Ethernet220 33,34,35,36 100000 9126 +Ethernet224 25,26,27,28 100000 9126 +Ethernet228 29,30,31,32 100000 9126 +Ethernet232 21,22,23,24 100000 9126 +Ethernet236 17,18,19,20 100000 9126 +Ethernet240 9,10,11,12 100000 9126 +Ethernet244 13,14,15,16 100000 9126 +Ethernet248 5,6,7,8 100000 9126 +Ethernet252 1,2,3,4 100000 9126 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 new file mode 100755 index 000000000000..b22aa6ef599b --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/qos.json.j2 @@ -0,0 +1,102 @@ +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "Ethernet180,Ethernet8,Ethernet44,Ethernet184,Ethernet188,Ethernet0,Ethernet4,Ethernet108,Ethernet248,Ethernet100,Ethernet244,Ethernet128,Ethernet104,Ethernet240,Ethernet40,Ethernet228,Ethernet96,Ethernet168,Ethernet148,Ethernet204,Ethernet120,Ethernet220,Ethernet144,Ethernet208,Ethernet160,Ethernet224,Ethernet140,Ethernet56,Ethernet164,Ethernet76,Ethernet72,Ethernet32,Ethernet16,Ethernet36,Ethernet12,Ethernet196,Ethernet28,Ethernet192,Ethernet200,Ethernet124,Ethernet24,Ethernet116,Ethernet80,Ethernet112,Ethernet84,Ethernet152,Ethernet136,Ethernet156,Ethernet92,Ethernet132,Ethernet48,Ethernet232,Ethernet172,Ethernet216,Ethernet236,Ethernet176,Ethernet212,Ethernet64,Ethernet88,Ethernet60,Ethernet52,Ethernet20,Ethernet68,Ethernet252": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x100nrz/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 new file mode 100644 index 000000000000..45cebf3b7144 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/config_64x200G_midstone200i.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/config_64x200G_midstone200i.yaml new file mode 100644 index 000000000000..7133de54e493 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/config_64x200G_midstone200i.yaml @@ -0,0 +1,653 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "200G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "253" + lanes: "4:4" + serdes_group: "31" + speed: "200G" + sysport: "253" + type: "eth" + - fec: "KPFEC" + id: "245" + lanes: "4:4" + serdes_group: "30" + speed: "200G" + sysport: "245" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "200G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "200G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "200G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "200G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "200G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "200G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "200G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "200G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "200G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "200G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "205" + lanes: "4:4" + serdes_group: "25" + speed: "200G" + sysport: "205" + type: "eth" + - fec: "KPFEC" + id: "197" + lanes: "4:4" + serdes_group: "24" + speed: "200G" + sysport: "197" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "200G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "200G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "189" + lanes: "4:4" + serdes_group: "23" + speed: "200G" + sysport: "189" + type: "eth" + - fec: "KPFEC" + id: "181" + lanes: "4:4" + serdes_group: "22" + speed: "200G" + sysport: "181" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "200G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "200G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "173" + lanes: "4:4" + serdes_group: "21" + speed: "200G" + sysport: "173" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "200G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "200G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "200G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "200G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "200G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "200G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "200G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "141" + lanes: "4:4" + serdes_group: "17" + speed: "200G" + sysport: "141" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "200G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "200G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "200G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "200G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "200G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "200G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "200G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "200G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "200G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "200G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "200G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "200G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "200G" + sysport: "85" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "200G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "200G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "200G" + sysport: "77" + type: "eth" + - fec: "KPFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "200G" + sysport: "69" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "200G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "200G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "200G" + sysport: "61" + type: "eth" + - fec: "KPFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "200G" + sysport: "53" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "200G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "200G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "200G" + sysport: "45" + type: "eth" + - fec: "KPFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "200G" + sysport: "37" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "200G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "200G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "200G" + sysport: "29" + type: "eth" + - fec: "KPFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "200G" + sysport: "21" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "200G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "200G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "200G" + sysport: "13" + type: "eth" + - fec: "KPFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "200G" + sysport: "5" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "200G" + sysport: "1" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 0" + isg: + - id: "0" + lane_swap: "01234567" + rx_polarity: "01110001" + tx_polarity: "00101001" + - id: "1" + lane_swap: "01234567" + rx_polarity: "11100100" + tx_polarity: "10111111" + - id: "2" + lane_swap: "01234567" + rx_polarity: "00010001" + tx_polarity: "00100010" + - id: "3" + lane_swap: "01234567" + rx_polarity: "11011101" + tx_polarity: "00101010" + - id: "4" + lane_swap: "01234567" + rx_polarity: "10010101" + tx_polarity: "10111110" + - id: "5" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01101000" + - id: "6" + lane_swap: "01234567" + rx_polarity: "01110011" + tx_polarity: "01110110" + - id: "7" + lane_swap: "01234567" + rx_polarity: "10111001" + tx_polarity: "01001000" + - id: "8" + lane_swap: "01234567" + rx_polarity: "01000000" + tx_polarity: "11000100" + - id: "9" + lane_swap: "01234567" + rx_polarity: "10100100" + tx_polarity: "10001010" + - id: "10" + lane_swap: "01234567" + rx_polarity: "00011101" + tx_polarity: "11000110" + - id: "11" + lane_swap: "01234567" + rx_polarity: "00000101" + tx_polarity: "01000111" + - id: "12" + lane_swap: "01234567" + rx_polarity: "11100000" + tx_polarity: "01111000" + - id: "13" + lane_swap: "01234567" + rx_polarity: "00101111" + tx_polarity: "10011111" + - id: "14" + lane_swap: "01234567" + rx_polarity: "00011000" + tx_polarity: "00101001" + - id: "15" + lane_swap: "01234567" + rx_polarity: "00110110" + tx_polarity: "10110111" + - id: "16" + lane_swap: "01234567" + rx_polarity: "00000111" + tx_polarity: "00101001" + - id: "17" + lane_swap: "01234567" + rx_polarity: "10001000" + tx_polarity: "10100111" + - id: "18" + lane_swap: "01234567" + rx_polarity: "11111110" + tx_polarity: "00011001" + - id: "19" + lane_swap: "01234567" + rx_polarity: "10011010" + tx_polarity: "10010101" + - id: "20" + lane_swap: "01234567" + rx_polarity: "01100000" + tx_polarity: "00101001" + - id: "21" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10010111" + - id: "22" + lane_swap: "01234567" + rx_polarity: "11010011" + tx_polarity: "00101001" + - id: "23" + lane_swap: "01234567" + rx_polarity: "01111011" + tx_polarity: "10110111" + - id: "24" + lane_swap: "01234567" + rx_polarity: "11101011" + tx_polarity: "00101001" + - id: "25" + lane_swap: "01234567" + rx_polarity: "11010111" + tx_polarity: "10110111" + - id: "26" + lane_swap: "01234567" + rx_polarity: "00101101" + tx_polarity: "00100001" + - id: "27" + lane_swap: "01234567" + rx_polarity: "11011001" + tx_polarity: "11000111" + - id: "28" + lane_swap: "01234567" + rx_polarity: "01010011" + tx_polarity: "00100001" + - id: "29" + lane_swap: "01234567" + rx_polarity: "01111001" + tx_polarity: "10110111" + - id: "30" + lane_swap: "01234567" + rx_polarity: "00110001" + tx_polarity: "00101001" + - id: "31" + lane_swap: "01234567" + rx_polarity: "01101101" + tx_polarity: "10110101" + - id: "32" + lane_swap: "01234567" + rx_polarity: "00000000" + tx_polarity: "00000000" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/inno.config.yaml b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/inno.config.yaml new file mode 100755 index 000000000000..970a5830339e --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x200G_midstone200i.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/innovium.77700_B b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/port_config.ini b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/port_config.ini new file mode 100644 index 000000000000..3dcbf72bc324 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/port_config.ini @@ -0,0 +1,67 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 200000 0 9126 rs +Ethernet4 253,254,255,256 200000 1 9126 rs +Ethernet8 245,246,247,248 200000 2 9126 rs +Ethernet12 241,242,243,244 200000 3 9126 rs +Ethernet16 233,234,235,236 200000 4 9126 rs +Ethernet20 237,238,239,240 200000 5 9126 rs +Ethernet24 229,230,231,232 200000 6 9126 rs +Ethernet28 225,226,227,228 200000 7 9126 rs +Ethernet32 217,218,219,220 200000 8 9126 rs +Ethernet36 221,222,223,224 200000 9 9126 rs +Ethernet40 213,214,215,216 200000 10 9126 rs +Ethernet44 209,210,211,212 200000 11 9126 rs +Ethernet48 201,202,203,204 200000 12 9126 rs +Ethernet52 205,206,207,208 200000 13 9126 rs +Ethernet56 197,198,199,200 200000 14 9126 rs +Ethernet60 193,194,195,196 200000 15 9126 rs +Ethernet64 185,186,187,188 200000 16 9126 rs +Ethernet68 189,190,191,192 200000 17 9126 rs +Ethernet72 181,182,183,184 200000 18 9126 rs +Ethernet76 177,178,179,180 200000 19 9126 rs +Ethernet80 169,170,171,172 200000 20 9126 rs +Ethernet84 173,174,175,176 200000 21 9126 rs +Ethernet88 165,166,167,168 200000 22 9126 rs +Ethernet92 161,162,163,164 200000 23 9126 rs +Ethernet96 153,154,155,156 200000 24 9126 rs +Ethernet100 157,158,159,160 200000 25 9126 rs +Ethernet104 149,150,151,152 200000 26 9126 rs +Ethernet108 145,146,147,148 200000 27 9126 rs +Ethernet112 137,138,139,140 200000 28 9126 rs +Ethernet116 141,142,143,144 200000 29 9126 rs +Ethernet120 133,134,135,136 200000 30 9126 rs +Ethernet124 129,130,131,132 200000 31 9126 rs +Ethernet128 121,122,123,124 200000 32 9126 rs +Ethernet132 125,126,127,128 200000 33 9126 rs +Ethernet136 117,118,119,120 200000 34 9126 rs +Ethernet140 113,114,115,116 200000 35 9126 rs +Ethernet144 105,106,107,108 200000 36 9126 rs +Ethernet148 109,110,111,112 200000 37 9126 rs +Ethernet152 101,102,103,104 200000 38 9126 rs +Ethernet156 97,98,99,100 200000 39 9126 rs +Ethernet160 89,90,91,92 200000 40 9126 rs +Ethernet164 93,94,95,96 200000 41 9126 rs +Ethernet168 85,86,87,88 200000 42 9126 rs +Ethernet172 81,82,83,84 200000 43 9126 rs +Ethernet176 73,74,75,76 200000 44 9126 rs +Ethernet180 77,78,79,80 200000 45 9126 rs +Ethernet184 69,70,71,72 200000 46 9126 rs +Ethernet188 65,66,67,68 200000 47 9126 rs +Ethernet192 57,58,59,60 200000 48 9126 rs +Ethernet196 61,62,63,64 200000 49 9126 rs +Ethernet200 53,54,55,56 200000 50 9126 rs +Ethernet204 49,50,51,52 200000 51 9126 rs +Ethernet208 41,42,43,44 200000 52 9126 rs +Ethernet212 45,46,47,48 200000 53 9126 rs +Ethernet216 37,38,39,40 200000 54 9126 rs +Ethernet220 33,34,35,36 200000 55 9126 rs +Ethernet224 25,26,27,28 200000 56 9126 rs +Ethernet228 29,30,31,32 200000 57 9126 rs +Ethernet232 21,22,23,24 200000 58 9126 rs +Ethernet236 17,18,19,20 200000 59 9126 rs +Ethernet240 9,10,11,12 200000 60 9126 rs +Ethernet244 13,14,15,16 200000 61 9126 rs +Ethernet248 5,6,7,8 200000 62 9126 rs +Ethernet252 1,2,3,4 200000 63 9126 rs +Ethernet256 257 10000 64 9126 none +Ethernet257 258 10000 65 9126 none diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 new file mode 100755 index 000000000000..16f9b42a2166 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 64 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/sai.profile b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/Midstone-200i_64x200/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/celestica/x86_64-cel_midstone-r0/default_sku b/device/celestica/x86_64-cel_midstone-r0/default_sku new file mode 100755 index 000000000000..6fe6e28064bd --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/default_sku @@ -0,0 +1 @@ +Midstone-200i t1 diff --git a/device/celestica/x86_64-cel_midstone-r0/fancontrol b/device/celestica/x86_64-cel_midstone-r0/fancontrol new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/device/celestica/x86_64-cel_midstone-r0/installer.conf b/device/celestica/x86_64-cel_midstone-r0/installer.conf new file mode 100755 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/celestica/x86_64-cel_midstone-r0/plugins/eeprom.py b/device/celestica/x86_64-cel_midstone-r0/plugins/eeprom.py new file mode 100755 index 000000000000..86e7f1b2af15 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica Midstone-200i +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/celestica/x86_64-cel_midstone-r0/plugins/psuutil.py b/device/celestica/x86_64-cel_midstone-r0/plugins/psuutil.py new file mode 100644 index 000000000000..4e6c5eec5d85 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +import os.path +import subprocess + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 1 + return status == 1 + + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + status = 1 + return status == 1 + diff --git a/device/celestica/x86_64-cel_midstone-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_midstone-r0/plugins/sfputil.py new file mode 100755 index 000000000000..4d2a444c198b --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/plugins/sfputil.py @@ -0,0 +1,205 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 65 + QSFP_PORT_START = PORT_START + QSFP_PORT_END = 63 + + EEPROM_OFFSET = 1 + + _port_to_eeprom_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.QSFP_PORT_END+1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + if self.port_start == 1: + offset = self.EEPROM_OFFSET - 1 + else: + offset = self.EEPROM_OFFSET + + for x in range(self.port_start, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + offset) + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ms200i_cpld/qsfp_modprs") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ms200i_cpld/qsfp_lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/ms200i_cpld/qsfp_lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value).strip('L') + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/ms200i_cpld/qsfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Determind if port_num start from 1 or 0 + if self.port_start == 1: + bit_index = port_num - 1 + else: + bit_index = port_num + + # Mask off the bit corresponding to our port + mask = (1 << bit_index) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value).rstrip('L')) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value).rstrip('L')) + reg_file.close() + + return True diff --git a/device/celestica/x86_64-cel_midstone-r0/sensors.conf b/device/celestica/x86_64-cel_midstone-r0/sensors.conf new file mode 100755 index 000000000000..7c9a6321dfc0 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/sensors.conf @@ -0,0 +1,2 @@ +# libsensors configuration file for Celestica Midstone-200i. +# The i2c bus portion is omit because adapter name diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 new file mode 100644 index 000000000000..4fca9cbcd156 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/config_32x400G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/config_32x400G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..2ba23d2a5a67 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/config_32x400G_Delta-et-c032if.yaml @@ -0,0 +1,429 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_A" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:8" + serdes_group: "27" + speed: "400G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:8" + serdes_group: "26" + speed: "400G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:8" + serdes_group: "25" + speed: "400G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:8" + serdes_group: "24" + speed: "400G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:8" + serdes_group: "23" + speed: "400G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:8" + serdes_group: "22" + speed: "400G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:8" + serdes_group: "21" + speed: "400G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:8" + serdes_group: "20" + speed: "400G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:8" + serdes_group: "19" + speed: "400G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:8" + serdes_group: "18" + speed: "400G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:8" + serdes_group: "17" + speed: "400G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:8" + serdes_group: "16" + speed: "400G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:8" + serdes_group: "15" + speed: "400G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:8" + serdes_group: "14" + speed: "400G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:8" + serdes_group: "12" + speed: "400G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:8" + serdes_group: "10" + speed: "400G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:8" + serdes_group: "11" + speed: "400G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:8" + serdes_group: "8" + speed: "400G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:8" + serdes_group: "9" + speed: "400G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:8" + serdes_group: "6" + speed: "400G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:8" + serdes_group: "7" + speed: "400G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:8" + serdes_group: "4" + speed: "400G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:8" + serdes_group: "5" + speed: "400G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:8" + serdes_group: "2" + speed: "400G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:8" + serdes_group: "3" + speed: "400G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:8" + serdes_group: "0" + speed: "400G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:8" + serdes_group: "1" + speed: "400G" + sysport: "9" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/inno.config.yaml new file mode 100755 index 000000000000..360b5af8e602 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x400G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/innovium.77700_A b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/innovium.77700_A new file mode 100644 index 000000000000..84aa41983606 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/port_config.ini new file mode 100755 index 000000000000..360e363f485b --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/port_config.ini @@ -0,0 +1,35 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 400000 0 9126 rs +Ethernet8 241,242,243,244 400000 1 9126 rs +Ethernet16 233,234,235,236 400000 2 9126 rs +Ethernet24 225,226,227,228 400000 3 9126 rs +Ethernet32 217,218,219,220 400000 4 9126 rs +Ethernet40 209,210,211,212 400000 5 9126 rs +Ethernet48 201,202,203,204 400000 6 9126 rs +Ethernet56 193,194,195,196 400000 7 9126 rs +Ethernet64 185,186,187,188 400000 8 9126 rs +Ethernet72 177,178,179,180 400000 9 9126 rs +Ethernet80 169,170,171,172 400000 10 9126 rs +Ethernet88 161,162,163,164 400000 11 9126 rs +Ethernet96 153,154,155,156 400000 12 9126 rs +Ethernet104 145,146,147,148 400000 13 9126 rs +Ethernet112 137,138,139,140 400000 14 9126 rs +Ethernet120 129,130,131,132 400000 15 9126 rs +Ethernet128 121,122,123,124 400000 16 9126 rs +Ethernet136 113,114,115,116 400000 17 9126 rs +Ethernet144 97,98,99,100 400000 18 9126 rs +Ethernet152 105,106,107,108 400000 19 9126 rs +Ethernet160 81,82,83,84 400000 20 9126 rs +Ethernet168 89,90,91,92 400000 21 9126 rs +Ethernet176 65,66,67,68 400000 22 9126 rs +Ethernet184 73,74,75,76 400000 23 9126 rs +Ethernet192 49,50,51,52 400000 24 9126 rs +Ethernet200 57,58,59,60 400000 25 9126 rs +Ethernet208 33,34,35,36 400000 26 9126 rs +Ethernet216 41,42,43,44 400000 27 9126 rs +Ethernet224 17,18,19,20 400000 28 9126 rs +Ethernet232 25,26,27,28 400000 29 9126 rs +Ethernet240 1,2,3,4 400000 30 9126 rs +Ethernet248 9,10,11,12 400000 31 9126 rs +Ethernet256 257 10000 32 9126 none +Ethernet257 258 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 new file mode 100755 index 000000000000..6c734d46ff2f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 32 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 new file mode 100644 index 000000000000..9529fbf52fb5 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 128 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*2)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/config_128x100G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/config_128x100G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..ad50fd04c2a0 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/config_128x100G_Delta-et-c032if.yaml @@ -0,0 +1,1102 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:2" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "251" + lanes: "2:2" + serdes_group: "31" + speed: "100G" + sysport: "251" + type: "eth" + - fec: "KPFEC" + id: "253" + lanes: "4:2" + serdes_group: "31" + speed: "100G" + sysport: "253" + type: "eth" + - fec: "KPFEC" + id: "255" + lanes: "6:2" + serdes_group: "31" + speed: "100G" + sysport: "255" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:2" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "243" + lanes: "2:2" + serdes_group: "30" + speed: "100G" + sysport: "243" + type: "eth" + - fec: "KPFEC" + id: "245" + lanes: "4:2" + serdes_group: "30" + speed: "100G" + sysport: "245" + type: "eth" + - fec: "KPFEC" + id: "247" + lanes: "6:2" + serdes_group: "30" + speed: "100G" + sysport: "247" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:2" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "235" + lanes: "2:2" + serdes_group: "29" + speed: "100G" + sysport: "235" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:2" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "239" + lanes: "6:2" + serdes_group: "29" + speed: "100G" + sysport: "239" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:2" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "227" + lanes: "2:2" + serdes_group: "28" + speed: "100G" + sysport: "227" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:2" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "231" + lanes: "6:2" + serdes_group: "28" + speed: "100G" + sysport: "231" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:2" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "219" + lanes: "2:2" + serdes_group: "27" + speed: "100G" + sysport: "219" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:2" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "223" + lanes: "6:2" + serdes_group: "27" + speed: "100G" + sysport: "223" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:2" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "211" + lanes: "2:2" + serdes_group: "26" + speed: "100G" + sysport: "211" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:2" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "215" + lanes: "6:2" + serdes_group: "26" + speed: "100G" + sysport: "215" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:2" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "203" + lanes: "2:2" + serdes_group: "25" + speed: "100G" + sysport: "203" + type: "eth" + - fec: "KPFEC" + id: "205" + lanes: "4:2" + serdes_group: "25" + speed: "100G" + sysport: "205" + type: "eth" + - fec: "KPFEC" + id: "207" + lanes: "6:2" + serdes_group: "25" + speed: "100G" + sysport: "207" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:2" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "195" + lanes: "2:2" + serdes_group: "24" + speed: "100G" + sysport: "195" + type: "eth" + - fec: "KPFEC" + id: "197" + lanes: "4:2" + serdes_group: "24" + speed: "100G" + sysport: "197" + type: "eth" + - fec: "KPFEC" + id: "199" + lanes: "6:2" + serdes_group: "24" + speed: "100G" + sysport: "199" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:2" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "187" + lanes: "2:2" + serdes_group: "23" + speed: "100G" + sysport: "187" + type: "eth" + - fec: "KPFEC" + id: "189" + lanes: "4:2" + serdes_group: "23" + speed: "100G" + sysport: "189" + type: "eth" + - fec: "KPFEC" + id: "191" + lanes: "6:2" + serdes_group: "23" + speed: "100G" + sysport: "191" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:2" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "179" + lanes: "2:2" + serdes_group: "22" + speed: "100G" + sysport: "179" + type: "eth" + - fec: "KPFEC" + id: "181" + lanes: "4:2" + serdes_group: "22" + speed: "100G" + sysport: "181" + type: "eth" + - fec: "KPFEC" + id: "183" + lanes: "6:2" + serdes_group: "22" + speed: "100G" + sysport: "183" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:2" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "171" + lanes: "2:2" + serdes_group: "21" + speed: "100G" + sysport: "171" + type: "eth" + - fec: "KPFEC" + id: "173" + lanes: "4:2" + serdes_group: "21" + speed: "100G" + sysport: "173" + type: "eth" + - fec: "KPFEC" + id: "175" + lanes: "6:2" + serdes_group: "21" + speed: "100G" + sysport: "175" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:2" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "163" + lanes: "2:2" + serdes_group: "20" + speed: "100G" + sysport: "163" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:2" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "167" + lanes: "6:2" + serdes_group: "20" + speed: "100G" + sysport: "167" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:2" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "155" + lanes: "2:2" + serdes_group: "19" + speed: "100G" + sysport: "155" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:2" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "159" + lanes: "6:2" + serdes_group: "19" + speed: "100G" + sysport: "159" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:2" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "147" + lanes: "2:2" + serdes_group: "18" + speed: "100G" + sysport: "147" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:2" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "151" + lanes: "6:2" + serdes_group: "18" + speed: "100G" + sysport: "151" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:2" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "139" + lanes: "2:2" + serdes_group: "17" + speed: "100G" + sysport: "139" + type: "eth" + - fec: "KPFEC" + id: "141" + lanes: "4:2" + serdes_group: "17" + speed: "100G" + sysport: "141" + type: "eth" + - fec: "KPFEC" + id: "143" + lanes: "6:2" + serdes_group: "17" + speed: "100G" + sysport: "143" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:2" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "131" + lanes: "2:2" + serdes_group: "16" + speed: "100G" + sysport: "131" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:2" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "135" + lanes: "6:2" + serdes_group: "16" + speed: "100G" + sysport: "135" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:2" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "123" + lanes: "2:2" + serdes_group: "15" + speed: "100G" + sysport: "123" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:2" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "127" + lanes: "6:2" + serdes_group: "15" + speed: "100G" + sysport: "127" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:2" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "115" + lanes: "2:2" + serdes_group: "14" + speed: "100G" + sysport: "115" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:2" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "119" + lanes: "6:2" + serdes_group: "14" + speed: "100G" + sysport: "119" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:2" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "99" + lanes: "2:2" + serdes_group: "12" + speed: "100G" + sysport: "99" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:2" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "103" + lanes: "6:2" + serdes_group: "12" + speed: "100G" + sysport: "103" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:2" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "107" + lanes: "2:2" + serdes_group: "13" + speed: "100G" + sysport: "107" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:2" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "111" + lanes: "6:2" + serdes_group: "13" + speed: "100G" + sysport: "111" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:2" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "83" + lanes: "2:2" + serdes_group: "10" + speed: "100G" + sysport: "83" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:2" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KPFEC" + id: "87" + lanes: "6:2" + serdes_group: "10" + speed: "100G" + sysport: "87" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:2" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "91" + lanes: "2:2" + serdes_group: "11" + speed: "100G" + sysport: "91" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:2" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "95" + lanes: "6:2" + serdes_group: "11" + speed: "100G" + sysport: "95" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:2" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "67" + lanes: "2:2" + serdes_group: "8" + speed: "100G" + sysport: "67" + type: "eth" + - fec: "KPFEC" + id: "69" + lanes: "4:2" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - fec: "KPFEC" + id: "71" + lanes: "6:2" + serdes_group: "8" + speed: "100G" + sysport: "71" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:2" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "75" + lanes: "2:2" + serdes_group: "9" + speed: "100G" + sysport: "75" + type: "eth" + - fec: "KPFEC" + id: "77" + lanes: "4:2" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - fec: "KPFEC" + id: "79" + lanes: "6:2" + serdes_group: "9" + speed: "100G" + sysport: "79" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:2" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "51" + lanes: "2:2" + serdes_group: "6" + speed: "100G" + sysport: "51" + type: "eth" + - fec: "KPFEC" + id: "53" + lanes: "4:2" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KPFEC" + id: "55" + lanes: "6:2" + serdes_group: "6" + speed: "100G" + sysport: "55" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:2" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "59" + lanes: "2:2" + serdes_group: "7" + speed: "100G" + sysport: "59" + type: "eth" + - fec: "KPFEC" + id: "61" + lanes: "4:2" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KPFEC" + id: "63" + lanes: "6:2" + serdes_group: "7" + speed: "100G" + sysport: "63" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:2" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "35" + lanes: "2:2" + serdes_group: "4" + speed: "100G" + sysport: "35" + type: "eth" + - fec: "KPFEC" + id: "37" + lanes: "4:2" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KPFEC" + id: "39" + lanes: "6:2" + serdes_group: "4" + speed: "100G" + sysport: "39" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:2" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "43" + lanes: "2:2" + serdes_group: "5" + speed: "100G" + sysport: "43" + type: "eth" + - fec: "KPFEC" + id: "45" + lanes: "4:2" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KPFEC" + id: "47" + lanes: "6:2" + serdes_group: "5" + speed: "100G" + sysport: "47" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:2" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "19" + lanes: "2:2" + serdes_group: "2" + speed: "100G" + sysport: "19" + type: "eth" + - fec: "KPFEC" + id: "21" + lanes: "4:2" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KPFEC" + id: "23" + lanes: "6:2" + serdes_group: "2" + speed: "100G" + sysport: "23" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:2" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "27" + lanes: "2:2" + serdes_group: "3" + speed: "100G" + sysport: "27" + type: "eth" + - fec: "KPFEC" + id: "29" + lanes: "4:2" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KPFEC" + id: "31" + lanes: "6:2" + serdes_group: "3" + speed: "100G" + sysport: "31" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:2" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "3" + lanes: "2:2" + serdes_group: "0" + speed: "100G" + sysport: "3" + type: "eth" + - fec: "KPFEC" + id: "5" + lanes: "4:2" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" + - fec: "KPFEC" + id: "7" + lanes: "6:2" + serdes_group: "0" + speed: "100G" + sysport: "7" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:2" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "11" + lanes: "2:2" + serdes_group: "1" + speed: "100G" + sysport: "11" + type: "eth" + - fec: "KPFEC" + id: "13" + lanes: "4:2" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "KPFEC" + id: "15" + lanes: "6:2" + serdes_group: "1" + speed: "100G" + sysport: "15" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/inno.config.yaml new file mode 100755 index 000000000000..17f3e060d712 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_128x100G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/port_config.ini new file mode 100644 index 000000000000..cd4dbc611ec1 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/port_config.ini @@ -0,0 +1,131 @@ +# name lanes speed index mtu +Ethernet0 249,250 100000 0 9126 +Ethernet2 251,252 100000 0 9126 +Ethernet4 253,254 100000 0 9126 +Ethernet6 255,256 100000 0 9126 +Ethernet8 241,242 100000 1 9126 +Ethernet10 243,244 100000 1 9126 +Ethernet12 245,246 100000 1 9126 +Ethernet14 247,248 100000 1 9126 +Ethernet16 233,234 100000 2 9126 +Ethernet18 235,236 100000 2 9126 +Ethernet20 237,238 100000 2 9126 +Ethernet22 239,240 100000 2 9126 +Ethernet24 225,226 100000 3 9126 +Ethernet26 227,228 100000 3 9126 +Ethernet28 229,230 100000 3 9126 +Ethernet30 231,232 100000 3 9126 +Ethernet32 217,218 100000 4 9126 +Ethernet34 219,220 100000 4 9126 +Ethernet36 221,222 100000 4 9126 +Ethernet38 223,224 100000 4 9126 +Ethernet40 209,210 100000 5 9126 +Ethernet42 211,212 100000 5 9126 +Ethernet44 213,214 100000 5 9126 +Ethernet46 215,216 100000 5 9126 +Ethernet48 201,202 100000 6 9126 +Ethernet50 203,204 100000 6 9126 +Ethernet52 205,206 100000 6 9126 +Ethernet54 207,208 100000 6 9126 +Ethernet56 193,194 100000 7 9126 +Ethernet58 195,196 100000 7 9126 +Ethernet60 197,198 100000 7 9126 +Ethernet62 199,200 100000 7 9126 +Ethernet64 185,186 100000 8 9126 +Ethernet66 187,188 100000 8 9126 +Ethernet68 189,190 100000 8 9126 +Ethernet70 191,192 100000 8 9126 +Ethernet72 177,178 100000 9 9126 +Ethernet74 179,180 100000 9 9126 +Ethernet76 181,182 100000 9 9126 +Ethernet78 183,184 100000 9 9126 +Ethernet80 169,170 100000 10 9126 +Ethernet82 171,172 100000 10 9126 +Ethernet84 173,174 100000 10 9126 +Ethernet86 175,176 100000 10 9126 +Ethernet88 161,162 100000 11 9126 +Ethernet90 163,164 100000 11 9126 +Ethernet92 165,166 100000 11 9126 +Ethernet94 167,168 100000 11 9126 +Ethernet96 153,154 100000 12 9126 +Ethernet98 155,156 100000 12 9126 +Ethernet100 157,158 100000 12 9126 +Ethernet102 159,160 100000 12 9126 +Ethernet104 145,146 100000 13 9126 +Ethernet106 147,148 100000 13 9126 +Ethernet108 149,150 100000 13 9126 +Ethernet110 151,152 100000 13 9126 +Ethernet112 137,138 100000 14 9126 +Ethernet114 139,140 100000 14 9126 +Ethernet116 141,142 100000 14 9126 +Ethernet118 143,144 100000 14 9126 +Ethernet120 129,130 100000 15 9126 +Ethernet122 131,132 100000 15 9126 +Ethernet124 133,134 100000 15 9126 +Ethernet126 135,136 100000 15 9126 +Ethernet128 121,122 100000 16 9126 +Ethernet130 123,124 100000 16 9126 +Ethernet132 125,126 100000 16 9126 +Ethernet134 127,128 100000 16 9126 +Ethernet136 113,114 100000 17 9126 +Ethernet138 115,116 100000 17 9126 +Ethernet140 117,118 100000 17 9126 +Ethernet142 119,120 100000 17 9126 +Ethernet144 97,98 100000 18 9126 +Ethernet146 99,100 100000 18 9126 +Ethernet148 101,102 100000 18 9126 +Ethernet150 103,104 100000 18 9126 +Ethernet152 105,106 100000 19 9126 +Ethernet154 107,108 100000 19 9126 +Ethernet156 109,110 100000 19 9126 +Ethernet158 111,112 100000 19 9126 +Ethernet160 81,82 100000 20 9126 +Ethernet162 83,84 100000 20 9126 +Ethernet164 85,86 100000 20 9126 +Ethernet166 87,88 100000 20 9126 +Ethernet168 89,90 100000 21 9126 +Ethernet170 91,92 100000 21 9126 +Ethernet172 93,94 100000 21 9126 +Ethernet174 95,96 100000 21 9126 +Ethernet176 65,66 100000 22 9126 +Ethernet178 67,68 100000 22 9126 +Ethernet180 69,70 100000 22 9126 +Ethernet182 71,72 100000 22 9126 +Ethernet184 73,74 100000 23 9126 +Ethernet186 75,76 100000 23 9126 +Ethernet188 77,78 100000 23 9126 +Ethernet190 79,80 100000 23 9126 +Ethernet192 49,50 100000 24 9126 +Ethernet194 51,52 100000 24 9126 +Ethernet196 53,54 100000 24 9126 +Ethernet198 55,56 100000 24 9126 +Ethernet200 57,58 100000 25 9126 +Ethernet202 59,60 100000 25 9126 +Ethernet204 61,62 100000 25 9126 +Ethernet206 63,64 100000 25 9126 +Ethernet208 33,34 100000 26 9126 +Ethernet210 35,36 100000 26 9126 +Ethernet212 37,38 100000 26 9126 +Ethernet214 39,40 100000 26 9126 +Ethernet216 41,42 100000 27 9126 +Ethernet218 43,44 100000 27 9126 +Ethernet220 45,46 100000 27 9126 +Ethernet222 47,48 100000 27 9126 +Ethernet224 17,18 100000 28 9126 +Ethernet226 19,20 100000 28 9126 +Ethernet228 21,22 100000 28 9126 +Ethernet230 23,24 100000 28 9126 +Ethernet232 25,26 100000 29 9126 +Ethernet234 27,28 100000 29 9126 +Ethernet236 29,30 100000 29 9126 +Ethernet238 31,32 100000 29 9126 +Ethernet240 1,2 100000 30 9126 +Ethernet242 3,4 100000 30 9126 +Ethernet244 5,6 100000 30 9126 +Ethernet246 7,8 100000 30 9126 +Ethernet248 9,10 100000 31 9126 +Ethernet250 11,12 100000 31 9126 +Ethernet252 13,14 100000 31 9126 +Ethernet254 15,16 100000 31 9126 +Ethernet256 257 10000 32 9126 +Ethernet257 258 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 new file mode 100755 index 000000000000..733bd51dc86f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 128 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*2)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_128x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 new file mode 100644 index 000000000000..4fca9cbcd156 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/config_32x100G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/config_32x100G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..4b4f02da4895 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/config_32x100G_Delta-et-c032if.yaml @@ -0,0 +1,415 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KRFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/inno.config.yaml new file mode 100755 index 000000000000..9350e166634e --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x100G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_A b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_A new file mode 100644 index 000000000000..84aa41983606 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/port_config.ini new file mode 100755 index 000000000000..45fbfd346c9f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/port_config.ini @@ -0,0 +1,33 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 100000 0 9126 rs +Ethernet8 241,242,243,244 100000 1 9126 rs +Ethernet16 233,234,235,236 100000 2 9126 rs +Ethernet24 225,226,227,228 100000 3 9126 rs +Ethernet32 217,218,219,220 100000 4 9126 rs +Ethernet40 209,210,211,212 100000 5 9126 rs +Ethernet48 201,202,203,204 100000 6 9126 rs +Ethernet56 193,194,195,196 100000 7 9126 rs +Ethernet64 185,186,187,188 100000 8 9126 rs +Ethernet72 177,178,179,180 100000 9 9126 rs +Ethernet80 169,170,171,172 100000 10 9126 rs +Ethernet88 161,162,163,164 100000 11 9126 rs +Ethernet96 153,154,155,156 100000 12 9126 rs +Ethernet104 145,146,147,148 100000 13 9126 rs +Ethernet112 137,138,139,140 100000 14 9126 rs +Ethernet120 129,130,131,132 100000 15 9126 rs +Ethernet128 121,122,123,124 100000 16 9126 rs +Ethernet136 113,114,115,116 100000 17 9126 rs +Ethernet144 97,98,99,100 100000 18 9126 rs +Ethernet152 105,106,107,108 100000 19 9126 rs +Ethernet160 81,82,83,84 100000 20 9126 rs +Ethernet168 89,90,91,92 100000 21 9126 rs +Ethernet176 65,66,67,68 100000 22 9126 rs +Ethernet184 73,74,75,76 100000 23 9126 rs +Ethernet192 49,50,51,52 100000 24 9126 rs +Ethernet200 57,58,59,60 100000 25 9126 rs +Ethernet208 33,34,35,36 100000 26 9126 rs +Ethernet216 41,42,43,44 100000 27 9126 rs +Ethernet224 17,18,19,20 100000 28 9126 rs +Ethernet232 25,26,27,28 100000 29 9126 rs +Ethernet240 1,2,3,4 100000 30 9126 rs +Ethernet248 9,10,11,12 100000 31 9126 rs diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 new file mode 100755 index 000000000000..6c734d46ff2f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 32 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 new file mode 100644 index 000000000000..4fca9cbcd156 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/config_32x200G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/config_32x200G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..0a76811110e8 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/config_32x200G_Delta-et-c032if.yaml @@ -0,0 +1,429 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "200G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "200G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "200G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "200G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "200G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "200G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "200G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "200G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "200G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "200G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "200G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "200G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "200G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "200G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "200G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "200G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "200G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "200G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "200G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "200G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "200G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "200G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "200G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "200G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "200G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "200G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "200G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "200G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "200G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "200G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "200G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "200G" + sysport: "9" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/inno.config.yaml new file mode 100755 index 000000000000..9bc0114cf69b --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x200G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/port_config.ini new file mode 100755 index 000000000000..48091f5e3674 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/port_config.ini @@ -0,0 +1,35 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 200000 0 9126 rs +Ethernet8 241,242,243,244 200000 1 9126 rs +Ethernet16 233,234,235,236 200000 2 9126 rs +Ethernet24 225,226,227,228 200000 3 9126 rs +Ethernet32 217,218,219,220 200000 4 9126 rs +Ethernet40 209,210,211,212 200000 5 9126 rs +Ethernet48 201,202,203,204 200000 6 9126 rs +Ethernet56 193,194,195,196 200000 7 9126 rs +Ethernet64 185,186,187,188 200000 8 9126 rs +Ethernet72 177,178,179,180 200000 9 9126 rs +Ethernet80 169,170,171,172 200000 10 9126 rs +Ethernet88 161,162,163,164 200000 11 9126 rs +Ethernet96 153,154,155,156 200000 12 9126 rs +Ethernet104 145,146,147,148 200000 13 9126 rs +Ethernet112 137,138,139,140 200000 14 9126 rs +Ethernet120 129,130,131,132 200000 15 9126 rs +Ethernet128 121,122,123,124 200000 16 9126 rs +Ethernet136 113,114,115,116 200000 17 9126 rs +Ethernet144 97,98,99,100 200000 18 9126 rs +Ethernet152 105,106,107,108 200000 19 9126 rs +Ethernet160 81,82,83,84 200000 20 9126 rs +Ethernet168 89,90,91,92 200000 21 9126 rs +Ethernet176 65,66,67,68 200000 22 9126 rs +Ethernet184 73,74,75,76 200000 23 9126 rs +Ethernet192 49,50,51,52 200000 24 9126 rs +Ethernet200 57,58,59,60 200000 25 9126 rs +Ethernet208 33,34,35,36 200000 26 9126 rs +Ethernet216 41,42,43,44 200000 27 9126 rs +Ethernet224 17,18,19,20 200000 28 9126 rs +Ethernet232 25,26,27,28 200000 29 9126 rs +Ethernet240 1,2,3,4 200000 30 9126 rs +Ethernet248 9,10,11,12 200000 31 9126 rs +Ethernet256 257 10000 32 9126 none +Ethernet257 258 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 new file mode 100755 index 000000000000..6c734d46ff2f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 32 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x200/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 new file mode 100644 index 000000000000..4fca9cbcd156 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 32 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/config_32x400G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/config_32x400G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..2ba23d2a5a67 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/config_32x400G_Delta-et-c032if.yaml @@ -0,0 +1,429 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_A" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:8" + serdes_group: "31" + speed: "400G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:8" + serdes_group: "30" + speed: "400G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:8" + serdes_group: "29" + speed: "400G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:8" + serdes_group: "28" + speed: "400G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:8" + serdes_group: "27" + speed: "400G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:8" + serdes_group: "26" + speed: "400G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:8" + serdes_group: "25" + speed: "400G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:8" + serdes_group: "24" + speed: "400G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:8" + serdes_group: "23" + speed: "400G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:8" + serdes_group: "22" + speed: "400G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:8" + serdes_group: "21" + speed: "400G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:8" + serdes_group: "20" + speed: "400G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:8" + serdes_group: "19" + speed: "400G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:8" + serdes_group: "18" + speed: "400G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:8" + serdes_group: "17" + speed: "400G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:8" + serdes_group: "16" + speed: "400G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:8" + serdes_group: "15" + speed: "400G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:8" + serdes_group: "14" + speed: "400G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:8" + serdes_group: "12" + speed: "400G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:8" + serdes_group: "13" + speed: "400G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:8" + serdes_group: "10" + speed: "400G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:8" + serdes_group: "11" + speed: "400G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:8" + serdes_group: "8" + speed: "400G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:8" + serdes_group: "9" + speed: "400G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:8" + serdes_group: "6" + speed: "400G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:8" + serdes_group: "7" + speed: "400G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:8" + serdes_group: "4" + speed: "400G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:8" + serdes_group: "5" + speed: "400G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:8" + serdes_group: "2" + speed: "400G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:8" + serdes_group: "3" + speed: "400G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:8" + serdes_group: "0" + speed: "400G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:8" + serdes_group: "1" + speed: "400G" + sysport: "9" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/inno.config.yaml new file mode 100755 index 000000000000..360b5af8e602 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x400G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_A" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_A b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_A new file mode 100644 index 000000000000..84aa41983606 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_A @@ -0,0 +1,59 @@ +sku: innovium.77700_A + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 6, 5, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 8:0 + ib: 1 + pic_id: 5 + + isg 31: + mode: 8:0 + ib: 0 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/port_config.ini new file mode 100755 index 000000000000..360e363f485b --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/port_config.ini @@ -0,0 +1,35 @@ +# name lanes speed index mtu fec +Ethernet0 249,250,251,252 400000 0 9126 rs +Ethernet8 241,242,243,244 400000 1 9126 rs +Ethernet16 233,234,235,236 400000 2 9126 rs +Ethernet24 225,226,227,228 400000 3 9126 rs +Ethernet32 217,218,219,220 400000 4 9126 rs +Ethernet40 209,210,211,212 400000 5 9126 rs +Ethernet48 201,202,203,204 400000 6 9126 rs +Ethernet56 193,194,195,196 400000 7 9126 rs +Ethernet64 185,186,187,188 400000 8 9126 rs +Ethernet72 177,178,179,180 400000 9 9126 rs +Ethernet80 169,170,171,172 400000 10 9126 rs +Ethernet88 161,162,163,164 400000 11 9126 rs +Ethernet96 153,154,155,156 400000 12 9126 rs +Ethernet104 145,146,147,148 400000 13 9126 rs +Ethernet112 137,138,139,140 400000 14 9126 rs +Ethernet120 129,130,131,132 400000 15 9126 rs +Ethernet128 121,122,123,124 400000 16 9126 rs +Ethernet136 113,114,115,116 400000 17 9126 rs +Ethernet144 97,98,99,100 400000 18 9126 rs +Ethernet152 105,106,107,108 400000 19 9126 rs +Ethernet160 81,82,83,84 400000 20 9126 rs +Ethernet168 89,90,91,92 400000 21 9126 rs +Ethernet176 65,66,67,68 400000 22 9126 rs +Ethernet184 73,74,75,76 400000 23 9126 rs +Ethernet192 49,50,51,52 400000 24 9126 rs +Ethernet200 57,58,59,60 400000 25 9126 rs +Ethernet208 33,34,35,36 400000 26 9126 rs +Ethernet216 41,42,43,44 400000 27 9126 rs +Ethernet224 17,18,19,20 400000 28 9126 rs +Ethernet232 25,26,27,28 400000 29 9126 rs +Ethernet240 1,2,3,4 400000 30 9126 rs +Ethernet248 9,10,11,12 400000 31 9126 rs +Ethernet256 257 10000 32 9126 none +Ethernet257 258 10000 33 9126 none diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 new file mode 100755 index 000000000000..6c734d46ff2f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 32 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_32x400/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 new file mode 100644 index 000000000000..45cebf3b7144 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/config_64x100G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/config_64x100G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..e5fbcc93543d --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/config_64x100G_Delta-et-c032if.yaml @@ -0,0 +1,653 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KRFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "100G" + sysport: "249" + type: "eth" + - fec: "KRFEC" + id: "253" + lanes: "4:4" + serdes_group: "31" + speed: "100G" + sysport: "253" + type: "eth" + - fec: "KRFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "100G" + sysport: "241" + type: "eth" + - fec: "KRFEC" + id: "245" + lanes: "4:4" + serdes_group: "30" + speed: "100G" + sysport: "245" + type: "eth" + - fec: "KRFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "100G" + sysport: "233" + type: "eth" + - fec: "KRFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "100G" + sysport: "237" + type: "eth" + - fec: "KRFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "100G" + sysport: "225" + type: "eth" + - fec: "KRFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "100G" + sysport: "229" + type: "eth" + - fec: "KRFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "100G" + sysport: "217" + type: "eth" + - fec: "KRFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "100G" + sysport: "221" + type: "eth" + - fec: "KRFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "100G" + sysport: "209" + type: "eth" + - fec: "KRFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "100G" + sysport: "213" + type: "eth" + - fec: "KRFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "100G" + sysport: "201" + type: "eth" + - fec: "KRFEC" + id: "205" + lanes: "4:4" + serdes_group: "25" + speed: "100G" + sysport: "205" + type: "eth" + - fec: "KRFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "100G" + sysport: "193" + type: "eth" + - fec: "KRFEC" + id: "197" + lanes: "4:4" + serdes_group: "24" + speed: "100G" + sysport: "197" + type: "eth" + - fec: "KRFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "100G" + sysport: "185" + type: "eth" + - fec: "KRFEC" + id: "189" + lanes: "4:4" + serdes_group: "23" + speed: "100G" + sysport: "189" + type: "eth" + - fec: "KRFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "100G" + sysport: "177" + type: "eth" + - fec: "KRFEC" + id: "181" + lanes: "4:4" + serdes_group: "22" + speed: "100G" + sysport: "181" + type: "eth" + - fec: "KRFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "100G" + sysport: "169" + type: "eth" + - fec: "KRFEC" + id: "173" + lanes: "4:4" + serdes_group: "21" + speed: "100G" + sysport: "173" + type: "eth" + - fec: "KRFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "100G" + sysport: "161" + type: "eth" + - fec: "KRFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "100G" + sysport: "165" + type: "eth" + - fec: "KRFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "100G" + sysport: "153" + type: "eth" + - fec: "KRFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "100G" + sysport: "157" + type: "eth" + - fec: "KRFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "100G" + sysport: "145" + type: "eth" + - fec: "KRFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "100G" + sysport: "149" + type: "eth" + - fec: "KRFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "100G" + sysport: "137" + type: "eth" + - fec: "KRFEC" + id: "141" + lanes: "4:4" + serdes_group: "17" + speed: "100G" + sysport: "141" + type: "eth" + - fec: "KRFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "100G" + sysport: "129" + type: "eth" + - fec: "KRFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "100G" + sysport: "133" + type: "eth" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KRFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/inno.config.yaml new file mode 100755 index 000000000000..d44c7bc0bc28 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x100G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/port_config.ini new file mode 100644 index 000000000000..9999a677da49 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/port_config.ini @@ -0,0 +1,67 @@ +# name lanes speed index mtu +Ethernet0 249,250,251,252 100000 0 9126 +Ethernet4 253,254,255,256 100000 0 9126 +Ethernet8 241,242,243,244 100000 1 9126 +Ethernet12 245,246,247,248 100000 1 9126 +Ethernet16 233,234,235,236 100000 2 9126 +Ethernet20 237,238,239,240 100000 2 9126 +Ethernet24 225,226,227,228 100000 3 9126 +Ethernet28 229,230,231,232 100000 3 9126 +Ethernet32 217,218,219,220 100000 4 9126 +Ethernet36 221,222,223,224 100000 4 9126 +Ethernet40 209,210,211,212 100000 5 9126 +Ethernet44 213,214,215,216 100000 5 9126 +Ethernet48 201,202,203,204 100000 6 9126 +Ethernet52 205,206,207,208 100000 6 9126 +Ethernet56 193,194,195,196 100000 7 9126 +Ethernet60 197,198,199,200 100000 7 9126 +Ethernet64 185,186,187,188 100000 8 9126 +Ethernet68 189,190,191,192 100000 8 9126 +Ethernet72 177,178,179,180 100000 9 9126 +Ethernet76 181,182,183,184 100000 9 9126 +Ethernet80 169,170,171,172 100000 10 9126 +Ethernet84 173,174,175,176 100000 10 9126 +Ethernet88 161,162,163,164 100000 11 9126 +Ethernet92 165,166,167,168 100000 11 9126 +Ethernet96 153,154,155,156 100000 12 9126 +Ethernet100 157,158,159,160 100000 12 9126 +Ethernet104 145,146,147,148 100000 13 9126 +Ethernet108 149,150,151,152 100000 13 9126 +Ethernet112 137,138,139,140 100000 14 9126 +Ethernet116 141,142,143,144 100000 14 9126 +Ethernet120 129,130,131,132 100000 15 9126 +Ethernet124 133,134,135,136 100000 15 9126 +Ethernet128 121,122,123,124 100000 16 9126 +Ethernet132 125,126,127,128 100000 16 9126 +Ethernet136 113,114,115,116 100000 17 9126 +Ethernet140 117,118,119,120 100000 17 9126 +Ethernet144 97,98,99,100 100000 18 9126 +Ethernet148 101,102,103,104 100000 18 9126 +Ethernet152 105,106,107,108 100000 19 9126 +Ethernet156 109,110,111,112 100000 19 9126 +Ethernet160 81,82,83,84 100000 20 9126 +Ethernet164 85,86,87,88 100000 20 9126 +Ethernet168 89,90,91,92 100000 21 9126 +Ethernet172 93,94,95,96 100000 21 9126 +Ethernet176 65,66,67,68 100000 22 9126 +Ethernet180 69,70,71,72 100000 22 9126 +Ethernet184 73,74,75,76 100000 23 9126 +Ethernet188 77,78,79,80 100000 23 9126 +Ethernet192 49,50,51,52 100000 24 9126 +Ethernet196 53,54,55,56 100000 24 9126 +Ethernet200 57,58,59,60 100000 25 9126 +Ethernet204 61,62,63,64 100000 25 9126 +Ethernet208 33,34,35,36 100000 26 9126 +Ethernet212 37,38,39,40 100000 26 9126 +Ethernet216 41,42,43,44 100000 27 9126 +Ethernet220 45,46,47,48 100000 27 9126 +Ethernet224 17,18,19,20 100000 28 9126 +Ethernet228 21,22,23,24 100000 28 9126 +Ethernet232 25,26,27,28 100000 29 9126 +Ethernet236 29,30,31,32 100000 29 9126 +Ethernet240 1,2,3,4 100000 30 9126 +Ethernet244 5,6,7,8 100000 30 9126 +Ethernet248 9,10,11,12 100000 31 9126 +Ethernet252 13,14,15,16 100000 31 9126 +Ethernet256 257 10000 32 9126 +Ethernet257 258 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 new file mode 100755 index 000000000000..16f9b42a2166 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 64 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x100/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 new file mode 100644 index 000000000000..45cebf3b7144 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/buffers.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '300m' %} +{% set default_ports_num = 64 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "47218432", + "type": "ingress", + "mode": "dynamic", + "xoff": "17708800" + }, + "egress_lossy_pool": { + "size": "18874368", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"1433600", + "size":"1518", + "dynamic_th":"-4", + "xon_offset":"6272" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "static_th":"9721600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|4-5": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|0-3": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|6-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/config_64x200G_Delta-et-c032if.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/config_64x200G_Delta-et-c032if.yaml new file mode 100755 index 000000000000..4b75a205ab5c --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/config_64x200G_Delta-et-c032if.yaml @@ -0,0 +1,653 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.77700_B" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47" + sys_clk: "1720" + ifc_clk: "1200" + mac_clk: "1340" + + devports: + - id: "0" + sysport: "1000" + type: "cpu" + - fec: "KPFEC" + id: "249" + lanes: "0:4" + serdes_group: "31" + speed: "200G" + sysport: "249" + type: "eth" + - fec: "KPFEC" + id: "253" + lanes: "4:4" + serdes_group: "31" + speed: "200G" + sysport: "253" + type: "eth" + - fec: "KPFEC" + id: "241" + lanes: "0:4" + serdes_group: "30" + speed: "200G" + sysport: "241" + type: "eth" + - fec: "KPFEC" + id: "245" + lanes: "4:4" + serdes_group: "30" + speed: "200G" + sysport: "245" + type: "eth" + - fec: "KPFEC" + id: "233" + lanes: "0:4" + serdes_group: "29" + speed: "200G" + sysport: "233" + type: "eth" + - fec: "KPFEC" + id: "237" + lanes: "4:4" + serdes_group: "29" + speed: "200G" + sysport: "237" + type: "eth" + - fec: "KPFEC" + id: "225" + lanes: "0:4" + serdes_group: "28" + speed: "200G" + sysport: "225" + type: "eth" + - fec: "KPFEC" + id: "229" + lanes: "4:4" + serdes_group: "28" + speed: "200G" + sysport: "229" + type: "eth" + - fec: "KPFEC" + id: "217" + lanes: "0:4" + serdes_group: "27" + speed: "200G" + sysport: "217" + type: "eth" + - fec: "KPFEC" + id: "221" + lanes: "4:4" + serdes_group: "27" + speed: "200G" + sysport: "221" + type: "eth" + - fec: "KPFEC" + id: "209" + lanes: "0:4" + serdes_group: "26" + speed: "200G" + sysport: "209" + type: "eth" + - fec: "KPFEC" + id: "213" + lanes: "4:4" + serdes_group: "26" + speed: "200G" + sysport: "213" + type: "eth" + - fec: "KPFEC" + id: "201" + lanes: "0:4" + serdes_group: "25" + speed: "200G" + sysport: "201" + type: "eth" + - fec: "KPFEC" + id: "205" + lanes: "4:4" + serdes_group: "25" + speed: "200G" + sysport: "205" + type: "eth" + - fec: "KPFEC" + id: "193" + lanes: "0:4" + serdes_group: "24" + speed: "200G" + sysport: "193" + type: "eth" + - fec: "KPFEC" + id: "197" + lanes: "4:4" + serdes_group: "24" + speed: "200G" + sysport: "197" + type: "eth" + - fec: "KPFEC" + id: "185" + lanes: "0:4" + serdes_group: "23" + speed: "200G" + sysport: "185" + type: "eth" + - fec: "KPFEC" + id: "189" + lanes: "4:4" + serdes_group: "23" + speed: "200G" + sysport: "189" + type: "eth" + - fec: "KPFEC" + id: "177" + lanes: "0:4" + serdes_group: "22" + speed: "200G" + sysport: "177" + type: "eth" + - fec: "KPFEC" + id: "181" + lanes: "4:4" + serdes_group: "22" + speed: "200G" + sysport: "181" + type: "eth" + - fec: "KPFEC" + id: "169" + lanes: "0:4" + serdes_group: "21" + speed: "200G" + sysport: "169" + type: "eth" + - fec: "KPFEC" + id: "173" + lanes: "4:4" + serdes_group: "21" + speed: "200G" + sysport: "173" + type: "eth" + - fec: "KPFEC" + id: "161" + lanes: "0:4" + serdes_group: "20" + speed: "200G" + sysport: "161" + type: "eth" + - fec: "KPFEC" + id: "165" + lanes: "4:4" + serdes_group: "20" + speed: "200G" + sysport: "165" + type: "eth" + - fec: "KPFEC" + id: "153" + lanes: "0:4" + serdes_group: "19" + speed: "200G" + sysport: "153" + type: "eth" + - fec: "KPFEC" + id: "157" + lanes: "4:4" + serdes_group: "19" + speed: "200G" + sysport: "157" + type: "eth" + - fec: "KPFEC" + id: "145" + lanes: "0:4" + serdes_group: "18" + speed: "200G" + sysport: "145" + type: "eth" + - fec: "KPFEC" + id: "149" + lanes: "4:4" + serdes_group: "18" + speed: "200G" + sysport: "149" + type: "eth" + - fec: "KPFEC" + id: "137" + lanes: "0:4" + serdes_group: "17" + speed: "200G" + sysport: "137" + type: "eth" + - fec: "KPFEC" + id: "141" + lanes: "4:4" + serdes_group: "17" + speed: "200G" + sysport: "141" + type: "eth" + - fec: "KPFEC" + id: "129" + lanes: "0:4" + serdes_group: "16" + speed: "200G" + sysport: "129" + type: "eth" + - fec: "KPFEC" + id: "133" + lanes: "4:4" + serdes_group: "16" + speed: "200G" + sysport: "133" + type: "eth" + - fec: "KPFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "200G" + sysport: "121" + type: "eth" + - fec: "KPFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "200G" + sysport: "125" + type: "eth" + - fec: "KPFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "200G" + sysport: "113" + type: "eth" + - fec: "KPFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "200G" + sysport: "117" + type: "eth" + - fec: "KPFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "200G" + sysport: "97" + type: "eth" + - fec: "KPFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "200G" + sysport: "101" + type: "eth" + - fec: "KPFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "200G" + sysport: "105" + type: "eth" + - fec: "KPFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "200G" + sysport: "109" + type: "eth" + - fec: "KPFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "200G" + sysport: "81" + type: "eth" + - fec: "KPFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "200G" + sysport: "85" + type: "eth" + - fec: "KPFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "200G" + sysport: "89" + type: "eth" + - fec: "KPFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "200G" + sysport: "93" + type: "eth" + - fec: "KPFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "200G" + sysport: "65" + type: "eth" + - fec: "KPFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "200G" + sysport: "69" + type: "eth" + - fec: "KPFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "200G" + sysport: "73" + type: "eth" + - fec: "KPFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "200G" + sysport: "77" + type: "eth" + - fec: "KPFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "200G" + sysport: "49" + type: "eth" + - fec: "KPFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "200G" + sysport: "53" + type: "eth" + - fec: "KPFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "200G" + sysport: "57" + type: "eth" + - fec: "KPFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "200G" + sysport: "61" + type: "eth" + - fec: "KPFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "200G" + sysport: "33" + type: "eth" + - fec: "KPFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "200G" + sysport: "37" + type: "eth" + - fec: "KPFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "200G" + sysport: "41" + type: "eth" + - fec: "KPFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "200G" + sysport: "45" + type: "eth" + - fec: "KPFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "200G" + sysport: "17" + type: "eth" + - fec: "KPFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "200G" + sysport: "21" + type: "eth" + - fec: "KPFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "200G" + sysport: "25" + type: "eth" + - fec: "KPFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "200G" + sysport: "29" + type: "eth" + - fec: "KPFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "200G" + sysport: "1" + type: "eth" + - fec: "KPFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "200G" + sysport: "5" + type: "eth" + - fec: "KPFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "200G" + sysport: "9" + type: "eth" + - fec: "KPFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "200G" + sysport: "13" + type: "eth" + - fec: "NONE" + id: "257" + lanes: "0:1" + serdes_group: "32" + speed: "10G" + sysport: "257" + type: "mgmt 0" + - fec: "NONE" + id: "258" + lanes: "1:1" + serdes_group: "32" + speed: "10G" + sysport: "258" + type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "01010101" + rx_polarity: "01100000" + lane_swap: "23641075" + - id: "1" + tx_polarity: "10110000" + rx_polarity: "11111111" + lane_swap: "64317520" + - id: "2" + tx_polarity: "00000000" + rx_polarity: "00000011" + lane_swap: "63147520" + - id: "3" + tx_polarity: "01101000" + rx_polarity: "00001110" + lane_swap: "31572046" + - id: "4" + tx_polarity: "00111000" + rx_polarity: "00001000" + lane_swap: "46105732" + - id: "5" + tx_polarity: "10111111" + rx_polarity: "11101000" + lane_swap: "27153604" + - id: "6" + tx_polarity: "01101110" + rx_polarity: "00001101" + lane_swap: "46503721" + - id: "7" + tx_polarity: "01000100" + rx_polarity: "10000101" + lane_swap: "03671245" + - id: "8" + tx_polarity: "01110101" + rx_polarity: "00010000" + lane_swap: "12640375" + - id: "9" + tx_polarity: "01011100" + rx_polarity: "11001111" + lane_swap: "02561347" + - id: "10" + tx_polarity: "01110110" + rx_polarity: "11000000" + lane_swap: "12740365" + - id: "11" + tx_polarity: "00111000" + rx_polarity: "00010111" + lane_swap: "01572436" + - id: "12" + tx_polarity: "00001111" + rx_polarity: "10111001" + lane_swap: "54320176" + - id: "13" + tx_polarity: "10011101" + rx_polarity: "00111011" + lane_swap: "26153704" + - id: "14" + tx_polarity: "00110000" + rx_polarity: "11010000" + lane_swap: "37452601" + - id: "15" + tx_polarity: "11100010" + rx_polarity: "01110011" + lane_swap: "51370462" + - id: "16" + tx_polarity: "10111010" + rx_polarity: "11010011" + lane_swap: "36152704" + - id: "17" + tx_polarity: "01011101" + rx_polarity: "00110001" + lane_swap: "45621073" + - id: "18" + tx_polarity: "11011111" + rx_polarity: "11001011" + lane_swap: "26143705" + - id: "19" + tx_polarity: "00100110" + rx_polarity: "00001001" + lane_swap: "42730165" + - id: "20" + tx_polarity: "10011011" + rx_polarity: "01101101" + lane_swap: "54217603" + - id: "21" + tx_polarity: "00101110" + rx_polarity: "10111111" + lane_swap: "26031745" + - id: "22" + tx_polarity: "01001110" + rx_polarity: "00111001" + lane_swap: "36024715" + - id: "23" + tx_polarity: "10101101" + rx_polarity: "01010011" + lane_swap: "45621370" + - id: "24" + tx_polarity: "11001110" + rx_polarity: "00011111" + lane_swap: "65234701" + - id: "25" + tx_polarity: "01110001" + rx_polarity: "01010111" + lane_swap: "37601452" + - id: "26" + tx_polarity: "01000100" + rx_polarity: "00001111" + lane_swap: "65034721" + - id: "27" + tx_polarity: "10111101" + rx_polarity: "11000101" + lane_swap: "34501672" + - id: "28" + tx_polarity: "01111000" + rx_polarity: "01110110" + lane_swap: "43061275" + - id: "29" + tx_polarity: "11110111" + rx_polarity: "11100111" + lane_swap: "57304621" + - id: "30" + tx_polarity: "10000100" + rx_polarity: "00101111" + lane_swap: "47125603" + - id: "31" + tx_polarity: "11111111" + rx_polarity: "11100010" + lane_swap: "13460275" + - id: "32" + tx_polarity: "00000000" + rx_polarity: "00000000" + lane_swap: "01234567" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/inno.config.yaml b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/inno.config.yaml new file mode 100755 index 000000000000..f68930c37ef4 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/inno.config.yaml @@ -0,0 +1,7 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_64x200G_Delta-et-c032if.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.77700_B" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +ULIMIT : "65536" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/innovium.77700_B b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/innovium.77700_B new file mode 100644 index 000000000000..27297b313959 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/innovium.77700_B @@ -0,0 +1,59 @@ +sku: innovium.77700_B + +device_id: 0x1b58 + +# Hardware constraint information +hardware: + num_ibs: 6 + + ports_per_ib: 32, 32, 32, 32, 20, 20 + recirc_port_num: 32, 32, 32, 32, 32, 32 + cpu_port_num: 33 + cpu_port_ib: 0 + mgmt_port_num: 33 + mgmt_port_ibs: 1,2 + + pics_per_ib: 6, 7, 7, 6, 5, 5 + pic_ports_per_pic: 8 + max_serdes_speed: 50 + + num_shared_pics: 2 + + isg [0-4]: + ib: 0 + pic_id: [0-4] + + isg [5-9]: + ib: 5 + pic_id: [0-4] + + isg [10-14]: + ib: 1 + pic_id: [0-4] + + isg [16-20]: + ib: 3 + pic_id: [0-4] + + isg [21-25]: + ib: 4 + pic_id: [0-4] + + isg [26-30]: + ib: 2 + pic_id: [0-4] + + isg 15: + mode: 4:4 + ib: 1, 3 + pic_id: 5 + + isg 31: + mode: 4:4 + ib: 0, 2 + pic_id: 5 + + isg 32: + mode: 1:1 + ib: 1, 2 + pic_id: 6 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/port_config.ini b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/port_config.ini new file mode 100644 index 000000000000..726e1a377d83 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/port_config.ini @@ -0,0 +1,67 @@ +# name lanes speed index mtu +Ethernet0 249,250,251,252 200000 0 9126 +Ethernet4 253,254,255,256 200000 0 9126 +Ethernet8 241,242,243,244 200000 1 9126 +Ethernet12 245,246,247,248 200000 1 9126 +Ethernet16 233,234,235,236 200000 2 9126 +Ethernet20 237,238,239,240 200000 2 9126 +Ethernet24 225,226,227,228 200000 3 9126 +Ethernet28 229,230,231,232 200000 3 9126 +Ethernet32 217,218,219,220 200000 4 9126 +Ethernet36 221,222,223,224 200000 4 9126 +Ethernet40 209,210,211,212 200000 5 9126 +Ethernet44 213,214,215,216 200000 5 9126 +Ethernet48 201,202,203,204 200000 6 9126 +Ethernet52 205,206,207,208 200000 6 9126 +Ethernet56 193,194,195,196 200000 7 9126 +Ethernet60 197,198,199,200 200000 7 9126 +Ethernet64 185,186,187,188 200000 8 9126 +Ethernet68 189,190,191,192 200000 8 9126 +Ethernet72 177,178,179,180 200000 9 9126 +Ethernet76 181,182,183,184 200000 9 9126 +Ethernet80 169,170,171,172 200000 10 9126 +Ethernet84 173,174,175,176 200000 10 9126 +Ethernet88 161,162,163,164 200000 11 9126 +Ethernet92 165,166,167,168 200000 11 9126 +Ethernet96 153,154,155,156 200000 12 9126 +Ethernet100 157,158,159,160 200000 12 9126 +Ethernet104 145,146,147,148 200000 13 9126 +Ethernet108 149,150,151,152 200000 13 9126 +Ethernet112 137,138,139,140 200000 14 9126 +Ethernet116 141,142,143,144 200000 14 9126 +Ethernet120 129,130,131,132 200000 15 9126 +Ethernet124 133,134,135,136 200000 15 9126 +Ethernet128 121,122,123,124 200000 16 9126 +Ethernet132 125,126,127,128 200000 16 9126 +Ethernet136 113,114,115,116 200000 17 9126 +Ethernet140 117,118,119,120 200000 17 9126 +Ethernet144 97,98,99,100 200000 18 9126 +Ethernet148 101,102,103,104 200000 18 9126 +Ethernet152 105,106,107,108 200000 19 9126 +Ethernet156 109,110,111,112 200000 19 9126 +Ethernet160 81,82,83,84 200000 20 9126 +Ethernet164 85,86,87,88 200000 20 9126 +Ethernet168 89,90,91,92 200000 21 9126 +Ethernet172 93,94,95,96 200000 21 9126 +Ethernet176 65,66,67,68 200000 22 9126 +Ethernet180 69,70,71,72 200000 22 9126 +Ethernet184 73,74,75,76 200000 23 9126 +Ethernet188 77,78,79,80 200000 23 9126 +Ethernet192 49,50,51,52 200000 24 9126 +Ethernet196 53,54,55,56 200000 24 9126 +Ethernet200 57,58,59,60 200000 25 9126 +Ethernet204 61,62,63,64 200000 25 9126 +Ethernet208 33,34,35,36 200000 26 9126 +Ethernet212 37,38,39,40 200000 26 9126 +Ethernet216 41,42,43,44 200000 27 9126 +Ethernet220 45,46,47,48 200000 27 9126 +Ethernet224 17,18,19,20 200000 28 9126 +Ethernet228 21,22,23,24 200000 28 9126 +Ethernet232 25,26,27,28 200000 29 9126 +Ethernet236 29,30,31,32 200000 29 9126 +Ethernet240 1,2,3,4 200000 30 9126 +Ethernet244 5,6,7,8 200000 30 9126 +Ethernet248 9,10,11,12 200000 31 9126 +Ethernet252 13,14,15,16 200000 31 9126 +Ethernet256 257 10000 32 9126 +Ethernet257 258 10000 33 9126 diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 new file mode 100755 index 000000000000..16f9b42a2166 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/qos.json.j2 @@ -0,0 +1,120 @@ +{# Default values which will be used if no actual configura available #} + +{% set default_ports_num = 64 -%} +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx*4)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "1":"1", + "0":"0", + "3":"3", + "2":"2", + "5":"5", + "4":"4", + "7":"7", + "6":"6" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "0", + "0": "0", + "3": "0", + "2": "0", + "4": "1", + "5": "2", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"4", + "5":"5", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP:AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP:AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP:AZURE]", + "pfc_enable": "4,5" + } + } +} diff --git a/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/sai.profile b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/sai.profile new file mode 100755 index 000000000000..0769b3063a12 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/Delta-et-c032if_64x200/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/inno.config.yaml diff --git a/device/delta/x86_64-delta_et-c032if-r0/default_sku b/device/delta/x86_64-delta_et-c032if-r0/default_sku new file mode 100644 index 000000000000..92740942d0e9 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/default_sku @@ -0,0 +1 @@ +Delta-et-c032if t1 diff --git a/device/delta/x86_64-delta_et-c032if-r0/installer.conf b/device/delta/x86_64-delta_et-c032if-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/delta/x86_64-delta_et-c032if-r0/led_proc_init.soc b/device/delta/x86_64-delta_et-c032if-r0/led_proc_init.soc new file mode 100644 index 000000000000..4173de277f6b --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/led_proc_init.soc @@ -0,0 +1,10 @@ +#ET_C032IF Port_Remap +# Vlan set and port enable + +# led0 port order remap + +#ET_C032IF_LED + +#-------------------------------------------------------------------------------------------------- +#LED Auto link/up + diff --git a/device/delta/x86_64-delta_et-c032if-r0/plugins/eeprom.py b/device/delta/x86_64-delta_et-c032if-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1a624414637c --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/plugins/eeprom.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +############################################################################# +# Mellanox +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-10/10-0053/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py b/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py new file mode 100644 index 000000000000..80383aaffddf --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/plugins/psuutil.py @@ -0,0 +1,78 @@ +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# + +import os.path +import subprocess + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + self.psu_status = "ipmitool raw 0x38 0x1 {} 0x50" + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + p = os.popen("ipmitool raw 0x38 0x2 7 0x32 0x28 1") + content = p.readline().rstrip() + reg_value = int(content, 16) + mask = (1 << (8 - index)) + if reg_value & mask == 0: + return False + status = 1 + p.close() + except IOError: + return False + return status == 1 + + + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + status = 0 + try: + p = os.popen(self.psu_status.format(index - 1)) + content = p.readline().rstrip() + reg_value = int(content, 16) + if reg_value != 0: + return False + status = 1 + p.close() + except IOError: + return False + return status == 1 + diff --git a/device/delta/x86_64-delta_et-c032if-r0/plugins/sfputil.py b/device/delta/x86_64-delta_et-c032if-r0/plugins/sfputil.py new file mode 100644 index 000000000000..4802c3a8f0ce --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/plugins/sfputil.py @@ -0,0 +1,255 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import datetime + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_START_SFP = 32 + PORT_END = 33 + PORTS_IN_BLOCK = 34 + + EEPROM_OFFSET = 1 + + _port_to_eeprom_mapping = {} + port_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_start_sfp(self): + return self.PORT_START_SFP + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + @property + def get_transceiver_status(self): + + try: + reg_file = open("/sys/devices/platform/delta-et-c032if-cpld.0/sfp_is_present") + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + reg_file.close() + + return int(content, 16) + + + def __init__(self): + eeprom_path = "/sys/kernel/sfp/eeprom_sfp_{0}" + + for x in range(0, self.port_end + 1): + self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) + + self.modprs_register = self.get_transceiver_status + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/delta-et-c032if-cpld.0/sfp_is_present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (self.port_end - port_num + 6)) + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end - 2: + return False + + try: + reg_file = open("/sys/devices/platform/delta-et-c032if-cpld.0/sfp_lp_mode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (self.port_end - port_num) - 2) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end - 2: + return False + + try: + reg_file = open("/sys/devices/platform/delta-et-c032if-cpld.0/sfp_lp_mode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (self.port_end - port_num) - 2) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value).rstrip("L") or "0" + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def reset(self, port_num): + QSFP_RESET_REGISTER_DEVICE_FILE = "/sys/devices/platform/delta-et-c032if-cpld.0/sfp_reset" + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end - 2: + return False + + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = reg_file.readline().rstrip() + + # File content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << (self.port_end - port_num) - 2) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the register to take port out of reset + try: + reg_file = open(QSFP_RESET_REGISTER_DEVICE_FILE, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + port_dict = {} + port = self.port_start + forever = False + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print "get_transceiver_change_event:Invalid timeout value", timeout + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print 'get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout + + return False, {} # Time wrap or possibly incorrect timeout + while timeout >= 0: + # Check for OIR events and return updated port_dict + reg_value = self.get_transceiver_status + if reg_value != self.modprs_register: + changed_ports = self.modprs_register ^ reg_value + while port >= self.port_start and port <= self.port_end: + + # Mask off the bit corresponding to our port + mask = (1 << (self.port_end - port + 6)) + + if changed_ports & mask: + # ModPrsL is active low + if reg_value & mask == 0: + port_dict[port] = '1' + else: + port_dict[port] = '0' + + port += 1 + + # Update reg value + self.modprs_register = reg_value + return True, port_dict + + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + print "get_transceiver_change_event: Should not reach here." + return False, {} diff --git a/device/delta/x86_64-delta_et-c032if-r0/sensors.conf b/device/delta/x86_64-delta_et-c032if-r0/sensors.conf new file mode 100644 index 000000000000..db34a541b26f --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/sensors.conf @@ -0,0 +1,4 @@ +# libsensors configuration file for DELTA-ET-C032IF +# ------------------------------------------------ +# + diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 9ad3355e3c5e..06726e335f9c 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -29,6 +29,8 @@ elif [ "$platform" == "barefoot" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" elif [ "$platform" == "vs" ]; then ORCHAGENT_ARGS+="-m $MAC_ADDRESS" +elif [ "$platform" == "innovium" ]; then + ORCHAGENT_ARGS+="-m $MAC_ADDRESS" fi exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp-sv2/Dockerfile.j2 index 7e6fb5f5caec..b269d49adef1 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp-sv2/Dockerfile.j2 @@ -17,7 +17,7 @@ RUN apt-get update RUN apt-get install -y curl ca-certificates # Install gcc which is required for installing hiredis -RUN apt-get install -y gcc make +RUN apt-get install -y gcc make ipmitool {% if docker_snmp_sv2_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/platform/innovium/docker-orchagent-invm.mk b/platform/innovium/docker-orchagent-invm.mk new file mode 100755 index 000000000000..64850188864f --- /dev/null +++ b/platform/innovium/docker-orchagent-invm.mk @@ -0,0 +1,5 @@ +# docker image for orchagent + +DOCKER_ORCHAGENT_PLATFORM_CODE = innovium +include $(PLATFORM_PATH)/../template/docker-orchagent-base.mk + diff --git a/platform/innovium/docker-ptf-invm.mk b/platform/innovium/docker-ptf-invm.mk new file mode 100755 index 000000000000..6c81734676fd --- /dev/null +++ b/platform/innovium/docker-ptf-invm.mk @@ -0,0 +1,7 @@ +# docker image for docker-ptf-invm + +DOCKER_PTF_INVM = docker-ptf-invm.gz +$(DOCKER_PTF_INVM)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift +$(DOCKER_PTF_INVM)_DEPENDS += $(PYTHON_SAITHRIFT_INVM) +$(DOCKER_PTF_INVM)_LOAD_DOCKERS += $(DOCKER_PTF) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_INVM) diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk new file mode 100755 index 000000000000..9bed9a21d4a6 --- /dev/null +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -0,0 +1,17 @@ +# docker image for innovium syncd with rpc + +DOCKER_SYNCD_INVM_RPC = docker-syncd-invm-rpc.gz +$(DOCKER_SYNCD_INVM_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-invm-rpc +$(DOCKER_SYNCD_INVM_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(INVM_LIBSAI) +$(DOCKER_SYNCD_INVM_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_INVM) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) +ifeq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) +endif + +$(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 new file mode 100755 index 000000000000..af31d587b90a --- /dev/null +++ b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 @@ -0,0 +1,53 @@ +FROM docker-syncd-invm + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +COPY \ +{% for deb in docker_syncd_invm_rpc_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -P syncd + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_syncd_invm_rpc_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + net-tools \ + python-pip \ + build-essential \ + libssl-dev \ + libffi-dev \ + python-dev \ + libpython2.7 \ + libjansson4 \ + wget \ + cmake \ + && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ + && tar xvfz 1.0.0.tar.gz \ + && cd nanomsg-1.0.0 \ + && mkdir -p build \ + && cmake . \ + && make install \ + && ldconfig \ + && cd .. \ + && rm -fr nanomsg-1.0.0 \ + && rm -f 1.0.0.tar.gz \ + && pip install cffi==1.7.0 \ + && pip install --upgrade cffi==1.7.0 \ + && pip install nnpy \ + && mkdir -p /opt \ + && cd /opt \ + && wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \ + && apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \ + && rm -rf /root/deps + +COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] + +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/platform/innovium/docker-syncd-invm-rpc/ptf_nn_agent.conf b/platform/innovium/docker-syncd-invm-rpc/ptf_nn_agent.conf new file mode 100755 index 000000000000..fa1ed0eb1622 --- /dev/null +++ b/platform/innovium/docker-syncd-invm-rpc/ptf_nn_agent.conf @@ -0,0 +1,10 @@ +[program:ptf_nn_agent] +command=/usr/bin/python /opt/ptf_nn_agent.py --device-socket 1@tcp://0.0.0.0:10900 -i 1-3@Ethernet12 --set-iface-rcv-buffer=109430400 +process_name=ptf_nn_agent +stdout_logfile=/tmp/ptf_nn_agent.out.log +stderr_logfile=/tmp/ptf_nn_agent.err.log +redirect_stderr=false +autostart=true +autorestart=true +startsecs=1 +numprocs=1 diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk new file mode 100755 index 000000000000..3e34bdd7574c --- /dev/null +++ b/platform/innovium/docker-syncd-invm.mk @@ -0,0 +1,17 @@ +# docker image for innovium syncd + +DOCKER_SYNCD_INVM = docker-syncd-invm.gz +$(DOCKER_SYNCD_INVM)_PATH = $(PLATFORM_PATH)/docker-syncd-invm +$(DOCKER_SYNCD_INVM)_DEPENDS += $(SYNCD) $(INVM_LIBSAI) +$(DOCKER_SYNCD_INVM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) +SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM) +ifneq ($(ENABLE_SYNCD_RPC),y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM) +endif + +$(DOCKER_SYNCD_INVM)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_INVM)_RUN_OPT += --net=host --privileged -t +$(DOCKER_SYNCD_INVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_INVM)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_INVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SYNCD_INVM)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 new file mode 100755 index 000000000000..d38258576dd3 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -0,0 +1,34 @@ +FROM docker-config-engine + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +COPY \ +{% for deb in docker_syncd_invm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +# Needed for Innovium Debug Shell +RUN apt-get install -y net-tools +RUN apt-get install -y libpython2.7 +RUN apt-get install -y libjansson4 + +RUN dpkg -i \ +{% for deb in docker_syncd_invm_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +## TODO: add kmod into Depends +RUN apt-get install -f kmod + +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/innovium/docker-syncd-invm/start.sh b/platform/innovium/docker-syncd-invm/start.sh new file mode 100755 index 000000000000..623316050475 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/start.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +supervisorctl start syncd diff --git a/platform/innovium/docker-syncd-invm/supervisord.conf b/platform/innovium/docker-syncd-invm/supervisord.conf new file mode 100755 index 000000000000..1af5d70a1d0c --- /dev/null +++ b/platform/innovium/docker-syncd-invm/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:syncd] +command=/usr/bin/syncd_start.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/innovium/invm-sai.mk b/platform/innovium/invm-sai.mk new file mode 100755 index 000000000000..24a7da915cd6 --- /dev/null +++ b/platform/innovium/invm-sai.mk @@ -0,0 +1,14 @@ +# INVM SAI + +INVM_SAI_ONLINE = https://github.com/Innovium/SONiC/raw/master/debian/201811 + +INVM_LIBSAI = isai.deb +INVM_HSAI = saihdr.deb +INVM_DRV = ipd.deb + +$(INVM_LIBSAI)_URL = $(INVM_SAI_ONLINE)/$(INVM_LIBSAI) +$(INVM_HSAI)_URL = $(INVM_SAI_ONLINE)/$(INVM_HSAI) +$(INVM_DRV)_URL = $(INVM_SAI_ONLINE)/$(INVM_DRV) + +SONIC_ONLINE_DEBS += $(INVM_LIBSAI) $(INVM_HSAI) $(INVM_DRV) +SONIC_STRETCH_DEBS += $(INVM_DRV) diff --git a/platform/innovium/libsaithrift-dev.mk b/platform/innovium/libsaithrift-dev.mk new file mode 100755 index 000000000000..d13df765b0fd --- /dev/null +++ b/platform/innovium/libsaithrift-dev.mk @@ -0,0 +1,7 @@ +# libsaithrift-dev package + +LIBSAITHRIFT_DEV_INVM = libsaithrift-dev_0.9.4_amd64.deb +$(LIBSAITHRIFT_DEV_INVM)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI +$(LIBSAITHRIFT_DEV_INVM)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(INVM_LIBSAI) $(INVM_HSAI) +$(LIBSAITHRIFT_DEV_INVM)_RDEPENDS += $(LIBTHRIFT) $(INVM_HSAI) +SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV_INVM) diff --git a/platform/innovium/one-image.mk b/platform/innovium/one-image.mk new file mode 100755 index 000000000000..485f40c77652 --- /dev/null +++ b/platform/innovium/one-image.mk @@ -0,0 +1,10 @@ +# sonic innovium ONE image installer + +SONIC_ONE_IMAGE = sonic-innovium.bin +$(SONIC_ONE_IMAGE)_MACHINE = innovium +$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CEL_MIDSTONE_200I_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELTA_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_INSTALLS += $(INVM_DRV) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/innovium/platform-modules-cel.mk b/platform/innovium/platform-modules-cel.mk new file mode 100755 index 000000000000..054bfefc310b --- /dev/null +++ b/platform/innovium/platform-modules-cel.mk @@ -0,0 +1,12 @@ +# Celestica platform modules + +CEL_PLATFORM_MODULE_VERSION = 0.2.2 + +export CEL_PLATFORM_MODULE_VERSION + +CEL_MIDSTONE_200I_PLATFORM_MODULE = platform-modules-midstone-200i_$(CEL_PLATFORM_MODULE_VERSION)_amd64.deb +$(CEL_MIDSTONE_200I_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cel +$(CEL_MIDSTONE_200I_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CEL_MIDSTONE_200I_PLATFORM_MODULE)_PLATFORM = x86_64-cel_midstone-r0 +SONIC_DPKG_DEBS += $(CEL_MIDSTONE_200I_PLATFORM_MODULE) +SONIC_STRETCH_DEBS+= $(CEL_MIDSTONE_200I_PLATFORM_MODULE) diff --git a/platform/innovium/platform-modules-delta.mk b/platform/innovium/platform-modules-delta.mk new file mode 100644 index 000000000000..a8172f13731a --- /dev/null +++ b/platform/innovium/platform-modules-delta.mk @@ -0,0 +1,13 @@ +# Delta Platform modules + +DELTA_ETC032IF_PLATFORM_MODULE_VERSION = 1.1 + +export DELTA_ETC032IF_PLATFORM_MODULE_VERSION + +DELTA_PLATFORM_MODULE = platform-modules-et-c032if_$(DELTA_ETC032IF_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-delta +$(DELTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(DELTA_PLATFORM_MODULE)_PLATFORM = x86_64-delta_et-c032if-r0 + +SONIC_DPKG_DEBS += $(DELTA_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(DELTA_PLATFORM_MODULE) diff --git a/platform/innovium/platform.conf b/platform/innovium/platform.conf new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/innovium/python-saithrift.mk b/platform/innovium/python-saithrift.mk new file mode 100755 index 000000000000..f578b34f758b --- /dev/null +++ b/platform/innovium/python-saithrift.mk @@ -0,0 +1,6 @@ +# python-saithrift package + +PYTHON_SAITHRIFT_INVM = python-saithrift_1.2.1_amd64.deb +$(PYTHON_SAITHRIFT_INVM)_SRC_PATH = $(SRC_PATH)/SAI +$(PYTHON_SAITHRIFT_INVM)_DEPENDS += $(INVM_LIBSAI) $(INVM_HSAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV) +SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_INVM) diff --git a/platform/innovium/rules.mk b/platform/innovium/rules.mk new file mode 100755 index 000000000000..635696a8c7a8 --- /dev/null +++ b/platform/innovium/rules.mk @@ -0,0 +1,21 @@ +include $(PLATFORM_PATH)/invm-sai.mk +include $(PLATFORM_PATH)/platform-modules-cel.mk +include $(PLATFORM_PATH)/platform-modules-delta.mk +include $(PLATFORM_PATH)/docker-orchagent-invm.mk +include $(PLATFORM_PATH)/docker-syncd-invm.mk +include $(PLATFORM_PATH)/docker-syncd-invm-rpc.mk +include $(PLATFORM_PATH)/one-image.mk +include $(PLATFORM_PATH)/libsaithrift-dev.mk +include $(PLATFORM_PATH)/python-saithrift.mk +include $(PLATFORM_PATH)/docker-ptf-invm.mk + +SONIC_ALL += $(SONIC_INVM_ONE_IMAGE) \ + $(DOCKER_FPM) \ + $(DOCKER_PTF_INVM) \ + $(DOCKER_SYNCD_INVM_RPC) + +# Inject invm sai into sairedis +$(LIBSAIREDIS)_DEPENDS += $(INVM_HSAI) $(INVM_LIBSAI) $(LIBSAITHRIFT_DEV_INVM) + +# Runtime dependency on invm sai is set only for syncd +$(SYNCD)_RDEPENDS += $(INVM_HSAI) diff --git a/platform/innovium/sonic-platform-modules-cel/.gitignore b/platform/innovium/sonic-platform-modules-cel/.gitignore new file mode 100755 index 000000000000..f805e810e5c6 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/.gitignore @@ -0,0 +1,33 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su diff --git a/platform/innovium/sonic-platform-modules-cel/LICENSE b/platform/innovium/sonic-platform-modules-cel/LICENSE new file mode 100755 index 000000000000..2386a3920c07 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2017 Celestica, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/innovium/sonic-platform-modules-cel/README.md b/platform/innovium/sonic-platform-modules-cel/README.md new file mode 100755 index 000000000000..fbda62f91eae --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/README.md @@ -0,0 +1 @@ +# Platform drivers for Celestica Midstone-200i for the SONiC project diff --git a/platform/innovium/sonic-platform-modules-cel/debian/changelog b/platform/innovium/sonic-platform-modules-cel/debian/changelog new file mode 100755 index 000000000000..4a4e5ed2b0a0 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/changelog @@ -0,0 +1,28 @@ +sonic-cel-platform-modules (0.2.2) unstable; urgency=low + + * Remove I2c mux ininitialization in init-script. + * Remapping virtual I2c ports number in sfputil. + * Fix qsfp driver, missing present status of sfp+ ports. + * Updated sfputil for decode sfp+ EEPROM. + * Add watchdog driver. + + -- Wirut Getbamrung Wed, 1 Feb 2018 16:00:00 +0700 + +sonic-cel-platform-modules (0.2.1) unstable; urgency=low + + * Fix module init-script not load CPLD virtual i2c driver properly. + + -- Pradchaya Phucharoen Mon, 9 Oct 2017 14:24:25 +0700 + +sonic-cel-platform-modules (0.2.0) unstable; urgency=low + + * Add sysfs interface to reset sfp ports. + * Fix qsfp driver, low power mode set/get incorrect bit. + + -- Pradchaya Phucharoen Tue, 26 Sep 2017 11:50:23 +0700 + +sonic-cel-platform-modules (0.1) unstable; urgency=low + + * Initial platform module. + + -- Pradchaya Phucharoen Tue, 23 Aug 2017 10:43:00 +0700 diff --git a/platform/innovium/sonic-platform-modules-cel/debian/compat b/platform/innovium/sonic-platform-modules-cel/debian/compat new file mode 100755 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/innovium/sonic-platform-modules-cel/debian/control b/platform/innovium/sonic-platform-modules-cel/debian/control new file mode 100755 index 000000000000..a8f3fd5e46b2 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/control @@ -0,0 +1,11 @@ +Source: sonic-cel-platform-modules +Section: main +Priority: extra +Maintainer: Wirut Getbamrung +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-midstone-200i +Architecture: amd64 +Depends: linux-image-4.9.0-9-amd64 +Description: kernel modules for platform devices diff --git a/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.init b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.init new file mode 100755 index 000000000000..7074d2b58125 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.init @@ -0,0 +1,52 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: $portmap +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup 200i board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + # Attach TLV 0x56 eeprom + echo 24lc64t 0x56 > /sys/bus/i2c/devices/i2c-0/new_device + sleep 2 + + modprobe 200i-cpld + sleep 2 + + # Turn off/down lpmod by defult (0 - Normal, 1 - Low Pow) + echo 0x00 > /sys/devices/platform/ms200i_cpld/qsfp_lpmode + + # Attach 64 instances of EEPROM driver QSFP ports + for ((n=1;n<=66;n++)); + do + echo sff8436 0x50 > /sys/bus/i2c/devices/i2c-$n/new_device + sleep 0.1 + done + + echo "done." + ;; + +stop) + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-200i.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.install b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.install new file mode 100644 index 000000000000..4f298feb8300 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.install @@ -0,0 +1,2 @@ +midstone-200i/cfg/midstone-200i-modules.conf etc/modules-load.d +midstone-200i/systemd/platform-modules-midstone-200i.service lib/systemd/system \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.postinst b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.postinst new file mode 100644 index 000000000000..213661ea1e84 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/platform-modules-midstone-200i.postinst @@ -0,0 +1,3 @@ +depmod -a +systemctl enable platform-modules-midstone-200i.service +systemctl start platform-modules-midstone-200i.service \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-cel/debian/rules b/platform/innovium/sonic-platform-modules-cel/debian/rules new file mode 100755 index 000000000000..3b01ad7e6555 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= midstone-200i + +%: + dh $@ + +override_dh_auto_build: + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) + +override_dh_auto_install: + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -pplatform-modules-$${mod} \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ + debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + done) + +override_dh_usrlocal: + +override_dh_clean: + dh_clean + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/cfg/midstone-200i-modules.conf b/platform/innovium/sonic-platform-modules-cel/midstone-200i/cfg/midstone-200i-modules.conf new file mode 100755 index 000000000000..b2a3e351c4c9 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/cfg/midstone-200i-modules.conf @@ -0,0 +1,15 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus + +i2c-mux-gpio +i2c-mux-pca954x +ipmi-devintf diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_cpld.c b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_cpld.c new file mode 100755 index 000000000000..3a99d2304029 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_cpld.c @@ -0,0 +1,854 @@ +/* + * ms200i_cpld.c - driver for MidStone's CPLD + * + * Copyright (C) 2017 Celestica Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "ms200i_cpld" + +#define RESET0102 0xA248 +#define RESET0310 0xA2DC +#define RESET1118 0xA2DD +#define RESET1926 0xA2DE +#define RESET2733 0xA2DF +#define RESET3441 0xA31C +#define RESET4249 0xA31D +#define RESET5057 0xA31E +#define RESET5864 0xA31F + +#define LPMOD0102 0xA249 +#define LPMOD0310 0xA2E0 +#define LPMOD1118 0xA2E1 +#define LPMOD1926 0xA2E2 +#define LPMOD2733 0xA2E3 +#define LPMOD3441 0xA320 +#define LPMOD4249 0xA321 +#define LPMOD5057 0xA322 +#define LPMOD5864 0xA323 + +#define ABS0102 0xA24A +#define ABS0310 0xA2E4 +#define ABS1118 0xA2E5 +#define ABS1926 0xA2E6 +#define ABS2733 0xA2E7 +#define ABS3441 0xA324 +#define ABS4249 0xA325 +#define ABS5057 0xA326 +#define ABS5864 0xA327 + +#define ABS6566 0xA244 + +#define INT0102 0xA24B +#define INT0310 0xA2E8 +#define INT1118 0xA2E9 +#define INT1926 0xA2EA +#define INT2733 0xA2EB +#define INT3441 0xA328 +#define INT4249 0xA329 +#define INT5057 0xA32A +#define INT5864 0xA32B + +#define LENGTH_PORT_CPLD 66 + +#define CPLD2_EX_CP_I2CFDR0_I2C 0xA230 +#define CPLD2_EX_CP_I2CCR0_I2C 0xA231 +#define CPLD2_EX_CP_I2CSR0_I2C 0xA232 +#define CPLD2_EX_CP_I2CDR0_I2C 0xA233 +#define CPLD2_EX_CP_I2CID0_I2C 0xA234 + +#define CPLD3_EX_CP_I2CFDR0_I2C 0xA2D0 +#define CPLD3_EX_CP_I2CCR0_I2C 0xA2D1 +#define CPLD3_EX_CP_I2CSR0_I2C 0xA2D2 +#define CPLD3_EX_CP_I2CDR0_I2C 0xA2D3 +#define CPLD3_EX_CP_I2CID0_I2C 0xA2D4 + +#define CPLD4_EX_CP_I2CFDR0_I2C 0xA310 +#define CPLD4_EX_CP_I2CCR0_I2C 0xA311 +#define CPLD4_EX_CP_I2CSR0_I2C 0xA312 +#define CPLD4_EX_CP_I2CDR0_I2C 0xA313 +#define CPLD4_EX_CP_I2CID0_I2C 0xA314 + +enum { + I2C_SR_BIT_RXAK = 0, + I2C_SR_BIT_MIF, + I2C_SR_BIT_SRW, + I2C_SR_BIT_BCSTM, + I2C_SR_BIT_MAL, + I2C_SR_BIT_MBB, + I2C_SR_BIT_MAAS, + I2C_SR_BIT_MCF +}; + +enum { + I2C_CR_BIT_BCST = 0, + I2C_CR_BIT_RSTA = 2, + I2C_CR_BIT_TXAK, + I2C_CR_BIT_MTX, + I2C_CR_BIT_MSTA, + I2C_CR_BIT_MIEN, + I2C_CR_BIT_MEN, +}; + +#ifdef DEBUG_KERN +#define info(fmt,args...) printk(KERN_INFO "line %3d : "fmt,__LINE__,##args) +#define check(REG) printk(KERN_INFO "line %3d : %-8s = %2.2X",__LINE__,#REG,inb(REG)); +#else +#define info(fmt,args...) +#define check(REG) +#endif + +#define GET_REG_BIT(REG,BIT) ((inb(REG) >> BIT) & 0x01) +#define SET_REG_BIT_H(REG,BIT) outb(inb(REG) | (0x01 << BIT),REG) +#define SET_REG_BIT_L(REG,BIT) outb(inb(REG) & ~(0x01 << BIT),REG) + +struct ms200i_i2c_data { + int portid; + unsigned REG_FDR0; + unsigned REG_CR0; + unsigned REG_SR0; + unsigned REG_DR0; + unsigned REG_ID0; +}; + +struct ms200i_cpld_data { + struct i2c_adapter *i2c_adapter[LENGTH_PORT_CPLD]; + struct mutex cpld_lock; + unsigned char sfpp_lpmode[2]; + unsigned char sfpp_reset[2]; +}; + +struct ms200i_cpld_data *cpld_data; + +int strtobp(const char* str,unsigned char *bytes){ + unsigned length = strlen(str); + if(length > 20){ + return 0; + } + int i,b=0; + memset(bytes,0,10); + for(i=0;i= '0' && c <= '9'){ + byte = c - '0'; + }else if(c >= 'a' && c <= 'f'){ + byte = c - 'a' + 0x0a; + }else if(c >= 'A' && c <= 'F'){ + byte = c - 'A' + 0x0a; + }else if(c == 'x' || c == 'X'){ + break; + }else{ + continue; + } + if(b%2==0) + bytes[b/2] = byte & 0x0F; + else + bytes[b/2] += (byte << 4) & 0xF0; + b++; + } + return (i/2) + (i%2); +} + +static ssize_t get_reset(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + unsigned long reset = 0; + + mutex_lock(&cpld_data->cpld_lock); + + reset = + ((unsigned long)(inb(RESET5864) & 0x7F) << 57 )| + ((unsigned long) inb(RESET5057) << 49 )| + ((unsigned long) inb(RESET4249) << 41 )| + ((unsigned long) inb(RESET3441) << 33 )| + ((unsigned long)(inb(RESET2733) & 0x7F) << 26 )| + ((unsigned long) inb(RESET1926) << 18 )| + ((unsigned long) inb(RESET1118) << 10 )| + ((unsigned long) inb(RESET0310) << 2 )| + ((unsigned long)(inb(RESET0102) & 0x03) ); + + mutex_unlock(&cpld_data->cpld_lock); + + return sprintf(buf,"0x%x%16.16lx\n", + cpld_data->sfpp_reset[1] << 1 | cpld_data->sfpp_reset[0], + reset & 0x3ffffffffffffffff); +} + +static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + unsigned char reset[10]; + int num; + + mutex_lock(&cpld_data->cpld_lock); + + num = strtobp(buf,reset); + if (num <= 0) + { + mutex_unlock(&cpld_data->cpld_lock); + return 22; + } + + outb (( reset[0] & 0x03 ) ,RESET0102); + outb (((reset[0] >>2) & 0x3F) | + (((reset[1] ) & 0x03) << 6),RESET0310); + outb (((reset[1] >>2) & 0x3F) | + (((reset[2] ) & 0x03) << 6),RESET1118); + outb (((reset[2] >>2) & 0x3F) | + (((reset[3] ) & 0x03) << 6),RESET1926); + outb (((reset[3] >>2) & 0x3F) | + (((reset[4] ) & 0x01) << 6),RESET2733); + outb (((reset[4] >>1) & 0x7F) | + (((reset[5] ) & 0x01) << 7),RESET3441); + outb (((reset[5] >>1) & 0x7F) | + (((reset[6] ) & 0x01) << 7),RESET4249); + outb (((reset[6] >>1) & 0x7F) | + (((reset[7] ) & 0x01) << 7),RESET5057); + outb (((reset[7] >>1) & 0x7F) ,RESET5864); + + cpld_data->sfpp_reset[0] = reset[8] & 0x01; + cpld_data->sfpp_reset[1] = (reset[8]>>1) & 0x01; + + mutex_unlock(&cpld_data->cpld_lock); + + return count; +} + +static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + unsigned long lpmod = 0; + + mutex_lock(&cpld_data->cpld_lock); + + lpmod = + ((unsigned long)(inb(LPMOD5864) & 0x7F) << 57 )| + ((unsigned long) inb(LPMOD5057) << 49 )| + ((unsigned long) inb(LPMOD4249) << 41 )| + ((unsigned long) inb(LPMOD3441) << 33 )| + ((unsigned long)(inb(LPMOD2733) & 0x7F) << 26 )| + ((unsigned long) inb(LPMOD1926) << 18 )| + ((unsigned long) inb(LPMOD1118) << 10 )| + ((unsigned long) inb(LPMOD0310) << 2 )| + ((unsigned long)(inb(LPMOD0102) & 0x03) ); + + mutex_unlock(&cpld_data->cpld_lock); + + return sprintf(buf,"0x%x%16.16lx\n", + cpld_data->sfpp_lpmode[1] << 1 | cpld_data->sfpp_lpmode[0], + lpmod & 0xffffffffffffffff); +} + +static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + unsigned char lpmod[10]; + int num; + + mutex_lock(&cpld_data->cpld_lock); + + num = strtobp(buf,lpmod); + if (num <= 0) + { + mutex_unlock(&cpld_data->cpld_lock); + return 22; + } + + outb (( lpmod[0] & 0x03 ) ,LPMOD0102); + outb (((lpmod[0] >>2) & 0x3F) | + (((lpmod[1] ) & 0x03) << 6),LPMOD0310); + outb (((lpmod[1] >>2) & 0x3F) | + (((lpmod[2] ) & 0x03) << 6),LPMOD1118); + outb (((lpmod[2] >>2) & 0x3F) | + (((lpmod[3] ) & 0x03) << 6),LPMOD1926); + outb (((lpmod[3] >>2) & 0x3F) | + (((lpmod[4] ) & 0x01) << 6),LPMOD2733); + outb (((lpmod[4] >>1) & 0x7F) | + (((lpmod[5] ) & 0x01) << 7),LPMOD3441); + outb (((lpmod[5] >>1) & 0x7F) | + (((lpmod[6] ) & 0x01) << 7),LPMOD4249); + outb (((lpmod[6] >>1) & 0x7F) | + (((lpmod[7] ) & 0x01) << 7),LPMOD5057); + outb (((lpmod[7] >>1) & 0x7F) ,LPMOD5864); + + cpld_data->sfpp_lpmode[0] = lpmod[8] & 0x01; + cpld_data->sfpp_lpmode[1] = (lpmod[8]>>1) & 0x01; + + mutex_unlock(&cpld_data->cpld_lock); + + return count; +} + +static ssize_t get_modprs(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + unsigned long present; + int present_sfp; + + mutex_lock(&cpld_data->cpld_lock); + present = + ((unsigned long)(inb(ABS5864) & 0x7F) << 57 )| + ((unsigned long) inb(ABS5057) << 49 )| + ((unsigned long) inb(ABS4249) << 41 )| + ((unsigned long) inb(ABS3441) << 33 )| + ((unsigned long)(inb(ABS2733) & 0x7F) << 26 )| + ((unsigned long) inb(ABS1926) << 18 )| + ((unsigned long) inb(ABS1118) << 10 )| + ((unsigned long) inb(ABS0310) << 2 )| + ((unsigned long)(inb(ABS0102) & 0x03) ); + + present_sfp = (inb(ABS6566) & 0x03); + mutex_unlock(&cpld_data->cpld_lock); + + return sprintf(buf,"0x%d%16.16lx\n", present_sfp, present & 0xffffffffffffffff); +} + +static ssize_t get_modirq(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + unsigned long irq; + + mutex_lock(&cpld_data->cpld_lock); + + irq = + ((unsigned long)(inb(INT5864) & 0x7F) << 57 )| + ((unsigned long) inb(INT5057) << 49 )| + ((unsigned long) inb(INT4249) << 41 )| + ((unsigned long) inb(INT3441) << 33 )| + ((unsigned long)(inb(INT2733) & 0x7F) << 26 )| + ((unsigned long) inb(INT1926) << 18 )| + ((unsigned long) inb(INT1118) << 10 )| + ((unsigned long) inb(INT0310) << 2 )| + ((unsigned long)(inb(INT0102) & 0x03) ); + + mutex_unlock(&cpld_data->cpld_lock); + + return sprintf(buf,"0x%17.17lx\n", irq & 0x3ffffffffffffffff); +} + +static DEVICE_ATTR(qsfp_reset , S_IRUGO | S_IWUSR, get_reset, set_reset); +static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); +static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); +static DEVICE_ATTR(qsfp_modirq, S_IRUGO, get_modirq, NULL); + +static struct attribute *ms200i_lpc_attrs[] = { + &dev_attr_qsfp_reset.attr, + &dev_attr_qsfp_lpmode.attr, + &dev_attr_qsfp_modprs.attr, + &dev_attr_qsfp_modirq.attr, + NULL, +}; + +static struct attribute_group ms200i_lpc_attr_grp = { + .attrs = ms200i_lpc_attrs, +}; + +static struct resource cel_ms200i_lpc_resources[] = { + { + .flags = IORESOURCE_IO, + }, +}; + +static void cel_ms200i_lpc_dev_release( struct device * dev) +{ + return; +} + +static struct platform_device cel_ms200i_lpc_dev = { + .name = DRIVER_NAME, + .id = -1, + .num_resources = ARRAY_SIZE(cel_ms200i_lpc_resources), + .resource = cel_ms200i_lpc_resources, + .dev = { + .release = cel_ms200i_lpc_dev_release, + } +}; + + +static int i2c_wait_ack(struct i2c_adapter *a,unsigned timeout,int writing){ + int error = 0; + unsigned tick=0; + int Status; + + struct ms200i_i2c_data *new_data = i2c_get_adapdata(a); + + check(new_data->REG_SR0); + check(new_data->REG_CR0); + + while(1){ + Status = inb(new_data->REG_SR0); + tick++; + if(tick > timeout){ + info("Status %2.2X",Status); + info("Error Timeout"); + error = -ETIMEDOUT; + break; + } + + + if(Status & (1 << I2C_SR_BIT_MIF)){ + break; + } + + if(writing == 0 && (Status & (1<REG_SR0); + outb(0, new_data->REG_SR0); + + if(error<0){ + info("Status %2.2X",Status); + return error; + } + + if(!(Status & (1 << I2C_SR_BIT_MCF))){ + info("Error Unfinish"); + return -EIO; + } + + if(Status & (1 <REG_CR0,1<cpld_lock); + + /* Write the command register */ + new_data = i2c_get_adapdata(a); + + unsigned int portid = new_data->portid; + +#ifdef DEBUG_KERN + printk(KERN_INFO "portid %2d|@ 0x%2.2X|f 0x%4.4X|(%d)%-5s| (%d)%-10s|CMD %2.2X |DAT %4.4X" + ,portid,addr,flags,rw,rw == 1 ? "READ ":"WRITE" + ,size, size == 0 ? "QUICK" : + size == 1 ? "BYTE" : + size == 2 ? "BYTE_DATA" : + size == 3 ? "WORD_DATA" : + size == 4 ? "PROC_CALL" : + size == 5 ? "BLOCK_DATA" : "ERROR" + ,cmd,data->word); +#endif + /* Map the size to what the chip understands */ + switch (size) { + case I2C_SMBUS_QUICK: + case I2C_SMBUS_BYTE: + case I2C_SMBUS_BYTE_DATA: + case I2C_SMBUS_WORD_DATA: + case I2C_SMBUS_BLOCK_DATA: + break; + default: + printk(KERN_INFO "Unsupported transaction %d\n", size); + error = -EOPNOTSUPP; + goto Done; + } + + unsigned int REG_FDR0; + unsigned int REG_CR0; + unsigned int REG_SR0; + unsigned int REG_DR0; + unsigned int REG_ID0; + + REG_FDR0 = new_data->REG_FDR0; + REG_CR0 = new_data->REG_CR0; + REG_SR0 = new_data->REG_SR0; + REG_DR0 = new_data->REG_DR0; + REG_ID0 = new_data->REG_ID0; + outb(portid,REG_ID0); + + int timeout=0; + int cnt=0; + + ////[S][ADDR/R] + //Clear status register + outb( 0 , REG_SR0); + outb( 1 << I2C_CR_BIT_MIEN | 1 << I2C_CR_BIT_MTX | 1 << I2C_CR_BIT_MSTA ,REG_CR0); + SET_REG_BIT_H(REG_CR0,I2C_CR_BIT_MEN); + + if(rw == I2C_SMBUS_READ && + (size == I2C_SMBUS_QUICK || size == I2C_SMBUS_BYTE)){ + // sent device address with Read mode + outb(addr << 1 | 0x01,REG_DR0); + }else{ + // sent device address with Write mode + outb(addr << 1 | 0x00,REG_DR0); + } + + + + info( "MS Start"); + + //// Wait {A} + error = i2c_wait_ack(a,50000,1); + if(error<0){ + info( "get error %d",error); + goto Done; + } + + //// [CMD]{A} + if(size == I2C_SMBUS_BYTE_DATA || + size == I2C_SMBUS_WORD_DATA || + size == I2C_SMBUS_BLOCK_DATA || + (size == I2C_SMBUS_BYTE && rw == I2C_SMBUS_WRITE)){ + + //sent command code to data register + outb(cmd,REG_DR0); + info( "MS Send CMD 0x%2.2X",cmd); + + // Wait {A} + error = i2c_wait_ack(a,50000,1); + if(error<0){ + info( "get error %d",error); + goto Done; + } + } + + switch(size){ + case I2C_SMBUS_BYTE_DATA: + cnt = 1; break; + case I2C_SMBUS_WORD_DATA: + cnt = 2; break; + case I2C_SMBUS_BLOCK_DATA: + // in block data mode keep number of byte in block[0] + cnt = data->block[0]; + break; + default: + cnt = 0; break; + } + + // [CNT] used only bloack data write + if(size == I2C_SMBUS_BLOCK_DATA && rw == I2C_SMBUS_WRITE){ + + outb(cnt,REG_DR0); + info( "MS Send CNT 0x%2.2X",cnt); + + // Wait {A} + error = i2c_wait_ack(a,50000,1); + if(error<0){ + info( "get error %d",error); + goto Done; + } + } + + // [DATA]{A} + if( rw == I2C_SMBUS_WRITE && ( + size == I2C_SMBUS_BYTE || + size == I2C_SMBUS_BYTE_DATA || + size == I2C_SMBUS_WORD_DATA || + size == I2C_SMBUS_BLOCK_DATA + )){ + int bid=0; + info( "MS prepare to sent [%d bytes]",cnt); + if(size == I2C_SMBUS_BLOCK_DATA ){ + bid=1; // block[0] is cnt; + cnt+=1; // offset from block[0] + } + for(;bidblock[bid],REG_DR0); + info( " Data > %2.2X",data->block[bid]); + // Wait {A} + error = i2c_wait_ack(a,50000,1); + if(error<0){ + goto Done; + } + } + + } + + //REPEATE START + if( rw == I2C_SMBUS_READ && ( + size == I2C_SMBUS_BYTE_DATA || + size == I2C_SMBUS_WORD_DATA || + size == I2C_SMBUS_BLOCK_DATA + )){ + info( "MS Repeated Start"); + + SET_REG_BIT_L(REG_CR0,I2C_CR_BIT_MEN); + outb(1 << I2C_CR_BIT_MIEN | + 1 << I2C_CR_BIT_MTX | + 1 << I2C_CR_BIT_MSTA | + 1 << I2C_CR_BIT_RSTA ,REG_CR0); + SET_REG_BIT_H(REG_CR0,I2C_CR_BIT_MEN); + + // sent Address with Read mode + outb( addr<<1 | 0x1 ,REG_DR0); + + // Wait {A} + error = i2c_wait_ack(a,50000,1); + if(error<0){ + goto Done; + } + + } + + if( rw == I2C_SMBUS_READ && ( + size == I2C_SMBUS_BYTE || + size == I2C_SMBUS_BYTE_DATA || + size == I2C_SMBUS_WORD_DATA || + size == I2C_SMBUS_BLOCK_DATA + )){ + + switch(size){ + case I2C_SMBUS_BYTE: + case I2C_SMBUS_BYTE_DATA: + cnt = 1; break; + case I2C_SMBUS_WORD_DATA: + cnt = 2; break; + case I2C_SMBUS_BLOCK_DATA: + //will be changed after recived first data + cnt = 3; break; + default: + cnt = 0; break; + } + + int bid = 0; + info( "MS Receive"); + + //set to Receive mode + outb(1 << I2C_CR_BIT_MEN | + 1 << I2C_CR_BIT_MIEN | + 1 << I2C_CR_BIT_MSTA , REG_CR0); + + for(bid=-1;bidblock[bid] = inb(REG_DR0); + + info( "DATA IN [%d] %2.2X",bid,data->block[bid]); + + if(size==I2C_SMBUS_BLOCK_DATA && bid == 0){ + cnt = data->block[0] + 1; + } + } + } + } + + +Stop: + //[P] + SET_REG_BIT_L(REG_CR0,I2C_CR_BIT_MSTA); + info( "MS STOP"); + +Done: + outb(1<cpld_lock); + + return error; +} + +static u32 ms200i_i2c_func(struct i2c_adapter *a) +{ + return I2C_FUNC_SMBUS_QUICK | + I2C_FUNC_SMBUS_BYTE | + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_BLOCK_DATA; +} + +static const struct i2c_algorithm ms200i_i2c_algorithm = { + .smbus_xfer = ms200i_i2c_access, + .functionality = ms200i_i2c_func, +}; + +static struct i2c_adapter * cel_ms200i_i2c_init(struct platform_device *pdev, int portid) +{ + int error; + + struct i2c_adapter *new_adapter; + struct ms200i_i2c_data *new_data; + + new_adapter = kzalloc(sizeof(*new_adapter), GFP_KERNEL); + if (!new_adapter) + return NULL; + + new_adapter->dev.parent = &pdev->dev; + new_adapter->owner = THIS_MODULE; + new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + new_adapter->algo = &ms200i_i2c_algorithm; + + snprintf(new_adapter->name, sizeof(new_adapter->name), + "SMBus ms200i i2c Adapter portid@%04x", portid); + + new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); + if (!new_data) + return NULL; + + new_data->portid = portid; + + // QSFP 1-2 and SFP 1-2 + if((portid >= 1 && portid <= 2) || (portid >= 65 && portid <= 66)){ + new_data->REG_FDR0 = CPLD2_EX_CP_I2CFDR0_I2C; + new_data->REG_CR0 = CPLD2_EX_CP_I2CCR0_I2C; + new_data->REG_SR0 = CPLD2_EX_CP_I2CSR0_I2C; + new_data->REG_DR0 = CPLD2_EX_CP_I2CDR0_I2C; + new_data->REG_ID0 = CPLD2_EX_CP_I2CID0_I2C; + + }else if((portid >= 3 && portid <= 33)){ + new_data->REG_FDR0 = CPLD3_EX_CP_I2CFDR0_I2C; + new_data->REG_CR0 = CPLD3_EX_CP_I2CCR0_I2C; + new_data->REG_SR0 = CPLD3_EX_CP_I2CSR0_I2C; + new_data->REG_DR0 = CPLD3_EX_CP_I2CDR0_I2C; + new_data->REG_ID0 = CPLD3_EX_CP_I2CID0_I2C; + + }else if((portid >= 34 && portid <= 64)){ + new_data->REG_FDR0 = CPLD4_EX_CP_I2CFDR0_I2C; + new_data->REG_CR0 = CPLD4_EX_CP_I2CCR0_I2C; + new_data->REG_SR0 = CPLD4_EX_CP_I2CSR0_I2C; + new_data->REG_DR0 = CPLD4_EX_CP_I2CDR0_I2C; + new_data->REG_ID0 = CPLD4_EX_CP_I2CID0_I2C; + } + outb(portid,new_data->REG_ID0); + outb(0x1F,new_data->REG_FDR0); // 0x1F 100kHz + + + i2c_set_adapdata(new_adapter,new_data); + + error = i2c_add_adapter(new_adapter); + if(error) + return NULL; + + return new_adapter; +}; + +static int cel_ms200i_lpc_drv_probe(struct platform_device *pdev) +{ + struct resource *res; + int ret =0; + int portid_count; + + cpld_data = devm_kzalloc(&pdev->dev, sizeof(struct ms200i_cpld_data), + GFP_KERNEL); + if (!cpld_data) + return -ENOMEM; + + mutex_init(&cpld_data->cpld_lock); + + res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (unlikely(!res)) { + printk(KERN_ERR " Specified Resource Not Available...\n"); + return -1; + } + + ret = sysfs_create_group(&pdev->dev.kobj, &ms200i_lpc_attr_grp); + if (ret) { + printk(KERN_ERR "Cannot create sysfs\n"); + } + + for(portid_count=1 ; portid_count<=LENGTH_PORT_CPLD ; portid_count++) + cpld_data->i2c_adapter[portid_count-1] = cel_ms200i_i2c_init(pdev, portid_count); + return 0; +} + +static int cel_ms200i_lpc_drv_remove(struct platform_device *pdev) +{ + int portid_count; + struct ms200i_i2c_data *new_data; + + sysfs_remove_group(&pdev->dev.kobj, &ms200i_lpc_attr_grp); + + for (portid_count=1 ; portid_count<=LENGTH_PORT_CPLD ; portid_count++) + i2c_del_adapter(cpld_data->i2c_adapter[portid_count-1]); + return 0; +} + +static struct platform_driver cel_ms200i_lpc_drv = { + .probe = cel_ms200i_lpc_drv_probe, + .remove = __exit_p(cel_ms200i_lpc_drv_remove), + .driver = { + .name = DRIVER_NAME, + }, +}; + +int cel_ms200i_lpc_init(void) +{ + platform_device_register(&cel_ms200i_lpc_dev); + platform_driver_register(&cel_ms200i_lpc_drv); + + return 0; +} + +void cel_ms200i_lpc_exit(void) +{ + platform_driver_unregister(&cel_ms200i_lpc_drv); + platform_device_unregister(&cel_ms200i_lpc_dev); +} + +module_init(cel_ms200i_lpc_init); +module_exit(cel_ms200i_lpc_exit); + +MODULE_AUTHOR("Pariwat Leamsumran "); +MODULE_DESCRIPTION("Celestica MidStone ms200i LPC Driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_wdt.c b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_wdt.c new file mode 100755 index 000000000000..9b3d79cc5a67 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/200i_wdt.c @@ -0,0 +1,363 @@ +/* + * Watchdog driver for the Midstone 200i + * + * Copyright (C) 2017 Celestica Corp. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRIVER_NAME "ms200i_wdt" + +#define CONF_GPIOBASE 0x8000F848 +#define PCI_CONFIG_ADDRESS 0x0CF8 +#define PCI_CONFIG_DATA 0x0CFC + +// WDT_CTRL is GPIO 32 +// GPIOBUS: 2 ,bit: 0th +#define WDT_CTRL_ENB_REG 0x30 +#define WDT_CTRL_DIR_REG 0x34 +#define WDT_CTRL_LVL_REG 0x38 +#define WDT_CTRL_MASK (unsigned long)(1<<(32%32)) + +// WDT_FEED is GPIO 15 +// GPIOBUS: 1 ,bit: 15th +#define WDT_FEED_ENB_REG 0x00 +#define WDT_FEED_DIR_REG 0x04 +#define WDT_FEED_LVL_REG 0x0C +#define WDT_FEED_MASK (unsigned long)(1<<(15%32)) + +static bool nowayout = WATCHDOG_NOWAYOUT; + +// For enabling Debug message +//#define ENAB_DEBUG +//#define ENAB_DEBUG_GPIO + +struct ms200i_wdt_drvdata { + struct watchdog_device wdt; + struct mutex lock; + unsigned int gpiobase; +}; + +static struct resource ms200i_wdt_resources[] = { + { + .flags = IORESOURCE_IO, + }, +}; + +static void ms200i_wdt_dev_release( struct device * dev) +{ + return; +} + +static struct platform_device ms200i_wdt_dev = { + .name = DRIVER_NAME, + .id = -1, + .num_resources = ARRAY_SIZE(ms200i_wdt_resources), + .resource = ms200i_wdt_resources, + .dev = { + .release = ms200i_wdt_dev_release, + } +}; + +static int ms200i_wdt_start(struct watchdog_device *wdt_dev) +{ + struct ms200i_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); + unsigned char reset_ctrl = 0x00; + unsigned long enab, gpio ,dir; + unsigned int base_addr; +#ifdef ENAB_DEBUG + printk(KERN_INFO "WDT Start"); +#endif + mutex_lock(&drvdata->lock); + + base_addr = drvdata->gpiobase; + + enab = inl(base_addr + WDT_CTRL_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl enab %16X",enab); +#endif + enab |= WDT_CTRL_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl enab %16X",enab); +#endif + outl(enab, base_addr + WDT_CTRL_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + enab = inl(base_addr + WDT_CTRL_ENB_REG); + printk(KERN_INFO "ctrl enab %16X",enab); +#endif + + enab = inl(base_addr + WDT_FEED_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed enab %16X",enab); +#endif + enab |= WDT_FEED_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed enab %16X",enab); +#endif + outl(enab, base_addr + WDT_FEED_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + enab = inl(base_addr + WDT_FEED_ENB_REG); + printk(KERN_INFO "feed enab %16X",enab); +#endif + + dir = inl(base_addr + WDT_CTRL_DIR_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl dir %16X",dir); +#endif + dir &= ~WDT_FEED_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl dir %16X",dir); +#endif + outl(dir, base_addr + WDT_CTRL_DIR_REG); +#ifdef ENAB_DEBUG_GPIO + dir = inl(base_addr + WDT_CTRL_DIR_REG); + printk(KERN_INFO "ctrl dir %16X",dir); +#endif + + dir = inl(base_addr + WDT_FEED_DIR_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed dir %16X",dir); +#endif + dir &= ~WDT_FEED_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed dir %16X",dir); +#endif + outl(dir, base_addr + WDT_FEED_DIR_REG); +#ifdef ENAB_DEBUG_GPIO + dir = inl(base_addr + WDT_FEED_DIR_REG); + printk(KERN_INFO "feed dir %16X",dir); +#endif + + gpio = inl(base_addr + WDT_CTRL_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + gpio &= ~WDT_CTRL_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + outl_p( gpio, base_addr + WDT_CTRL_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + gpio = inl(base_addr + WDT_CTRL_LVL_REG); + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + + mutex_unlock(&drvdata->lock); + printk(KERN_INFO "WDT Start Finish"); + return 0; +} + +static int ms200i_wdt_stop(struct watchdog_device *wdt_dev) +{ + struct ms200i_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); + unsigned long gpio; + unsigned long base_addr; +#ifdef ENAB_DEBUG + printk(KERN_INFO "WDT Stop"); +#endif + mutex_lock(&drvdata->lock); + + base_addr = drvdata->gpiobase; + + gpio = inl(base_addr + WDT_CTRL_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + gpio &= ~(WDT_CTRL_MASK); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + outl_p(gpio, base_addr + WDT_CTRL_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + gpio = inl(base_addr + WDT_CTRL_ENB_REG); + printk(KERN_INFO "ctrl gpio %16X",gpio); +#endif + + gpio = inl(base_addr + WDT_FEED_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + gpio &= ~(WDT_CTRL_MASK); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + outl_p(gpio, base_addr + WDT_FEED_ENB_REG); +#ifdef ENAB_DEBUG_GPIO + gpio = inl(base_addr + WDT_FEED_ENB_REG); + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + + mutex_unlock(&drvdata->lock); + + return 0; +} + +static int ms200i_wdt_ping(struct watchdog_device *wdt_dev) +{ + struct ms200i_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); + unsigned long gpio; + unsigned long base_addr; + +#ifdef ENAB_DEBUG + printk(KERN_INFO "WDT PING"); +#endif + mutex_lock(&drvdata->lock); + + base_addr = drvdata->gpiobase; + + gpio = inl(base_addr + WDT_FEED_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + gpio &= ~WDT_FEED_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + outl_p( gpio, base_addr + WDT_FEED_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + gpio = inl(base_addr + WDT_FEED_LVL_REG); + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + mdelay(10); + + gpio = inl(base_addr + WDT_FEED_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + gpio |= WDT_FEED_MASK; +#ifdef ENAB_DEBUG_GPIO + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + outl_p( gpio, base_addr + WDT_FEED_LVL_REG); +#ifdef ENAB_DEBUG_GPIO + gpio = inl(base_addr + WDT_FEED_LVL_REG); + printk(KERN_INFO "feed gpio %16X",gpio); +#endif + + mutex_unlock(&drvdata->lock); +#ifdef ENAB_DEBUG + printk(KERN_INFO "WDT PING FINISH"); +#endif + return 0; +} + +static const struct watchdog_info ms200i_wdt_info = { + .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .identity = "MS200i Watchdog", +}; + +static const struct watchdog_ops ms200i_wdt_ops = { + .owner = THIS_MODULE, + .start = ms200i_wdt_start, + .stop = ms200i_wdt_stop, + .ping = ms200i_wdt_ping, +}; + +static int ms200i_wdt_probe(struct platform_device *pdev) +{ + struct ms200i_wdt_drvdata *drvdata; + int ret; + unsigned int base_addr; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), + GFP_KERNEL); + if (!drvdata) { + ret = -ENOMEM; + goto err; + } + + outl(CONF_GPIOBASE, PCI_CONFIG_ADDRESS); + base_addr = inl(PCI_CONFIG_DATA); + // remove last bit , that is hardware inditcate. + base_addr &= ~(0x01); + + if(base_addr == 0){ + printk(KERN_INFO "can't get gpio base address"); + }else{ + printk(KERN_INFO "gpio base address : %8.8X",base_addr); + } + + mutex_init(&drvdata->lock); + + drvdata->gpiobase = base_addr; + drvdata->wdt.info = &ms200i_wdt_info; + drvdata->wdt.ops = &ms200i_wdt_ops; + + watchdog_set_nowayout(&drvdata->wdt, nowayout); + watchdog_set_drvdata(&drvdata->wdt, drvdata); + + ret = watchdog_register_device(&drvdata->wdt); + if (ret != 0) { + dev_err(&pdev->dev, "watchdog_register_device() failed: %d\n", + ret); + goto err; + } + + platform_set_drvdata(pdev, drvdata); + +err: + return ret; +} + +static int ms200i_wdt_remove(struct platform_device *pdev) +{ + struct ms200i_wdt_drvdata *drvdata = platform_get_drvdata(pdev); + + watchdog_unregister_device(&drvdata->wdt); +#ifdef ENAB_DEBUG + printk(KERN_INFO "MS200i WDT Remove"); +#endif + return 0; +} + +static struct platform_driver ms200i_wdt_drv = { + .probe = ms200i_wdt_probe, + .remove = ms200i_wdt_remove, + .driver = { + .name = DRIVER_NAME, + }, +}; + +int ms200i_wdt_init(void) +{ +#ifdef ENAB_DEBUG + printk(KERN_INFO "MS200i WDT Init"); +#endif + platform_device_register(&ms200i_wdt_dev); + platform_driver_register(&ms200i_wdt_drv); + + return 0; +} + +void ms200i_wdt_exit(void) +{ +#ifdef ENAB_DEBUG + printk(KERN_INFO "MS200i WDT Exit"); +#endif + platform_driver_unregister(&ms200i_wdt_drv); + platform_device_unregister(&ms200i_wdt_dev); +} + +module_init(ms200i_wdt_init); +module_exit(ms200i_wdt_exit); + +MODULE_AUTHOR("Sittisak Sinprem "); +MODULE_DESCRIPTION("Midstone ms200i Watchdog"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ms200i-watchdog"); diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/Makefile b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/Makefile new file mode 100755 index 000000000000..932a13cf8253 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/Makefile @@ -0,0 +1 @@ +obj-m := 200i_cpld.o mc24lc64t.o 200i_wdt.o diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/mc24lc64t.c b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/mc24lc64t.c new file mode 100755 index 000000000000..a391056d09a7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/modules/mc24lc64t.c @@ -0,0 +1,142 @@ +/* + * mc24lc64t.c - driver for Microchip 24LC64T + * + * Copyright (C) 2017 Celestica Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct mc24lc64t_data { + struct i2c_client *fake_client; + struct mutex update_lock; +}; + +static ssize_t mc24lc64t_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct i2c_client *client = kobj_to_i2c_client(kobj); + struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); + unsigned long timeout, read_time, i = 0; + int status; + + mutex_lock(&drvdata->update_lock); + + if (i2c_smbus_write_byte_data(client, off>>8, off)) + { + status = -EIO; + goto exit; + } + + msleep(1); + +begin: + + if (i < count) + { + timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/ + do { + read_time = jiffies; + + status = i2c_smbus_read_byte(client); + if (status >= 0) + { + buf[i++] = status; + goto begin; + } + } while (time_before(read_time, timeout)); + + status = -ETIMEDOUT; + goto exit; + } + + status = count; + +exit: + mutex_unlock(&drvdata->update_lock); + + return status; +} + +static struct bin_attribute mc24lc64t_bit_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = 65536, + .read = mc24lc64t_read, +}; + +static int mc24lc64t_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adapter = client->adapter; + struct mc24lc64t_data *drvdata; + int err; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA + | I2C_FUNC_SMBUS_READ_BYTE)) + return -EPFNOSUPPORT; + + if (!(drvdata = devm_kzalloc(&client->dev, + sizeof(struct mc24lc64t_data), GFP_KERNEL))) + return -ENOMEM; + + drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + if (!drvdata->fake_client) + return -ENOMEM; + + i2c_set_clientdata(client, drvdata); + mutex_init(&drvdata->update_lock); + + err = sysfs_create_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); + if (err) + i2c_unregister_device(drvdata->fake_client); + + return err; +} + +static int mc24lc64t_remove(struct i2c_client *client) +{ + struct mc24lc64t_data *drvdata = i2c_get_clientdata(client); + + i2c_unregister_device(drvdata->fake_client); + + sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr); + + return 0; +} + +static const struct i2c_device_id mc24lc64t_id[] = { + { "24lc64t", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, mc24lc64t_id); + +static struct i2c_driver mc24lc64t_driver = { + .driver = { + .name = "mc24lc64t", + .owner = THIS_MODULE, + }, + .probe = mc24lc64t_probe, + .remove = mc24lc64t_remove, + .id_table = mc24lc64t_id, +}; + +module_i2c_driver(mc24lc64t_driver); + +MODULE_AUTHOR("Abhisit Sangjan "); +MODULE_DESCRIPTION("Microchip 24LC64T Driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-cel/midstone-200i/systemd/platform-modules-midstone-200i.service b/platform/innovium/sonic-platform-modules-cel/midstone-200i/systemd/platform-modules-midstone-200i.service new file mode 100644 index 000000000000..dbb7aed39df7 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-cel/midstone-200i/systemd/platform-modules-midstone-200i.service @@ -0,0 +1,13 @@ +[Unit] +Description=Celestica Midstone 200i platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-midstone-200i start +ExecStop=-/etc/init.d/platform-modules-midstone-200i stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-delta/LICENSE b/platform/innovium/sonic-platform-modules-delta/LICENSE new file mode 100644 index 000000000000..ea87fe9caabe --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Delta Networks, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/innovium/sonic-platform-modules-delta/common/modules/dni_emc2305.c b/platform/innovium/sonic-platform-modules-delta/common/modules/dni_emc2305.c new file mode 100644 index 000000000000..73d9900af5b4 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/common/modules/dni_emc2305.c @@ -0,0 +1,381 @@ +/* + * + * + * Copyright (C) 2017 Delta Networks, Inc. + * + * This program is free software; you can redistribute it + * and/or modify it under the terms ofthe GNU General Public License as + * published by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * + * + * + * + * A hwmon driver for the SMSC EMC2305 fan controller + * Complete datasheet is available (6/2013) at: + * http://www.smsc.com/media/Downloads_Public/Data_Sheets/2305.pdf + */ + +#include +#include +#include +#include +#include + + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf); +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count); +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf); +static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, 0x2F, 0x4C, + 0x4D, I2C_CLIENT_END + }; + + +#define EMC2305_REG_DEVICE 0xFD +#define EMC2305_REG_VENDOR 0xFE + +//#define FAN_MINIMUN 0x33 /*20%*/ +#define FAN_MINIMUN 0x0 /*0%*/ +#define FAN_RPM_BASED 0xAB + +#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * n) +#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * n) +#define EMC2305_REG_FAN_TACH(n) (0x3E + 0x10 * n) +#define EMC2305_REG_FAN_CONF(n) (0x32 + 0x10 * n) +#define EMC2305_REG_FAN_REAR_H_RPM(n) (0x3D + 0x10 * n) +#define EMC2305_REG_FAN_REAR_L_RPM(n) (0x3C + 0x10 * n) + +#define EMC2305_DEVICE 0x34 +#define EMC2305_VENDOR 0x5D +#define MAX_FAN_SPEED 23000 + +struct emc2305_data +{ + struct device *hwmon_dev; + struct attribute_group attrs; + struct mutex lock; +}; + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info); +static int emc2305_remove(struct i2c_client *client); + +static const struct i2c_device_id emc2305_id[] = +{ + { "emc2305", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, emc2305_id); + +static struct i2c_driver emc2305_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = { + .name = "emc2305", + }, + .probe = emc2305_probe, + .remove = emc2305_remove, + .id_table = emc2305_id, + .detect = emc2305_detect, + .address_list = normal_i2c, +}; + +static SENSOR_DEVICE_ATTR(fan1_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 0); +static SENSOR_DEVICE_ATTR(fan2_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 1); +static SENSOR_DEVICE_ATTR(fan3_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 2); +static SENSOR_DEVICE_ATTR(fan4_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 3); +static SENSOR_DEVICE_ATTR(fan5_input, S_IWUSR | S_IRUGO, show_fan, set_fan, 4); +static SENSOR_DEVICE_ATTR(fan1_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 0); +static SENSOR_DEVICE_ATTR(fan2_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 1); +static SENSOR_DEVICE_ATTR(fan3_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 2); +static SENSOR_DEVICE_ATTR(fan4_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 3); +static SENSOR_DEVICE_ATTR(fan5_input_percentage, S_IWUSR | S_IRUGO, show_fan_percentage, set_fan_percentage, 4); +static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); +static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); +static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); +static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4); + +static struct attribute *emc2305_attr[] = +{ + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan1_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan2_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan3_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan4_input_percentage.dev_attr.attr, + &sensor_dev_attr_fan5_input_percentage.dev_attr.attr, + &sensor_dev_attr_pwm1.dev_attr.attr, + &sensor_dev_attr_pwm2.dev_attr.attr, + &sensor_dev_attr_pwm3.dev_attr.attr, + &sensor_dev_attr_pwm4.dev_attr.attr, + &sensor_dev_attr_pwm5.dev_attr.attr, + NULL +}; + +static ssize_t show_fan_percentage(struct device *dev, struct device_attribute * devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + if ((int)(3932160 * 2 / (val > 0 ? val : 1) == 960))return sprintf(buf, "%d\n", 0); + return sprintf(buf, "%d\n", (int)(3932160 * 2 / (val > 0 ? val : 1) * 100 / MAX_FAN_SPEED)); +} + + +static ssize_t set_fan_percentage(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 100) + { + return -EINVAL; + } + + if (val <= 5) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + val = val * 230; + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + + +static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + + mutex_lock(&data->lock); + val = i2c_smbus_read_word_swapped(client, + EMC2305_REG_FAN_TACH(attr->index)); + mutex_unlock(&data->lock); + /* Left shift 3 bits for showing correct RPM */ + val = val >> 3; + return sprintf(buf, "%d\n", 3932160 * 2 / (val > 0 ? val : 1)); +} + +static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long hsb, lsb; + unsigned long tech; + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 23000) + { + return -EINVAL; + } + + if (val <= 960) + { + hsb = 0xff; /*high bit*/ + lsb = 0xe0; /*low bit*/ + } + else + { + tech = (3932160 * 2) / (val > 0 ? val : 1); + hsb = (uint8_t)(((tech << 3) >> 8) & 0x0ff); + lsb = (uint8_t)((tech << 3) & 0x0f8); + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_H_RPM(attr->index), hsb); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_REAR_L_RPM(attr->index), lsb); + mutex_unlock(&data->lock); + return count; +} + +static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + int val; + + mutex_lock(&data->lock); + val = i2c_smbus_read_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index)); + mutex_unlock(&data->lock); + return sprintf(buf, "%d\n", val); +} + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + struct i2c_client *client = to_i2c_client(dev); + struct emc2305_data *data = i2c_get_clientdata(client); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + { + return ret; + } + if (val > 255) + { + return -EINVAL; + } + + mutex_lock(&data->lock); + i2c_smbus_write_byte_data(client, + EMC2305_REG_FAN_DRIVE(attr->index), + val); + mutex_unlock(&data->lock); + return count; +} + +static int emc2305_detect(struct i2c_client *client, + struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = client->adapter; + int vendor, device; + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + { + return -ENODEV; + } + + vendor = i2c_smbus_read_byte_data(client, EMC2305_REG_VENDOR); + if (vendor != EMC2305_VENDOR) + { + return -ENODEV; + } + + device = i2c_smbus_read_byte_data(client, EMC2305_REG_DEVICE); + if (device != EMC2305_DEVICE) + { + return -ENODEV; + } + + strlcpy(info->type, "emc2305", I2C_NAME_SIZE); + + return 0; +} + +static int emc2305_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct emc2305_data *data; + int err; + int i; + + data = devm_kzalloc(&client->dev, sizeof(struct emc2305_data), + GFP_KERNEL); + if (!data) + { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s chip found\n", client->name); + + data->attrs.attrs = emc2305_attr; + err = sysfs_create_group(&client->dev.kobj, &data->attrs); + if (err) + { + return err; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + err = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + for (i = 0; i < 5; i++) + { + /* set minimum drive to 0% */ + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i), FAN_MINIMUN); + i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_CONF(i), FAN_RPM_BASED); + } + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return err; +} + +static int emc2305_remove(struct i2c_client *client) +{ + struct emc2305_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->attrs); + return 0; +} + +module_i2c_driver(emc2305_driver); + +MODULE_AUTHOR("Neal Tai"); +MODULE_DESCRIPTION("SMSC EMC2305 fan controller driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-delta/debian/changelog b/platform/innovium/sonic-platform-modules-delta/debian/changelog new file mode 100644 index 000000000000..ec8327e8ae7a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/changelog @@ -0,0 +1,5 @@ +sonic-delta-platform-modules (1.1) unstable; urgency=low + + * Initial release + + -- Neal Tai Fri, 21 APR 2017 11:11:11 -0800 diff --git a/platform/innovium/sonic-platform-modules-delta/debian/compat b/platform/innovium/sonic-platform-modules-delta/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/innovium/sonic-platform-modules-delta/debian/control b/platform/innovium/sonic-platform-modules-delta/debian/control new file mode 100644 index 000000000000..53fc6df6b676 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/control @@ -0,0 +1,13 @@ +Source: sonic-delta-platform-modules +Section: main +Priority: extra +Maintainer: Neal Tai +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-et-c032if +Architecture: amd64 +Depends: linux-image-4.9.0-9-amd64 +Description: kernel modules for platform devices such as fan, led, sfp + + diff --git a/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.init b/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.init new file mode 100755 index 000000000000..61f373f0d476 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup et-c032if board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + modprobe optoe + modprobe ipmi_devintf + modprobe delta_et-c032if_platform + + /usr/local/bin/et-c032if_platform_init.sh + echo "done." + ;; + +stop) + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-et-c032if.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.install b/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.install new file mode 100644 index 000000000000..45886664b870 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/platform-modules-et-c032if.install @@ -0,0 +1,3 @@ +et-c032if/cfg/et-c032if-modules.conf etc/modules-load.d +et-c032if/scripts/et-c032if_platform_init.sh usr/local/bin +systemd/platform-modules-et-c032if.service lib/systemd/system diff --git a/platform/innovium/sonic-platform-modules-delta/debian/rules b/platform/innovium/sonic-platform-modules-delta/debian/rules new file mode 100755 index 000000000000..a84c235e5480 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/debian/rules @@ -0,0 +1,33 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= et-c032if + +%: + dh $@ --with=systemd + +override_dh_auto_build: + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + done) + +override_dh_auto_install: + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -pplatform-modules-$${mod} \ + $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ + debian/platform-modules-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + done) + +override_dh_usrlocal: + +override_dh_clean: + dh_clean + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) + diff --git a/platform/innovium/sonic-platform-modules-delta/et-c032if/cfg/et-c032if-modules.conf b/platform/innovium/sonic-platform-modules-delta/et-c032if/cfg/et-c032if-modules.conf new file mode 100644 index 000000000000..552b4103ed02 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/et-c032if/cfg/et-c032if-modules.conf @@ -0,0 +1,13 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus +i2c-mux-gpio +i2c-mux-pca954x diff --git a/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/Makefile b/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/Makefile new file mode 100644 index 000000000000..2e8feec0b405 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := delta_et-c032if_platform.o + diff --git a/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/delta_et-c032if_platform.c b/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/delta_et-c032if_platform.c new file mode 100644 index 000000000000..918b6552c03e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/et-c032if/modules/delta_et-c032if_platform.c @@ -0,0 +1,2102 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define CPULD_ADDR 0x31 +#define SWPLD2_ADDR 0x35 +#define SWPLD3_ADDR 0x36 +#define BUS0_BASE_NUM 10 +#define BUS0_DEV_NUM 3 +#define DEFAULT_NUM 0 +#define EEPROM_VAL 0xfc +#define SWPLD_VAL 0xfe +#define QSFP_VAL 0xff +#define BUS0_MUX_REG 0x14 +#define QSFP_PRESENCE_1 0x51 +#define QSFP_PRESENCE_2 0x52 +#define QSFP_PRESENCE_3 0x51 +#define QSFP_PRESENCE_4 0x52 +#define SFP_PRESENCE 0x71 +#define QSFP_RESPONDE_1 0x31 +#define QSFP_RESPONDE_2 0x32 +#define QSFP_RESPONDE_3 0x31 +#define QSFP_RESPONDE_4 0x32 +#define QSFP_LP_MODE_1 0x21 +#define QSFP_LP_MODE_2 0x22 +#define QSFP_LP_MODE_3 0x21 +#define QSFP_LP_MODE_4 0x22 +#define QSFP_RESET_1 0x11 +#define QSFP_RESET_2 0x12 +#define QSFP_RESET_3 0x11 +#define QSFP_RESET_4 0x12 +#define QSFP_INTERRUPT_1 0x61 +#define QSFP_INTERRUPT_2 0x62 +#define QSFP_INTERRUPT_3 0x61 +#define QSFP_INTERRUPT_4 0x62 + +#define EEPROM_SIZE 256 +#define EEPROM_MASK 29 +#define ATTR_R 1 +#define ATTR_W 2 + +#define et_c032if_i2c_device_num(NUM){ \ + .name = "delta-et-c032if-i2c-device", \ + .id = NUM, \ + .dev = { \ + .platform_data = &et_c032if_i2c_device_platform_data[NUM],\ + .release = device_release, \ + }, \ +} + +struct mutex dni_lock; + +/*Define struct to get client of i2c_new_deivce */ +struct i2c_client * i2c_client_9548_1; +struct i2c_client * i2c_client_9548_2; +struct i2c_client * i2c_client_9548_3; +struct i2c_client * i2c_client_9548_4; +struct i2c_client * i2c_client_9548_5; + +static struct kobject *kobj_cpld; +static struct kobject *kobj_swpld2; +static struct kobject *kobj_swpld3; +static struct kobject *kobj_sfp; + +enum{ + BUS0 = 0, + BUS1, + BUS2, + BUS3, + BUS4, + BUS5, + BUS6, + BUS7, + BUS8, + BUS9, + BUS10, + BUS11, + BUS12, + BUS13, + BUS14, + BUS15, + BUS16, + BUS17, + BUS18, + BUS19, +}; + +static struct cpld_attribute_data { + uint8_t bus; + uint8_t addr; + uint8_t reg; + uint8_t mask; + char note[350]; +}; + +unsigned char reverse_8bits(unsigned char c) +{ + unsigned char s = 0; + int i; + for (i = 0; i < 8; ++i) { + s <<= 1; + s |= c & 1; + c >>= 1; + } + return s; +} + +unsigned char dni_log2 (unsigned char num){ + unsigned char num_log2 = 0; + while(num > 0){ + num = num >> 1; + num_log2 += 1; + } + return num_log2 -1; +} + +/*---------------- I2C device - start ------------- */ +static void device_release(struct device *dev) +{ + return; +} + +struct i2c_device_platform_data { + int parent; + struct i2c_board_info info; + struct i2c_client *client; +}; +/* pca9548 - add 8 bus */ + +static struct pca954x_platform_mode pca954x_1_mode[] = +{ + { .adap_id = 30, + .deselect_on_exit = 1, + }, + { .adap_id = 31, + .deselect_on_exit = 1, + }, + { .adap_id = 32, + .deselect_on_exit = 1, + }, + { .adap_id = 33, + .deselect_on_exit = 1, + }, + { .adap_id = 34, + .deselect_on_exit = 1, + }, + { .adap_id = 35, + .deselect_on_exit = 1, + }, + { .adap_id = 36, + .deselect_on_exit = 1, + }, + { .adap_id = 37, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_mode pca954x_2_mode[] = +{ + { .adap_id = 38, + .deselect_on_exit = 1, + }, + { .adap_id = 39, + .deselect_on_exit = 1, + }, + { .adap_id = 40, + .deselect_on_exit = 1, + }, + { .adap_id = 41, + .deselect_on_exit = 1, + }, + { .adap_id = 42, + .deselect_on_exit = 1, + }, + { .adap_id = 43, + .deselect_on_exit = 1, + }, + { .adap_id = 44, + .deselect_on_exit = 1, + }, + { .adap_id = 45, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_mode pca954x_3_mode[] = +{ + { .adap_id = 46, + .deselect_on_exit = 1, + }, + { .adap_id = 47, + .deselect_on_exit = 1, + }, + { .adap_id = 48, + .deselect_on_exit = 1, + }, + { .adap_id = 49, + .deselect_on_exit = 1, + }, + { .adap_id = 50, + .deselect_on_exit = 1, + }, + { .adap_id = 51, + .deselect_on_exit = 1, + }, + { .adap_id = 52, + .deselect_on_exit = 1, + }, + { .adap_id = 53, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_mode pca954x_4_mode[] = +{ + { .adap_id = 54, + .deselect_on_exit = 1, + }, + { .adap_id = 55, + .deselect_on_exit = 1, + }, + { .adap_id = 56, + .deselect_on_exit = 1, + }, + { .adap_id = 57, + .deselect_on_exit = 1, + }, + { .adap_id = 58, + .deselect_on_exit = 1, + }, + { .adap_id = 59, + .deselect_on_exit = 1, + }, + { .adap_id = 60, + .deselect_on_exit = 1, + }, + { .adap_id = 61, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_mode pca954x_5_mode[] = +{ + { .adap_id = 62, + .deselect_on_exit = 1, + }, + { .adap_id = 63, + .deselect_on_exit = 1, + }, + { .adap_id = 64, + .deselect_on_exit = 1, + }, + { .adap_id = 65, + .deselect_on_exit = 1, + }, + { .adap_id = 66, + .deselect_on_exit = 1, + }, + { .adap_id = 67, + .deselect_on_exit = 1, + }, + { .adap_id = 68, + .deselect_on_exit = 1, + }, + { .adap_id = 69, + .deselect_on_exit = 1, + }, +}; + +static struct pca954x_platform_data pca954x_data[] = +{ + { + .modes = pca954x_1_mode, + .num_modes = ARRAY_SIZE(pca954x_1_mode), + }, + { + .modes = pca954x_2_mode, + .num_modes = ARRAY_SIZE(pca954x_2_mode), + }, + { + .modes = pca954x_3_mode, + .num_modes = ARRAY_SIZE(pca954x_3_mode), + }, + { + .modes = pca954x_4_mode, + .num_modes = ARRAY_SIZE(pca954x_4_mode), + }, + { + .modes = pca954x_5_mode, + .num_modes = ARRAY_SIZE(pca954x_5_mode), + }, +}; + +static struct i2c_board_info __initdata i2c_info_pca9548[] = +{ + { + I2C_BOARD_INFO("pca9548", 0x71), + .platform_data = &pca954x_data[0], + }, + { + I2C_BOARD_INFO("pca9548", 0x72), + .platform_data = &pca954x_data[1], + }, + { + I2C_BOARD_INFO("pca9548", 0x73), + .platform_data = &pca954x_data[2], + }, + { + I2C_BOARD_INFO("pca9548", 0x74), + .platform_data = &pca954x_data[3], + }, + { + I2C_BOARD_INFO("pca9548", 0x76), + .platform_data = &pca954x_data[4], + }, +}; + +static struct i2c_device_platform_data et_c032if_i2c_device_platform_data[] = { + { + /* id eeprom (0x53) */ + .parent = 10, + .info = { I2C_BOARD_INFO("24c02", 0x53) }, + .client = NULL, + }, + { + /* qsfp 1 (0x50) */ + .parent = 30, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 2 (0x50) */ + .parent = 31, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 3 (0x50) */ + .parent = 32, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 4 (0x50) */ + .parent = 33, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 5 (0x50) */ + .parent = 34, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 6 (0x50) */ + .parent = 35, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 7 (0x50) */ + .parent = 36, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 8 (0x50) */ + .parent = 37, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 9 (0x50) */ + .parent = 38, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 10 (0x50) */ + .parent = 39, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 11 (0x50) */ + .parent = 40, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 12 (0x50) */ + .parent = 41, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 13 (0x50) */ + .parent = 42, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 14 (0x50) */ + .parent = 43, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 15 (0x50) */ + .parent = 44, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 16 (0x50) */ + .parent = 45, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 17 (0x50) */ + .parent = 46, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 18 (0x50) */ + .parent = 47, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 19 (0x50) */ + .parent = 48, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 20 (0x50) */ + .parent = 49, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 21 (0x50) */ + .parent = 50, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 22 (0x50) */ + .parent = 51, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 23 (0x50) */ + .parent = 52, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 24 (0x50) */ + .parent = 53, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 25 (0x50) */ + .parent = 54, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 26 (0x50) */ + .parent = 55, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 27 (0x50) */ + .parent = 56, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 28 (0x50) */ + .parent = 57, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 29 (0x50) */ + .parent = 58, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 30 (0x50) */ + .parent = 59, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 31 (0x50) */ + .parent = 60, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* qsfp 32 (0x50) */ + .parent = 61, + .info = { .type = "optoe1", .addr = 0x50 }, + .client = NULL, + }, + { + /* sfp 1 (0x50) */ + .parent = 62, + .info = { .type = "optoe2", .addr = 0x50 }, + .client = NULL, + }, + { + /* sfp 2 (0x50) */ + .parent = 63, + .info = { .type = "optoe2", .addr = 0x50 }, + .client = NULL, + }, + +}; + + +static struct platform_device et_c032if_i2c_device[] = { + et_c032if_i2c_device_num(0), + et_c032if_i2c_device_num(1), + et_c032if_i2c_device_num(2), + et_c032if_i2c_device_num(3), + et_c032if_i2c_device_num(4), + et_c032if_i2c_device_num(5), + et_c032if_i2c_device_num(6), + et_c032if_i2c_device_num(7), + et_c032if_i2c_device_num(8), + et_c032if_i2c_device_num(9), + et_c032if_i2c_device_num(10), + et_c032if_i2c_device_num(11), + et_c032if_i2c_device_num(12), + et_c032if_i2c_device_num(13), + et_c032if_i2c_device_num(14), + et_c032if_i2c_device_num(15), + et_c032if_i2c_device_num(16), + et_c032if_i2c_device_num(17), + et_c032if_i2c_device_num(18), + et_c032if_i2c_device_num(19), + et_c032if_i2c_device_num(20), + et_c032if_i2c_device_num(21), + et_c032if_i2c_device_num(22), + et_c032if_i2c_device_num(23), + et_c032if_i2c_device_num(24), + et_c032if_i2c_device_num(25), + et_c032if_i2c_device_num(26), + et_c032if_i2c_device_num(27), + et_c032if_i2c_device_num(28), + et_c032if_i2c_device_num(29), + et_c032if_i2c_device_num(30), + et_c032if_i2c_device_num(31), + et_c032if_i2c_device_num(32), + et_c032if_i2c_device_num(33), + et_c032if_i2c_device_num(34), +}; + +/*---------------- I2C device - end ------------- */ + +/*---------------- I2C driver - start ------------- */ +static int __init i2c_device_probe(struct platform_device *pdev) +{ + struct i2c_device_platform_data *pdata; + struct i2c_adapter *parent; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", + pdata->parent); + return -ENODEV; + } + + pdata->client = i2c_new_device(parent, &pdata->info); + if (!pdata->client) { + dev_err(&pdev->dev, "Failed to create i2c client %s at %d\n", + pdata->info.type, pdata->parent); + return -ENODEV; + } + + return 0; +} + +static int __exit i2c_deivce_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent; + struct i2c_device_platform_data *pdata; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + return -ENODEV; + } + if (pdata->client) { + parent = (pdata->client)->adapter; + i2c_unregister_device(pdata->client); + i2c_put_adapter(parent); + } + return 0; +} +static struct platform_driver i2c_device_driver = { + .probe = i2c_device_probe, + .remove = __exit_p(i2c_deivce_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et-c032if-i2c-device", + } +}; + +/*---------------- I2C driver - end ------------- */ + +/*---------------- CPLD - start ------------- */ + +unsigned char cpupld_reg_addr; +unsigned char swpld2_reg_addr; +unsigned char swpld3_reg_addr; + +/* CPLD -- device */ + +enum cpld_type { + cpu_cpld, +}; + +enum swpld2_type { + swpld2, +}; + +enum swpld3_type { + swpld3, +}; + +enum cpld_attributes { +//CPLDs address and value + CPLD_REG_ADDR, + CPLD_REG_VALUE, + SWPLD2_REG_ADDR, + SWPLD2_REG_VALUE, + SWPLD3_REG_ADDR, + SWPLD3_REG_VALUE, + SFP_SELECT_PORT, + SFP_IS_PRESENT, + SFP_IS_PRESENT_ALL, + QSFP_LP_MODE, + QSFP_RESET, + QSFP_INTERRUPT, + QSFP_RESPONDE, +}; + +struct cpld_platform_data { + int reg_addr; + struct i2c_client *client; +}; + +static struct cpld_platform_data et_c032if_cpld_platform_data[] = { + [cpu_cpld] = { + .reg_addr = CPULD_ADDR, + }, +}; + +static struct cpld_platform_data et_c032if_swpld2_platform_data[] = { + [swpld2] = { + .reg_addr = SWPLD2_ADDR, + }, +}; + +static struct cpld_platform_data et_c032if_swpld3_platform_data[] = { + [swpld3] = { + .reg_addr = SWPLD3_ADDR, + }, +}; + +static struct platform_device et_c032if_cpld = { + .name = "delta-et-c032if-cpld", + .id = 0, + .dev = { + .platform_data = et_c032if_cpld_platform_data, + .release = device_release, + }, +}; + +static struct platform_device et_c032if_swpld2 = { + .name = "delta-et-c032if-swpld2", + .id = 0, + .dev = { + .platform_data = et_c032if_swpld2_platform_data, + .release = device_release + }, +}; + +static struct platform_device et_c032if_swpld3 = { + .name = "delta-et-c032if-swpld3", + .id = 0, + .dev = { + .platform_data = et_c032if_swpld3_platform_data, + .release = device_release + }, +}; + +static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + int ret; + int mask; + int value; + char note[450]; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + mutex_lock(&dni_lock); + switch (attr->index) { + case CPLD_REG_ADDR: + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", cpupld_reg_addr); + case SWPLD2_REG_ADDR: + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", swpld2_reg_addr); + case SWPLD3_REG_ADDR: + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", swpld3_reg_addr); + case CPLD_REG_VALUE: + ret = i2c_smbus_read_byte_data(pdata[cpu_cpld].client, cpupld_reg_addr); + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", ret); + case SWPLD2_REG_VALUE: + ret = i2c_smbus_read_byte_data(pdata[swpld2].client, swpld2_reg_addr); + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", ret); + case SWPLD3_REG_VALUE: + ret = i2c_smbus_read_byte_data(pdata[swpld3].client, swpld3_reg_addr); + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x\n", ret); + default: + mutex_unlock(&dni_lock); + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0xff: + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x%s", value, note); + case 0x0f: + case 0x07: + case 0x03: + break; + case 0x0c: + value = value >> 2; + break; + case 0xf0: + case 0x70: + case 0x30: + value = value >> 4; + break; + case 0xe0: + value = value >> 5; + break; + case 0xc0: + value = value >> 6; + break; + default : + value = value >> dni_log2(mask); + mutex_unlock(&dni_lock); + return sprintf(buf, "%d%s", value, note); + } + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%02x%s", value, note); +} + +static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_attr, + const char *buf, size_t count) +{ + int err; + int set_data; + unsigned long set_data_ul; + unsigned char mask; + unsigned char mask_out; + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 0, &set_data_ul); + if (err){ + return err; + } + + mutex_lock(&dni_lock); + set_data = (int)set_data_ul; + if (set_data > 0xff){ + printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + mutex_unlock(&dni_lock); + return count; + } + + switch (attr->index) { + case CPLD_REG_ADDR: + cpupld_reg_addr = set_data; + mutex_unlock(&dni_lock); + return count; + case SWPLD2_REG_ADDR: + swpld2_reg_addr = set_data; + mutex_unlock(&dni_lock); + return count; + case SWPLD3_REG_ADDR: + swpld3_reg_addr = set_data; + mutex_unlock(&dni_lock); + return count; + case CPLD_REG_VALUE: + i2c_smbus_write_byte_data(pdata[cpu_cpld].client, cpupld_reg_addr, set_data); + mutex_unlock(&dni_lock); + return count; + case SWPLD2_REG_VALUE: + i2c_smbus_write_byte_data(pdata[swpld2].client, swpld2_reg_addr, set_data); + mutex_unlock(&dni_lock); + return count; + case SWPLD3_REG_VALUE: + i2c_smbus_write_byte_data(pdata[swpld3].client, swpld3_reg_addr, set_data); + mutex_unlock(&dni_lock); + return count; + default: + mutex_unlock(&dni_lock); + return sprintf(buf, "%d not found", attr->index); + } + + switch (mask) { + case 0x03: + case 0x07: + case 0x0f: + case 0xff: + set_data = mask_out | (set_data & mask); + break; + case 0x0c: + set_data = set_data << 2; + set_data = mask_out | (set_data & mask); + break; + case 0xf0: + case 0x70: + case 0x30: + set_data = set_data << 4; + set_data = mask_out | (set_data & mask); + break; + case 0xe0: + set_data = set_data << 5; + set_data = mask_out | (set_data & mask); + break; + case 0xc0: + set_data = set_data << 6; + set_data = mask_out | (set_data & mask); + break; + default : + set_data = mask_out | (set_data << dni_log2(mask) ); + } + switch (attr->index) { + default: + mutex_unlock(&dni_lock); + return sprintf(buf, "cpld not found"); + } + mutex_unlock(&dni_lock); + return count; +} + +/* ---------------- SFP attribute read/write - start -------- */ + +static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr, char *buf){ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct device *i2cdev_1 = kobj_to_dev(kobj_swpld2); + struct device *i2cdev_2 = kobj_to_dev(kobj_swpld3); + struct cpld_platform_data *pdata1 = i2cdev_1->platform_data; + struct cpld_platform_data *pdata2 = i2cdev_2->platform_data; + + mutex_lock(&dni_lock); + int ret; + u32 data = 0; + int data2 = 0; + u8 save_bytes = 0x00; + + switch (attr->index) { + case SFP_IS_PRESENT: + /* Report the SFP/QSFP ALL PRESENCE status + * This data information form SWPLD2 and SWPLD3. */ + + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_PRESENCE_4); + data = (u32)(ret & 0xff); + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_PRESENCE_3); + data |= (u32)(ret & 0xff) << 8; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_PRESENCE_2); + data |= (u32)(ret & 0xff) << 16; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_PRESENCE_1); + data |= (u32)(ret & 0xff) << 24; + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, SFP_PRESENCE); + data2 = (ret & 0x44); + save_bytes = data2 & 0x40; + save_bytes = save_bytes << 1; + data2 &= 0x04; + data2 = data2 << 4; + data2 |= save_bytes; + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%x%02x\n", data, data2); + + case QSFP_LP_MODE: + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_LP_MODE_4); + data = (u32)(ret & 0xff); + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_LP_MODE_3); + data |= (u32)(ret & 0xff) << 8; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_LP_MODE_2); + data |= (u32)(ret & 0xff) << 16; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_LP_MODE_1); + data |= (u32)(ret & 0xff) << 24; + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%x\n", data); + + case QSFP_RESET: + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_RESET_4); + data = (u32)(ret & 0xff); + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_RESET_3); + data |= (u32)(ret & 0xff) << 8; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_RESET_2); + data |= (u32)(ret & 0xff) << 16; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_RESET_1); + data |= (u32)(ret & 0xff) << 24; + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%x\n", data); + + case QSFP_INTERRUPT: + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_INTERRUPT_4); + data = (u32)(ret & 0xff); + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_INTERRUPT_3); + data |= (u32)(ret & 0xff) << 8; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_INTERRUPT_2); + data |= (u32)(ret & 0xff) << 16; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_INTERRUPT_1); + data |= (u32)(ret & 0xff) << 24; + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%x\n", data); + + case QSFP_RESPONDE: + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_RESPONDE_4); + data = (u32)(ret & 0xff); + ret = i2c_smbus_read_byte_data(pdata2[swpld3].client, QSFP_RESPONDE_3); + data |= (u32)(ret & 0xff) << 8; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_RESPONDE_2); + data |= (u32)(ret & 0xff) << 16; + ret = i2c_smbus_read_byte_data(pdata1[swpld2].client, QSFP_RESPONDE_1); + data |= (u32)(ret & 0xff) << 24; + mutex_unlock(&dni_lock); + return sprintf(buf, "0x%x\n", data); + + default: + mutex_unlock(&dni_lock); + return sprintf(buf, "%d not found", attr->index); + } +} + + +static ssize_t set_lpmode_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) +{ + struct device *i2cdev_1 = kobj_to_dev(kobj_swpld2); + struct device *i2cdev_2 = kobj_to_dev(kobj_swpld3); + struct cpld_platform_data *pdata1 = i2cdev_1->platform_data; + struct cpld_platform_data *pdata2 = i2cdev_2->platform_data; + unsigned long long set_data; + int err; + int values = 0x00; + u8 reg_t = 0x00; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + mutex_lock(&dni_lock); + reg_t = QSFP_LP_MODE_1; + values = ((set_data >> 24 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + reg_t = QSFP_LP_MODE_2; + values = ((set_data >> 16 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + reg_t = QSFP_LP_MODE_3; + values = ((set_data >> 8 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + reg_t = QSFP_LP_MODE_4; + values = (set_data & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + mutex_unlock(&dni_lock); + return count; + +ERROR: + mutex_unlock(&dni_lock); + return -EIO; +} + +static ssize_t set_reset_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) +{ + struct device *i2cdev_1 = kobj_to_dev(kobj_swpld2); + struct device *i2cdev_2 = kobj_to_dev(kobj_swpld3); + struct cpld_platform_data *pdata1 = i2cdev_1->platform_data; + struct cpld_platform_data *pdata2 = i2cdev_2->platform_data; + unsigned long long set_data; + int err; + int values = 0x00; + u8 reg_t = 0x00; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + + mutex_lock(&dni_lock); + reg_t = QSFP_RESET_1; + values = ((set_data >> 24 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESET_2; + values = ((set_data >> 16 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESET_3; + values = ((set_data >> 8 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESET_4; + values = (set_data & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + mutex_unlock(&dni_lock); + return count; + +ERROR: + mutex_unlock(&dni_lock); + return -EIO; +} + +static ssize_t set_interrupt_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) +{ + struct device *i2cdev_1 = kobj_to_dev(kobj_swpld2); + struct device *i2cdev_2 = kobj_to_dev(kobj_swpld3); + struct cpld_platform_data *pdata1 = i2cdev_1->platform_data; + struct cpld_platform_data *pdata2 = i2cdev_2->platform_data; + unsigned long long set_data; + int err; + int values = 0x00; + u8 reg_t = 0x00; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + + mutex_lock(&dni_lock); + reg_t = QSFP_INTERRUPT_1; + values = ((set_data >> 24 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_INTERRUPT_2; + values = ((set_data >> 16 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_INTERRUPT_3; + values = ((set_data >> 8 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_INTERRUPT_4; + values = (set_data & 0xff); + + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + mutex_unlock(&dni_lock); + return count; + +ERROR: + mutex_unlock(&dni_lock); + return -EIO; +} + +static ssize_t set_responde_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count) +{ + struct device *i2cdev_1 = kobj_to_dev(kobj_swpld2); + struct device *i2cdev_2 = kobj_to_dev(kobj_swpld3); + struct cpld_platform_data *pdata1 = i2cdev_1->platform_data; + struct cpld_platform_data *pdata2 = i2cdev_2->platform_data; + unsigned long long set_data; + int err; + int values = 0x00; + u8 reg_t = 0x00; + + err = kstrtoull(buf, 16, &set_data); + if (err){ + return err; + } + + mutex_lock(&dni_lock); + reg_t = QSFP_RESPONDE_1; + values = ((set_data >> 24 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESPONDE_2; + values = ((set_data >> 16 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata1[swpld2].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESPONDE_3; + values = ((set_data >> 8 ) & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + reg_t = QSFP_RESPONDE_4; + values = (set_data & 0xff); + if (i2c_smbus_write_byte_data(pdata2[swpld3].client, reg_t, (u8)values) < 0) + { + goto ERROR; + } + + mutex_unlock(&dni_lock); + return count; + +ERROR: + mutex_unlock(&dni_lock); + return -EIO; +} + +static SENSOR_DEVICE_ATTR(cpld_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_ADDR); +static SENSOR_DEVICE_ATTR(cpld_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, CPLD_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld2_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, SWPLD2_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld2_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, SWPLD2_REG_VALUE); +static SENSOR_DEVICE_ATTR(swpld3_reg_addr, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, SWPLD3_REG_ADDR); +static SENSOR_DEVICE_ATTR(swpld3_reg_value, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, SWPLD3_REG_VALUE); +//SFP, QSFP +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, for_status, NULL, SFP_IS_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_lp_mode, S_IWUSR | S_IRUGO, for_status, set_lpmode_data, QSFP_LP_MODE); +static SENSOR_DEVICE_ATTR(sfp_reset, S_IWUSR | S_IRUGO, for_status, set_reset_data, QSFP_RESET); +static SENSOR_DEVICE_ATTR(sfp_interrupt, S_IWUSR | S_IRUGO, for_status, set_interrupt_data, QSFP_INTERRUPT); +static SENSOR_DEVICE_ATTR(sfp_responde, S_IWUSR | S_IRUGO, for_status, set_responde_data, QSFP_RESPONDE); + +static struct attribute *cpld_attrs[] = { + &sensor_dev_attr_cpld_reg_value.dev_attr.attr, + &sensor_dev_attr_cpld_reg_addr.dev_attr.attr, +//SFP, QSFP + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_lp_mode.dev_attr.attr, + &sensor_dev_attr_sfp_reset.dev_attr.attr, + &sensor_dev_attr_sfp_interrupt.dev_attr.attr, + &sensor_dev_attr_sfp_responde.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld2_attrs[] = { + &sensor_dev_attr_swpld2_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld2_reg_addr.dev_attr.attr, + NULL, +}; + +static struct attribute *swpld3_attrs[] = { + &sensor_dev_attr_swpld3_reg_value.dev_attr.attr, + &sensor_dev_attr_swpld3_reg_addr.dev_attr.attr, + NULL, +}; + +static struct attribute_group cpld_attr_grp = { + .attrs = cpld_attrs, +}; + +static struct attribute_group swpld2_attr_grp = { + .attrs = swpld2_attrs, +}; + +static struct attribute_group swpld3_attr_grp = { + .attrs = swpld3_attrs, +}; + +/* CPLD -- driver */ +static int __init cpld_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "CPLD platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(BUS0); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", BUS0); + return -ENODEV; + } + + pdata[cpu_cpld].client = i2c_new_dummy(parent, pdata[cpu_cpld].reg_addr); + if (!pdata[cpu_cpld].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[cpu_cpld].reg_addr); + goto error; + } + + kobj_cpld = &pdev->dev.kobj; + ret = sysfs_create_group(&pdev->dev.kobj, &cpld_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create cpld attribute group"); + goto error; + } + + return 0; +error: + kobject_put(kobj_cpld); + i2c_unregister_device(pdata[cpu_cpld].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit cpld_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &cpld_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[cpu_cpld].client) { + if (!parent) { + parent = (pdata[cpu_cpld].client)->adapter; + } + i2c_unregister_device(pdata[cpu_cpld].client); + } + } + i2c_put_adapter(parent); + + return 0; +} + +static int __init swpld2_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD2 platform data not found\n"); + return -ENODEV; + } + parent = i2c_get_adapter(11); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", 11); + return -ENODEV; + } + + pdata[swpld2].client = i2c_new_dummy(parent, pdata[swpld2].reg_addr); + if (!pdata[swpld2].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[swpld2].reg_addr); + goto error; + } + + kobj_swpld2 = &pdev->dev.kobj; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld2_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create swpld attribute group"); + goto error; + } + return 0; + +error: + kobject_put(kobj_swpld2); + i2c_unregister_device(pdata[swpld2].client); + i2c_put_adapter(parent); + return -ENODEV; +} + +static int __exit swpld2_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &swpld2_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[swpld2].client) { + if (!parent) { + parent = (pdata[swpld2].client)->adapter; + } + i2c_unregister_device(pdata[swpld2].client); + } + } + i2c_put_adapter(parent); + return 0; +} + + +static int __init swpld3_probe(struct platform_device *pdev) +{ + struct cpld_platform_data *pdata; + struct i2c_adapter *parent; + int ret; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD3 platform data not found\n"); + return -ENODEV; + } + + parent = i2c_get_adapter(11); + if (!parent) { + printk(KERN_WARNING "Parent adapter (%d) not found\n", 11); + return -ENODEV; + } + + pdata[swpld3].client = i2c_new_dummy(parent, pdata[swpld3].reg_addr); + if (!pdata[swpld3].client) { + printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[swpld3].reg_addr); + goto error; + } + + kobj_swpld3 = &pdev->dev.kobj; + ret = sysfs_create_group(&pdev->dev.kobj, &swpld3_attr_grp); + if (ret) { + printk(KERN_WARNING "Fail to create swpld attribute group"); + goto error; + } + + return 0; + +error: + kobject_put(kobj_swpld3); + i2c_unregister_device(pdata[swpld3].client); + i2c_put_adapter(parent); + + return -ENODEV; +} + +static int __exit swpld3_remove(struct platform_device *pdev) +{ + struct i2c_adapter *parent = NULL; + struct cpld_platform_data *pdata = pdev->dev.platform_data; + sysfs_remove_group(&pdev->dev.kobj, &swpld3_attr_grp); + + if (!pdata) { + dev_err(&pdev->dev, "Missing platform data\n"); + } + else { + if (pdata[swpld3].client) { + if (!parent) { + parent = (pdata[swpld3].client)->adapter; + } + i2c_unregister_device(pdata[swpld3].client); + } + } + i2c_put_adapter(parent); + return 0; +} + +static struct platform_driver cpld_driver = { + .probe = cpld_probe, + .remove = __exit_p(cpld_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et-c032if-cpld", + }, +}; + +static struct platform_driver swpld2_driver = { + .probe = swpld2_probe, + .remove = __exit_p(swpld2_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et-c032if-swpld2", + }, +}; + +static struct platform_driver swpld3_driver = { + .probe = swpld3_probe, + .remove = __exit_p(swpld3_remove), + .driver = { + .owner = THIS_MODULE, + .name = "delta-et-c032if-swpld3", + }, +}; + + +/*---------------- CPLD - end ------------- */ + +/*---------------- delta ATTR - start ------------- */ + +struct delta_bin_attribute { + struct bin_attribute attr; + int index; +}; + +#define to_delta_attr(x) container_of(x, struct delta_bin_attribute, attr) + +#define BIN_ATTR(_name, _mode, _read, _write, _size, _index) { \ + .attr = { \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .read = _read, \ + .write = _write, \ + .size = _size, \ + }, \ + .index = _index, \ +} + +#define DELTA_BIN_ATTR(_name, _mode, _read, _write, _size, _index) \ +struct delta_bin_attribute delta_attr_##_name \ + = BIN_ATTR(_name, _mode, _read, _write, _size, _index) + +static char eeprom_data[EEPROM_SIZE]; + +static ssize_t access_user_space(const char *name, char *buf, size_t len, loff_t offset, int mode) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + ssize_t vfs_ret = 0; + + fs = get_fs(); + set_fs(get_ds()); + + switch(mode) + { + case ATTR_W: + fp = filp_open(name, O_WRONLY, S_IWUSR | S_IRUGO); + if (IS_ERR(fp)){ + return -ENOENT; + } + vfs_ret = vfs_write(fp, buf, len, &pos); + break; + case ATTR_R: + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)){ + return -ENOENT; + } + vfs_ret = vfs_read(fp, buf, len, &pos); + break; + } + + set_fs(fs); + filp_close(fp, NULL); + return vfs_ret; +} + +enum sfp_attributes{ + EEPROM_SYS, + EEPROM_SFP_1, + EEPROM_SFP_2, + EEPROM_SFP_3, + EEPROM_SFP_4, + EEPROM_SFP_5, + EEPROM_SFP_6, + EEPROM_SFP_7, + EEPROM_SFP_8, + EEPROM_SFP_9, + EEPROM_SFP_10, + EEPROM_SFP_11, + EEPROM_SFP_12, + EEPROM_SFP_13, + EEPROM_SFP_14, + EEPROM_SFP_15, + EEPROM_SFP_16, + EEPROM_SFP_17, + EEPROM_SFP_18, + EEPROM_SFP_19, + EEPROM_SFP_20, + EEPROM_SFP_21, + EEPROM_SFP_22, + EEPROM_SFP_23, + EEPROM_SFP_24, + EEPROM_SFP_25, + EEPROM_SFP_26, + EEPROM_SFP_27, + EEPROM_SFP_28, + EEPROM_SFP_29, + EEPROM_SFP_30, + EEPROM_SFP_31, + EEPROM_SFP_32, + EEPROM_SFP_33, + EEPROM_SFP_34, +}; + + +static ssize_t delta_bin_attr_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct delta_bin_attribute *delta_attr = to_delta_attr(attr); + char attr_path[100]; + + mutex_lock(&dni_lock); + memset(buf, 0, count); + switch(delta_attr->index) { + case EEPROM_SFP_1: + case EEPROM_SFP_2: + case EEPROM_SFP_3: + case EEPROM_SFP_4: + case EEPROM_SFP_5: + case EEPROM_SFP_6: + case EEPROM_SFP_7: + case EEPROM_SFP_8: + case EEPROM_SFP_9: + case EEPROM_SFP_10: + case EEPROM_SFP_11: + case EEPROM_SFP_12: + case EEPROM_SFP_13: + case EEPROM_SFP_14: + case EEPROM_SFP_15: + case EEPROM_SFP_16: + case EEPROM_SFP_17: + case EEPROM_SFP_18: + case EEPROM_SFP_19: + case EEPROM_SFP_20: + case EEPROM_SFP_21: + case EEPROM_SFP_22: + case EEPROM_SFP_23: + case EEPROM_SFP_24: + case EEPROM_SFP_25: + case EEPROM_SFP_26: + case EEPROM_SFP_27: + case EEPROM_SFP_28: + case EEPROM_SFP_29: + case EEPROM_SFP_30: + case EEPROM_SFP_31: + case EEPROM_SFP_32: + case EEPROM_SFP_33: + case EEPROM_SFP_34: + sprintf(attr_path, "/sys/bus/i2c/devices/%d-0050/eeprom", delta_attr->index + EEPROM_MASK); + if (access_user_space(attr_path, eeprom_data, EEPROM_SIZE, 0, ATTR_R) < 0) { + goto ACCESS_ERROR; + } + count = (count <= EEPROM_SIZE) ? count : EEPROM_SIZE; + memcpy(buf, eeprom_data + off, count); + break; + case EEPROM_SYS: + sprintf(attr_path, "/sys/bus/i2c/devices/10-0053/eeprom"); + if (access_user_space(attr_path, eeprom_data, EEPROM_SIZE, 0, ATTR_R) < 0) { + goto ACCESS_ERROR; + } + count = (count <= EEPROM_SIZE) ? count : EEPROM_SIZE; + memcpy(buf, eeprom_data + off, count); + break; + default: + goto ACCESS_ERROR; + } + mutex_unlock(&dni_lock); + return count; + +ACCESS_ERROR: + mutex_unlock(&dni_lock); + return -ENXIO; +} + +static ssize_t delta_bin_attr_write(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct delta_bin_attribute *delta_attr = to_delta_attr(attr); + char attr_path[100]; + + mutex_lock(&dni_lock); + + switch(delta_attr->index){ + case EEPROM_SFP_1: + case EEPROM_SFP_2: + case EEPROM_SFP_3: + case EEPROM_SFP_4: + case EEPROM_SFP_5: + case EEPROM_SFP_6: + case EEPROM_SFP_7: + case EEPROM_SFP_8: + case EEPROM_SFP_9: + case EEPROM_SFP_10: + case EEPROM_SFP_11: + case EEPROM_SFP_12: + case EEPROM_SFP_13: + case EEPROM_SFP_14: + case EEPROM_SFP_15: + case EEPROM_SFP_16: + case EEPROM_SFP_17: + case EEPROM_SFP_18: + case EEPROM_SFP_19: + case EEPROM_SFP_20: + case EEPROM_SFP_21: + case EEPROM_SFP_22: + case EEPROM_SFP_23: + case EEPROM_SFP_24: + case EEPROM_SFP_25: + case EEPROM_SFP_26: + case EEPROM_SFP_27: + case EEPROM_SFP_28: + case EEPROM_SFP_29: + case EEPROM_SFP_30: + case EEPROM_SFP_31: + case EEPROM_SFP_32: + case EEPROM_SFP_33: + case EEPROM_SFP_34: + sprintf(attr_path, "/sys/bus/i2c/devices/%d-0050/eeprom", delta_attr->index + EEPROM_MASK); + if (access_user_space(attr_path, buf, count, 0, ATTR_W) < 0) { + goto ACCESS_ERROR; + } + break; + case EEPROM_SYS: + sprintf(attr_path, "/sys/bus/i2c/devices/10-0053/eeprom"); + if (access_user_space(attr_path, buf, count, 0, ATTR_W) < 0) { + goto ACCESS_ERROR; + } + break; + default: + goto ACCESS_ERROR; + } + + mutex_unlock(&dni_lock); + return count; +ACCESS_ERROR: + mutex_unlock(&dni_lock); + return -ETIMEDOUT; +} + +DELTA_BIN_ATTR(eeprom_sys, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SYS); +DELTA_BIN_ATTR(eeprom_sfp_1, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_1); +DELTA_BIN_ATTR(eeprom_sfp_2, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_2); +DELTA_BIN_ATTR(eeprom_sfp_3, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_3); +DELTA_BIN_ATTR(eeprom_sfp_4, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_4); +DELTA_BIN_ATTR(eeprom_sfp_5, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_5); +DELTA_BIN_ATTR(eeprom_sfp_6, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_6); +DELTA_BIN_ATTR(eeprom_sfp_7, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_7); +DELTA_BIN_ATTR(eeprom_sfp_8, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_8); +DELTA_BIN_ATTR(eeprom_sfp_9, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_9); +DELTA_BIN_ATTR(eeprom_sfp_10, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_10); +DELTA_BIN_ATTR(eeprom_sfp_11, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_11); +DELTA_BIN_ATTR(eeprom_sfp_12, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_12); +DELTA_BIN_ATTR(eeprom_sfp_13, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_13); +DELTA_BIN_ATTR(eeprom_sfp_14, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_14); +DELTA_BIN_ATTR(eeprom_sfp_15, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_15); +DELTA_BIN_ATTR(eeprom_sfp_16, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_16); +DELTA_BIN_ATTR(eeprom_sfp_17, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_17); +DELTA_BIN_ATTR(eeprom_sfp_18, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_18); +DELTA_BIN_ATTR(eeprom_sfp_19, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_19); +DELTA_BIN_ATTR(eeprom_sfp_20, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_20); +DELTA_BIN_ATTR(eeprom_sfp_21, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_21); +DELTA_BIN_ATTR(eeprom_sfp_22, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_22); +DELTA_BIN_ATTR(eeprom_sfp_23, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_23); +DELTA_BIN_ATTR(eeprom_sfp_24, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_24); +DELTA_BIN_ATTR(eeprom_sfp_25, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_25); +DELTA_BIN_ATTR(eeprom_sfp_26, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_26); +DELTA_BIN_ATTR(eeprom_sfp_27, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_27); +DELTA_BIN_ATTR(eeprom_sfp_28, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_28); +DELTA_BIN_ATTR(eeprom_sfp_29, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_29); +DELTA_BIN_ATTR(eeprom_sfp_30, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_30); +DELTA_BIN_ATTR(eeprom_sfp_31, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_31); +DELTA_BIN_ATTR(eeprom_sfp_32, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_32); +DELTA_BIN_ATTR(eeprom_sfp_33, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_33); +DELTA_BIN_ATTR(eeprom_sfp_34, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_34); + +static struct bin_attribute *sfp_attrs[] = { + &delta_attr_eeprom_sys.attr, + &delta_attr_eeprom_sfp_1.attr, + &delta_attr_eeprom_sfp_2.attr, + &delta_attr_eeprom_sfp_3.attr, + &delta_attr_eeprom_sfp_4.attr, + &delta_attr_eeprom_sfp_5.attr, + &delta_attr_eeprom_sfp_6.attr, + &delta_attr_eeprom_sfp_7.attr, + &delta_attr_eeprom_sfp_8.attr, + &delta_attr_eeprom_sfp_9.attr, + &delta_attr_eeprom_sfp_10.attr, + &delta_attr_eeprom_sfp_11.attr, + &delta_attr_eeprom_sfp_12.attr, + &delta_attr_eeprom_sfp_13.attr, + &delta_attr_eeprom_sfp_14.attr, + &delta_attr_eeprom_sfp_15.attr, + &delta_attr_eeprom_sfp_16.attr, + &delta_attr_eeprom_sfp_17.attr, + &delta_attr_eeprom_sfp_18.attr, + &delta_attr_eeprom_sfp_19.attr, + &delta_attr_eeprom_sfp_20.attr, + &delta_attr_eeprom_sfp_21.attr, + &delta_attr_eeprom_sfp_22.attr, + &delta_attr_eeprom_sfp_23.attr, + &delta_attr_eeprom_sfp_24.attr, + &delta_attr_eeprom_sfp_25.attr, + &delta_attr_eeprom_sfp_26.attr, + &delta_attr_eeprom_sfp_27.attr, + &delta_attr_eeprom_sfp_28.attr, + &delta_attr_eeprom_sfp_29.attr, + &delta_attr_eeprom_sfp_30.attr, + &delta_attr_eeprom_sfp_31.attr, + &delta_attr_eeprom_sfp_32.attr, + &delta_attr_eeprom_sfp_33.attr, + &delta_attr_eeprom_sfp_34.attr, + NULL, /* need to NULL terminate the list of attributes */ +}; + +static struct attribute_group sfp_attr_grp = { + .bin_attrs = sfp_attrs, +}; + +/*---------------- delta ATTR - end ------------- */ + +/*---------------- MUX - start ------------- */ + +struct cpld_mux_platform_data { + int parent; + int base_nr; + int reg_addr; + struct i2c_client *cpld; +}; + +struct cpld_mux { + struct i2c_adapter *parent; + struct i2c_adapter **child; + struct cpld_mux_platform_data data; +}; + +static struct cpld_mux_platform_data et_c032if_cpld_mux_platform_data[] = { + { + .parent = BUS0, + .base_nr = BUS0_BASE_NUM, + .cpld = NULL, + .reg_addr = BUS0_MUX_REG, + }, +}; + +static struct platform_device et_c032if_cpld_mux[] = +{ + { + .name = "delta-et-c032if-cpld-mux", + .id = 0, + .dev = { + .platform_data = &et_c032if_cpld_mux_platform_data[0], + .release = device_release, + }, + }, +}; + +static int cpld_reg_write_byte(struct i2c_client *client, u8 regaddr, u8 val) +{ + union i2c_smbus_data data; + + data.byte = val; + return client->adapter->algo->smbus_xfer(client->adapter, client->addr, + client->flags, + I2C_SMBUS_WRITE, + regaddr, I2C_SMBUS_BYTE_DATA, &data); +} + +static int cpld_mux_select(struct i2c_mux_core *muxc, u32 chan) +{ + struct cpld_mux *mux = i2c_mux_priv(muxc); + u8 cpld_mux_val=0; + + if ( mux->data.base_nr == BUS0_BASE_NUM ) + { + switch (chan) { + case 0: + cpld_mux_val = EEPROM_VAL; + break; + case 1: + cpld_mux_val = SWPLD_VAL; + break; + case 2: + cpld_mux_val = QSFP_VAL; + break; + default: + cpld_mux_val = 0x00; + break; + } + } + else + { + cpld_mux_val = 0x00; + } + return cpld_reg_write_byte(mux->data.cpld, mux->data.reg_addr, (u8)(cpld_mux_val & 0xff)); + +} + +static int __init cpld_mux_probe(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc; + struct cpld_mux *mux; + struct cpld_mux_platform_data *pdata; + struct i2c_adapter *parent; + int i, ret, dev_num; + + pdata = pdev->dev.platform_data; + if (!pdata) { + dev_err(&pdev->dev, "SWPLD platform data not found\n"); + return -ENODEV; + } + mux = kzalloc(sizeof(*mux), GFP_KERNEL); + if (!mux) { + printk(KERN_ERR "Failed to allocate memory for mux\n"); + return -ENOMEM; + } + mux->data = *pdata; + + parent = i2c_get_adapter(pdata->parent); + if (!parent) { + kfree(mux); + dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); + return -ENODEV; + } + /* Judge bus number to decide how many devices*/ + switch (pdata->parent) { + case BUS0: + dev_num = BUS0_DEV_NUM; + break; + default : + dev_num = DEFAULT_NUM; + break; + } + + muxc = i2c_mux_alloc(parent, &pdev->dev, dev_num, 0, 0,cpld_mux_select, NULL); + if (!muxc) { + ret = -ENOMEM; + goto alloc_failed; + } + muxc->priv = mux; + platform_set_drvdata(pdev, muxc); + + for (i = 0; i < dev_num; i++) + { + int nr = pdata->base_nr + i; + unsigned int class = 0; + ret = i2c_mux_add_adapter(muxc, nr, i, class); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter %d\n", i); + goto add_adapter_failed; + } + } + dev_info(&pdev->dev, "%d port mux on %s adapter\n", dev_num, parent->name); + return 0; + +add_adapter_failed: + i2c_mux_del_adapters(muxc); +alloc_failed: + kfree(mux); + i2c_put_adapter(parent); + + return ret; +} + +static int __exit cpld_mux_remove(struct platform_device *pdev) +{ + struct i2c_mux_core *muxc = platform_get_drvdata(pdev); + struct i2c_adapter *parent = muxc->parent; + + i2c_mux_del_adapters(muxc); + i2c_put_adapter(parent); + + return 0; +} + +static struct platform_driver cpld_mux_driver = { + .probe = cpld_mux_probe, + .remove = __exit_p(cpld_mux_remove), /* TODO */ + .driver = { + .owner = THIS_MODULE, + .name = "delta-et-c032if-cpld-mux", + }, +}; +/*---------------- MUX - end ------------- */ + +/*---------------- module initialization ------------- */ +static int __init delta_et_c032if_platform_init(void) +{ + struct i2c_adapter *adapter; + struct cpld_platform_data *cpld_pdata; + struct cpld_mux_platform_data *cpld_mux_pdata; + int ret,i = 0; + + mutex_init(&dni_lock); + printk("c032if_platform module initialization\n"); + + // set the CPLD prob and remove + ret = platform_driver_register(&cpld_driver); + if (ret) { + printk(KERN_WARNING "Fail to register cpld driver\n"); + goto error_cpld_driver; + } + + ret = platform_driver_register(&cpld_mux_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld mux driver\n"); + goto error_cpld_mux_driver; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld2_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld2_driver; + } + + // set the SWPLD prob and remove + ret = platform_driver_register(&swpld3_driver); + if (ret) { + printk(KERN_WARNING "Fail to register swpld driver\n"); + goto error_swpld3_driver; + } + + // register the i2c devices + ret = platform_driver_register(&i2c_device_driver); + if (ret) { + printk(KERN_WARNING "Fail to register i2c device driver\n"); + goto error_i2c_device_driver; + } + + // register the CPLD + ret = platform_device_register(&et_c032if_cpld); + if (ret) { + printk(KERN_WARNING "Fail to create cpld device\n"); + goto error_et_c032if_cpld; + } + + cpld_pdata = et_c032if_cpld.dev.platform_data; + cpld_mux_pdata = et_c032if_cpld_mux[0].dev.platform_data; + cpld_mux_pdata->cpld = cpld_pdata[cpu_cpld].client; + ret = platform_device_register(&et_c032if_cpld_mux[0]); + if (ret) { + printk(KERN_WARNING "Fail to create cpld mux\n"); + goto error_et_c032if_cpld_mux; + } + + adapter = i2c_get_adapter(12); + i2c_client_9548_1 = i2c_new_device(adapter, &i2c_info_pca9548[0]); + i2c_client_9548_2 = i2c_new_device(adapter, &i2c_info_pca9548[1]); + i2c_client_9548_3 = i2c_new_device(adapter, &i2c_info_pca9548[2]); + i2c_client_9548_4 = i2c_new_device(adapter, &i2c_info_pca9548[3]); + i2c_client_9548_5 = i2c_new_device(adapter, &i2c_info_pca9548[4]); + i2c_put_adapter(adapter); + + // register the SWPLD2 + ret = platform_device_register(&et_c032if_swpld2); + if (ret) { + printk(KERN_WARNING "Fail to create swpld2 device\n"); + goto error_swpld2_device; + } + + // register the SWPLD3 + ret = platform_device_register(&et_c032if_swpld3); + if (ret) { + printk(KERN_WARNING "Fail to create swpld3 device\n"); + goto error_swpld3_device; + } + for (i = 0; i < ARRAY_SIZE(et_c032if_i2c_device); i++) + { + ret = platform_device_register(&et_c032if_i2c_device[i]); + if (ret) { + printk(KERN_WARNING "Fail to create i2c device %d\n", i); + goto error_et_c032if_i2c_device; + } + } + + kobj_sfp = kobject_create_and_add("sfp", kernel_kobj); + if(!kobj_sfp) + { + return -ENOMEM; + } + ret = sysfs_create_group(kobj_sfp, &sfp_attr_grp); + if (ret) + { + printk(KERN_WARNING "Fail to create sysfs of sfp group\n"); + goto error_create_sfp_group; + } + if (ret) + goto error_create_sfp_group; + + return 0; + +error_create_sfp_group: + kobject_put(kobj_sfp); +error_et_c032if_i2c_device: + i--; + for (; i >= 0; i--) { + platform_device_unregister(&et_c032if_i2c_device[i]); + } + i = ARRAY_SIZE(et_c032if_cpld_mux); + platform_device_unregister(&et_c032if_swpld3); +error_swpld3_device: + platform_device_unregister(&et_c032if_swpld2); +error_swpld2_device: + i2c_unregister_device(i2c_client_9548_1); + i2c_unregister_device(i2c_client_9548_2); + i2c_unregister_device(i2c_client_9548_3); + i2c_unregister_device(i2c_client_9548_4); + i2c_unregister_device(i2c_client_9548_5); +error_et_c032if_cpld_mux: + platform_device_unregister(&et_c032if_cpld_mux[0]); + platform_device_unregister(&et_c032if_cpld); +error_et_c032if_cpld: + platform_driver_unregister(&i2c_device_driver); +error_i2c_device_driver: + platform_driver_unregister(&swpld3_driver); +error_swpld3_driver: + platform_driver_unregister(&swpld2_driver); +error_swpld2_driver: + platform_driver_unregister(&cpld_mux_driver); +error_cpld_mux_driver: + platform_driver_unregister(&cpld_driver); +error_cpld_driver: + return ret; +} + +static void __exit delta_et_c032if_platform_exit(void) +{ + int i = 0; + + kobject_put(kobj_sfp); + for (i = 0; i < ARRAY_SIZE(et_c032if_i2c_device); i++) { + platform_device_unregister(&et_c032if_i2c_device[i]); + } + platform_device_unregister(&et_c032if_swpld2); + platform_device_unregister(&et_c032if_swpld3); + i2c_unregister_device(i2c_client_9548_1); + i2c_unregister_device(i2c_client_9548_2); + i2c_unregister_device(i2c_client_9548_3); + i2c_unregister_device(i2c_client_9548_4); + i2c_unregister_device(i2c_client_9548_5); + platform_device_unregister(&et_c032if_cpld_mux[0]); + platform_device_unregister(&et_c032if_cpld); + platform_driver_unregister(&i2c_device_driver); + platform_driver_unregister(&swpld2_driver); + platform_driver_unregister(&swpld3_driver); + platform_driver_unregister(&cpld_mux_driver); + platform_driver_unregister(&cpld_driver); +} + +module_init(delta_et_c032if_platform_init); +module_exit(delta_et_c032if_platform_exit); + +MODULE_DESCRIPTION("Delta et-c032if Platform Support"); +MODULE_AUTHOR("Johnson Lu "); +MODULE_LICENSE("GPL"); diff --git a/platform/innovium/sonic-platform-modules-delta/et-c032if/scripts/et-c032if_platform_init.sh b/platform/innovium/sonic-platform-modules-delta/et-c032if/scripts/et-c032if_platform_init.sh new file mode 100644 index 000000000000..522aabea26bc --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/et-c032if/scripts/et-c032if_platform_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#platform init script for Delta et-c032if + + + +exit 0 + + diff --git a/platform/innovium/sonic-platform-modules-delta/systemd/platform-modules-et-c032if.service b/platform/innovium/sonic-platform-modules-delta/systemd/platform-modules-et-c032if.service new file mode 100644 index 000000000000..273a5ab65a4a --- /dev/null +++ b/platform/innovium/sonic-platform-modules-delta/systemd/platform-modules-et-c032if.service @@ -0,0 +1,13 @@ +[Unit] +Description=Delta et-c032if Platform modules +After=local-fs.target +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-et-c032if start +ExecStop=-/etc/init.d/platform-modules-et-c032if stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From d821cb84b8d85439a36b4da03ec00d227782810b Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 16 Aug 2019 12:08:46 -0700 Subject: [PATCH 208/219] [radv service] radv service should be a cold only dependent of swss (#3348) radv should be left alone during warm restart of swss. Otherwise it will announce departure and cause hosts to lose default gateway. Signed-off-by: Ying Xie --- files/build_templates/radv.service.j2 | 4 ++-- files/scripts/swss.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/build_templates/radv.service.j2 b/files/build_templates/radv.service.j2 index 4f1c67e661b0..3dadc56e46ab 100644 --- a/files/build_templates/radv.service.j2 +++ b/files/build_templates/radv.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=Router advertiser container -Requires=updategraph.service swss.service +Requires=updategraph.service After=updategraph.service swss.service Before=ntp-config.service @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh wait ExecStop=/usr/bin/{{ docker_container_name }}.sh stop [Install] -WantedBy=multi-user.target swss.service +WantedBy=multi-user.target diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 7b6ae6b5dbfe..5b2f582ef4c4 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -2,7 +2,7 @@ SERVICE="swss" PEER="syncd" -DEPENDENT="teamd" +DEPENDENT="teamd radv" DEBUGLOG="/tmp/swss-syncd-debug.log" LOCKFILE="/tmp/swss-syncd-lock" From 32793274a1d8c5ffeef5fb5bd55c7595d50be320 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 16 Aug 2019 12:49:21 -0700 Subject: [PATCH 209/219] [201811][swss][platform-daemon] advance sub module head (#3360) Submodule src/sonic-platform-daemons 42f64d8..1039764: > Merge pull request #42 from keboliu/backport-state-machine Submodule src/sonic-swss 950e9db..384c21e: > [Orchagent]: Fixbug segmentfault at routeorch (#1025) Signed-off-by: Ying Xie --- src/sonic-platform-daemons | 2 +- src/sonic-swss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 42f64d8f61b8..1039764ef53e 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 42f64d8f61b83fdef07c6ac24b2d67f820e1e745 +Subproject commit 1039764ef53e70be5d7b4da0caaf6eab8dc8ca60 diff --git a/src/sonic-swss b/src/sonic-swss index 950e9db345b7..384c21ed8575 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 950e9db345b763b4853a8a1bc828c42c4563dce8 +Subproject commit 384c21ed85751dbb86edd763475ebe74bf2567cb From 8d5e37dd3479b2ee6f28c13a6e871449a86ffc61 Mon Sep 17 00:00:00 2001 From: Mykola F <37578614+mykolaf@users.noreply.github.com> Date: Mon, 19 Aug 2019 19:53:07 +0300 Subject: [PATCH 210/219] [Mellanox] align platform_reboot to use "hardware reboot" (#3320) Signed-off-by: Mykola Faryma --- device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index 58ead6402398..6e02d011f82d 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -4,6 +4,7 @@ declare -r EXIT_SUCCESS="0" declare -r EXIT_ERROR="1" declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" +declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pwr_cycle" FORCE_REBOOT="no" @@ -20,7 +21,7 @@ function ParseArguments() { ParseArguments "$@" -${FW_UPGRADE_SCRIPT} --upgrade +${FW_UPGRADE_SCRIPT} --upgrade --verbose EXIT_CODE="$?" if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then echo "Failed to burn MLNX FW: errno=${EXIT_CODE}" @@ -31,4 +32,6 @@ if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then fi fi -exec /sbin/reboot $@ +echo 1 > $SYSFS_PWR_CYCLE +sleep 3 +echo 0 > $SYSFS_PWR_CYCLE From 1fba1951a7ee559df795da3b92986ab5349e560c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 20 Aug 2019 20:19:51 +0000 Subject: [PATCH 211/219] [kernel] Upgrade kernel to version 4.9.168-1+deb9u5 - Pick up security patches. Signed-off-by: Ying Xie --- rules/linux-kernel.mk | 2 +- src/sonic-linux-kernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 70e597876fc0..5d54c89706dd 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -3,7 +3,7 @@ KVERSION_SHORT = 4.9.0-9 KVERSION = $(KVERSION_SHORT)-amd64 KERNEL_VERSION = 4.9.168 -KERNEL_SUBVERSION = 1+deb9u3 +KERNEL_SUBVERSION = 1+deb9u5 export KVERSION_SHORT KVERSION KERNEL_VERSION KERNEL_SUBVERSION diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index eea4da7acd15..f6a43915c5fa 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit eea4da7acd15be5766a4ab7db3feb6561fd2b5b4 +Subproject commit f6a43915c5fa4fec330f63f700f735515138739a From 950bc059d0d5bdc3a4f06281fe6a68d282fe0a31 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 2 Apr 2019 16:59:00 -0700 Subject: [PATCH 212/219] [minigraph]: Mark both ERSPAN and ERSPANv6 as mirror ACL tables (#2732) - Support ERSPAN and ERSPANv6 two types of ACL tables. - Update the unit test to cover this case. Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/minigraph.py | 2 +- src/sonic-config-engine/tests/t0-sample-graph.xml | 10 ++++++++++ src/sonic-config-engine/tests/test_cfggen.py | 12 +++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index b017d4820ced..2dc5960dd971 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -246,7 +246,7 @@ def parse_dpg(dpg, hname): # Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface if port_alias_map[member] in intfs_inpc: print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" - elif member.lower() == 'erspan': + elif member.lower().startswith('erspan'): is_mirror = True; # Erspan session will be attached to all front panel ports, # if panel ports is a member port of LAG, should add the LAG diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 5eace767c468..bb1a4a4a22f6 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -269,6 +269,16 @@ + + ERSPAN + everflow + Everflow + + + ERSPANv6 + everflowV6 + Everflow + PortChannel01;PortChannel02;PortChannel03;PortChannel04 DataAcl diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index efaf686253f5..1755468300d5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -81,11 +81,13 @@ def test_minigraph_acl(self): self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" "Warning: ignore interface 'fortyGigE0/2' as it is not in the port_config.ini\n" "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" - "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," - " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," - " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}," - " 'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}," - " 'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}}") + "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}, " + "'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}, " + "'EVERFLOW': {'type': 'MIRROR', 'policy_desc': 'EVERFLOW', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}, " + "'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, " + "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, " + "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, " + "'EVERFLOWV6': {'type': 'MIRROR', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' From 16bfd7200f5dc141270dd02a4aa66b00e1f41d93 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Fri, 26 Apr 2019 15:25:09 -0700 Subject: [PATCH 213/219] [minigraph]: Fix bug in copying list in Python (#2831) '=' cannot be used for copying the list Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 1755468300d5..4833530fb466 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -83,11 +83,11 @@ def test_minigraph_acl(self): "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04']}, " "'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL'}, " - "'EVERFLOW': {'type': 'MIRROR', 'policy_desc': 'EVERFLOW', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}, " + "'EVERFLOW': {'type': 'MIRROR', 'policy_desc': 'EVERFLOW', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}, " "'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, " "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, " "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, " - "'EVERFLOWV6': {'type': 'MIRROR', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}") + "'EVERFLOWV6': {'type': 'MIRROR', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' From 66245e29a3ece09c647a82567c4569bb4bfddc54 Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Wed, 1 May 2019 12:04:33 -0700 Subject: [PATCH 214/219] [minigraph]: Add mirror type v6 condition (#2836) Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/minigraph.py | 17 ++++++++++++----- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2dc5960dd971..060cac0447fd 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -228,6 +228,7 @@ def parse_dpg(dpg, hname): aclattach = aclintf.find(str(QName(ns, "AttachTo"))).text.split(';') acl_intfs = [] is_mirror = False + is_mirror_v6 = False # TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g., # maybe we should explicity ignore management and loopback interfaces?) because we @@ -247,7 +248,10 @@ def parse_dpg(dpg, hname): if port_alias_map[member] in intfs_inpc: print >> sys.stderr, "Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface" elif member.lower().startswith('erspan'): - is_mirror = True; + if member.lower().startswith('erspanv6'): + is_mirror_v6 = True + else: + is_mirror = True; # Erspan session will be attached to all front panel ports, # if panel ports is a member port of LAG, should add the LAG # to acl table instead of the panel ports @@ -258,10 +262,13 @@ def parse_dpg(dpg, hname): break; if acl_intfs: acls[aclname] = {'policy_desc': aclname, - 'ports': acl_intfs, - 'type': 'MIRROR' if is_mirror else 'L3'} - elif is_mirror: - acls[aclname] = {'policy_desc': aclname, 'type': 'MIRROR'} + 'ports': acl_intfs} + if is_mirror: + acls[aclname]['type'] = 'MIRROR' + elif is_mirror_v6: + acls[aclname]['type'] = 'MIRRORV6' + else: + acls[aclname]['type'] = 'L3' else: # This ACL has no interfaces to attach to -- consider this a control plane ACL try: diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 4833530fb466..a841f4d19c23 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -87,7 +87,7 @@ def test_minigraph_acl(self): "'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT'}, " "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}, " "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}, " - "'EVERFLOWV6': {'type': 'MIRROR', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}") + "'EVERFLOWV6': {'type': 'MIRRORV6', 'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet24', 'Ethernet40', 'Ethernet20', 'Ethernet44', 'Ethernet48', 'Ethernet28', 'Ethernet96', 'Ethernet92', 'Ethernet76', 'Ethernet72', 'Ethernet52', 'Ethernet80', 'Ethernet56', 'Ethernet32', 'Ethernet16', 'Ethernet36', 'Ethernet12', 'Ethernet60', 'Ethernet8', 'Ethernet4', 'Ethernet0', 'Ethernet64', 'Ethernet68', 'Ethernet84', 'Ethernet88', 'Ethernet108', 'Ethernet104', 'Ethernet100']}}") def test_minigraph_everflow(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v MIRROR_SESSION' From b715ec89c4da7d3bf72de6068840dd56802ccfcf Mon Sep 17 00:00:00 2001 From: pavel-shirshov Date: Mon, 19 Aug 2019 16:05:20 -0700 Subject: [PATCH 215/219] [Fast-Reboot]: FR mode is active only first 3 minutes after start. (#3352) * Fast reboot mode should be enabled only 3 minutes after restart * Advance sonic-quagga submodule --- files/scripts/syncd.sh | 2 +- src/sonic-quagga | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 11d195348882..ef666b786299 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -64,7 +64,7 @@ function getBootType() TYPE='fastfast' ;; *SONIC_BOOT_TYPE=fast*|*fast-reboot*) - TYPE='fast' + TYPE=$(awk '{ if ($1 <= 180) print "fast"; else print "cold" }' /proc/uptime) ;; *) TYPE='cold' diff --git a/src/sonic-quagga b/src/sonic-quagga index 99d9ca8e3291..904a35010779 160000 --- a/src/sonic-quagga +++ b/src/sonic-quagga @@ -1 +1 @@ -Subproject commit 99d9ca8e3291cead8a3f15ff2cb15cf53d70a896 +Subproject commit 904a350107793d44be7167500fcec9087ca3243b From 8c7b0e90db0f8bb596aeaab78d166dd5c6f6d96d Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Fri, 23 Aug 2019 11:55:38 -0700 Subject: [PATCH 216/219] [device/arista] Update driver submodules (#3377) - increase timeout for power supply driver initialization --- platform/barefoot/sonic-platform-modules-arista | 2 +- platform/broadcom/sonic-platform-modules-arista | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index a2213dd18e6f..2b66f7c272de 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a2213dd18e6f6c6f4786f7f9275cd7b4b016bd71 +Subproject commit 2b66f7c272de8fc618cd568bccfc7ae289d465ef diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index a2213dd18e6f..2b66f7c272de 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit a2213dd18e6f6c6f4786f7f9275cd7b4b016bd71 +Subproject commit 2b66f7c272de8fc618cd568bccfc7ae289d465ef From 60b2e54c2becf82e207a5e35af24c0a1448081c7 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Mon, 26 Aug 2019 15:24:50 -0700 Subject: [PATCH 217/219] [201811][utilities][swss] advance sub module head (#3383) Submodule src/sonic-utilities 7460f5c..4f72e14: > [config] Call 'systemctl reset-failed' before 'systemctl restart' when restarting services (#607) > [neighbor advertiser] try getting vlan addresses from o.s first (#613) > [neighbor_advertiser]: Add V6 support to mirror ICMPV6 packets (#612) Submodule src/sonic-swss 384c21e..46bc1f4: > [portsyncd]: Add default catch block in portsyncd (#1033) Signed-off-by: Ying Xie --- src/sonic-swss | 2 +- src/sonic-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-swss b/src/sonic-swss index 384c21ed8575..46bc1f483980 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 384c21ed85751dbb86edd763475ebe74bf2567cb +Subproject commit 46bc1f483980c0f398b7d4b097b6b23a69254944 diff --git a/src/sonic-utilities b/src/sonic-utilities index 7460f5c11b05..4f72e146647d 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 7460f5c11b052cf0e610e668551c8bc6826269fb +Subproject commit 4f72e146647d2ebb93b9e6eb327337942cc68b14 From f78fcb10082f7f3e6bad763540038d1a04138b87 Mon Sep 17 00:00:00 2001 From: simonJi2018 <37395146+simonJi2018@users.noreply.github.com> Date: Wed, 28 Aug 2019 23:43:06 +0800 Subject: [PATCH 218/219] [201811][platform/nephos]fix the compile error about syncd (#3373) Fixed errors in the following files to resolve build failures - docker-ptf-nephos.mk\docker-syncd-nephos.mk\libsaithrift-dev.mk\rules.mk - Upgrade sai.mk for support sai_1.4.1 and upgrade sdk version to 3.0.0 --- platform/nephos/docker-ptf-nephos.mk | 2 +- platform/nephos/docker-syncd-nephos.mk | 12 ++++++------ platform/nephos/libsaithrift-dev.mk | 4 ++-- platform/nephos/rules.mk | 5 ++--- platform/nephos/sai.mk | 6 +++--- platform/nephos/sdk.mk | 4 ++-- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/platform/nephos/docker-ptf-nephos.mk b/platform/nephos/docker-ptf-nephos.mk index 7fbbd271cf65..ee4363fa9ff1 100644 --- a/platform/nephos/docker-ptf-nephos.mk +++ b/platform/nephos/docker-ptf-nephos.mk @@ -2,6 +2,6 @@ DOCKER_PTF_NEPHOS = docker-ptf-nephos.gz $(DOCKER_PTF_NEPHOS)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift -$(DOCKER_PTF_NEPHOS)_DEPENDS += $(PYTHON_SAITHRIFT_NEPHOS) +$(DOCKER_PTF_NEPHOS)_DEPENDS += $(PYTHON_SAITHRIFT) $(DOCKER_PTF_NEPHOS)_LOAD_DOCKERS += $(DOCKER_PTF) SONIC_DOCKER_IMAGES += $(DOCKER_PTF_NEPHOS) diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index be7f606cc7f9..bbfd1cba4132 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -1,17 +1,17 @@ # docker image for nephos syncd -DOCKER_SYNCD_PLATFORM_CODE = bfn +DOCKER_SYNCD_PLATFORM_CODE = nephos include $(PLATFORM_PATH)/../template/docker-syncd-base.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) +$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(NPX_DIAG) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ - $(LIBSWSSCOMMON_DBG) \ - $(LIBSAIMETADATA_DBG) \ - $(LIBSAIREDIS_DBG) - -$(DOCKER_SYNCD_BASE)_FILES += $(DSSERVE) $(NPX_DIAG) + $(LIBSWSSCOMMON_DBG) \ + $(LIBSAIMETADATA_DBG) \ + $(LIBSAIREDIS_DBG) $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd +$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += npx_diag:/usr/bin/npx_diag diff --git a/platform/nephos/libsaithrift-dev.mk b/platform/nephos/libsaithrift-dev.mk index 6ffb4bf51205..e21ebc5c6828 100644 --- a/platform/nephos/libsaithrift-dev.mk +++ b/platform/nephos/libsaithrift-dev.mk @@ -4,7 +4,7 @@ SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) @@ -12,7 +12,7 @@ PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(NEPHOS_SAI) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk index 2e2ee702fb5b..445699baf7eb 100644 --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -8,21 +8,20 @@ include $(PLATFORM_PATH)/docker-syncd-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk -include $(PLATFORM_PATH)/python-saithrift.mk include $(PLATFORM_PATH)/docker-ptf-nephos.mk NPX_DIAG = npx_diag $(NPX_DIAG)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/npx_diag" DSSERVE = dsserve -$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20170518/dsserve?sv=2015-04-05&sr=b&sig=gyNbgSL%2FvpMXDdpboVkIJcTKMRdGgEaOR9OukHhEsu8%3D&se=2030-03-31T23%3A06%3A35Z&sp=r" +$(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/20190307/dsserve?sv=2015-04-05&sr=b&sig=lk7BH3DtW%2F5ehc0Rkqfga%2BUCABI0UzQmDamBsZH9K6w%3D&se=2038-05-06T22%3A34%3A45Z&sp=r" SONIC_ONLINE_FILES += $(NPX_DIAG) $(DSSERVE) SONIC_ALL += $(SONIC_ONE_IMAGE) $(DOCKER_FPM) # Inject nephos sai into sairedis -$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV_NEPHOS) +$(LIBSAIREDIS)_DEPENDS += $(NEPHOS_SAI) $(NEPHOS_SAI_DEV) $(LIBSAITHRIFT_DEV) # Runtime dependency on nephos sai is set only for syncd $(SYNCD)_RDEPENDS += $(NEPHOS_SAI) diff --git a/platform/nephos/sai.mk b/platform/nephos/sai.mk index 0cf8e4698e16..1517cd003525 100644 --- a/platform/nephos/sai.mk +++ b/platform/nephos/sai.mk @@ -1,6 +1,6 @@ -SDK_VERSION = 2.0.7 -SAI_VERSION = 1.3.6 -SAI_COMMIT_ID = 2016d4 +SDK_VERSION = 3.0.0 +SAI_VERSION = 1.4.1 +SAI_COMMIT_ID = 3824ca NEPHOS_SAI = libsainps_$(SDK_VERSION)_sai_$(SAI_VERSION)_$(SAI_COMMIT_ID)_amd64.deb $(NEPHOS_SAI)_URL = "https://github.com/NephosInc/SONiC/raw/master/sai/libsainps_$(SDK_VERSION)_sai_$(SAI_VERSION)_$(SAI_COMMIT_ID)_amd64.deb" diff --git a/platform/nephos/sdk.mk b/platform/nephos/sdk.mk index 9ca3d8754468..508017a3219c 100644 --- a/platform/nephos/sdk.mk +++ b/platform/nephos/sdk.mk @@ -1,6 +1,6 @@ -SDK_VERSION = 2.0.7 +SDK_VERSION = 3.0.0 LINUX_VER = 4.9.0-9 -SDK_COMMIT_ID = 4ce00c +SDK_COMMIT_ID = f0eac8 NEPHOS_NPS_KERNEL = nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb $(NEPHOS_NPS_KERNEL)_URL = "https://github.com/NephosInc/SONiC/raw/master/sdk/nps-modules-$(LINUX_VER)_$(SDK_VERSION)_$(SDK_COMMIT_ID)_amd64.deb" From c6655b8bdf44c967c91b6e1f1d561cd3812a4bf6 Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Wed, 28 Aug 2019 15:46:48 -0700 Subject: [PATCH 219/219] [swss]: Add hash seed 15 for SpineRouter type (#3390) Signed-off-by: Zhenggen Xu --- dockers/docker-orchagent/switch.json.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index a7dafd40f267..f8beffbc9ad7 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -6,6 +6,8 @@ {% set hash_seed = 0 %} {% elif DEVICE_METADATA.localhost.type == "LeafRouter" %} {% set hash_seed = 10 %} +{% elif DEVICE_METADATA.localhost.type == "SpineRouter" %} +{% set hash_seed = 15 %} {% endif %} {% endif %} [