Commit 18343b80 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'mac80211-next-for-net-next-2022-01-04' of...

Merge tag 'mac80211-next-for-net-next-2022-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
Just a few more changes:
 - mac80211: allow non-standard VHT MCSes 10/11
 - mac80211: add sleepable station iterator for drivers
 - nl80211: clarify a comment
 - mac80211: small cleanup to use typed element helpers

* tag 'mac80211-next-for-net-next-2022-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next:
  mac80211: use ieee80211_bss_get_elem()
  nl80211: clarify comment for mesh PLINK_BLOCKED state
  mac80211: Add stations iterator where the iterator function may sleep
  mac80211: allow non-standard VHT MCS-10/11
====================

Link: https://lore.kernel.org/r/20220104153403.69749-1-johannes@sipsolutions.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 416b2743 b3c1906e
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -5614,6 +5614,9 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
 * This function iterates over the interfaces associated with a given
 * hardware that are currently active and calls the callback for them.
 * This version can only be used while holding the wiphy mutex.
 * The driver must not call this with a lock held that it can also take in
 * response to callbacks from mac80211, and it must not call this within
 * callbacks made by mac80211 - both would result in deadlocks.
 *
 * @hw: the hardware struct of which the interfaces should be iterated over
 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
@@ -5627,6 +5630,24 @@ void ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
						struct ieee80211_vif *vif),
					     void *data);

/**
 * ieee80211_iterate_stations - iterate stations
 *
 * This function iterates over all stations associated with a given
 * hardware that are currently uploaded to the driver and calls the callback
 * function for them.
 * This function allows the iterator function to sleep, when the iterator
 * function is atomic @ieee80211_iterate_stations_atomic can be used.
 *
 * @hw: the hardware struct of which the interfaces should be iterated over
 * @iterator: the iterator function to call, cannot sleep
 * @data: first argument of the iterator function
 */
void ieee80211_iterate_stations(struct ieee80211_hw *hw,
				void (*iterator)(void *data,
						 struct ieee80211_sta *sta),
				void *data);

/**
 * ieee80211_iterate_stations_atomic - iterate stations
 *
+1 −1
Original line number Diff line number Diff line
@@ -5623,7 +5623,7 @@ enum nl80211_if_combination_attrs {
 * @NL80211_PLINK_ESTAB: mesh peer link is established
 * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled
 * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh
 *	plink are discarded
 *	plink are discarded, except for authentication frames
 * @NUM_NL80211_PLINK_STATES: number of peer link states
 * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states
 */
+7 −7
Original line number Diff line number Diff line
@@ -4906,7 +4906,7 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
				     struct cfg80211_bss *cbss)
{
	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
	const u8 *ht_cap_ie, *vht_cap_ie;
	const struct element *ht_cap_elem, *vht_cap_elem;
	const struct ieee80211_ht_cap *ht_cap;
	const struct ieee80211_vht_cap *vht_cap;
	u8 chains = 1;
@@ -4914,9 +4914,9 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
	if (ifmgd->flags & IEEE80211_STA_DISABLE_HT)
		return chains;

	ht_cap_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_HT_CAPABILITY);
	if (ht_cap_ie && ht_cap_ie[1] >= sizeof(*ht_cap)) {
		ht_cap = (void *)(ht_cap_ie + 2);
	ht_cap_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_HT_CAPABILITY);
	if (ht_cap_elem && ht_cap_elem->datalen >= sizeof(*ht_cap)) {
		ht_cap = (void *)ht_cap_elem->data;
		chains = ieee80211_mcs_to_chains(&ht_cap->mcs);
		/*
		 * TODO: use "Tx Maximum Number Spatial Streams Supported" and
@@ -4927,12 +4927,12 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
	if (ifmgd->flags & IEEE80211_STA_DISABLE_VHT)
		return chains;

	vht_cap_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_VHT_CAPABILITY);
	if (vht_cap_ie && vht_cap_ie[1] >= sizeof(*vht_cap)) {
	vht_cap_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_VHT_CAPABILITY);
	if (vht_cap_elem && vht_cap_elem->datalen >= sizeof(*vht_cap)) {
		u8 nss;
		u16 tx_mcs_map;

		vht_cap = (void *)(vht_cap_ie + 2);
		vht_cap = (void *)vht_cap_elem->data;
		tx_mcs_map = le16_to_cpu(vht_cap->supp_mcs.tx_mcs_map);
		for (nss = 8; nss > 0; nss--) {
			if (((tx_mcs_map >> (2 * (nss - 1))) & 3) !=
+1 −1
Original line number Diff line number Diff line
@@ -4929,7 +4929,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
				goto drop;
			break;
		case RX_ENC_VHT:
			if (WARN_ONCE(status->rate_idx > 9 ||
			if (WARN_ONCE(status->rate_idx > 11 ||
				      !status->nss ||
				      status->nss > 8,
				      "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n",
+13 −0
Original line number Diff line number Diff line
@@ -862,6 +862,19 @@ static void __iterate_stations(struct ieee80211_local *local,
	}
}

void ieee80211_iterate_stations(struct ieee80211_hw *hw,
				void (*iterator)(void *data,
						 struct ieee80211_sta *sta),
				void *data)
{
	struct ieee80211_local *local = hw_to_local(hw);

	mutex_lock(&local->sta_mtx);
	__iterate_stations(local, iterator, data);
	mutex_unlock(&local->sta_mtx);
}
EXPORT_SYMBOL_GPL(ieee80211_iterate_stations);

void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
			void (*iterator)(void *data,
					 struct ieee80211_sta *sta),