File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -248,13 +248,25 @@ config_syncd_barefoot()
248
248
echo " SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin" >> $PROFILE_FILE
249
249
fi
250
250
CMD_ARGS+=" -l -p $PROFILE_FILE "
251
-
252
- # Check and load SDE profile
251
+ # Check if SDE profile is configured
253
252
P4_PROFILE=$( sonic-cfggen -d -v ' DEVICE_METADATA["localhost"]["p4_profile"]' )
254
253
if [[ -n " $P4_PROFILE " ]]; then
255
254
if [[ ( -d /opt/bfn/install_${P4_PROFILE} ) && ( -L /opt/bfn/install || ! -e /opt/bfn/install ) ]]; then
256
255
ln -srfn /opt/bfn/install_${P4_PROFILE} /opt/bfn/install
257
256
fi
257
+ else
258
+ CHIP_FAMILY_INFO=" $( cat $HWSKU_DIR /switch-tna-sai.conf | grep chip_family | awk -F : ' {print $2}' | cut -d ' "' -f 2) "
259
+ CHIP_FAMILY=${CHIP_FAMILY_INFO,,}
260
+ [[ " $CHIP_FAMILY " == " tofino" ]] && P4_PTYPE=" x" || P4_PTYPE=" y"
261
+ # Check if the current profile fits the ASIC family
262
+ PROFILE_DEFAULT=$( readlink /opt/bfn/install)
263
+ if [[ " $PROFILE_DEFAULT " != " install_$P4_PTYPE " * " _profile" && " $PROFILE_DEFAULT " != * " _$CHIP_FAMILY " ]]; then
264
+ # Find suitable profile
265
+ PROFILE=$( ls -d /opt/bfn/install_$P4_PTYPE * _profile -d /opt/bfn/install_* _$CHIP_FAMILY 2> /dev/null | head -1)
266
+ if [[ ! -z $PROFILE ]]; then
267
+ ln -srfn $PROFILE /opt/bfn/install
268
+ fi
269
+ fi
258
270
fi
259
271
export PYTHONHOME=/opt/bfn/install/
260
272
export PYTHONPATH=/opt/bfn/install/
You can’t perform that action at this time.
0 commit comments