Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92cd5a3f authored by Sara Sharon's avatar Sara Sharon Committed by Connor O'Brien
Browse files

UPSTREAM: cfg80211: make BSSID generation function inline



This will enable reuse by mac80211.

Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
(cherry picked from commit 7ece9c372b21635120e7ab5ea3fc41ce9892ead8)
Bug: 154523213
Signed-off-by: default avatarConnor O'Brien <connoro@google.com>
Change-Id: I1db90bf0e255ae57955e2bdf663b1877c6c2df29
parent 8f2a99ba
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -5127,6 +5127,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
+0 −16
Original line number Diff line number Diff line
@@ -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)