linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Sara Sharon <sara.sharon@intel.com>
Subject: [PATCH v7 07/11] cfg80211: make BSSID generation function inline
Date: Mon, 28 Jan 2019 11:54:42 +0100	[thread overview]
Message-ID: <20190128105446.17256-7-johannes@sipsolutions.net> (raw)
In-Reply-To: <20190128105446.17256-1-johannes@sipsolutions.net>

From: Sara Sharon <sara.sharon@intel.com>

This will enable reuse by mac80211.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/cfg80211.h | 23 +++++++++++++++++++++++
 net/wireless/scan.c    | 16 ----------------
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5a8b1b5c3ac8..dff0d757e036 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5327,6 +5327,29 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
 	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
 }
 
+/**
+ * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
+ * @bssid: transmitter BSSID
+ * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
+ * @mbssid_index: BSSID index, taken from Multiple BSSID index element
+ * @new_bssid_addr: address of the resulting BSSID
+ */
+static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
+					  u8 mbssid_index, u8 *new_bssid_addr)
+{
+	u64 bssid_tmp, new_bssid;
+	u64 lsb_n;
+
+	bssid_tmp = ether_addr_to_u64(bssid);
+
+	lsb_n = bssid_tmp & ((1 << max_bssid) - 1);
+	new_bssid = bssid_tmp;
+	new_bssid &= ~((1 << max_bssid) - 1);
+	new_bssid |= (lsb_n + mbssid_index) % (1 << max_bssid);
+
+	u64_to_ether_addr(new_bssid, new_bssid_addr);
+}
+
 /**
  * enum cfg80211_bss_frame_type - frame type that the BSS data came from
  * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 77b0e1d08b13..a66d5b5a5f67 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -179,22 +179,6 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev,
 	return true;
 }
 
-static void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
-				   u8 mbssid_index, u8 *new_bssid_addr)
-{
-	u64 bssid_tmp, new_bssid = 0;
-	u64 lsb_n;
-
-	bssid_tmp = ether_addr_to_u64(bssid);
-
-	lsb_n = bssid_tmp & ((1 << max_bssid) - 1);
-	new_bssid = bssid_tmp;
-	new_bssid &= ~((1 << max_bssid) - 1);
-	new_bssid |= (lsb_n + mbssid_index) % (1 << max_bssid);
-
-	u64_to_ether_addr(new_bssid, new_bssid_addr);
-}
-
 static size_t cfg80211_gen_new_ie(const u8 *ie, size_t ielen,
 				  const u8 *subelement, size_t subie_len,
 				  u8 *new_ie, gfp_t gfp)
-- 
2.17.2


  parent reply	other threads:[~2019-01-28 10:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 10:54 [PATCH v7 01/11] mac80211: pass bssids to elements parsing function Johannes Berg
2019-01-28 10:54 ` [PATCH v7 02/11] mac80211: move the bss update from elements to an helper Johannes Berg
2019-01-28 10:54 ` [PATCH v7 03/11] cfg80211: Parsing of Multiple BSSID information in scanning Johannes Berg
2019-01-28 10:54 ` [PATCH v7 04/11] cfg80211: Properly track transmitting and non-transmitting BSS Johannes Berg
2019-01-28 10:54 ` [PATCH v7 05/11] cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible Johannes Berg
2019-01-28 10:54 ` [PATCH v7 06/11] cfg80211: parse mbssid only if HW supports it Johannes Berg
2019-01-28 10:54 ` Johannes Berg [this message]
2019-01-28 10:54 ` [PATCH v7 08/11] cfg80211: save mbssid properties Johannes Berg
2019-01-28 10:54 ` [PATCH v7 09/11] mac80211: support mbssid Johannes Berg
2019-01-28 10:54 ` [PATCH v7 10/11] mac80211: indicate support for multiple BSSID Johannes Berg
2019-01-28 10:54 ` [PATCH v7 11/11] mac80211_hwsim: Declare support for Multi-BSSID 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=20190128105446.17256-7-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sara.sharon@intel.com \
    /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).