Merge tag 'mac80211-next-for-davem-2016-02-26' into next2
[linux-2.6-block.git] / drivers / net / wireless / intel / iwlwifi / mvm / d3.c
index 346376187ef849455ae1b60da0039cc2e48fd633..5214482a04030fc3ca0325891c7e9c8f9873b420 100644 (file)
@@ -251,16 +251,19 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
                return;
        case WLAN_CIPHER_SUITE_TKIP:
                if (sta) {
+                       u64 pn64;
+
                        tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc;
                        tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc;
 
                        rx_p1ks = data->tkip->rx_uni;
 
-                       ieee80211_get_key_tx_seq(key, &seq);
-                       tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16);
-                       tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32);
+                       pn64 = atomic64_read(&key->tx_pn);
+                       tkip_tx_sc->iv16 = cpu_to_le16(TKIP_PN_TO_IV16(pn64));
+                       tkip_tx_sc->iv32 = cpu_to_le32(TKIP_PN_TO_IV32(pn64));
 
-                       ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k);
+                       ieee80211_get_tkip_p1k_iv(key, TKIP_PN_TO_IV32(pn64),
+                                                 p1k);
                        iwl_mvm_convert_p1k(p1k, data->tkip->tx.p1k);
 
                        memcpy(data->tkip->mic_keys.tx,
@@ -1614,7 +1617,9 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw,
                case WLAN_CIPHER_SUITE_TKIP:
                        iwl_mvm_tkip_sc_to_seq(&sc->tkip.tsc, &seq);
                        iwl_mvm_set_tkip_rx_seq(sc->tkip.unicast_rsc, key);
-                       ieee80211_set_key_tx_seq(key, &seq);
+                       atomic64_set(&key->tx_pn,
+                                    (u64)seq.tkip.iv16 |
+                                    ((u64)seq.tkip.iv32 << 16));
                        break;
                }