Skip to content

Commit 14f8994

Browse files
Russell King (Oracle)Kalle Valo
authored andcommitted
wifi: wlcore: fix wlcore AP mode
Using wl183x devices in AP mode with various firmwares is not stable. The driver currently adds a station to firmware with basic rates when it is first known to the stack using the CMD_ADD_PEER command. Once the station has finished authorising, another CMD_ADD_PEER command is issued to update the firmware with the rates the station can use. However, after a random amount of time, the firmware ignores the power management nullfunc frames from the station, and tries to send packets while the station is asleep, resulting in lots of retries dropping down in rate due to no response. This restricts the available bandwidth. With this happening with several stations, the user visible effect is the latency of interactive connections increases significantly, packets get dropped, and in general the WiFi connections become unreliable and unstable. Eventually, the firmware transmit queue appears to get stuck - with packets and blocks allocated that never clear. TI have a couple of patches that address this, but they touch the mac80211 core to disable NL80211_FEATURE_FULL_AP_CLIENT_STATE for *all* wireless drivers, which has the effect of not adding the station to the stack until later when the rates are known. This is a sledge hammer approach to solving the problem. The solution implemented here has the same effect, but without impacting all drivers. We delay adding the station to firmware until it has been authorised in the driver, and correspondingly remove the station when unwinding from authorised state. Adding the station to firmware allocates a hlid, which will now happen later than the driver expects. Therefore, we need to track when this happens so that we transmit using the correct hlid. This patch is an equivalent fix to these two patches in TI's wilink8-wlan repository: https://git.ti.com/cgit/wilink8-wlan/build-utilites/tree/patches/kernel_patches/4.19.38/0004-mac80211-patch.patch?h=r8.9&id=a2ee50aa5190ed3b334373d6cd09b1bff56ffcf7 https://git.ti.com/cgit/wilink8-wlan/build-utilites/tree/patches/kernel_patches/4.19.38/0005-wlcore-patch.patch?h=r8.9&id=a2ee50aa5190ed3b334373d6cd09b1bff56ffcf7 Reported-by: Russell King (Oracle) <[email protected]> Co-developed-by: Johannes Berg <[email protected]> Tested-by: Russell King (Oracle) <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://msgid.link/[email protected]
1 parent 0d9c2be commit 14f8994

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

drivers/net/wireless/ti/wlcore/cmd.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,13 +1566,6 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
15661566
cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates,
15671567
wlvif->band));
15681568

1569-
if (!cmd->supported_rates) {
1570-
wl1271_debug(DEBUG_CMD,
1571-
"peer has no supported rates yet, configuring basic rates: 0x%x",
1572-
wlvif->basic_rate_set);
1573-
cmd->supported_rates = cpu_to_le32(wlvif->basic_rate_set);
1574-
}
1575-
15761569
wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x",
15771570
cmd->supported_rates, sta->uapsd_queues);
15781571

drivers/net/wireless/ti/wlcore/main.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5139,19 +5139,23 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
51395139

51405140
/* Add station (AP mode) */
51415141
if (is_ap &&
5142-
old_state == IEEE80211_STA_NOTEXIST &&
5143-
new_state == IEEE80211_STA_NONE) {
5142+
old_state == IEEE80211_STA_AUTH &&
5143+
new_state == IEEE80211_STA_ASSOC) {
51445144
ret = wl12xx_sta_add(wl, wlvif, sta);
51455145
if (ret)
51465146
return ret;
51475147

5148+
wl_sta->fw_added = true;
5149+
51485150
wlcore_update_inconn_sta(wl, wlvif, wl_sta, true);
51495151
}
51505152

51515153
/* Remove station (AP mode) */
51525154
if (is_ap &&
5153-
old_state == IEEE80211_STA_NONE &&
5154-
new_state == IEEE80211_STA_NOTEXIST) {
5155+
old_state == IEEE80211_STA_ASSOC &&
5156+
new_state == IEEE80211_STA_AUTH) {
5157+
wl_sta->fw_added = false;
5158+
51555159
/* must not fail */
51565160
wl12xx_sta_remove(wl, wlvif, sta);
51575161

@@ -5165,11 +5169,6 @@ static int wl12xx_update_sta_state(struct wl1271 *wl,
51655169
if (ret < 0)
51665170
return ret;
51675171

5168-
/* reconfigure rates */
5169-
ret = wl12xx_cmd_add_peer(wl, wlvif, sta, wl_sta->hlid);
5170-
if (ret < 0)
5171-
return ret;
5172-
51735172
ret = wl1271_acx_set_ht_capabilities(wl, &sta->deflink.ht_cap,
51745173
true,
51755174
wl_sta->hlid);

drivers/net/wireless/ti/wlcore/tx.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ EXPORT_SYMBOL(wl12xx_is_dummy_packet);
140140
static u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif,
141141
struct sk_buff *skb, struct ieee80211_sta *sta)
142142
{
143-
if (sta) {
144-
struct wl1271_station *wl_sta;
145-
146-
wl_sta = (struct wl1271_station *)sta->drv_priv;
147-
return wl_sta->hlid;
143+
if (sta && wl1271_station(sta)->fw_added) {
144+
return wl1271_station(sta)->hlid;
148145
} else {
149146
struct ieee80211_hdr *hdr;
150147

drivers/net/wireless/ti/wlcore/wlcore_i.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ struct wl12xx_rx_filter {
324324

325325
struct wl1271_station {
326326
u8 hlid;
327+
bool fw_added;
327328
bool in_connection;
328329

329330
/*
@@ -335,6 +336,11 @@ struct wl1271_station {
335336
u64 total_freed_pkts;
336337
};
337338

339+
static inline struct wl1271_station *wl1271_station(struct ieee80211_sta *sta)
340+
{
341+
return (struct wl1271_station *)sta->drv_priv;
342+
}
343+
338344
struct wl12xx_vif {
339345
struct wl1271 *wl;
340346
struct list_head list;

0 commit comments

Comments
 (0)