From 92e6e35d5fbdd0dbe57ee826e92a6523e4be059a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 25 Feb 2016 20:24:47 +0000 Subject: [PATCH] mac80211: backport brcmfmac fix for primary channel in 80 MHz mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki SVN-Revision: 48782 --- ...ting-primary-channel-for-80-MHz-widt.patch | 64 +++++++++++++++++++ ...und-bug-with-some-inconsistent-BSSes.patch | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch new file mode 100644 index 0000000000..9277b2cabc --- /dev/null +++ b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch @@ -0,0 +1,64 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 20 Jan 2016 16:46:04 +0100 +Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +First of all it changes the way we calculate primary channel offset. If +we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means +center frequency is 5210 MHz) it makes sense to calculate primary offset +as -30 MHz. +Then it fixes values we compare primary_offset with. We were comparing +offset in MHz against -2 or 2 which was resulting in picking a wrong +primary channel. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br + brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", + ch->chan->center_freq, ch->center_freq1, ch->width); + ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); +- primary_offset = ch->center_freq1 - ch->chan->center_freq; ++ primary_offset = ch->chan->center_freq - ch->center_freq1; + switch (ch->width) { + case NL80211_CHAN_WIDTH_20: + case NL80211_CHAN_WIDTH_20_NOHT: +@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br + break; + case NL80211_CHAN_WIDTH_40: + ch_inf.bw = BRCMU_CHAN_BW_40; +- if (primary_offset < 0) ++ if (primary_offset > 0) + ch_inf.sb = BRCMU_CHAN_SB_U; + else + ch_inf.sb = BRCMU_CHAN_SB_L; + break; + case NL80211_CHAN_WIDTH_80: + ch_inf.bw = BRCMU_CHAN_BW_80; +- if (primary_offset < 0) { +- if (primary_offset < -CH_10MHZ_APART) +- ch_inf.sb = BRCMU_CHAN_SB_UU; +- else +- ch_inf.sb = BRCMU_CHAN_SB_UL; +- } else { +- if (primary_offset > CH_10MHZ_APART) +- ch_inf.sb = BRCMU_CHAN_SB_LL; +- else +- ch_inf.sb = BRCMU_CHAN_SB_LU; +- } ++ if (primary_offset == -30) ++ ch_inf.sb = BRCMU_CHAN_SB_LL; ++ else if (primary_offset == -10) ++ ch_inf.sb = BRCMU_CHAN_SB_LU; ++ else if (primary_offset == 10) ++ ch_inf.sb = BRCMU_CHAN_SB_UL; ++ else ++ ch_inf.sb = BRCMU_CHAN_SB_UU; + break; + case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: diff --git a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index 9aeb97e601..4295b4bd33 100644 --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,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 -@@ -618,9 +618,37 @@ static struct wireless_dev *brcmf_cfg802 +@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802 u32 *flags, struct vif_params *params) { -- 2.30.2