linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix a center frequency recalculation issue in ieee80211_chandef_downgrade
@ 2022-07-08  9:58 MeiChia Chiu
  0 siblings, 0 replies; only message in thread
From: MeiChia Chiu @ 2022-07-08  9:58 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Felix Fietkau, Money Wang, Ryder Lee, Shayne Chen, Evelyn Tsai,
	linux-wireless, linux-mediatek, MeiChia Chiu, MeiChia Chiu

From: MeiChia Chiu <meichia.chiu@mediatek.com>

When mac80211 downgrades working bandwidth,
the cent_freq and cent_freq1 need to be recalculated.
There is a typo in the case of downgrading bandwidth from
320M to 160M which would cause a wrong frequency value.

Reviewed-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
---
 net/mac80211/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index bccc3a309ed0..bcb4aa7d7599 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -4075,7 +4075,7 @@ u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c)
 		/* n_P20 */
 		tmp = (150 + c->chan->center_freq - c->center_freq1) / 20;
 		/* n_P160 */
-		tmp /= 80;
+		tmp /= 8;
 		c->center_freq1 = c->center_freq1 - 80 + 160 * tmp;
 		c->width = NL80211_CHAN_WIDTH_160;
 		ret = IEEE80211_STA_DISABLE_320MHZ;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-08  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08  9:58 [PATCH] mac80211: fix a center frequency recalculation issue in ieee80211_chandef_downgrade MeiChia Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).