aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rate.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/mac80211/rate.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r--net/mac80211/rate.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index be04d46110fe..3d5a2cb835c4 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -145,6 +145,7 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf,
145static const struct file_operations rcname_ops = { 145static const struct file_operations rcname_ops = {
146 .read = rcname_read, 146 .read = rcname_read,
147 .open = mac80211_open_file_generic, 147 .open = mac80211_open_file_generic,
148 .llseek = default_llseek,
148}; 149};
149#endif 150#endif
150 151
@@ -207,10 +208,11 @@ static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
207 208
208 fc = hdr->frame_control; 209 fc = hdr->frame_control;
209 210
210 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);
211} 212}
212 213
213static 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,
215 struct ieee80211_supported_band *sband)
214{ 216{
215 u8 i; 217 u8 i;
216 218
@@ -221,7 +223,7 @@ static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, u8 max_rate_idx)
221 if (basic_rates & (1 << *idx)) 223 if (basic_rates & (1 << *idx))
222 return; /* selected rate is a basic rate */ 224 return; /* selected rate is a basic rate */
223 225
224 for (i = *idx + 1; i <= max_rate_idx; i++) { 226 for (i = *idx + 1; i <= sband->n_bitrates; i++) {
225 if (basic_rates & (1 << i)) { 227 if (basic_rates & (1 << i)) {
226 *idx = i; 228 *idx = i;
227 return; 229 return;
@@ -236,16 +238,25 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
236 struct ieee80211_tx_rate_control *txrc) 238 struct ieee80211_tx_rate_control *txrc)
237{ 239{
238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); 240 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
241 struct ieee80211_supported_band *sband = txrc->sband;
242 int mcast_rate;
239 243
240 if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) { 244 if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
241 info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta); 245 info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
242 info->control.rates[0].count = 246 info->control.rates[0].count =
243 (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 247 (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
244 1 : txrc->hw->max_rate_tries; 248 1 : txrc->hw->max_rate_tries;
245 if (!sta && txrc->ap) 249 if (!sta && txrc->bss) {
250 mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
251 if (mcast_rate > 0) {
252 info->control.rates[0].idx = mcast_rate - 1;
253 return true;
254 }
255
246 rc_send_low_broadcast(&info->control.rates[0].idx, 256 rc_send_low_broadcast(&info->control.rates[0].idx,
247 txrc->bss_conf->basic_rates, 257 txrc->bss_conf->basic_rates,
248 txrc->sband->n_bitrates); 258 sband);
259 }
249 return true; 260 return true;
250 } 261 }
251 return false; 262 return false;
@@ -328,6 +339,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
328 * if needed. 339 * if needed.
329 */ 340 */
330 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { 341 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
342 /* Skip invalid rates */
343 if (info->control.rates[i].idx < 0)
344 break;
331 /* Rate masking supports only legacy rates for now */ 345 /* Rate masking supports only legacy rates for now */
332 if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) 346 if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS)
333 continue; 347 continue;
@@ -368,8 +382,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
368 382
369 ref = rate_control_alloc(name, local); 383 ref = rate_control_alloc(name, local);
370 if (!ref) { 384 if (!ref) {
371 printk(KERN_WARNING "%s: Failed to select rate control " 385 wiphy_warn(local->hw.wiphy,
372 "algorithm\n", wiphy_name(local->hw.wiphy)); 386 "Failed to select rate control algorithm\n");
373 return -ENOENT; 387 return -ENOENT;
374 } 388 }
375 389
@@ -380,9 +394,8 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
380 sta_info_flush(local, NULL); 394 sta_info_flush(local, NULL);
381 } 395 }
382 396
383 printk(KERN_DEBUG "%s: Selected rate control " 397 wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n",
384 "algorithm '%s'\n", wiphy_name(local->hw.wiphy), 398 ref->ops->name);
385 ref->ops->name);
386 399
387 return 0; 400 return 0;
388} 401}