-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sonic-sairedis: Add support to sonic-sairedis for gearbox phys (#624)
* sonic-sairedis: Add support to sonic-sairedis for gearbox phys * builds on support for multiple switches in sonic-sairedis * new vslib switch BCM81724 implements a virtual gearbox phy. * support for launching second (BCM81724 is supported by its own syncd) * simple refactoring of tests to support switches by part number, still working with sairedis to support multiple switch in tests so BCM81724 will be a separate pull request) * changed example context_config.json to reflect renaming of phy REDIS tables (see sonic-swss-common commit 292b08a3a80b24b23663020b37e6260039a311c0) Note that a future commit to sonic-buildimage will be required to trigger launch of physyncd (launching is based on device config files which are currently not present in sonic-buildimage). Testing done in multiple environments (broadcom fork and pure upstream). Example CLI output based on changes pushed to sonic-utilities (commit a6c4456) running in VS switch supporting BCM81724: root@sonic:/home/admin# show gearbox interfaces status PHY Id Interface MAC Lanes MAC Lane Speed PHY Lanes PHY Lane Speed Line Lanes Line Lane Speed Oper Admin -------- ----------- ----------- ---------------- ----------- ---------------- ------------ ----------------- ------ ------- 1 Ethernet0 25,26,27,28 10G 200,201 20G 206 40G up up 1 Ethernet4 29,30,31,32 10G 202,203 20G 207 40G up up 1 Ethernet8 33,34,35,36 10G 204,205 20G 208 40G up up HLD is located at https://github.com/Azure/SONiC/blob/b817a12fd89520d3fd26bbc5897487928e7f6de7/doc/gearbox/gearbox_mgr_design.md Signed-off-by: syd.logan@broadcom.com * Address review comments * recode syncd_init_common.sh to support physyncd * revert syncd_init_common.sh to support only launching syncd, modify physyncd_start.sh to launch via python script bypassing syncd_init_common Co-authored-by: Syd Logan <slogan621@gmail.com>
- Loading branch information
Showing
76 changed files
with
739 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Script to start syncd using supervisord | ||
# | ||
|
||
exec "/usr/bin/physyncd_startup.py" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/python | ||
|
||
''' | ||
Copyright 2019 Broadcom. The term "Broadcom" refers to Broadcom Inc. | ||
and/or its subsidiaries. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
''' | ||
import os | ||
import json | ||
import subprocess | ||
|
||
|
||
def physyncd_enable(gearbox_config): | ||
i = 1 | ||
for phy in gearbox_config['phys']: | ||
subprocess.Popen(["/bin/bash", "-c", "/bin/bash -c {}".format('"exec /usr/bin/syncd -p /etc/sai.d/pai.profile -x /usr/share/sonic/hwsku/context_config.json -g {}"'.format(i))], close_fds=True) | ||
i += 1 | ||
|
||
def main(): | ||
|
||
# Only privileged users can execute this command | ||
if os.geteuid() != 0: | ||
sys.exit("Root privileges required for this operation") | ||
|
||
""" Loads json file """ | ||
try: | ||
with open('/usr/share/sonic/hwsku/gearbox_config.json') as file_object: | ||
gearbox_config=json.load(file_object) | ||
except: | ||
sys.exit("No external PHY / gearbox supported on this platform, existing physycd application") | ||
|
||
physyncd_enable(gearbox_config) | ||
|
||
|
||
if __name__== "__main__": | ||
main() | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or | ||
its subsidiaries. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "SwitchStateBase.h" | ||
|
||
namespace saivs | ||
{ | ||
class SwitchBCM81724: | ||
public SwitchStateBase | ||
{ | ||
public: | ||
|
||
SwitchBCM81724( | ||
_In_ sai_object_id_t switch_id, | ||
_In_ std::shared_ptr<RealObjectIdManager> manager, | ||
_In_ std::shared_ptr<SwitchConfig> config); | ||
|
||
SwitchBCM81724( | ||
_In_ sai_object_id_t switch_id, | ||
_In_ std::shared_ptr<RealObjectIdManager> manager, | ||
_In_ std::shared_ptr<SwitchConfig> config, | ||
_In_ std::shared_ptr<WarmBootState> warmBootState); | ||
|
||
virtual ~SwitchBCM81724(); | ||
|
||
protected: | ||
|
||
virtual sai_status_t create_port_dependencies(_In_ sai_object_id_t port_id) override; | ||
|
||
virtual sai_status_t create_qos_queues_per_port(_In_ sai_object_id_t port_id) override; | ||
|
||
virtual sai_status_t create_qos_queues() override; | ||
|
||
virtual sai_status_t set_switch_mac_address() override; | ||
|
||
virtual sai_status_t create_default_vlan() override; | ||
|
||
virtual sai_status_t create_default_1q_bridge() override; | ||
|
||
virtual sai_status_t create_default_virtual_router() override; | ||
|
||
virtual sai_status_t create_default_stp_instance() override; | ||
|
||
virtual sai_status_t create_default_trap_group() override; | ||
|
||
virtual sai_status_t create_ingress_priority_groups_per_port( | ||
_In_ sai_object_id_t port_id) override; | ||
|
||
virtual sai_status_t create_ingress_priority_groups() override; | ||
|
||
virtual sai_status_t create_vlan_members() override; | ||
|
||
virtual sai_status_t create_bridge_ports() override; | ||
|
||
virtual sai_status_t set_acl_entry_min_prio() override; | ||
|
||
virtual sai_status_t set_acl_capabilities() override; | ||
|
||
virtual sai_status_t set_maximum_number_of_childs_per_scheduler_group() override; | ||
|
||
virtual sai_status_t set_number_of_ecmp_groups() override; | ||
|
||
virtual sai_status_t create_cpu_port(); | ||
|
||
virtual sai_status_t create_ports(); | ||
|
||
protected : // refresh | ||
|
||
virtual sai_status_t refresh_port_list( | ||
_In_ const sai_attr_metadata_t *meta) override; | ||
|
||
virtual sai_status_t refresh_bridge_port_list( | ||
_In_ const sai_attr_metadata_t *meta, | ||
_In_ sai_object_id_t bridge_id) override; | ||
|
||
virtual sai_status_t refresh_vlan_member_list( | ||
_In_ const sai_attr_metadata_t *meta, | ||
_In_ sai_object_id_t vlan_id) override; | ||
|
||
protected: | ||
|
||
virtual sai_status_t refresh_read_only( _In_ const sai_attr_metadata_t *meta, _In_ sai_object_id_t object_id) override; | ||
virtual sai_status_t set_switch_default_attributes(); | ||
virtual sai_status_t initialize_default_objects() override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.