autocore-x86: advertise 2.5G/5G link modes for Intel x550

This commit is contained in:
coolsnowwolf 2023-07-26 22:57:19 +08:00
parent 2b743dbff0
commit 37eaf33035
2 changed files with 13 additions and 1 deletions

View File

@ -24,7 +24,7 @@ endef
define Package/autocore-x86
TITLE:=x86/x64 auto core loadbalance script.
MAINTAINER:=Lean
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool +pciutils
VARIANT:=x86
endef

View File

@ -43,6 +43,18 @@ start()
mkdir -p /tmp/sysinfo
echo $h > /tmp/sysinfo/model
all_pcis=`lspci | grep -i 'eth' | grep -i 'x550' | cut -d ' ' -f 1`
all_ifs=`cat /proc/net/dev | grep -i 'eth' | cut -d : -f 1 | sed 's/^[ \t]*//g'`
for ifname in ${all_ifs}
do
if_pci=`ethtool -i ${ifname} | grep -i 'bus-info' | cut -d : -f 3-`
if [[ "$all_pcis" =~ "$if_pci" ]]
then
ethtool -s ${ifname} advertise 0x1800000001028
fi
done
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
b=$(echo "$a" | wc -l)