Commit 61f02611 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: clean up band switch in duration

Most devices now do duration calculations, so we don't hit
this code at all any more. Clearly the approach of warning
at compile time here when new bands are added didn't work,
the new bands were just added with "TODO". Clean it up, it
won't matter for new bands since they'll just not have any
need to calculate durations in software.

While at it, also clean up and unify the code a bit.

Link: https://msgid.link/20240129194108.70a97bd69265.Icdd8b0ac60a382244466510090eb0f5868151f39@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent efa2cce6
...@@ -133,6 +133,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, ...@@ -133,6 +133,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
mrate = sband->bitrates[0].bitrate; mrate = sband->bitrates[0].bitrate;
for (i = 0; i < sband->n_bitrates; i++) { for (i = 0; i < sband->n_bitrates; i++) {
struct ieee80211_rate *r = &sband->bitrates[i]; struct ieee80211_rate *r = &sband->bitrates[i];
u32 flag;
if (r->bitrate > txrate->bitrate) if (r->bitrate > txrate->bitrate)
break; break;
...@@ -145,28 +146,24 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, ...@@ -145,28 +146,24 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
switch (sband->band) { switch (sband->band) {
case NL80211_BAND_2GHZ: case NL80211_BAND_2GHZ:
case NL80211_BAND_LC: { case NL80211_BAND_LC:
u32 flag;
if (tx->sdata->deflink.operating_11g_mode) if (tx->sdata->deflink.operating_11g_mode)
flag = IEEE80211_RATE_MANDATORY_G; flag = IEEE80211_RATE_MANDATORY_G;
else else
flag = IEEE80211_RATE_MANDATORY_B; flag = IEEE80211_RATE_MANDATORY_B;
if (r->flags & flag)
mrate = r->bitrate;
break; break;
}
case NL80211_BAND_5GHZ: case NL80211_BAND_5GHZ:
case NL80211_BAND_6GHZ: case NL80211_BAND_6GHZ:
if (r->flags & IEEE80211_RATE_MANDATORY_A) flag = IEEE80211_RATE_MANDATORY_A;
mrate = r->bitrate;
break; break;
case NL80211_BAND_S1GHZ: default:
case NL80211_BAND_60GHZ: flag = 0;
/* TODO, for now fall through */
case NUM_NL80211_BANDS:
WARN_ON(1); WARN_ON(1);
break; break;
} }
if (r->flags & flag)
mrate = r->bitrate;
} }
if (rate == -1) { if (rate == -1) {
/* No matching basic rate found; use highest suitable mandatory /* No matching basic rate found; use highest suitable mandatory
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment