From 37eaf33035f2c01f4f0d97fbcce25f75ffebd697 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 26 Jul 2023 22:57:19 +0800 Subject: [PATCH] autocore-x86: advertise 2.5G/5G link modes for Intel x550 --- package/lean/autocore/Makefile | 2 +- package/lean/autocore/files/x86/autocore | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package/lean/autocore/Makefile b/package/lean/autocore/Makefile index 7c550a410..125421234 100644 --- a/package/lean/autocore/Makefile +++ b/package/lean/autocore/Makefile @@ -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 diff --git a/package/lean/autocore/files/x86/autocore b/package/lean/autocore/files/x86/autocore index 3172beba3..ecae6d7d2 100755 --- a/package/lean/autocore/files/x86/autocore +++ b/package/lean/autocore/files/x86/autocore @@ -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)