[][MAC80211][WiFi7][app][convert iwpriv/mwctl command with link_id]
[Description]
Add support to convert mwctl bandX to -i <mld_intf> -l <link_id> for mlo
interface. For example, if sigma command is
"$ mwctl bandX set ap_rfeatures coding_type=8",
iwpriv.sh will convert it to
"$ hostapd_cli -i <mld_intf> -l <link_id> raw ap_rfeatures coding_type=8".
The steps to convert mwctl/iwpriv command shows as below:
1. Parse band idx "bandX" from command "mwctl bandX set ap_rfeatures xxx".
2. Read mlo debugfs "mt76_links_info"
3. Parse the ouput of step2 to fetch bandX_links_id, which is the
link_id belong to this band idx.
4. Add "-l <link_id>" to the output command
Please note that this conversion only applicable to the following vendor
commands:
1. ap_rfeatures
2. ap_wireless
[Release-log]
N/A
Change-Id: I59a8d793d1e39bcccda23089337ce8cd6981045d
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9197771
diff --git a/feed/app/atenl/files/iwpriv.sh b/feed/app/atenl/files/iwpriv.sh
index 0dde191..0fe319d 100755
--- a/feed/app/atenl/files/iwpriv.sh
+++ b/feed/app/atenl/files/iwpriv.sh
@@ -1222,10 +1222,32 @@
## Translate to mt76-vendor command
"csi"|"amnt"|"ap_rfeatures"|"ap_wireless"|"mu"|"set_muru_manual_config")
cert_cmd="$*"
- if [ ! -z "$mld" ]; then
- mld_interface=$(iw dev | grep Interface | awk '{print $2}')
- cert_cmd="$(echo $* | sed 's/band[0-9]/${mld_interface}/')"
- fi
+
+ if [ ! -z "$mld" ]; then
+ mld_interface=$(iw dev | grep Interface | awk '{print $2}')
+ if [ $cmd == "ap_rfeatures" ] || [ "$cmd" == "ap_wireless" ]; then
+
+ band_number=$(echo "$cert_cmd" | grep -o 'band[0-9]*')
+
+ links_info_base="/sys/kernel/debug/ieee80211/phy0/netdev"
+ links_info_intf="${mld_interface}/mt76_links_info"
+ links_info_cmd="${links_info_base}:${links_info_intf}"
+
+ band_link_id_info=$(
+ cat "$links_info_cmd" | grep "${band_number}_link_id"
+ )
+ band_link_id=$(
+ echo "$band_link_id_info" | awk -F'=' '{print $2}' | tr -d ' '
+ )
+
+ cmd_w_link_id=$(echo $* | sed "s/band[0-9]/& -l ${band_link_id}/g")
+ cert_cmd=${cmd_w_link_id}
+
+ fi
+ ## convert bandX to mld interface name
+ cert_cmd="$(echo ${cert_cmd} | sed 's/band[0-9]/${mld_interface}/')"
+ fi
+
if [ ${is_connac3} == "1" ]; then
hostapd_cmd="$(echo $cert_cmd | sed 's/set/raw/')"
do_cmd "hostapd_cli -i $hostapd_cmd"