Commit 2400dfe2 authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: mac80211: remove shifted rate support



We really cannot even get into this as we can't have
a BSS with a 5/10 MHz (scan) width, and therefore all
the code handling shifted rates cannot happen. Remove
it all, since it's broken anyway, at least with MLO.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5add321c
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -632,7 +632,7 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
{
	struct ieee80211_supported_band *sband;
	struct ieee80211_chanctx_conf *conf;
	int rateidx, shift = 0;
	int rateidx;
	bool cck, short_pream;
	u32 basic_rates;
	u8 band = 0;
@@ -641,10 +641,8 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
	len += 38; /* Ethernet header length */

	conf = rcu_dereference(vif->bss_conf.chanctx_conf);
	if (conf) {
	if (conf)
		band = conf->def.chan->band;
		shift = ieee80211_chandef_get_shift(&conf->def);
	}

	if (pubsta) {
		struct sta_info *sta = container_of(pubsta, struct sta_info,
@@ -704,7 +702,7 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
	short_pream = vif->bss_conf.use_short_preamble;

	rateidx = basic_rates ? ffs(basic_rates) - 1 : 0;
	rate = sband->bitrates[rateidx].bitrate << shift;
	rate = sband->bitrates[rateidx].bitrate;
	cck = sband->bitrates[rateidx].flags & IEEE80211_RATE_MANDATORY_B;

	return ieee80211_calc_legacy_rate_duration(rate, short_pream, cck, len);
+2 −6
Original line number Diff line number Diff line
@@ -810,15 +810,11 @@ void sta_set_rate_info_tx(struct sta_info *sta,
		rinfo->nss = ieee80211_rate_get_vht_nss(rate);
	} else {
		struct ieee80211_supported_band *sband;
		int shift = ieee80211_vif_get_shift(&sta->sdata->vif);
		u16 brate;

		sband = ieee80211_get_sband(sta->sdata);
		WARN_ON_ONCE(sband && !sband->bitrates);
		if (sband && sband->bitrates) {
			brate = sband->bitrates[rate->idx].bitrate;
			rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
		}
		if (sband && sband->bitrates)
			rinfo->legacy = sband->bitrates[rate->idx].bitrate;
	}
	if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
		rinfo->bw = RATE_INFO_BW_40;
+3 −10
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
	u32 rate_flags, rates = 0, rates_added = 0;
	struct beacon_data *presp;
	int frame_len;
	int shift;

	/* Build IBSS probe response */
	frame_len = sizeof(struct ieee80211_hdr_3addr) +
@@ -92,7 +91,6 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,

	sband = local->hw.wiphy->bands[chandef->chan->band];
	rate_flags = ieee80211_chandef_rate_flags(chandef);
	shift = ieee80211_chandef_get_shift(chandef);
	rates_n = 0;
	if (have_higher_than_11mbit)
		*have_higher_than_11mbit = false;
@@ -111,8 +109,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
	*pos++ = WLAN_EID_SUPP_RATES;
	*pos++ = min_t(int, 8, rates_n);
	for (ri = 0; ri < sband->n_bitrates; ri++) {
		int rate = DIV_ROUND_UP(sband->bitrates[ri].bitrate,
					5 * (1 << shift));
		int rate = DIV_ROUND_UP(sband->bitrates[ri].bitrate, 5);
		u8 basic = 0;
		if (!(rates & BIT(ri)))
			continue;
@@ -155,8 +152,7 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
		*pos++ = WLAN_EID_EXT_SUPP_RATES;
		*pos++ = rates_n - 8;
		for (; ri < sband->n_bitrates; ri++) {
			int rate = DIV_ROUND_UP(sband->bitrates[ri].bitrate,
						5 * (1 << shift));
			int rate = DIV_ROUND_UP(sband->bitrates[ri].bitrate, 5);
			u8 basic = 0;
			if (!(rates & BIT(ri)))
				continue;
@@ -399,7 +395,6 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
	enum nl80211_channel_type chan_type;
	u64 tsf;
	u32 rate_flags;
	int shift;

	lockdep_assert_wiphy(sdata->local->hw.wiphy);

@@ -434,7 +429,6 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,

	sband = sdata->local->hw.wiphy->bands[cbss->channel->band];
	rate_flags = ieee80211_chandef_rate_flags(&sdata->u.ibss.chandef);
	shift = ieee80211_vif_get_shift(&sdata->vif);

	basic_rates = 0;

@@ -448,8 +442,7 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
			    != rate_flags)
				continue;

			brate = DIV_ROUND_UP(sband->bitrates[j].bitrate,
					     5 * (1 << shift));
			brate = DIV_ROUND_UP(sband->bitrates[j].bitrate, 5);
			if (brate == rate) {
				if (is_basic)
					basic_rates |= BIT(j);
+2 −37
Original line number Diff line number Diff line
@@ -1141,40 +1141,6 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
#define sdata_dereference(p, sdata) \
	wiphy_dereference(sdata->local->hw.wiphy, p)

static inline int
ieee80211_chanwidth_get_shift(enum nl80211_chan_width width)
{
	switch (width) {
	case NL80211_CHAN_WIDTH_5:
		return 2;
	case NL80211_CHAN_WIDTH_10:
		return 1;
	default:
		return 0;
	}
}

static inline int
ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
{
	return ieee80211_chanwidth_get_shift(chandef->width);
}

static inline int
ieee80211_vif_get_shift(struct ieee80211_vif *vif)
{
	struct ieee80211_chanctx_conf *chanctx_conf;
	int shift = 0;

	rcu_read_lock();
	chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
	if (chanctx_conf)
		shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
	rcu_read_unlock();

	return shift;
}

static inline int
ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems,
				struct cfg80211_rnr_elems *rnr_elems,
@@ -2041,7 +2007,7 @@ struct sk_buff *
ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
			      struct sk_buff *skb, u32 info_flags);
void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
			  int retry_count, int shift, bool send_to_cooked,
			  int retry_count, bool send_to_cooked,
			  struct ieee80211_tx_status *status);

void ieee80211_check_fast_xmit(struct sta_info *sta);
@@ -2214,8 +2180,7 @@ static inline int __ieee80211_resume(struct ieee80211_hw *hw)
/* utility functions/constants */
extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
int ieee80211_frame_duration(enum nl80211_band band, size_t len,
			     int rate, int erp, int short_preamble,
			     int shift);
			     int rate, int erp, int short_preamble);
void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
					   struct ieee80211_tx_queue_params *qparam,
					   int ac);
+6 −12
Original line number Diff line number Diff line
@@ -829,7 +829,6 @@ static void ieee80211_assoc_add_rates(struct sk_buff *skb,
				      struct ieee80211_supported_band *sband,
				      struct ieee80211_mgd_assoc_data *assoc_data)
{
	unsigned int shift = ieee80211_chanwidth_get_shift(width);
	unsigned int rates_len, supp_rates_len;
	u32 rates = 0;
	int i, count;
@@ -868,8 +867,7 @@ static void ieee80211_assoc_add_rates(struct sk_buff *skb,
	count = 0;
	for (i = 0; i < sband->n_bitrates; i++) {
		if (BIT(i) & rates) {
			int rate = DIV_ROUND_UP(sband->bitrates[i].bitrate,
						5 * (1 << shift));
			int rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5);
			*pos++ = (u8)rate;
			if (++count == 8)
				break;
@@ -885,8 +883,7 @@ static void ieee80211_assoc_add_rates(struct sk_buff *skb,
			if (BIT(i) & rates) {
				int rate;

				rate = DIV_ROUND_UP(sband->bitrates[i].bitrate,
						    5 * (1 << shift));
				rate = DIV_ROUND_UP(sband->bitrates[i].bitrate, 5);
				*pos++ = (u8)rate;
			}
		}
@@ -3857,8 +3854,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
				u8 *supp_rates, unsigned int supp_rates_len,
				u32 *rates, u32 *basic_rates,
				bool *have_higher_than_11mbit,
				int *min_rate, int *min_rate_index,
				int shift)
				int *min_rate, int *min_rate_index)
{
	int i, j;

@@ -3866,7 +3862,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
		int rate = supp_rates[i] & 0x7f;
		bool is_basic = !!(supp_rates[i] & 0x80);

		if ((rate * 5 * (1 << shift)) > 110)
		if ((rate * 5) > 110)
			*have_higher_than_11mbit = true;

		/*
@@ -3890,7 +3886,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,

			br = &sband->bitrates[j];

			brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5);
			brate = DIV_ROUND_UP(br->bitrate, 5);
			if (brate == rate) {
				*rates |= BIT(j);
				if (is_basic)
@@ -4334,8 +4330,6 @@ static int ieee80211_mgd_setup_link_sta(struct ieee80211_link_data *link,
	u32 rates = 0, basic_rates = 0;
	bool have_higher_than_11mbit = false;
	int min_rate = INT_MAX, min_rate_index = -1;
	/* this is clearly wrong for MLO but we'll just remove it later */
	int shift = ieee80211_vif_get_shift(&sdata->vif);
	struct ieee80211_supported_band *sband;

	memcpy(link_sta->addr, cbss->bssid, ETH_ALEN);
@@ -4351,7 +4345,7 @@ static int ieee80211_mgd_setup_link_sta(struct ieee80211_link_data *link,

	ieee80211_get_rates(sband, bss->supp_rates, bss->supp_rates_len,
			    &rates, &basic_rates, &have_higher_than_11mbit,
			    &min_rate, &min_rate_index, shift);
			    &min_rate, &min_rate_index);

	/*
	 * This used to be a workaround for basic rates missing
Loading