iwlagn: send simple LQ command for WoWLAN
authorJohannes Berg <johannes.berg@intel.com>
Mon, 10 Oct 2011 14:26:54 +0000 (07:26 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Oct 2011 18:48:10 +0000 (14:48 -0400)
For some reason, WoWLAN doesn't always seem to
be happy with more advanced LQ commands. Since
we don't need them as we're not going to send
a lot of data, simply program the station with
the very simple default LQ command.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn-sta.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-sta.h

index 8f0b86de1863f75df092290c1914f2383710f4eb..8e7177b38e876b4c402b5d641e8ccaa819532a4f 100644 (file)
 #include "iwl-agn.h"
 #include "iwl-trans.h"
 
-static struct iwl_link_quality_cmd *
-iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
+void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
+                    u8 sta_id, struct iwl_link_quality_cmd *link_cmd)
 {
        int i, r;
-       struct iwl_link_quality_cmd *link_cmd;
        u32 rate_flags = 0;
        __le32 rate_n_flags;
 
-       link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL);
-       if (!link_cmd) {
-               IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
-               return NULL;
-       }
-
        lockdep_assert_held(&priv->shrd->mutex);
 
+       memset(link_cmd, 0, sizeof(*link_cmd));
+
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
        if (priv->band == IEEE80211_BAND_5GHZ)
@@ -87,6 +82,20 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
                cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
 
        link_cmd->sta_id = sta_id;
+}
+
+static struct iwl_link_quality_cmd *
+iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
+{
+       struct iwl_link_quality_cmd *link_cmd;
+
+       link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL);
+       if (!link_cmd) {
+               IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
+               return NULL;
+       }
+
+       iwl_sta_fill_lq(priv, ctx, sta_id, link_cmd);
 
        return link_cmd;
 }
index 580a4d702ff3c019ef7c84880ae080f272eae3eb..30bfdd36e42cbc1548745d908cec3867456bd88c 100644 (file)
@@ -595,8 +595,11 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
                               sizeof(struct iwl_addsta_cmd));
                        send_lq = false;
                        if (priv->stations[i].lq) {
-                               memcpy(&lq, priv->stations[i].lq,
-                                      sizeof(struct iwl_link_quality_cmd));
+                               if (priv->shrd->wowlan)
+                                       iwl_sta_fill_lq(priv, ctx, i, &lq);
+                               else
+                                       memcpy(&lq, priv->stations[i].lq,
+                                              sizeof(struct iwl_link_quality_cmd));
                                send_lq = true;
                        }
                        spin_unlock_irqrestore(&priv->shrd->sta_lock,
index 1bca0dabde8d1009309a3e662db95aebca3b3b8c..b86c8937f5da772bc44f65536ca2f9731d8eee7c 100644 (file)
@@ -58,6 +58,8 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
                    const u8 *addr, bool is_ap, struct ieee80211_sta *sta);
 
+void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
+                    u8 sta_id, struct iwl_link_quality_cmd *link_cmd);
 int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
                    struct iwl_link_quality_cmd *lq, u8 flags, bool init);
 void iwl_reprogram_ap_sta(struct iwl_priv *priv, struct iwl_rxon_context *ctx);