All of lore.kernel.org
 help / color / mirror / Atom feed
* Classification of BSS with different frequencies in KHz
@ 2022-11-09  6:15 JUN-KYU SHIN
  2022-11-09  9:13 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: JUN-KYU SHIN @ 2022-11-09  6:15 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

"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.

[-- Attachment #2: 0001-Classification-of-BSS-with-different-frequencies-in-.patch --]
[-- Type: text/x-diff, Size: 1022 bytes --]

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Classification of BSS with different frequencies in KHz
  2022-11-09  6:15 Classification of BSS with different frequencies in KHz JUN-KYU SHIN
@ 2022-11-09  9:13 ` Johannes Berg
  2022-11-10  2:20   ` [PATCH] " JUN-KYU SHIN
  2022-11-10  5:48   ` [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band JUN-KYU SHIN
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2022-11-09  9:13 UTC (permalink / raw)
  To: JUN-KYU SHIN; +Cc: linux-wireless

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Classification of BSS with different frequencies in KHz.
  2022-11-09  9:13 ` Johannes Berg
@ 2022-11-10  2:20   ` JUN-KYU SHIN
  2022-11-10  5:48   ` [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band JUN-KYU SHIN
  1 sibling, 0 replies; 7+ messages in thread
From: JUN-KYU SHIN @ 2022-11-10  2:20 UTC (permalink / raw)
  To: johannes; +Cc: jk.shin, linux-wireless

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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.
  2022-11-09  9:13 ` Johannes Berg
  2022-11-10  2:20   ` [PATCH] " JUN-KYU SHIN
@ 2022-11-10  5:48   ` JUN-KYU SHIN
  2022-11-10  8:00     ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: JUN-KYU SHIN @ 2022-11-10  5:48 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, JUN-KYU SHIN

If the "channel->freq_offset" comparison is omitted in cmp_bss(),
BSS with different kHz units cannot be distinguished in the S1G Band.
So "freq_offset" should also be included in the comparison.

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 22ae8996ada3..6bba130ea670 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 + (u32)b->channel->freq_offset) -
-					(a->channel->center_freq + (u32)a->channel->freq_offset));
+		return ((b->channel->center_freq * 1000 + b->channel->freq_offset) -
+					(a->channel->center_freq * 1000 + a->channel->freq_offset));
 
 	a_ies = rcu_access_pointer(a->ies);
 	if (!a_ies)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.
  2022-11-10  5:48   ` [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band JUN-KYU SHIN
@ 2022-11-10  8:00     ` Johannes Berg
  2022-11-10  8:18       ` [PATCH v3] " JUN-KYU SHIN
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2022-11-10  8:00 UTC (permalink / raw)
  To: JUN-KYU SHIN; +Cc: linux-wireless

On Thu, 2022-11-10 at 14:48 +0900, JUN-KYU SHIN wrote:
> If the "channel->freq_offset" comparison is omitted in cmp_bss(),
> BSS with different kHz units cannot be distinguished in the S1G Band.
> So "freq_offset" should also be included in the comparison.
> 
> 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 22ae8996ada3..6bba130ea670 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 + (u32)b->channel->freq_offset) -
> -					(a->channel->center_freq + (u32)a->channel->freq_offset));
> +		return ((b->channel->center_freq * 1000 + b->channel->freq_offset) -
> +					(a->channel->center_freq * 1000 + a->channel->freq_offset));
> 

Looks like that patch would apply on top of your other patch, you need
to resend a complete new patch instead please.

johannes

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.
  2022-11-10  8:00     ` Johannes Berg
@ 2022-11-10  8:18       ` JUN-KYU SHIN
  2022-11-10  8:24         ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: JUN-KYU SHIN @ 2022-11-10  8:18 UTC (permalink / raw)
  To: johannes; +Cc: jk.shin, linux-wireless

If the "channel->freq_offset" comparison is omitted in cmp_bss(),
BSS with different kHz units cannot be distinguished in the S1G Band.
So "freq_offset" should also be included in the comparison.

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..6bba130ea670 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 * 1000 + b->channel->freq_offset) -
+					(a->channel->center_freq * 1000 + a->channel->freq_offset));
 
 	a_ies = rcu_access_pointer(a->ies);
 	if (!a_ies)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.
  2022-11-10  8:18       ` [PATCH v3] " JUN-KYU SHIN
@ 2022-11-10  8:24         ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2022-11-10  8:24 UTC (permalink / raw)
  To: JUN-KYU SHIN; +Cc: linux-wireless

On Thu, 2022-11-10 at 17:18 +0900, JUN-KYU SHIN wrote:
> If the "channel->freq_offset" comparison is omitted in cmp_bss(),
> BSS with different kHz units cannot be distinguished in the S1G Band.
> So "freq_offset" should also be included in the comparison.
> 
> 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..6bba130ea670 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 * 1000 + b->channel->freq_offset) -
> +					(a->channel->center_freq * 1000 + a->channel->freq_offset));
> 

And while we're at it - you don't need the outer parentheses on a return
statement, and the indentation could be lining up properly so that a->
is under b->

johannes

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-10  8:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09  6:15 Classification of BSS with different frequencies in KHz JUN-KYU SHIN
2022-11-09  9:13 ` Johannes Berg
2022-11-10  2:20   ` [PATCH] " JUN-KYU SHIN
2022-11-10  5:48   ` [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band JUN-KYU SHIN
2022-11-10  8:00     ` Johannes Berg
2022-11-10  8:18       ` [PATCH v3] " JUN-KYU SHIN
2022-11-10  8:24         ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.