Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
[cascardo/linux.git] / drivers / net / wireless / ath / ath9k / htc_drv_main.c
index c785129..ca78e33 100644 (file)
@@ -489,24 +489,20 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
                ista = (struct ath9k_htc_sta *) sta->drv_priv;
                memcpy(&tsta.macaddr, sta->addr, ETH_ALEN);
                memcpy(&tsta.bssid, common->curbssid, ETH_ALEN);
-               tsta.is_vif_sta = 0;
                ista->index = sta_idx;
+               tsta.is_vif_sta = 0;
+               maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
+                                sta->ht_cap.ampdu_factor);
+               tsta.maxampdu = cpu_to_be16(maxampdu);
        } else {
                memcpy(&tsta.macaddr, vif->addr, ETH_ALEN);
                tsta.is_vif_sta = 1;
+               tsta.maxampdu = cpu_to_be16(0xffff);
        }
 
        tsta.sta_index = sta_idx;
        tsta.vif_index = avp->index;
 
-       if (!sta) {
-               tsta.maxampdu = cpu_to_be16(0xffff);
-       } else {
-               maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
-                                sta->ht_cap.ampdu_factor);
-               tsta.maxampdu = cpu_to_be16(maxampdu);
-       }
-
        WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
        if (ret) {
                if (sta)
@@ -856,7 +852,9 @@ set_timer:
 /* mac80211 Callbacks */
 /**********************/
 
-static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+static void ath9k_htc_tx(struct ieee80211_hw *hw,
+                        struct ieee80211_tx_control *control,
+                        struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr;
        struct ath9k_htc_priv *priv = hw->priv;
@@ -883,7 +881,7 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
                goto fail_tx;
        }
 
-       ret = ath9k_htc_tx_start(priv, skb, slot, false);
+       ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false);
        if (ret != 0) {
                ath_dbg(common, XMIT, "Tx failed\n");
                goto clear_slot;
@@ -1331,6 +1329,34 @@ static int ath9k_htc_sta_remove(struct ieee80211_hw *hw,
        return ret;
 }
 
+static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw,
+                                   struct ieee80211_vif *vif,
+                                   struct ieee80211_sta *sta, u32 changed)
+{
+       struct ath9k_htc_priv *priv = hw->priv;
+       struct ath_common *common = ath9k_hw_common(priv->ah);
+       struct ath9k_htc_target_rate trate;
+
+       mutex_lock(&priv->mutex);
+       ath9k_htc_ps_wakeup(priv);
+
+       if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) {
+               memset(&trate, 0, sizeof(struct ath9k_htc_target_rate));
+               ath9k_htc_setup_rate(priv, sta, &trate);
+               if (!ath9k_htc_send_rate_cmd(priv, &trate))
+                       ath_dbg(common, CONFIG,
+                               "Supported rates for sta: %pM updated, rate caps: 0x%X\n",
+                               sta->addr, be32_to_cpu(trate.capflags));
+               else
+                       ath_dbg(common, CONFIG,
+                               "Unable to update supported rates for sta: %pM\n",
+                               sta->addr);
+       }
+
+       ath9k_htc_ps_restore(priv);
+       mutex_unlock(&priv->mutex);
+}
+
 static int ath9k_htc_conf_tx(struct ieee80211_hw *hw,
                             struct ieee80211_vif *vif, u16 queue,
                             const struct ieee80211_tx_queue_params *params)
@@ -1419,7 +1445,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
                                key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
                        if (priv->ah->sw_mgmt_crypto &&
                            key->cipher == WLAN_CIPHER_SUITE_CCMP)
-                               key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
+                               key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX;
                        ret = 0;
                }
                break;
@@ -1758,6 +1784,7 @@ struct ieee80211_ops ath9k_htc_ops = {
        .sta_add            = ath9k_htc_sta_add,
        .sta_remove         = ath9k_htc_sta_remove,
        .conf_tx            = ath9k_htc_conf_tx,
+       .sta_rc_update      = ath9k_htc_sta_rc_update,
        .bss_info_changed   = ath9k_htc_bss_info_changed,
        .set_key            = ath9k_htc_set_key,
        .get_tsf            = ath9k_htc_get_tsf,