iwmc3200wifi: Fix test of unsigned in iwm_ntf_stop_resume_tx()
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-agn-rs.c
index e6c35e0..fe511cb 100644 (file)
@@ -75,106 +75,6 @@ static const u8 ant_toggle_lookup[] = {
        /*ANT_ABC  -> */ ANT_ABC,
 };
 
-/**
- * struct iwl_rate_scale_data -- tx success history for one rate
- */
-struct iwl_rate_scale_data {
-       u64 data;               /* bitmap of successful frames */
-       s32 success_counter;    /* number of frames successful */
-       s32 success_ratio;      /* per-cent * 128  */
-       s32 counter;            /* number of frames attempted */
-       s32 average_tpt;        /* success ratio * expected throughput */
-       unsigned long stamp;
-};
-
-/**
- * struct iwl_scale_tbl_info -- tx params and success history for all rates
- *
- * There are two of these in struct iwl_lq_sta,
- * one for "active", and one for "search".
- */
-struct iwl_scale_tbl_info {
-       enum iwl_table_type lq_type;
-       u8 ant_type;
-       u8 is_SGI;      /* 1 = short guard interval */
-       u8 is_ht40;     /* 1 = 40 MHz channel width */
-       u8 is_dup;      /* 1 = duplicated data streams */
-       u8 action;      /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */
-       u8 max_search;  /* maximun number of tables we can search */
-       s32 *expected_tpt;      /* throughput metrics; expected_tpt_G, etc. */
-       u32 current_rate;  /* rate_n_flags, uCode API format */
-       struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */
-};
-
-struct iwl_traffic_load {
-       unsigned long time_stamp;       /* age of the oldest statistics */
-       u32 packet_count[TID_QUEUE_MAX_SIZE];   /* packet count in this time
-                                                * slice */
-       u32 total;                      /* total num of packets during the
-                                        * last TID_MAX_TIME_DIFF */
-       u8 queue_count;                 /* number of queues that has
-                                        * been used since the last cleanup */
-       u8 head;                        /* start of the circular buffer */
-};
-
-/**
- * struct iwl_lq_sta -- driver's rate scaling private structure
- *
- * Pointer to this gets passed back and forth between driver and mac80211.
- */
-struct iwl_lq_sta {
-       u8 active_tbl;          /* index of active table, range 0-1 */
-       u8 enable_counter;      /* indicates HT mode */
-       u8 stay_in_tbl;         /* 1: disallow, 0: allow search for new mode */
-       u8 search_better_tbl;   /* 1: currently trying alternate mode */
-       s32 last_tpt;
-
-       /* The following determine when to search for a new mode */
-       u32 table_count_limit;
-       u32 max_failure_limit;  /* # failed frames before new search */
-       u32 max_success_limit;  /* # successful frames before new search */
-       u32 table_count;
-       u32 total_failed;       /* total failed frames, any/all rates */
-       u32 total_success;      /* total successful frames, any/all rates */
-       u64 flush_timer;        /* time staying in mode before new search */
-
-       u8 action_counter;      /* # mode-switch actions tried */
-       u8 is_green;
-       u8 is_dup;
-       enum ieee80211_band band;
-       u8 ibss_sta_added;
-
-       /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
-       u32 supp_rates;
-       u16 active_legacy_rate;
-       u16 active_siso_rate;
-       u16 active_mimo2_rate;
-       u16 active_mimo3_rate;
-       u16 active_rate_basic;
-       s8 max_rate_idx;     /* Max rate set by user */
-       u8 missed_rate_counter;
-
-       struct iwl_link_quality_cmd lq;
-       struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
-       struct iwl_traffic_load load[TID_MAX_LOAD_COUNT];
-       u8 tx_agg_tid_en;
-#ifdef CONFIG_MAC80211_DEBUGFS
-       struct dentry *rs_sta_dbgfs_scale_table_file;
-       struct dentry *rs_sta_dbgfs_stats_table_file;
-       struct dentry *rs_sta_dbgfs_rate_scale_data_file;
-       struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
-       u32 dbg_fixed_rate;
-#endif
-       struct iwl_priv *drv;
-
-       /* used to be in sta_info */
-       int last_txrate_idx;
-       /* last tx rate_n_flags */
-       u32 last_rate_n_flags;
-       /* packets destined for this STA are aggregated */
-       u8 is_agg;
-};
-
 static void rs_rate_scale_perform(struct iwl_priv *priv,
                                   struct sk_buff *skb,
                                   struct ieee80211_sta *sta,
@@ -401,7 +301,7 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
        if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
                IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
                                sta->addr, tid);
-               ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid);
+               ieee80211_start_tx_ba_session(sta, tid);
        }
 }
 
@@ -2575,22 +2475,13 @@ static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
                          gfp_t gfp)
 {
        struct iwl_lq_sta *lq_sta;
+       struct iwl_station_priv *sta_priv = (struct iwl_station_priv *) sta->drv_priv;
        struct iwl_priv *priv;
-       int i, j;
 
        priv = (struct iwl_priv *)priv_rate;
        IWL_DEBUG_RATE(priv, "create station rate scale window\n");
 
-       lq_sta = kzalloc(sizeof(struct iwl_lq_sta), gfp);
-
-       if (lq_sta == NULL)
-               return NULL;
-       lq_sta->lq.sta_id = 0xff;
-
-
-       for (j = 0; j < LQ_SIZE; j++)
-               for (i = 0; i < IWL_RATE_COUNT; i++)
-                       rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
+       lq_sta = &sta_priv->lq_sta;
 
        return lq_sta;
 }
@@ -2604,6 +2495,12 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
        struct iwl_lq_sta *lq_sta = priv_sta;
 
+       lq_sta->lq.sta_id = 0xff;
+
+       for (j = 0; j < LQ_SIZE; j++)
+               for (i = 0; i < IWL_RATE_COUNT; i++)
+                       rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
+
        lq_sta->flush_timer = 0;
        lq_sta->supp_rates = sta->supp_rates[sband->band];
        for (j = 0; j < LQ_SIZE; j++)
@@ -2800,7 +2697,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
                repeat_rate--;
        }
 
-       lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_MAX;
+       lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
        lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
        lq_cmd->agg_params.agg_time_limit =
                cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
@@ -2819,11 +2716,9 @@ static void rs_free(void *priv_rate)
 static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
                        void *priv_sta)
 {
-       struct iwl_lq_sta *lq_sta = priv_sta;
        struct iwl_priv *priv __maybe_unused = priv_r;
 
        IWL_DEBUG_RATE(priv, "enter\n");
-       kfree(lq_sta);
        IWL_DEBUG_RATE(priv, "leave\n");
 }
 
@@ -3069,16 +2964,16 @@ static void rs_add_debugfs(void *priv, void *priv_sta,
 {
        struct iwl_lq_sta *lq_sta = priv_sta;
        lq_sta->rs_sta_dbgfs_scale_table_file =
-               debugfs_create_file("rate_scale_table", 0600, dir,
+               debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir,
                                lq_sta, &rs_sta_dbgfs_scale_table_ops);
        lq_sta->rs_sta_dbgfs_stats_table_file =
-               debugfs_create_file("rate_stats_table", 0600, dir,
+               debugfs_create_file("rate_stats_table", S_IRUSR, dir,
                        lq_sta, &rs_sta_dbgfs_stats_table_ops);
        lq_sta->rs_sta_dbgfs_rate_scale_data_file =
-               debugfs_create_file("rate_scale_data", 0600, dir,
+               debugfs_create_file("rate_scale_data", S_IRUSR, dir,
                        lq_sta, &rs_sta_dbgfs_rate_scale_data_ops);
        lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
-               debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
+               debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir,
                &lq_sta->tx_agg_tid_en);
 
 }