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.
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
@@ -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
Johannes Berg
maintainerQuoted 2 lines · JUN-KYU SHIN
"
freq_offset" also needs to be compared on S1G Band.
Iffreq_offsetcomparison is omitted incmp_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
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
@@ -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
PATCH v2 1/1 wifi: cfg80211: Classification of BSS with different frequencies in the S1G Band.
In reply to Johannes BergIf 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
@@ -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
Johannes Berg
maintainerRe: [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 incmp_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 <[email protected]>--- net/wireless/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/wireless/scan.c +0
-0
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
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
@@ -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
Johannes Berg
maintainerRe: [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 incmp_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 <[email protected]>--- net/wireless/scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/wireless/scan.c +0
-0
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