From: Thomas Pedersen <thomas@cozybit.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH 2/2] cfg80211: simplify mesh BSS comparison
Date: Tue, 29 Jan 2013 17:42:22 -0800 [thread overview]
Message-ID: <20130130014222.GA25214@cable.cozybit.com> (raw)
In-Reply-To: <1359503120-25685-2-git-send-email-johannes@sipsolutions.net>
On Wed, Jan 30, 2013 at 12:45:20AM +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Instead of first checking if a BSS is an MBSS
> and then doing the comparisons, inline it all
> into the BSS comparison function. This avoids
> doing the IE searches twice and is also a lot
> less code.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> net/wireless/scan.c | 120 +++++++++++++++++-----------------------------------
> 1 file changed, 39 insertions(+), 81 deletions(-)
>
> diff --git a/net/wireless/scan.c b/net/wireless/scan.c
> index 72ef3b2..5fd7c47 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -288,26 +288,6 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
> }
> EXPORT_SYMBOL(cfg80211_find_vendor_ie);
>
> -static int cmp_ies(u8 num, const u8 *ies1, int len1, const u8 *ies2, int len2)
> -{
> - const u8 *ie1 = cfg80211_find_ie(num, ies1, len1);
> - const u8 *ie2 = cfg80211_find_ie(num, ies2, len2);
> -
> - /* equal if both missing */
> - if (!ie1 && !ie2)
> - return 0;
> - /* sort missing IE before (left of) present IE */
> - if (!ie1)
> - return -1;
> - if (!ie2)
> - return 1;
> -
> - /* sort by length first, then by contents */
> - if (ie1[1] != ie2[1])
> - return ie2[1] - ie1[1];
> - return memcmp(ie1 + 2, ie2 + 2, ie1[1]);
> -}
> -
FWIW cfg80211_get_mesh() has no users either.
> static int cmp_bss(struct cfg80211_bss *a,
> struct cfg80211_bss *b,
> bool hide_ssid)
> {
> const struct cfg80211_bss_ies *a_ies, *b_ies;
> - const u8 *ie1;
> - const u8 *ie2;
> + const u8 *ie1 = NULL;
> + const u8 *ie2 = NULL;
> int i, r;
>
> - r = cmp_bss_core(a, b);
> - if (r)
> - return r;
> + if (a->channel != b->channel)
> + return b->channel->center_freq - a->channel->center_freq;
>
> a_ies = rcu_access_pointer(a->ies);
> if (!a_ies)
> @@ -444,6 +367,41 @@ static int cmp_bss(struct cfg80211_bss *a,
> if (!b_ies)
> return 1;
>
> + if (WLAN_CAPABILITY_IS_STA_BSS(a->capability))
> + ie1 = cfg80211_find_ie(WLAN_EID_MESH_ID,
> + a_ies->data, a_ies->len);
> + if (WLAN_CAPABILITY_IS_STA_BSS(a->capability))
You probably wanted:
if (WLAN_CAPABILITY_IS_STA_BSS(b->capability))
--
Thomas
next prev parent reply other threads:[~2013-01-30 1:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 23:45 [PATCH 1/2] cfg80211: refactor hidden SSID finding Johannes Berg
2013-01-29 23:45 ` [PATCH 2/2] cfg80211: simplify mesh BSS comparison Johannes Berg
2013-01-30 1:42 ` Thomas Pedersen [this message]
2013-01-30 7:49 ` Johannes Berg
2013-01-29 23:55 ` [PATCH 1/2] cfg80211: refactor hidden SSID finding Johannes Berg
2013-02-04 15:39 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130130014222.GA25214@cable.cozybit.com \
--to=thomas@cozybit.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).