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

Commit 8a4988d1 authored by Janusz.Dziedzic@tieto.com's avatar Janusz.Dziedzic@tieto.com Committed by Johannes Berg
Browse files

mac80211: IBSS: refactor ieee80211_rx_bss_info



Put station specific code in ieee80211_update_sta_info
function.

Signed-off-by: default avatarJanusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d66c2582
Loading
Loading
Loading
Loading
+99 −85
Original line number Diff line number Diff line
@@ -965,29 +965,25 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
			    mgmt->sa, sdata->u.ibss.bssid, NULL, 0, 0, 0);
}

static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata,
				      struct ieee80211_mgmt *mgmt, size_t len,
				      struct ieee80211_rx_status *rx_status,
				  struct ieee802_11_elems *elems)
				      struct ieee802_11_elems *elems,
				      struct ieee80211_channel *channel)
{
	struct ieee80211_local *local = sdata->local;
	struct cfg80211_bss *cbss;
	struct ieee80211_bss *bss;
	struct sta_info *sta;
	struct ieee80211_channel *channel;
	u64 beacon_timestamp, rx_timestamp;
	u32 supp_rates = 0;
	enum ieee80211_band band = rx_status->band;
	enum nl80211_bss_scan_width scan_width;
	struct ieee80211_local *local = sdata->local;
	struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
	bool rates_updated = false;
	u32 supp_rates = 0;

	channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq);
	if (!channel)
	if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
		return;

	if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
	    ether_addr_equal(mgmt->bssid, sdata->u.ibss.bssid)) {
	if (!ether_addr_equal(mgmt->bssid, sdata->u.ibss.bssid))
		return;

	rcu_read_lock();
	sta = sta_info_get(sdata, mgmt->sa);
@@ -1007,8 +1003,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
				scan_width = NL80211_BSS_CHAN_WIDTH_10;

			sta->sta.supp_rates[band] = supp_rates |
					ieee80211_mandatory_rates(sband,
								  scan_width);
				ieee80211_mandatory_rates(sband, scan_width);
			if (sta->sta.supp_rates[band] != prev_rates) {
				ibss_dbg(sdata,
					 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
@@ -1044,13 +1039,13 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
		 * fall back to HT20 if we don't use or use
		 * the other extension channel
		 */
			if (chandef.center_freq1 !=
			    sdata->u.ibss.chandef.center_freq1)
		if (chandef.center_freq1 != sdata->u.ibss.chandef.center_freq1)
			htcap_ie.cap_info &=
				cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);

			rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(
						sdata, sband, &htcap_ie, sta);
		rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
								   &htcap_ie,
								   sta);
	}

	if (sta && rates_updated) {
@@ -1069,6 +1064,25 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
	rcu_read_unlock();
}

static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
				  struct ieee80211_mgmt *mgmt, size_t len,
				  struct ieee80211_rx_status *rx_status,
				  struct ieee802_11_elems *elems)
{
	struct ieee80211_local *local = sdata->local;
	struct cfg80211_bss *cbss;
	struct ieee80211_bss *bss;
	struct ieee80211_channel *channel;
	u64 beacon_timestamp, rx_timestamp;
	u32 supp_rates = 0;
	enum ieee80211_band band = rx_status->band;

	channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq);
	if (!channel)
		return;

	ieee80211_update_sta_info(sdata, mgmt, len, rx_status, elems, channel);

	bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
					channel);
	if (!bss)