diff mbox series

Classification of BSS with different frequencies in KHz

Message ID 20221109061532.GA13554@DESKTOP-7BCE18E.localdomain (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series Classification of BSS with different frequencies in KHz | expand

Commit Message

JUN-KYU SHIN Nov. 9, 2022, 6:15 a.m. UTC
"freq_offset" also needs to be compared on S1G Band.
If freq_offset comparison is omitted in cmp_bss, other bss cannot be distinguished in units of khz.

Comments

Johannes Berg Nov. 9, 2022, 9:13 a.m. UTC | #1
On Wed, 2022-11-09 at 15:15 +0900, JUN-KYU SHIN wrote:
> "freq_offset" also needs to be compared on S1G Band.
> If freq_offset comparison is omitted in cmp_bss, other bss cannot be distinguished in units of khz.


please don't send patches as attachments.

The patch looks wrong, the freq offset is in different units, so this
could cause bad == comparisons?

johannes
JUN-KYU SHIN Nov. 10, 2022, 2:20 a.m. UTC | #2
Hi johannes,

First of all, thank you very much for the review and feedback.
This mail is corrected part of your feedback.


Signed-off-by: JUN-KYU SHIN <jk.shin@newratek.com>
---
 net/wireless/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 3cfc668c4189..22ae8996ada3 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1289,8 +1289,8 @@ static int cmp_bss(struct cfg80211_bss *a,
 	int i, r;
 
 	if (a->channel != b->channel)
-		return ((b->channel->center_freq + b->channel->freq_offset) -
-					(a->channel->center_freq + a->channel->freq_offset));
+		return ((b->channel->center_freq + (u32)b->channel->freq_offset) -
+					(a->channel->center_freq + (u32)a->channel->freq_offset));
 
 	a_ies = rcu_access_pointer(a->ies);
 	if (!a_ies)
diff mbox series

Patch

From 39e6b6b9ecf0b301223dd9e34715e9d103573ff7 Mon Sep 17 00:00:00 2001
From: JUN-KYU SHIN <jk.shin@newratek.com>
Date: Wed, 9 Nov 2022 14:35:49 +0900
Subject: [PATCH] Classification of BSS with different frequencies in KHz.

"freq_offset" also needs to be compared on S1G Band.
If freq_offset comparison is omitted in cmp_bss,
other bss cannot be distinguished in units of khz.

Signed-off-by: JUN-KYU SHIN <jk.shin@newratek.com>
---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 806a5f1330ff..3cfc668c4189 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1289,7 +1289,8 @@  static int cmp_bss(struct cfg80211_bss *a,
 	int i, r;
 
 	if (a->channel != b->channel)
-		return b->channel->center_freq - a->channel->center_freq;
+		return ((b->channel->center_freq + b->channel->freq_offset) -
+					(a->channel->center_freq + a->channel->freq_offset));
 
 	a_ies = rcu_access_pointer(a->ies);
 	if (!a_ies)
-- 
2.25.1