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

Commit 77965c97 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

cfg80211: clean up signal type



It wasn't a good idea to make the signal type a per-BSS option,
although then it is closer to the actual value. Move it to be
a per-wiphy setting, update mac80211 to match.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 630e64c4
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -577,8 +577,7 @@ enum cfg80211_signal_type {
 * @information_elements: the information elements (Note that there
 *	is no guarantee that these are well-formed!)
 * @len_information_elements: total length of the information elements
 * @signal: signal strength value
 * @signal_type: signal type
 * @signal: signal strength value (type depends on the wiphy's signal_type)
 * @free_priv: function pointer to free private data
 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
 */
@@ -593,7 +592,6 @@ struct cfg80211_bss {
	size_t len_information_elements;

	s32 signal;
	enum cfg80211_signal_type signal_type;

	void (*free_priv)(struct cfg80211_bss *bss);
	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
@@ -782,6 +780,7 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
 *
 * @wiphy: the wiphy reporting the BSS
 * @bss: the found BSS
 * @signal: the signal strength, type depends on the wiphy's signal_type
 * @gfp: context flags
 *
 * This informs cfg80211 that BSS information was found and
@@ -791,8 +790,7 @@ struct cfg80211_bss*
cfg80211_inform_bss_frame(struct wiphy *wiphy,
			  struct ieee80211_channel *channel,
			  struct ieee80211_mgmt *mgmt, size_t len,
			  s32 signal, enum cfg80211_signal_type sigtype,
			  gfp_t gfp);
			  s32 signal, gfp_t gfp);

struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
				      struct ieee80211_channel *channel,
+3 −0
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ struct ieee80211_supported_band {
 * 	the regulatory_hint() API. This can be used by the driver
 *	on the reg_notifier() if it chooses to ignore future
 *	regulatory domain changes caused by other drivers.
 * @signal_type: signal type reported in &struct cfg80211_bss.
 */
struct wiphy {
	/* assign these fields before you register the wiphy */
@@ -213,6 +214,8 @@ struct wiphy {
	bool custom_regulatory;
	bool strict_regulatory;

	enum cfg80211_signal_type signal_type;

	int bss_priv_size;
	u8 max_scan_ssids;

+5 −0
Original line number Diff line number Diff line
@@ -861,6 +861,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
	/* mac80211 always supports monitor */
	local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);

	if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
		local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
	else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
		local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;

	result = wiphy_register(local->hw.wiphy);
	if (result < 0)
		goto fail_wiphy_register;
+3 −8
Original line number Diff line number Diff line
@@ -63,20 +63,15 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
{
	struct ieee80211_bss *bss;
	int clen;
	enum cfg80211_signal_type sigtype = CFG80211_SIGNAL_TYPE_NONE;
	s32 signal = 0;

	if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
		sigtype = CFG80211_SIGNAL_TYPE_MBM;
	if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
		signal = rx_status->signal * 100;
	} else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) {
		sigtype = CFG80211_SIGNAL_TYPE_UNSPEC;
	else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
		signal = (rx_status->signal * 100) / local->hw.max_signal;
	}

	bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel,
						mgmt, len, signal, sigtype,
						GFP_ATOMIC);
						mgmt, len, signal, GFP_ATOMIC);

	if (!bss)
		return NULL;
+1 −1
Original line number Diff line number Diff line
@@ -2457,7 +2457,7 @@ static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags,
	NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability);
	NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq);

	switch (res->signal_type) {
	switch (rdev->wiphy.signal_type) {
	case CFG80211_SIGNAL_TYPE_MBM:
		NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal);
		break;
Loading