-
Notifications
You must be signed in to change notification settings - Fork 371
sonic-sairedis: Add support to sonic-sairedis for gearbox phys #624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4942ac1
sonic-sairedis: Add support to sonic-sairedis for gearbox phys
slogan621 8695a23
Address review comments
slogan621 4d93ea9
recode syncd_init_common.sh to support physyncd
slogan621 9e2d0c4
revert syncd_init_common.sh to support only launching syncd, modify p…
slogan621 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,89 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| CMD_PHYSYNCD=/usr/bin/physyncd | ||
|
|
||
| # dsserve: domain socket server for stdio | ||
| CMD_DSSERVE=/usr/bin/dsserve | ||
| CMD_DSSERVE_ARGS="$CMD_PHYSYNCD --diag" | ||
|
|
||
| ENABLE_SAITHRIFT=0 | ||
|
|
||
| PLATFORM_DIR=/usr/share/sonic/platform | ||
| HWSKU_DIR=/usr/share/sonic/hwsku | ||
|
|
||
| SONIC_ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) | ||
|
|
||
| if [ -x $CMD_DSSERVE ]; then | ||
| CMD=$CMD_DSSERVE | ||
| CMD_ARGS=$CMD_DSSERVE_ARGS | ||
| else | ||
| CMD=$CMD_PHYSYNCD | ||
| CMD_ARGS= | ||
| fi | ||
|
|
||
| # Use temporary view between init and apply | ||
| CMD_ARGS+=" -u" | ||
|
|
||
| BOOT_TYPE="$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" | ||
|
|
||
| case "$BOOT_TYPE" in | ||
| fast-reboot) | ||
| FAST_REBOOT='yes' | ||
| ;; | ||
| fastfast) | ||
| if [ -e /var/warmboot/warm-starting ]; then | ||
| FASTFAST_REBOOT='yes' | ||
| fi | ||
| ;; | ||
| *) | ||
| FAST_REBOOT='no' | ||
| FASTFAST_REBOOT='no' | ||
| ;; | ||
| esac | ||
|
|
||
|
|
||
| function check_warm_boot() | ||
| { | ||
| # FIXME: if we want to continue start option approach, then we need to add | ||
| # code here to support redis database query. | ||
| # SYSTEM_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|system" enable` | ||
| # SERVICE_WARM_START=`/usr/bin/redis-cli -n 6 hget "WARM_RESTART_ENABLE_TABLE|${SERVICE}" enable` | ||
| # SYSTEM_WARM_START could be empty, always make WARM_BOOT meaningful. | ||
| # if [[ x"$SYSTEM_WARM_START" == x"true" ]] || [[ x"$SERVICE_WARM_START" == x"true" ]]; then | ||
| # WARM_BOOT="true" | ||
| # else | ||
| WARM_BOOT="false" | ||
| # fi | ||
| } | ||
|
|
||
|
|
||
| function set_start_type() | ||
| { | ||
| if [ x"$WARM_BOOT" == x"true" ]; then | ||
| CMD_ARGS+=" -t warm" | ||
| elif [ $FAST_REBOOT == "yes" ]; then | ||
| CMD_ARGS+=" -t fast" | ||
| elif [ $FASTFAST_REBOOT == "yes" ]; then | ||
| CMD_ARGS+=" -t fastfast" | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| config_syncd_bcm() | ||
| { | ||
| :; | ||
| } | ||
|
|
||
|
|
||
| config_physyncd() | ||
| { | ||
|
|
||
| set_start_type | ||
|
|
||
| if [ ${ENABLE_SAITHRIFT} == 1 ]; then | ||
| CMD_ARGS+=" -r -m $HWSKU_DIR/port_config.ini" | ||
| fi | ||
|
|
||
| [ -r $PLATFORM_DIR/physyncd.conf ] && . $PLATFORM_DIR/physyncd.conf | ||
| } | ||
|
|
||
This file contains hidden or 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,12 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Script to start syncd using supervisord | ||
| # | ||
|
|
||
| # Source the file that holds common code for systemd and supervisord | ||
| . /usr/bin/physyncd_init_common.sh | ||
|
|
||
| config_physyncd | ||
|
|
||
| exec "/usr/bin/physyncd_startup.py" | ||
|
|
This file contains hidden or 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: | ||
sydlogan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 hidden or 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 hidden or 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; | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.