From: Rafał Miłecki Date: Thu, 2 Feb 2017 10:23:17 +0000 (+0100) Subject: mac80211: brcmfmac: backport wowlan netdetect fixes X-Git-Tag: v17.01.0-rc2~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5c4b2eb3dd9261d9e604dcdff2c93860a6313582;p=oweals%2Fopenwrt.git mac80211: brcmfmac: backport wowlan netdetect fixes I needed a moment to figure out relation between this patchset and the nl80211: fix validation of scheduled scan info for wowlan netdetect It appears nl80211 commit will go on top of brcmfmac changes so it's safe to backport these patches. One patch that was excluded is commit 2a2a5d1835b6 ("brcmfmac: add .update_connect_params() callback") as it depends on missing commit 088e8df82f91 ("cfg80211: Add support to update connection parameters"). Signed-off-by: Rafał Miłecki --- diff --git a/package/kernel/mac80211/patches/364-0001-brcmfmac-provide-a-value-for-struct-wowlan_support-m.patch b/package/kernel/mac80211/patches/364-0001-brcmfmac-provide-a-value-for-struct-wowlan_support-m.patch new file mode 100644 index 0000000000..ec127d3c93 --- /dev/null +++ b/package/kernel/mac80211/patches/364-0001-brcmfmac-provide-a-value-for-struct-wowlan_support-m.patch @@ -0,0 +1,30 @@ +From 2ef0359031b9ed891ca381b2687186fb52b277f8 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Fri, 27 Jan 2017 12:27:45 +0000 +Subject: [PATCH] brcmfmac: provide a value for struct + wowlan_support::max_nd_match_sets + +The driver advertises support for WOWLAN_NETDETECT but did not specify +maximum amount of netdetect match sets. This was no issue due to a bug +in nl80211. As that has been fixed, brcmfmac also needs fixing. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6356,6 +6356,8 @@ static void brcmf_wiphy_wowl_params(stru + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) { + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ND)) { + brcmf_wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT; ++ brcmf_wowlan_support.max_nd_match_sets = ++ BRCMF_PNO_MAX_PFN_COUNT; + init_waitqueue_head(&cfg->wowl.nd_data_wait); + } + } diff --git a/package/kernel/mac80211/patches/364-0002-brcmfmac-fix-handling-firmware-results-for-wowl-netd.patch b/package/kernel/mac80211/patches/364-0002-brcmfmac-fix-handling-firmware-results-for-wowl-netd.patch new file mode 100644 index 0000000000..52541ed3d0 --- /dev/null +++ b/package/kernel/mac80211/patches/364-0002-brcmfmac-fix-handling-firmware-results-for-wowl-netd.patch @@ -0,0 +1,39 @@ +From d29afe91af5995306d940b3dfee2419e0bb24a51 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Fri, 27 Jan 2017 12:27:46 +0000 +Subject: [PATCH] brcmfmac: fix handling firmware results for wowl netdetect + +For wowl netdetect the event data changed for newer chips. This +was recently fixed for scheduled scan, but same change is needed +for wowl netdetect. Removing now pointles += operation from both +result handlers. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -3328,7 +3328,6 @@ brcmf_notify_sched_scan_results(struct b + goto out_err; + } + +- data += sizeof(struct brcmf_pno_scanresults_le); + netinfo_start = brcmf_get_netinfo_array(pfn_result); + + for (i = 0; i < result_count; i++) { +@@ -3476,8 +3475,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i + return -EINVAL; + } + +- data += sizeof(struct brcmf_pno_scanresults_le); +- netinfo = (struct brcmf_pno_net_info_le *)data; ++ netinfo = brcmf_get_netinfo_array(pfn_result); + memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); + cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; + cfg->wowl.nd->n_channels = 1; diff --git a/package/kernel/mac80211/patches/364-0003-brcmfmac-allow-wowlan-support-to-be-per-device.patch b/package/kernel/mac80211/patches/364-0003-brcmfmac-allow-wowlan-support-to-be-per-device.patch new file mode 100644 index 0000000000..79c9c65c2b --- /dev/null +++ b/package/kernel/mac80211/patches/364-0003-brcmfmac-allow-wowlan-support-to-be-per-device.patch @@ -0,0 +1,78 @@ +From 0b57010fc18e12c19d14379cd739d4eb7c3898f3 Mon Sep 17 00:00:00 2001 +From: Arend Van Spriel +Date: Fri, 27 Jan 2017 12:27:47 +0000 +Subject: [PATCH] brcmfmac: allow wowlan support to be per device + +The wowlan support is (partially) determined dynamic by checking the +device/firmware capabilities. So they can differ per device. So it +is not possible to use a static global. Instead use the global as a +template and use kmemdup(). When kmemdup() fails the template is used +unmodified. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 ++++++++++++++++------ + 1 file changed, 19 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6337,7 +6337,7 @@ static void brcmf_wiphy_pno_params(struc + } + + #ifdef CONFIG_PM +-static struct wiphy_wowlan_support brcmf_wowlan_support = { ++static const struct wiphy_wowlan_support brcmf_wowlan_support = { + .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT, + .n_patterns = BRCMF_WOWL_MAXPATTERNS, + .pattern_max_len = BRCMF_WOWL_MAXPATTERNSIZE, +@@ -6350,21 +6350,29 @@ static void brcmf_wiphy_wowl_params(stru + { + #ifdef CONFIG_PM + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct wiphy_wowlan_support *wowl; ++ ++ wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support), ++ GFP_KERNEL); ++ if (!wowl) { ++ brcmf_err("only support basic wowlan features\n"); ++ wiphy->wowlan = &brcmf_wowlan_support; ++ return; ++ } + + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO)) { + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ND)) { +- brcmf_wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT; +- brcmf_wowlan_support.max_nd_match_sets = +- BRCMF_PNO_MAX_PFN_COUNT; ++ wowl->flags |= WIPHY_WOWLAN_NET_DETECT; ++ wowl->max_nd_match_sets = BRCMF_PNO_MAX_PFN_COUNT; + init_waitqueue_head(&cfg->wowl.nd_data_wait); + } + } + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) { +- brcmf_wowlan_support.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY; +- brcmf_wowlan_support.flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE; ++ wowl->flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY; ++ wowl->flags |= WIPHY_WOWLAN_GTK_REKEY_FAILURE; + } + +- wiphy->wowlan = &brcmf_wowlan_support; ++ wiphy->wowlan = wowl; + #endif + } + +@@ -6745,6 +6753,10 @@ static void brcmf_free_wiphy(struct wiph + kfree(wiphy->bands[NL80211_BAND_5GHZ]->channels); + kfree(wiphy->bands[NL80211_BAND_5GHZ]); + } ++#if IS_ENABLED(CONFIG_PM) ++ if (wiphy->wowlan != &brcmf_wowlan_support) ++ kfree(wiphy->wowlan); ++#endif + wiphy_free(wiphy); + } + diff --git a/package/kernel/mac80211/patches/841-brcmfmac-use-wiphy_read_of_freq_limits.patch b/package/kernel/mac80211/patches/841-brcmfmac-use-wiphy_read_of_freq_limits.patch index c23d4c070e..614399f831 100644 --- a/package/kernel/mac80211/patches/841-brcmfmac-use-wiphy_read_of_freq_limits.patch +++ b/package/kernel/mac80211/patches/841-brcmfmac-use-wiphy_read_of_freq_limits.patch @@ -9,7 +9,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5884,6 +5884,9 @@ static int brcmf_construct_chaninfo(stru +@@ -5882,6 +5882,9 @@ static int brcmf_construct_chaninfo(stru continue; } @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki /* assuming the chanspecs order is HT20, * HT40 upper, HT40 lower, and VHT80. */ -@@ -6475,6 +6478,9 @@ static int brcmf_setup_wiphy(struct wiph +@@ -6483,6 +6486,9 @@ static int brcmf_setup_wiphy(struct wiph wiphy->bands[NL80211_BAND_5GHZ] = band; } }