Search Linux Wireless

[PATCH 2/2] wifi: rtw88: Avoid using macid 0 in AP mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In AP mode, the firmware stops transmitting beacons if it receives
H2C_CMD_RA_INFO for macid 0.

Leave macid 0 unused in AP mode. Macid 1 is already reserved for
broadcast/multicast. Assign macid 2 to the first connected client.

Tested with RTL8811CU and RTL8723DU.

Cc: stable@xxxxxxxxxxxxxxx # 6.6.x
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx>
---
Tagging this for inclusion only in 6.6+ because that's the oldest
stable kernel with USB support, and presumably the PCI devices don't
have this problem. My RTL8822CE doesn't.

I don't know if SDIO devices also have this problem.
---
 drivers/net/wireless/realtek/rtw88/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index b3a089b4f707..e0b1ccc3759c 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -316,11 +316,12 @@ static void rtw_ips_work(struct work_struct *work)
 	mutex_unlock(&rtwdev->mutex);
 }
 
-static u8 rtw_acquire_macid(struct rtw_dev *rtwdev)
+static u8 rtw_acquire_macid(struct rtw_dev *rtwdev, struct ieee80211_vif *vif)
 {
 	unsigned long mac_id;
 
-	mac_id = find_first_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM);
+	mac_id = find_next_zero_bit(rtwdev->mac_id_map, RTW_MAX_MAC_ID_NUM,
+				    vif->type == NL80211_IFTYPE_AP ? 2 : 0);
 	if (mac_id < RTW_MAX_MAC_ID_NUM)
 		set_bit(mac_id, rtwdev->mac_id_map);
 
@@ -345,7 +346,7 @@ int rtw_sta_add(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,
 	struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
 	int i;
 
-	si->mac_id = rtw_acquire_macid(rtwdev);
+	si->mac_id = rtw_acquire_macid(rtwdev, vif);
 	if (si->mac_id >= RTW_MAX_MAC_ID_NUM)
 		return -ENOSPC;
 
-- 
2.45.2





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux