From b5eee425b4b8dca8240b1fd4a423d26c9afaa8b0 Mon Sep 17 00:00:00 2001 From: Alexei Avshalom Lazar Date: Sun, 22 Dec 2019 11:41:56 +0200 Subject: [PATCH] wil6210: notify cfg80211_new_sta upon connection before init tx ring In AP mode upon client connection, sometimes Rx data packet (e.g EAPOL) arrives before driver notify cfg80211_new_sta to kernel. This causes the Rx packet to get lost. To fix this, as part of connect event handling, call cfg80211_new_sta() earlier, before initializing Tx ring. Change-Id: Ife5fd7a5c79da4c0dd094c2b9cbc3785a165331d Signed-off-by: Alexei Avshalom Lazar --- drivers/net/wireless/ath/wil6210/wmi.c | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 1aed102c2734..6040b5c1a1e8 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -1069,6 +1069,24 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len) mutex_unlock(&wil->mutex); return; } + + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + if (!sinfo) { + wmi_disconnect_sta(vif, wil->sta[evt->cid].addr, + WLAN_REASON_UNSPECIFIED, false); + rc = -ENOMEM; + goto out; + } + + sinfo->generation = wil->sinfo_gen++; + + if (assoc_req_ie) { + sinfo->assoc_req_ies = assoc_req_ie; + sinfo->assoc_req_ies_len = assoc_req_ielen; + } + + cfg80211_new_sta(ndev, evt->bssid, sinfo, GFP_KERNEL); + kfree(sinfo); } ether_addr_copy(wil->sta[evt->cid].addr, evt->bssid); @@ -1111,28 +1129,10 @@ static void wmi_evt_connect(struct wil6210_vif *vif, int id, void *d, int len) (wdev->iftype == NL80211_IFTYPE_P2P_GO)) { if (rc) { - if (disable_ap_sme) - /* notify new_sta has failed */ - cfg80211_del_sta(ndev, evt->bssid, GFP_KERNEL); + /* notify new_sta has failed */ + cfg80211_del_sta(ndev, evt->bssid, GFP_KERNEL); goto out; } - - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); - if (!sinfo) { - rc = -ENOMEM; - goto out; - } - - sinfo->generation = wil->sinfo_gen++; - - if (assoc_req_ie) { - sinfo->assoc_req_ies = assoc_req_ie; - sinfo->assoc_req_ies_len = assoc_req_ielen; - } - - cfg80211_new_sta(ndev, evt->bssid, sinfo, GFP_KERNEL); - - kfree(sinfo); } else { wil_err(wil, "unhandled iftype %d for CID %d\n", wdev->iftype, evt->cid);