From b1fc9b79d0f25250547597a096417b5c8896f446 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 7 Nov 2018 13:06:52 +0100 Subject: [PATCH] mac80211: brcmfmac: backport the latest 4.20 changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki (cherry picked from commit b50f162b3cce3d95874e4394f4765413f58765f1) --- ...reduce-timeout-for-action-frame-scan.patch | 67 ++++++++++++++++ ...l-timeout-waiting-for-action-frame-o.patch | 79 +++++++++++++++++++ ...fix-decoding-channel-info-for-160-MH.patch | 41 ++++++++++ 3 files changed, 187 insertions(+) create mode 100644 package/kernel/mac80211/patches/335-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch create mode 100644 package/kernel/mac80211/patches/335-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch create mode 100644 package/kernel/mac80211/patches/336-v4.20-0001-brcmutil-really-fix-decoding-channel-info-for-160-MH.patch diff --git a/package/kernel/mac80211/patches/335-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch b/package/kernel/mac80211/patches/335-v4.20-0001-brcmfmac-reduce-timeout-for-action-frame-scan.patch new file mode 100644 index 0000000000..9111fd4ea2 --- /dev/null +++ b/package/kernel/mac80211/patches/335-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 */ +@@ -1141,7 +1141,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"); +@@ -1157,7 +1156,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; +@@ -1165,7 +1163,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))) +@@ -1178,7 +1177,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/335-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch b/package/kernel/mac80211/patches/335-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch new file mode 100644 index 0000000000..2bf504f64c --- /dev/null +++ b/package/kernel/mac80211/patches/335-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 +@@ -1464,10 +1464,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 +@@ -1518,6 +1520,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/336-v4.20-0001-brcmutil-really-fix-decoding-channel-info-for-160-MH.patch b/package/kernel/mac80211/patches/336-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/336-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; -- 2.25.1