diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-07-16 13:05:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-24 15:05:16 -0400 |
commit | 4c6d4f5c33fbe19b134c1af43af166fee79eb986 (patch) | |
tree | 789bd7f9c049ea9c57ad8f4826df6bcad3774ade /drivers/net/wireless | |
parent | 943ab70f6aebfdc0005ef7e58ae982e9ec22224b (diff) |
mac80211: add helper for management / no-ack frame rate decision
All current rate control algorithms agree to send management and no-ack
frames at the lowest rate. They also agree to do this when sta
and the private rate control data is NULL. We add a hlper to mac80211
for this and simplify the rate control algorithm code.
Developers wishing to make enhancements to rate control algorithms
are for broadcast/multicast can opt to not use this in their
gate_rate() mac80211 callback.
Cc: Zhu Yi <yi.zhu@intel.com>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: ipw3945-devel@lists.sourceforge.net
Cc: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Cc: Derek Smithies <derek@indranet.co.nz>
Cc: Chittajit Mitra <Chittajit.Mitra@Atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 7 |
3 files changed, 5 insertions, 29 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 2c72901adbee..630fcf46e0dd 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1518,23 +1518,11 @@ exit: | |||
1518 | static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | 1518 | static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, |
1519 | struct ieee80211_tx_rate_control *txrc) | 1519 | struct ieee80211_tx_rate_control *txrc) |
1520 | { | 1520 | { |
1521 | struct ieee80211_supported_band *sband = txrc->sband; | ||
1522 | struct sk_buff *skb = txrc->skb; | ||
1523 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
1524 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1525 | struct ath_softc *sc = priv; | 1521 | struct ath_softc *sc = priv; |
1526 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1522 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1527 | __le16 fc = hdr->frame_control; | ||
1528 | 1523 | ||
1529 | /* lowest rate for management and NO_ACK frames */ | 1524 | if (rate_control_send_low(sta, priv_sta, txrc)) |
1530 | if (!ieee80211_is_data(fc) || | ||
1531 | tx_info->flags & IEEE80211_TX_CTL_NO_ACK || !sta) { | ||
1532 | tx_info->control.rates[0].idx = rate_lowest_index(sband, sta); | ||
1533 | tx_info->control.rates[0].count = | ||
1534 | (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) ? | ||
1535 | 1 : ATH_MGT_TXMAXTRY; | ||
1536 | return; | 1525 | return; |
1537 | } | ||
1538 | 1526 | ||
1539 | /* Find tx rate for unicast frames */ | 1527 | /* Find tx rate for unicast frames */ |
1540 | ath_rc_ratefind(sc, ath_rc_priv, txrc); | 1528 | ath_rc_ratefind(sc, ath_rc_priv, txrc); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 2b776924d5e7..a16bd4147eac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -673,7 +673,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
673 | s8 scale_action = 0; | 673 | s8 scale_action = 0; |
674 | unsigned long flags; | 674 | unsigned long flags; |
675 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 675 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
676 | __le16 fc; | ||
677 | u16 rate_mask = sta ? sta->supp_rates[sband->band] : 0; | 676 | u16 rate_mask = sta ? sta->supp_rates[sband->band] : 0; |
678 | s8 max_rate_idx = -1; | 677 | s8 max_rate_idx = -1; |
679 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 678 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
@@ -681,16 +680,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
681 | 680 | ||
682 | IWL_DEBUG_RATE(priv, "enter\n"); | 681 | IWL_DEBUG_RATE(priv, "enter\n"); |
683 | 682 | ||
684 | /* Send management frames and NO_ACK data using lowest rate. */ | 683 | if (rate_control_send_low(sta, priv_sta, txrc)) |
685 | fc = hdr->frame_control; | ||
686 | if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK || | ||
687 | !sta || !priv_sta) { | ||
688 | IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); | ||
689 | info->control.rates[0].idx = rate_lowest_index(sband, sta); | ||
690 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) | ||
691 | info->control.rates[0].count = 1; | ||
692 | return; | 684 | return; |
693 | } | 685 | |
686 | rate_mask = sta->supp_rates[sband->band]; | ||
694 | 687 | ||
695 | /* get user max rate if set */ | 688 | /* get user max rate if set */ |
696 | max_rate_idx = txrc->max_rate_idx; | 689 | max_rate_idx = txrc->max_rate_idx; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 3fea027f35d1..63280411fd58 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -2481,13 +2481,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2481 | } | 2481 | } |
2482 | 2482 | ||
2483 | /* Send management frames and NO_ACK data using lowest rate. */ | 2483 | /* Send management frames and NO_ACK data using lowest rate. */ |
2484 | if (!ieee80211_is_data(hdr->frame_control) || | 2484 | if (rate_control_send_low(sta, priv_sta, txrc)) |
2485 | info->flags & IEEE80211_TX_CTL_NO_ACK || !sta || !lq_sta) { | ||
2486 | info->control.rates[0].idx = rate_lowest_index(sband, sta); | ||
2487 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) | ||
2488 | info->control.rates[0].count = 1; | ||
2489 | return; | 2485 | return; |
2490 | } | ||
2491 | 2486 | ||
2492 | rate_idx = lq_sta->last_txrate_idx; | 2487 | rate_idx = lq_sta->last_txrate_idx; |
2493 | 2488 | ||