From 6712a8f13cd0d773a18c946d75f29e3636c71949 Mon Sep 17 00:00:00 2001 From: Volodymyr Boiko <66446128+vboykox@users.noreply.github.com> Date: Tue, 13 Oct 2020 00:16:01 +0300 Subject: [PATCH 1/2] [barefoot][platform] Fix symlinks and syncd.conf for Newport in platform/ (#5585) Fix symlinks and syncd.conf for Newport in platform/ directory Signed-off-by: Volodymyr Boyko --- .../x86_64-accton_as9516_32d-r0/syncd.conf | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf b/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf new file mode 100644 index 000000000000..6035b97b9834 --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf @@ -0,0 +1,23 @@ +#!/bin/bash + + +y_profile_set() { + P4_PROFILE=$(sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["p4_profile"]') + if [[ -n "$P4_PROFILE" || ( ! -L /opt/bfn/install && -e /opt/bfn/install ) ]]; then + return + fi + + Y_PROFILE=$(ls -d /opt/bfn/install_y*_profile 2> /dev/null | head -1) + if [[ -z $Y_PROFILE ]]; then + echo "No P4 profile found for Newport" + return + fi + + ln -srfn $Y_PROFILE /opt/bfn/install +} + +( + unset PYTHONPATH + unset PYTHONHOME + y_profile_set +) From 73e28f9adad578b65b215f6ca019c822d77fc828 Mon Sep 17 00:00:00 2001 From: Myron Sosyak <49795530+msosyak@users.noreply.github.com> Date: Thu, 24 Dec 2020 20:27:52 +0200 Subject: [PATCH 2/2] [barefoot] Fix y_profile_set to not reset link (#6238) Y* profile is the name pattern for p4 programs that developed for the current platform. The difference between them is features enabled and resource reservation. For this platform, it is expected to work on any Y profile. but after the latest changes, the first Y profile is always used. Signed-off-by: Myron Sosyak --- device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf b/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf index 6035b97b9834..11956f83a5af 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/syncd.conf @@ -7,12 +7,18 @@ y_profile_set() { return fi + if [[ $(readlink /opt/bfn/install) =~ "install_y" ]]; then + echo "/opt/bfn/install is a link to Y profile" + return + fi + Y_PROFILE=$(ls -d /opt/bfn/install_y*_profile 2> /dev/null | head -1) if [[ -z $Y_PROFILE ]]; then echo "No P4 profile found for Newport" return fi + echo "Link /opt/bfn/install to $Y_PROFILE" ln -srfn $Y_PROFILE /opt/bfn/install }