aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/rc.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 /drivers/net/wireless/ath9k/rc.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 'drivers/net/wireless/ath9k/rc.c')
-rw-r--r--drivers/net/wireless/ath9k/rc.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 9b2526030965..6afafeddeda2 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1864,24 +1864,21 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1864 1864
1865 hdr = (struct ieee80211_hdr *)skb->data; 1865 hdr = (struct ieee80211_hdr *)skb->data;
1866 fc = hdr->frame_control; 1866 fc = hdr->frame_control;
1867 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1867 /* XXX: UGLY HACK!! */
1868 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1868 1869
1869 spin_lock_bh(&sc->node_lock); 1870 spin_lock_bh(&sc->node_lock);
1870 an = ath_node_find(sc, hdr->addr1); 1871 an = ath_node_find(sc, hdr->addr1);
1871 spin_unlock_bh(&sc->node_lock); 1872 spin_unlock_bh(&sc->node_lock);
1872 1873
1873 if (!an || !priv_sta || !ieee80211_is_data(fc)) { 1874 if (tx_info_priv == NULL)
1874 if (tx_info->driver_data[0] != NULL) {
1875 kfree(tx_info->driver_data[0]);
1876 tx_info->driver_data[0] = NULL;
1877 }
1878 return; 1875 return;
1879 } 1876
1880 if (tx_info->driver_data[0] != NULL) { 1877 if (an && priv_sta && ieee80211_is_data(fc))
1881 ath_rate_tx_complete(sc, an, priv_sta, tx_info_priv); 1878 ath_rate_tx_complete(sc, an, priv_sta, tx_info_priv);
1882 kfree(tx_info->driver_data[0]); 1879
1883 tx_info->driver_data[0] = NULL; 1880 kfree(tx_info_priv);
1884 } 1881 tx_info->control.vif = NULL;
1885} 1882}
1886 1883
1887static void ath_tx_aggr_resp(struct ath_softc *sc, 1884static void ath_tx_aggr_resp(struct ath_softc *sc,
@@ -1927,10 +1924,11 @@ static void ath_tx_aggr_resp(struct ath_softc *sc,
1927 } 1924 }
1928} 1925}
1929 1926
1930static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband, 1927static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1931 struct ieee80211_sta *sta, void *priv_sta, 1928 struct ieee80211_tx_rate_control *txrc)
1932 struct sk_buff *skb, struct rate_selection *sel)
1933{ 1929{
1930 struct ieee80211_supported_band *sband = txrc->sband;
1931 struct sk_buff *skb = txrc->skb;
1934 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1932 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1935 struct ath_softc *sc = priv; 1933 struct ath_softc *sc = priv;
1936 struct ieee80211_hw *hw = sc->hw; 1934 struct ieee80211_hw *hw = sc->hw;
@@ -1945,17 +1943,17 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1945 1943
1946 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); 1944 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
1947 1945
1948 /* allocate driver private area of tx_info */ 1946 /* allocate driver private area of tx_info, XXX: UGLY HACK! */
1949 tx_info->driver_data[0] = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC); 1947 tx_info->control.vif = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC);
1950 ASSERT(tx_info->driver_data[0] != NULL); 1948 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1951 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1949 ASSERT(tx_info_priv != NULL);
1952 1950
1953 lowest_idx = rate_lowest_index(sband, sta); 1951 lowest_idx = rate_lowest_index(sband, sta);
1954 tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10; 1952 tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10;
1955 /* lowest rate for management and multicast/broadcast frames */ 1953 /* lowest rate for management and multicast/broadcast frames */
1956 if (!ieee80211_is_data(fc) || 1954 if (!ieee80211_is_data(fc) ||
1957 is_multicast_ether_addr(hdr->addr1) || !sta) { 1955 is_multicast_ether_addr(hdr->addr1) || !sta) {
1958 sel->rate_idx = lowest_idx; 1956 tx_info->control.rates[0].idx = lowest_idx;
1959 return; 1957 return;
1960 } 1958 }
1961 1959
@@ -1966,8 +1964,10 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1966 tx_info_priv->rcs, 1964 tx_info_priv->rcs,
1967 &is_probe, 1965 &is_probe,
1968 false); 1966 false);
1967#if 0
1969 if (is_probe) 1968 if (is_probe)
1970 sel->probe_idx = ath_rc_priv->tx_ratectrl.probe_rate; 1969 sel->probe_idx = ath_rc_priv->tx_ratectrl.probe_rate;
1970#endif
1971 1971
1972 /* Ratecontrol sometimes returns invalid rate index */ 1972 /* Ratecontrol sometimes returns invalid rate index */
1973 if (tx_info_priv->rcs[0].rix != 0xff) 1973 if (tx_info_priv->rcs[0].rix != 0xff)
@@ -1975,7 +1975,7 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1975 else 1975 else
1976 tx_info_priv->rcs[0].rix = ath_rc_priv->prev_data_rix; 1976 tx_info_priv->rcs[0].rix = ath_rc_priv->prev_data_rix;
1977 1977
1978 sel->rate_idx = tx_info_priv->rcs[0].rix; 1978 tx_info->control.rates[0].idx = tx_info_priv->rcs[0].rix;
1979 1979
1980 /* Check if aggregation has to be enabled for this tid */ 1980 /* Check if aggregation has to be enabled for this tid */
1981 1981