Merge "wil6210: notify cfg80211_new_sta upon connection before init tx ring"

This commit is contained in:
qctecmdr 2019-12-30 18:34:58 -08:00 • committed by Gerrit - the friendly Code Review server
commit 9a2d5fc879
3 changed files with 63 additions and 20 deletions

View file

@ -34,6 +34,8 @@
*/
#define WIL_EDMG_CHANNELS (BIT(0) | BIT(1) | BIT(2) | BIT(3))
#define WIL_DISABLE_EDMG 255
bool disable_ap_sme;
module_param(disable_ap_sme, bool, 0444);
MODULE_PARM_DESC(disable_ap_sme, " let user space handle AP mode SME");
@ -594,6 +596,9 @@ int wil_spec2wmi_ch(u8 spec_ch, u8 *wmi_ch)
case 12:
*wmi_ch = WMI_CHANNEL_12;
break;
case WIL_DISABLE_EDMG:
*wmi_ch = 0;
break;
default:
return -EINVAL;
}
@ -2336,6 +2341,11 @@ static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
struct wil6210_vif *vif = ndev_to_vif(ndev);
int rc;
u32 privacy = 0;
u16 len = 0, proberesp_len = 0;
u8 *ies = NULL, *proberesp;
bool ssid_changed = false;
const u8 *ie;
wil_dbg_misc(wil, "change_beacon, mid=%d\n", vif->mid);
wil_print_bcon_data(bcon);
@ -2348,6 +2358,27 @@ static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
memcpy(vif->ssid, wdev->ssid, wdev->ssid_len);
vif->ssid_len = wdev->ssid_len;
/* extract updated SSID from the probe response IE */
proberesp = _wil_cfg80211_get_proberesp_ies(bcon->probe_resp,
bcon->probe_resp_len,
&proberesp_len);
rc = _wil_cfg80211_merge_extra_ies(proberesp,
proberesp_len,
bcon->proberesp_ies,
bcon->proberesp_ies_len,
&ies, &len);
if (!rc) {
ie = cfg80211_find_ie(WLAN_EID_SSID, ies, len);
if (ie && ie[1] <= IEEE80211_MAX_SSID_LEN)
if (ie[1] != vif->ssid_len ||
memcmp(&ie[2], vif->ssid, ie[1])) {
memcpy(vif->ssid, &ie[2], ie[1]);
vif->ssid_len = ie[1];
ssid_changed = true;
}
}
/* in case privacy has changed, need to restart the AP */
if (vif->privacy != privacy) {
wil_dbg_misc(wil, "privacy changed %d=>%d. Restarting AP\n",
@ -2361,9 +2392,20 @@ static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
vif->hidden_ssid,
vif->pbss);
} else {
if (ssid_changed) {
rc = wmi_set_ssid(vif, vif->ssid_len, vif->ssid);
if (rc)
goto out;
}
rc = _wil_cfg80211_set_ies(vif, bcon);
}
if (ssid_changed) {
wdev->ssid_len = vif->ssid_len;
memcpy(wdev->ssid, vif->ssid, vif->ssid_len);
}
out:
return rc;
}

View file

@ -1049,6 +1049,7 @@ struct wil6210_priv {
u8 wakeup_trigger;
struct wil_suspend_stats suspend_stats;
struct wil_debugfs_data dbg_data;
/* set to WIL_EDMG_DISABLE to force disable EDMG */
u8 force_edmg_channel;
bool tx_latency; /* collect TX latency measurements */
size_t tx_latency_res; /* bin resolution in usec */

View file

@ -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);