aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rate.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-11 09:07:23 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-16 16:39:08 -0500
commit8f0729b16ae354f9db89394fc1d2d65003455d56 (patch)
tree260a562d0c0079ebfc1c507c9aa50e55a1592b6d /net/mac80211/rate.c
parent885a46d0f7942d76c2f3860acb45f75237d3bb42 (diff)
mac80211: add support for setting the ad-hoc multicast rate
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.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 33f76993da08..76de4f8d9327 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -211,10 +211,20 @@ static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
211 return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc); 211 return (info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc);
212} 212}
213 213
214static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx) 214static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u32 mcast_rate,
215 struct ieee80211_supported_band *sband)
215{ 216{
216 u8 i; 217 u8 i;
217 218
219 if (mcast_rate) {
220 for (i = 0; i < sband->n_bitrates; i++) {
221 if (sband->bitrates[i].bitrate == mcast_rate) {
222 *idx = i;
223 return;
224 }
225 }
226 }
227
218 if (basic_rates == 0) 228 if (basic_rates == 0)
219 return; /* assume basic rates unknown and accept rate */ 229 return; /* assume basic rates unknown and accept rate */
220 if (*idx < 0) 230 if (*idx < 0)
@@ -222,7 +232,7 @@ static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx)
222 if (basic_rates & (1 << *idx)) 232 if (basic_rates & (1 << *idx))
223 return; /* selected rate is a basic rate */ 233 return; /* selected rate is a basic rate */
224 234
225 for (i = *idx + 1; i <= max_rate_idx; i++) { 235 for (i = *idx + 1; i <= sband->n_bitrates; i++) {
226 if (basic_rates & (1 << i)) { 236 if (basic_rates & (1 << i)) {
227 *idx = i; 237 *idx = i;
228 return; 238 return;
@@ -243,10 +253,11 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
243 info->control.rates[0].count = 253 info->control.rates[0].count =
244 (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 254 (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
245 1 : txrc->hw->max_rate_tries; 255 1 : txrc->hw->max_rate_tries;
246 if (!sta && txrc->ap) 256 if (!sta && txrc->bss)
247 rc_send_low_broadcast(&info->control.rates[0].idx, 257 rc_send_low_broadcast(&info->control.rates[0].idx,
248 txrc->bss_conf->basic_rates, 258 txrc->bss_conf->basic_rates,
249 txrc->sband->n_bitrates); 259 txrc->bss_conf->mcast_rate,
260 txrc->sband);
250 return true; 261 return true;
251 } 262 }
252 return false; 263 return false;