aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rate.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-22 20:58:24 +0100
committerJohn W. Linville <linville@tuxdriver.com>2010-11-24 16:19:35 -0500
commitdd5b4cc71cd09c33e1579cc6d5720656e94e52de (patch)
tree86a27c86480109d9b6bbedddc083095035fbef2d /net/mac80211/rate.c
parentmac80211: probe the AP when resuming (diff)
downloadlinux-dev-dd5b4cc71cd09c33e1579cc6d5720656e94e52de.tar.xz
linux-dev-dd5b4cc71cd09c33e1579cc6d5720656e94e52de.zip
cfg80211/mac80211: improve ad-hoc multicast rate handling
- store the multicast rate as an index instead of the rate value (reduces cpu overhead in a hotpath) - validate the rate values (must match a bitrate in at least one sband) Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r--net/mac80211/rate.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 76de4f8d9327..3d5a2cb835c4 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -211,20 +211,11 @@ static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc);
}
-static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate,
+static void rc_send_low_broadcast(s8 *idx, u32 basic_rates,
struct ieee80211_supported_band *sband)
{
u8 i;
- if (mcast_rate) {
- for (i = 0; i < sband->n_bitrates; i++) {
- if (sband->bitrates[i].bitrate == mcast_rate) {
- *idx = i;
- return;
- }
- }
- }
-
if (basic_rates == 0)
return; /* assume basic rates unknown and accept rate */
if (*idx < 0)
@@ -247,17 +238,25 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
struct ieee80211_tx_rate_control *txrc)
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
+ struct ieee80211_supported_band *sband = txrc->sband;
+ int mcast_rate;
if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
info->control.rates[0].count =
(info->flags & IEEE80211_TX_CTL_NO_ACK) ?
1 : txrc->hw->max_rate_tries;
- if (!sta && txrc->bss)
+ if (!sta && txrc->bss) {
+ mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
+ if (mcast_rate > 0) {
+ info->control.rates[0].idx = mcast_rate - 1;
+ return true;
+ }
+
rc_send_low_broadcast(&info->control.rates[0].idx,
txrc->bss_conf->basic_rates,
- txrc->bss_conf->mcast_rate,
- txrc->sband);
+ sband);
+ }
return true;
}
return false;