aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rc80211_pid_algo.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-21 06:40:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:23 -0400
commite6a9854b05c1a6af1308fe2b8c68f35abf28a3ee (patch)
tree241f611f8194586ccabf61bacb060508773b9d05 /net/mac80211/rc80211_pid_algo.c
parentcb121bad67a32cde37adc2729b7e18aa4fd3063e (diff)
mac80211/drivers: rewrite the rate control API
So after the previous changes we were still unhappy with how convoluted the API is and decided to make things simpler for everybody. This completely changes the rate control API, now taking into account 802.11n with MCS rates and more control, most drivers don't support that though. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rc80211_pid_algo.c')
-rw-r--r--net/mac80211/rc80211_pid_algo.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 86eb374e3b87..92caecfcee78 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -241,7 +241,7 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba
241 241
242 /* Ignore all frames that were sent with a different rate than the rate 242 /* Ignore all frames that were sent with a different rate than the rate
243 * we currently advise mac80211 to use. */ 243 * we currently advise mac80211 to use. */
244 if (info->tx_rate_idx != spinfo->txrate_idx) 244 if (info->status.rates[0].idx != spinfo->txrate_idx)
245 return; 245 return;
246 246
247 spinfo->tx_num_xmit++; 247 spinfo->tx_num_xmit++;
@@ -253,10 +253,10 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba
253 /* We count frames that totally failed to be transmitted as two bad 253 /* We count frames that totally failed to be transmitted as two bad
254 * frames, those that made it out but had some retries as one good and 254 * frames, those that made it out but had some retries as one good and
255 * one bad frame. */ 255 * one bad frame. */
256 if (info->status.excessive_retries) { 256 if (!(info->flags & IEEE80211_TX_STAT_ACK)) {
257 spinfo->tx_num_failed += 2; 257 spinfo->tx_num_failed += 2;
258 spinfo->tx_num_xmit++; 258 spinfo->tx_num_xmit++;
259 } else if (info->status.retry_count) { 259 } else if (info->status.rates[0].count) {
260 spinfo->tx_num_failed++; 260 spinfo->tx_num_failed++;
261 spinfo->tx_num_xmit++; 261 spinfo->tx_num_xmit++;
262 } 262 }
@@ -270,23 +270,32 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba
270} 270}
271 271
272static void 272static void
273rate_control_pid_get_rate(void *priv, struct ieee80211_supported_band *sband, 273rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
274 struct ieee80211_sta *sta, void *priv_sta, 274 void *priv_sta,
275 struct sk_buff *skb, 275 struct ieee80211_tx_rate_control *txrc)
276 struct rate_selection *sel)
277{ 276{
277 struct sk_buff *skb = txrc->skb;
278 struct ieee80211_supported_band *sband = txrc->sband;
278 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 279 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
280 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
279 struct rc_pid_sta_info *spinfo = priv_sta; 281 struct rc_pid_sta_info *spinfo = priv_sta;
280 int rateidx; 282 int rateidx;
281 u16 fc; 283 u16 fc;
282 284
285 if (txrc->rts)
286 info->control.rates[0].count =
287 txrc->hw->conf.long_frame_max_tx_count;
288 else
289 info->control.rates[0].count =
290 txrc->hw->conf.short_frame_max_tx_count;
291
283 /* Send management frames and broadcast/multicast data using lowest 292 /* Send management frames and broadcast/multicast data using lowest
284 * rate. */ 293 * rate. */
285 fc = le16_to_cpu(hdr->frame_control); 294 fc = le16_to_cpu(hdr->frame_control);
286 if (!sta || !spinfo || 295 if (!sta || !spinfo ||
287 (fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || 296 (fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
288 is_multicast_ether_addr(hdr->addr1)) { 297 is_multicast_ether_addr(hdr->addr1)) {
289 sel->rate_idx = rate_lowest_index(sband, sta); 298 info->control.rates[0].idx = rate_lowest_index(sband, sta);
290 return; 299 return;
291 } 300 }
292 301
@@ -295,7 +304,7 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_supported_band *sband,
295 if (rateidx >= sband->n_bitrates) 304 if (rateidx >= sband->n_bitrates)
296 rateidx = sband->n_bitrates - 1; 305 rateidx = sband->n_bitrates - 1;
297 306
298 sel->rate_idx = rateidx; 307 info->control.rates[0].idx = rateidx;
299 308
300#ifdef CONFIG_MAC80211_DEBUGFS 309#ifdef CONFIG_MAC80211_DEBUGFS
301 rate_control_pid_event_tx_rate(&spinfo->events, 310 rate_control_pid_event_tx_rate(&spinfo->events,