From: Felix Fietkau Date: Tue, 8 Aug 2023 18:12:11 +0000 (+0200) Subject: mac80211: fix applying tx/rx antenna changes afer hostapd reload change X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=afa229038c05ba0ca20595d7f73bea94db21d3a6;p=openwrt%2Fstaging%2Fsvanheule.git mac80211: fix applying tx/rx antenna changes afer hostapd reload change Tear down all interfaces if the antenna settings change, so that the capabilities can be recalculated properly Signed-off-by: Felix Fietkau --- diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index a2a7bdba25..d87a2c6312 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -1089,14 +1089,18 @@ drv_mac80211_setup() { json_get_values scan_list scan_list json_select .. + json_select data && { + json_get_var prev_rxantenna rxantenna + json_get_var prev_txantenna txantenna + json_select .. + } + find_phy || { echo "Could not find PHY for device '$1'" wireless_set_retry 0 return 1 } - wireless_set_data phy="$phy" - local wdev local cwdev local found @@ -1130,6 +1134,9 @@ drv_mac80211_setup() { [ "$txantenna" = "all" ] && txantenna=0xffffffff [ "$rxantenna" = "all" ] && rxantenna=0xffffffff + [ "$rxantenna" = "$prev_rxantenna" -a "$txantenna" = "$prev_txantenna" ] || mac80211_reset_config "$phy" + wireless_set_data phy="$phy" txantenna="$txantenna" rxantenna="$rxantenna" + iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1 iw phy "$phy" set antenna_gain $antenna_gain >/dev/null 2>&1 iw phy "$phy" set distance "$distance" >/dev/null 2>&1