From: Rafał Miłecki Date: Wed, 7 Nov 2018 08:01:32 +0000 (+0100) Subject: mac80211: brcmfmac: backport the latest 4.20 changes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b50f162b3cce3d95874e4394f4765413f58765f1;p=openwrt%2Fstaging%2Fdangole.git mac80211: brcmfmac: backport the latest 4.20 changes Signed-off-by: Rafał Miłecki --- diff --git a/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch b/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch new file mode 100644 index 0000000000..192ed1a770 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch @@ -0,0 +1,57 @@ +From a8254fa4ba60b85829b6e5ede6564f81cd70d59f Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Tue, 11 Sep 2018 11:24:04 +0800 +Subject: [PATCH] brcmfmac: remove set but not used variables 'sfdoff' and + 'pad_size' + +Fixes gcc '-Wunused-but-set-variable' warning: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function 'brcmf_sdio_rxglom': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:1466:11: warning: + variable 'sfdoff' set but not used [-Wunused-but-set-variable] + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function 'brcmf_sdio_bus_preinit': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3408:7: warning: + variable 'pad_size' set but not used [-Wunused-but-set-variable] + +Signed-off-by: YueHaibing +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1463,7 +1463,7 @@ static u8 brcmf_sdio_rxglom(struct brcmf + struct sk_buff *pfirst, *pnext; + + int errcode; +- u8 doff, sfdoff; ++ u8 doff; + + struct brcmf_sdio_hdrinfo rd_new; + +@@ -1597,7 +1597,6 @@ static u8 brcmf_sdio_rxglom(struct brcmf + + /* Remove superframe header, remember offset */ + skb_pull(pfirst, rd_new.dat_offset); +- sfdoff = rd_new.dat_offset; + num = 0; + + /* Validate all the subframe headers */ +@@ -3405,7 +3404,6 @@ static int brcmf_sdio_bus_preinit(struct + struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; + struct brcmf_sdio *bus = sdiodev->bus; + struct brcmf_core *core = bus->sdio_core; +- uint pad_size; + u32 value; + int err; + +@@ -3448,7 +3446,6 @@ static int brcmf_sdio_bus_preinit(struct + if (sdiodev->sg_support) { + bus->txglom = false; + value = 1; +- pad_size = bus->sdiodev->func2->cur_blksize << 1; + err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", + &value, sizeof(u32)); + if (err < 0) { diff --git a/package/kernel/mac80211/patches/brcm/306-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch b/package/kernel/mac80211/patches/brcm/306-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch new file mode 100644 index 0000000000..a71c1aee03 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/306-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch @@ -0,0 +1,67 @@ +From edb6d6885bef82d1eac432dbeca9fbf4ec349d7e Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Thu, 27 Sep 2018 14:59:44 +0000 +Subject: [PATCH] brcmfmac: reduce timeout for action frame scan + +Finding a common channel to send an action frame out is required for +some action types. Since a loop with several scan retry is used to find +the channel, a short wait time could be considered for each attempt. +This patch reduces the wait time from 1500 to 450 msec for each action +frame scan. + +This patch fixes the WFA p2p certification 5.1.20 failure caused by the +long action frame send time. + +Signed-off-by: Chung-Hsien Hsu +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -74,7 +74,7 @@ + #define P2P_AF_MAX_WAIT_TIME msecs_to_jiffies(2000) + #define P2P_INVALID_CHANNEL -1 + #define P2P_CHANNEL_SYNC_RETRY 5 +-#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(1500) ++#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(450) + #define P2P_DEFAULT_SLEEP_TIME_VSDB 200 + + /* WiFi P2P Public Action Frame OUI Subtypes */ +@@ -1134,7 +1134,6 @@ static s32 brcmf_p2p_af_searching_channe + { + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct brcmf_cfg80211_vif *pri_vif; +- unsigned long duration; + s32 retry; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1150,7 +1149,6 @@ static s32 brcmf_p2p_af_searching_channe + * pending action frame tx is cancelled. + */ + retry = 0; +- duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT); + while ((retry < P2P_CHANNEL_SYNC_RETRY) && + (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) { + afx_hdl->is_listen = false; +@@ -1158,7 +1156,8 @@ static s32 brcmf_p2p_af_searching_channe + retry); + /* search peer on peer's listen channel */ + schedule_work(&afx_hdl->afx_work); +- wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration); ++ wait_for_completion_timeout(&afx_hdl->act_frm_scan, ++ P2P_AF_FRM_SCAN_MAX_WAIT); + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, + &p2p->status))) +@@ -1171,7 +1170,7 @@ static s32 brcmf_p2p_af_searching_channe + afx_hdl->is_listen = true; + schedule_work(&afx_hdl->afx_work); + wait_for_completion_timeout(&afx_hdl->act_frm_scan, +- duration); ++ P2P_AF_FRM_SCAN_MAX_WAIT); + } + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, diff --git a/package/kernel/mac80211/patches/brcm/306-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch b/package/kernel/mac80211/patches/brcm/306-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch new file mode 100644 index 0000000000..ef2d0934fc --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/306-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch @@ -0,0 +1,79 @@ +From fbf07000960d9c8a13fdc17c6de0230d681c7543 Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Thu, 27 Sep 2018 14:59:49 +0000 +Subject: [PATCH] brcmfmac: fix full timeout waiting for action frame + on-channel tx + +The driver sends an action frame down and waits for a completion signal +triggered by the received BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE event +to continue the process. However, the action frame could be transmitted +either on the current channel or on an off channel. For the on-channel +case, only BRCMF_E_ACTION_FRAME_COMPLETE event will be received when +the frame is transmitted, which make the driver always wait a full +timeout duration. This patch has the completion signal be triggered by +receiving the BRCMF_E_ACTION_FRAME_COMPLETE event for the on-channel +case. + +This change fixes WFA p2p certification 5.1.19 failure. + +Signed-off-by: Chung-Hsien Hsu +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 17 +++++++++++++++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 ++ + 2 files changed, 17 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -1457,10 +1457,12 @@ int brcmf_p2p_notify_action_tx_complete( + return 0; + + if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { +- if (e->status == BRCMF_E_STATUS_SUCCESS) ++ if (e->status == BRCMF_E_STATUS_SUCCESS) { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, + &p2p->status); +- else { ++ if (!p2p->wait_for_offchan_complete) ++ complete(&p2p->send_af_done); ++ } else { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); + /* If there is no ack, we don't need to wait for + * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event +@@ -1511,6 +1513,17 @@ static s32 brcmf_p2p_tx_action_frame(str + p2p->af_sent_channel = le32_to_cpu(af_params->channel); + p2p->af_tx_sent_jiffies = jiffies; + ++ if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) && ++ p2p->af_sent_channel == ++ ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq)) ++ p2p->wait_for_offchan_complete = false; ++ else ++ p2p->wait_for_offchan_complete = true; ++ ++ brcmf_dbg(TRACE, "Waiting for %s tx completion event\n", ++ (p2p->wait_for_offchan_complete) ? ++ "off-channel" : "on-channel"); ++ + timeout = wait_for_completion_timeout(&p2p->send_af_done, + P2P_AF_MAX_WAIT_TIME); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +@@ -124,6 +124,7 @@ struct afx_hdl { + * @gon_req_action: about to send go negotiation requets frame. + * @block_gon_req_tx: drop tx go negotiation requets frame. + * @p2pdev_dynamically: is p2p device if created by module param or supplicant. ++ * @wait_for_offchan_complete: wait for off-channel tx completion event. + */ + struct brcmf_p2p_info { + struct brcmf_cfg80211_info *cfg; +@@ -144,6 +145,7 @@ struct brcmf_p2p_info { + bool gon_req_action; + bool block_gon_req_tx; + bool p2pdev_dynamically; ++ bool wait_for_offchan_complete; + }; + + s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced); diff --git a/package/kernel/mac80211/patches/brcm/307-v4.20-0001-brcmutil-really-fix-decoding-channel-info-for-160-MH.patch b/package/kernel/mac80211/patches/brcm/307-v4.20-0001-brcmutil-really-fix-decoding-channel-info-for-160-MH.patch new file mode 100644 index 0000000000..154664c854 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/307-v4.20-0001-brcmutil-really-fix-decoding-channel-info-for-160-MH.patch @@ -0,0 +1,41 @@ +From 3401d42c7ea2d064d15c66698ff8eb96553179ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 26 Oct 2018 12:50:39 +0200 +Subject: [PATCH] brcmutil: really fix decoding channel info for 160 MHz + bandwidth +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Previous commit /adding/ support for 160 MHz chanspecs was incomplete. +It didn't set bandwidth info and didn't extract control channel info. As +the result it was also using uninitialized "sb" var. + +This change has been tested for two chanspecs found to be reported by +some devices/firmwares: +1) 60/160 (0xee32) + Before: chnum:50 control_ch_num:36 + After: chnum:50 control_ch_num:60 +2) 120/160 (0xed72) + Before: chnum:114 control_ch_num:100 + After: chnum:114 control_ch_num:120 + +Fixes: 330994e8e8ec ("brcmfmac: fix for proper support of 160MHz bandwidth") +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c +@@ -193,6 +193,9 @@ static void brcmu_d11ac_decchspec(struct + } + break; + case BRCMU_CHSPEC_D11AC_BW_160: ++ ch->bw = BRCMU_CHAN_BW_160; ++ ch->sb = brcmu_maskget16(ch->chspec, BRCMU_CHSPEC_D11AC_SB_MASK, ++ BRCMU_CHSPEC_D11AC_SB_SHIFT); + switch (ch->sb) { + case BRCMU_CHAN_SB_LLL: + ch->control_ch_num -= CH_70MHZ_APART;