Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-4965-rs.c
index b9a4e4b..3ccb84a 100644 (file)
@@ -38,6 +38,7 @@
 #include "../net/mac80211/rate.h"
 
 #include "iwl-dev.h"
+#include "iwl-sta.h"
 #include "iwl-core.h"
 #include "iwl-helpers.h"
 
@@ -280,11 +281,11 @@ static u8 rs_tl_add_packet(struct iwl4965_lq_sta *lq_data,
        u32 time_diff;
        s32 index;
        struct iwl4965_traffic_load *tl = NULL;
-       u16 fc = le16_to_cpu(hdr->frame_control);
+       __le16 fc = hdr->frame_control;
        u8 tid;
 
-       if (ieee80211_is_qos_data(fc)) {
-               u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
+       if (ieee80211_is_data_qos(fc)) {
+               u8 *qc = ieee80211_get_qos_ctl(hdr);
                tid = qc[0] & 0xf;
        } else
                return MAX_TID_COUNT;
@@ -793,7 +794,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
        struct iwl4965_scale_tbl_info tbl_type;
        struct iwl4965_scale_tbl_info *curr_tbl, *search_tbl;
        u8 active_index = 0;
-       u16 fc = le16_to_cpu(hdr->frame_control);
+       __le16 fc = hdr->frame_control;
        s32 tpt = 0;
 
        IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n");
@@ -821,9 +822,6 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
 
        lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
 
-       if (!priv->lq_mngr.lq_ready)
-               goto out;
-
        if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
            !lq_sta->ibss_sta_added)
                goto out;
@@ -1650,7 +1648,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        int high_tpt = IWL_INVALID_VALUE;
        u32 fail_count;
        s8 scale_action = 0;
-       u16 fc, rate_mask;
+       __le16 fc;
+       u16 rate_mask;
        u8 update_lq = 0;
        struct iwl4965_lq_sta *lq_sta;
        struct iwl4965_scale_tbl_info *tbl, *tbl1;
@@ -1665,7 +1664,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 
        IWL_DEBUG_RATE("rate scale calculate new rate for skb\n");
 
-       fc = le16_to_cpu(hdr->frame_control);
+       fc = hdr->frame_control;
        if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) {
                /* Send management frames and broadcast/multicast data using
                 * lowest rate. */
@@ -1676,10 +1675,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        if (!sta || !sta->rate_ctrl_priv)
                return;
 
-       if (!priv->lq_mngr.lq_ready) {
-               IWL_DEBUG_RATE("still rate scaling not ready\n");
-               return;
-       }
        lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
 
        tid = rs_tl_add_packet(lq_sta, hdr);
@@ -2099,7 +2094,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
        struct ieee80211_conf *conf = &local->hw.conf;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct sta_info *sta;
-       u16 fc;
+       __le16 fc;
        struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
        struct iwl4965_lq_sta *lq_sta;
 
@@ -2111,7 +2106,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
 
        /* Send management frames and broadcast/multicast data using lowest
         * rate. */
-       fc = le16_to_cpu(hdr->frame_control);
+       fc = hdr->frame_control;
        if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
            !sta || !sta->rate_ctrl_priv) {
                sel->rate_idx = rate_lowest_index(local, sband, sta);
@@ -2138,11 +2133,8 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
                        lq_sta->ibss_sta_added = 1;
                        rs_initialize_lq(priv, conf, sta);
                }
-               if (!lq_sta->ibss_sta_added)
-                       goto done;
        }
 
-done:
        if ((i < 0) || (i > IWL_RATE_COUNT)) {
                sel->rate_idx = rate_lowest_index(local, sband, sta);
                goto out;
@@ -2273,12 +2265,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
 
        /* as default allow aggregation for all tids */
        lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
-#ifdef CONFIG_MAC80211_DEBUGFS
        lq_sta->drv = priv;
-#endif
-
-       if (priv->assoc_station_added)
-               priv->lq_mngr.lq_ready = 1;
 
        rs_initialize_lq(priv, conf, sta);
 }
@@ -2419,7 +2406,7 @@ static void rs_clear(void *priv_rate)
 
        IWL_DEBUG_RATE("enter\n");
 
-       priv->lq_mngr.lq_ready = 0;
+       /* TODO - add rate scale state reset */
 
        IWL_DEBUG_RATE("leave\n");
 }
@@ -2714,13 +2701,6 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
        return cnt;
 }
 
-void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
-{
-       struct iwl_priv *priv = hw->priv;
-
-       priv->lq_mngr.lq_ready = 1;
-}
-
 int iwl4965_rate_control_register(void)
 {
        return ieee80211_rate_control_register(&rs_ops);