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

Commit e1a0c6b3 authored by Johannes Berg's avatar Johannes Berg
Browse files

mac80211: stop toggling IEEE80211_HT_CAP_SUP_WIDTH_20_40



For VHT, many more bandwidth changes are possible. As a first
step, stop toggling the IEEE80211_HT_CAP_SUP_WIDTH_20_40 flag
in the HT capabilities and instead introduce a bandwidth field
indicating the currently usable bandwidth to transmit to the
station. Of course, make all drivers use it.

To achieve this, make ieee80211_ht_cap_ie_to_sta_ht_cap() get
the station as an argument, rather than the new capabilities,
so it can set up the new bandwidth field.

If the station is a VHT station and VHT bandwidth is in use,
also set the bandwidth accordingly.

Doing this allows us to get rid of the supports_40mhz flag as
the HT capabilities now reflect the true capability instead of
the current setting.

While at it, also fix ieee80211_ht_cap_ie_to_sta_ht_cap() to not
ignore HT cap overrides when MCS TX isn't supported (not that it
really happens...)

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4a34215e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1204,7 +1204,7 @@ static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta)
			caps |= WLAN_RC_TS_FLAG | WLAN_RC_DS_FLAG;
		else if (sta->ht_cap.mcs.rx_mask[1])
			caps |= WLAN_RC_DS_FLAG;
		if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
		if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) {
			caps |= WLAN_RC_40_FLAG;
			if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
				caps |= WLAN_RC_SGI_FLAG;
+1 −1
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx,

bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
			    struct iwl_rxon_context *ctx,
			    struct ieee80211_sta_ht_cap *ht_cap);
			    struct ieee80211_sta *sta);

static inline int iwl_sta_id(struct ieee80211_sta *sta)
{
+3 −3
Original line number Diff line number Diff line
@@ -1305,7 +1305,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
	tbl->max_search = IWL_MAX_SEARCH;
	rate_mask = lq_sta->active_mimo2_rate;

	if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(priv, ctx, sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
@@ -1361,7 +1361,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv,
	tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH;
	rate_mask = lq_sta->active_mimo3_rate;

	if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(priv, ctx, sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
@@ -1410,7 +1410,7 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
	tbl->max_search = IWL_MAX_SEARCH;
	rate_mask = lq_sta->active_siso_rate;

	if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(priv, ctx, sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
+5 −14
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,

bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
			    struct iwl_rxon_context *ctx,
			    struct ieee80211_sta_ht_cap *ht_cap)
			    struct ieee80211_sta *sta)
{
	if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
		return false;
@@ -183,20 +183,11 @@ bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
		return false;
#endif

	/*
	 * Remainder of this function checks ht_cap, but if it's
	 * NULL then we can do HT40 (special case for RXON)
	 */
	if (!ht_cap)
	/* special case for RXON */
	if (!sta)
		return true;

	if (!ht_cap->ht_supported)
		return false;

	if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
		return false;

	return true;
	return sta->bandwidth >= IEEE80211_STA_RX_BW_40;
}

static void iwl_sta_calc_ht_flags(struct iwl_priv *priv,
@@ -246,7 +237,7 @@ static void iwl_sta_calc_ht_flags(struct iwl_priv *priv,
	*flags |= cpu_to_le32(
		(u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);

	if (iwl_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(priv, ctx, sta))
		*flags |= STA_FLG_HT40_EN_MSK;
}

+5 −19
Original line number Diff line number Diff line
@@ -1209,23 +1209,9 @@ static s32 rs_get_best_rate(struct iwl_mvm *mvm,
	return new_rate;
}

static bool iwl_is_ht40_tx_allowed(struct iwl_mvm *mvm,
			    struct ieee80211_sta_ht_cap *ht_cap)
static bool iwl_is_ht40_tx_allowed(struct ieee80211_sta *sta)
{
	/*
	 * Remainder of this function checks ht_cap, but if it's
	 * NULL then we can do HT40 (special case for RXON)
	 */
	if (!ht_cap)
		return true;

	if (!ht_cap->ht_supported)
		return false;

	if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
		return false;

	return true;
	return sta->bandwidth >= IEEE80211_STA_RX_BW_40;
}

/*
@@ -1258,7 +1244,7 @@ static int rs_switch_to_mimo2(struct iwl_mvm *mvm,
	tbl->max_search = IWL_MAX_SEARCH;
	rate_mask = lq_sta->active_mimo2_rate;

	if (iwl_is_ht40_tx_allowed(mvm, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
@@ -1311,7 +1297,7 @@ static int rs_switch_to_mimo3(struct iwl_mvm *mvm,
	tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH;
	rate_mask = lq_sta->active_mimo3_rate;

	if (iwl_is_ht40_tx_allowed(mvm, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
@@ -1356,7 +1342,7 @@ static int rs_switch_to_siso(struct iwl_mvm *mvm,
	tbl->max_search = IWL_MAX_SEARCH;
	rate_mask = lq_sta->active_siso_rate;

	if (iwl_is_ht40_tx_allowed(mvm, &sta->ht_cap))
	if (iwl_is_ht40_tx_allowed(sta))
		tbl->is_ht40 = 1;
	else
		tbl->is_ht40 = 0;
Loading