Skip to contentSkip to conversation

Classification of BSS with different frequencies in KHz

PATCH Superseded JUN-KYU SHIN 2 participants 7 messages Nov 9, 2022 – Nov 10, 2022 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

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

From 39e6b6b9ecf0b301223dd9e34715e9d103573ff7 Mon Sep 17 00:00:00 2001
From: JUN-KYU SHIN <[email protected]>
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.

---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/scan.c +2 -1
index 806a5f1330ff..3cfc668c4189 100644
@@ -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)
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 2 lines · JUN-KYU SHIN

"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

#2 lore raw

Re: [PATCH] Classification of BSS with different frequencies in KHz.

Hi johannes,

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

---
 net/wireless/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/scan.c +2 -2
index 3cfc668c4189..22ae8996ada3 100644
@@ -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)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 1/1 wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.

In reply to Johannes Berg

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.

---
 net/wireless/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/scan.c +2 -2
index 22ae8996ada3..6bba130ea670 100644
@@ -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)
Signature · 1 line
2.25.1
maintainer
#4 lore raw

Re: [PATCH v2] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.

Quoted 14 lines · 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.

---
 net/wireless/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/scan.c +0 -0
index 22ae8996ada3..6bba130ea670 100644

net/wireless/scan.c static int cmp_bss(struct cfg80211_bss *a, · line 1294

Quoted 8 lines
net/wireless/scan.c +2 -2
@@ -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

#5 lore raw

PATCH v3 1/1 wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.

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.

---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/scan.c +2 -1
index 806a5f1330ff..6bba130ea670 100644
@@ -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)
Signature · 1 line
2.25.1
maintainer
#6 lore raw

Re: [PATCH v3] wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.

Quoted 14 lines · 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.

---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/scan.c +0 -0
index 806a5f1330ff..6bba130ea670 100644

net/wireless/scan.c static int cmp_bss(struct cfg80211_bss *a, · line 1294

Quoted 7 lines
net/wireless/scan.c +2 -1
@@ -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