diff options
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index a7968df9dacb..d6aca91e612d 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -640,3 +640,31 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) | |||
640 | 640 | ||
641 | return ret; | 641 | return ret; |
642 | } | 642 | } |
643 | |||
644 | u64 ieee80211_mandatory_rates(struct ieee80211_local *local, | ||
645 | enum ieee80211_band band) | ||
646 | { | ||
647 | struct ieee80211_supported_band *sband; | ||
648 | struct ieee80211_rate *bitrates; | ||
649 | u64 mandatory_rates; | ||
650 | enum ieee80211_rate_flags mandatory_flag; | ||
651 | int i; | ||
652 | |||
653 | sband = local->hw.wiphy->bands[band]; | ||
654 | if (!sband) { | ||
655 | WARN_ON(1); | ||
656 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
657 | } | ||
658 | |||
659 | if (band == IEEE80211_BAND_2GHZ) | ||
660 | mandatory_flag = IEEE80211_RATE_MANDATORY_B; | ||
661 | else | ||
662 | mandatory_flag = IEEE80211_RATE_MANDATORY_A; | ||
663 | |||
664 | bitrates = sband->bitrates; | ||
665 | mandatory_rates = 0; | ||
666 | for (i = 0; i < sband->n_bitrates; i++) | ||
667 | if (bitrates[i].flags & mandatory_flag) | ||
668 | mandatory_rates |= BIT(i); | ||
669 | return mandatory_rates; | ||
670 | } | ||