| .. | .. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * GPL LICENSE SUMMARY |
|---|
| 7 | 7 | * |
|---|
| 8 | | - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
|---|
| 8 | + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. |
|---|
| 9 | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
|---|
| 10 | 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
|---|
| 11 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 12 | 11 | * |
|---|
| 13 | 12 | * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | 13 | * it under the terms of version 2 of the GNU General Public License as |
|---|
| .. | .. |
|---|
| 28 | 27 | * |
|---|
| 29 | 28 | * BSD LICENSE |
|---|
| 30 | 29 | * |
|---|
| 31 | | - * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
|---|
| 30 | + * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. |
|---|
| 32 | 31 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
|---|
| 33 | 32 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
|---|
| 34 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 35 | 33 | * All rights reserved. |
|---|
| 36 | 34 | * |
|---|
| 37 | 35 | * Redistribution and use in source and binary forms, with or without |
|---|
| .. | .. |
|---|
| 72 | 70 | #include "iwl-modparams.h" |
|---|
| 73 | 71 | #include "fw-api.h" |
|---|
| 74 | 72 | #include "mvm.h" |
|---|
| 73 | +#include "fw/img.h" |
|---|
| 75 | 74 | |
|---|
| 76 | 75 | void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, |
|---|
| 77 | 76 | struct ieee80211_vif *vif, |
|---|
| .. | .. |
|---|
| 80 | 79 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
|---|
| 81 | 80 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
|---|
| 82 | 81 | |
|---|
| 83 | | - if (iwlwifi_mod_params.swcrypto) |
|---|
| 84 | | - return; |
|---|
| 85 | | - |
|---|
| 86 | 82 | mutex_lock(&mvm->mutex); |
|---|
| 87 | 83 | |
|---|
| 88 | | - memcpy(mvmvif->rekey_data.kek, data->kek, NL80211_KEK_LEN); |
|---|
| 89 | | - memcpy(mvmvif->rekey_data.kck, data->kck, NL80211_KCK_LEN); |
|---|
| 84 | + mvmvif->rekey_data.kek_len = data->kek_len; |
|---|
| 85 | + mvmvif->rekey_data.kck_len = data->kck_len; |
|---|
| 86 | + memcpy(mvmvif->rekey_data.kek, data->kek, data->kek_len); |
|---|
| 87 | + memcpy(mvmvif->rekey_data.kck, data->kck, data->kck_len); |
|---|
| 88 | + mvmvif->rekey_data.akm = data->akm & 0xFF; |
|---|
| 90 | 89 | mvmvif->rekey_data.replay_ctr = |
|---|
| 91 | 90 | cpu_to_le64(be64_to_cpup((__be64 *)data->replay_ctr)); |
|---|
| 92 | 91 | mvmvif->rekey_data.valid = true; |
|---|
| .. | .. |
|---|
| 161 | 160 | struct wowlan_key_data { |
|---|
| 162 | 161 | struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; |
|---|
| 163 | 162 | struct iwl_wowlan_tkip_params_cmd *tkip; |
|---|
| 163 | + struct iwl_wowlan_kek_kck_material_cmd_v3 *kek_kck_cmd; |
|---|
| 164 | 164 | bool error, use_rsc_tsc, use_tkip, configure_keys; |
|---|
| 165 | 165 | int wep_key_idx; |
|---|
| 166 | 166 | }; |
|---|
| .. | .. |
|---|
| 237 | 237 | default: |
|---|
| 238 | 238 | data->error = true; |
|---|
| 239 | 239 | return; |
|---|
| 240 | + case WLAN_CIPHER_SUITE_BIP_GMAC_256: |
|---|
| 241 | + case WLAN_CIPHER_SUITE_BIP_GMAC_128: |
|---|
| 242 | + data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_GCMP); |
|---|
| 243 | + return; |
|---|
| 240 | 244 | case WLAN_CIPHER_SUITE_AES_CMAC: |
|---|
| 245 | + data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_CCM); |
|---|
| 241 | 246 | /* |
|---|
| 242 | 247 | * Ignore CMAC keys -- the WoWLAN firmware doesn't support them |
|---|
| 243 | 248 | * but we also shouldn't abort suspend due to that. It does have |
|---|
| .. | .. |
|---|
| 250 | 255 | if (sta) { |
|---|
| 251 | 256 | u64 pn64; |
|---|
| 252 | 257 | |
|---|
| 253 | | - tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; |
|---|
| 254 | | - tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; |
|---|
| 258 | + tkip_sc = |
|---|
| 259 | + data->rsc_tsc->params.all_tsc_rsc.tkip.unicast_rsc; |
|---|
| 260 | + tkip_tx_sc = |
|---|
| 261 | + &data->rsc_tsc->params.all_tsc_rsc.tkip.tsc; |
|---|
| 255 | 262 | |
|---|
| 256 | 263 | rx_p1ks = data->tkip->rx_uni; |
|---|
| 257 | 264 | |
|---|
| .. | .. |
|---|
| 270 | 277 | rx_mic_key = data->tkip->mic_keys.rx_unicast; |
|---|
| 271 | 278 | } else { |
|---|
| 272 | 279 | tkip_sc = |
|---|
| 273 | | - data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; |
|---|
| 280 | + data->rsc_tsc->params.all_tsc_rsc.tkip.multicast_rsc; |
|---|
| 274 | 281 | rx_p1ks = data->tkip->rx_multi; |
|---|
| 275 | 282 | rx_mic_key = data->tkip->mic_keys.rx_mcast; |
|---|
| 283 | + data->kek_kck_cmd->gtk_cipher = |
|---|
| 284 | + cpu_to_le32(STA_KEY_FLG_TKIP); |
|---|
| 276 | 285 | } |
|---|
| 277 | 286 | |
|---|
| 278 | 287 | /* |
|---|
| .. | .. |
|---|
| 304 | 313 | data->use_rsc_tsc = true; |
|---|
| 305 | 314 | break; |
|---|
| 306 | 315 | case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 316 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 317 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 307 | 318 | if (sta) { |
|---|
| 308 | 319 | u64 pn64; |
|---|
| 309 | 320 | |
|---|
| 310 | | - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; |
|---|
| 311 | | - aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; |
|---|
| 321 | + aes_sc = |
|---|
| 322 | + data->rsc_tsc->params.all_tsc_rsc.aes.unicast_rsc; |
|---|
| 323 | + aes_tx_sc = |
|---|
| 324 | + &data->rsc_tsc->params.all_tsc_rsc.aes.tsc; |
|---|
| 312 | 325 | |
|---|
| 313 | 326 | pn64 = atomic64_read(&key->tx_pn); |
|---|
| 314 | 327 | aes_tx_sc->pn = cpu_to_le64(pn64); |
|---|
| 315 | 328 | } else { |
|---|
| 316 | | - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; |
|---|
| 329 | + aes_sc = |
|---|
| 330 | + data->rsc_tsc->params.all_tsc_rsc.aes.multicast_rsc; |
|---|
| 331 | + data->kek_kck_cmd->gtk_cipher = |
|---|
| 332 | + key->cipher == WLAN_CIPHER_SUITE_CCMP ? |
|---|
| 333 | + cpu_to_le32(STA_KEY_FLG_CCM) : |
|---|
| 334 | + cpu_to_le32(STA_KEY_FLG_GCMP); |
|---|
| 317 | 335 | } |
|---|
| 318 | 336 | |
|---|
| 319 | 337 | /* |
|---|
| .. | .. |
|---|
| 326 | 344 | const u8 *pn; |
|---|
| 327 | 345 | |
|---|
| 328 | 346 | mvmsta = iwl_mvm_sta_from_mac80211(sta); |
|---|
| 329 | | - ptk_pn = rcu_dereference_protected( |
|---|
| 330 | | - mvmsta->ptk_pn[key->keyidx], |
|---|
| 331 | | - lockdep_is_held(&mvm->mutex)); |
|---|
| 332 | | - if (WARN_ON(!ptk_pn)) |
|---|
| 347 | + rcu_read_lock(); |
|---|
| 348 | + ptk_pn = rcu_dereference(mvmsta->ptk_pn[key->keyidx]); |
|---|
| 349 | + if (WARN_ON(!ptk_pn)) { |
|---|
| 350 | + rcu_read_unlock(); |
|---|
| 333 | 351 | break; |
|---|
| 352 | + } |
|---|
| 334 | 353 | |
|---|
| 335 | 354 | for (i = 0; i < IWL_MAX_TID_COUNT; i++) { |
|---|
| 336 | 355 | pn = iwl_mvm_find_max_pn(key, ptk_pn, &seq, i, |
|---|
| .. | .. |
|---|
| 342 | 361 | ((u64)pn[1] << 32) | |
|---|
| 343 | 362 | ((u64)pn[0] << 40)); |
|---|
| 344 | 363 | } |
|---|
| 364 | + |
|---|
| 365 | + rcu_read_unlock(); |
|---|
| 345 | 366 | } else { |
|---|
| 346 | 367 | for (i = 0; i < IWL_NUM_RSC; i++) { |
|---|
| 347 | 368 | u8 *pn = seq.ccmp.pn; |
|---|
| .. | .. |
|---|
| 358 | 379 | data->use_rsc_tsc = true; |
|---|
| 359 | 380 | break; |
|---|
| 360 | 381 | } |
|---|
| 382 | + |
|---|
| 383 | + IWL_DEBUG_WOWLAN(mvm, "GTK cipher %d\n", data->kek_kck_cmd->gtk_cipher); |
|---|
| 361 | 384 | |
|---|
| 362 | 385 | if (data->configure_keys) { |
|---|
| 363 | 386 | mutex_lock(&mvm->mutex); |
|---|
| .. | .. |
|---|
| 385 | 408 | } |
|---|
| 386 | 409 | } |
|---|
| 387 | 410 | |
|---|
| 388 | | -static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, |
|---|
| 389 | | - struct cfg80211_wowlan *wowlan) |
|---|
| 411 | +static int iwl_mvm_send_patterns_v1(struct iwl_mvm *mvm, |
|---|
| 412 | + struct cfg80211_wowlan *wowlan) |
|---|
| 390 | 413 | { |
|---|
| 391 | | - struct iwl_wowlan_patterns_cmd *pattern_cmd; |
|---|
| 414 | + struct iwl_wowlan_patterns_cmd_v1 *pattern_cmd; |
|---|
| 392 | 415 | struct iwl_host_cmd cmd = { |
|---|
| 393 | 416 | .id = WOWLAN_PATTERNS, |
|---|
| 394 | 417 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
|---|
| .. | .. |
|---|
| 398 | 421 | if (!wowlan->n_patterns) |
|---|
| 399 | 422 | return 0; |
|---|
| 400 | 423 | |
|---|
| 401 | | - cmd.len[0] = sizeof(*pattern_cmd) + |
|---|
| 402 | | - wowlan->n_patterns * sizeof(struct iwl_wowlan_pattern); |
|---|
| 424 | + cmd.len[0] = struct_size(pattern_cmd, patterns, wowlan->n_patterns); |
|---|
| 403 | 425 | |
|---|
| 404 | 426 | pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); |
|---|
| 405 | 427 | if (!pattern_cmd) |
|---|
| .. | .. |
|---|
| 426 | 448 | return err; |
|---|
| 427 | 449 | } |
|---|
| 428 | 450 | |
|---|
| 451 | +static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, |
|---|
| 452 | + struct cfg80211_wowlan *wowlan) |
|---|
| 453 | +{ |
|---|
| 454 | + struct iwl_wowlan_patterns_cmd *pattern_cmd; |
|---|
| 455 | + struct iwl_host_cmd cmd = { |
|---|
| 456 | + .id = WOWLAN_PATTERNS, |
|---|
| 457 | + .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
|---|
| 458 | + }; |
|---|
| 459 | + int i, err; |
|---|
| 460 | + |
|---|
| 461 | + if (!wowlan->n_patterns) |
|---|
| 462 | + return 0; |
|---|
| 463 | + |
|---|
| 464 | + cmd.len[0] = sizeof(*pattern_cmd) + |
|---|
| 465 | + wowlan->n_patterns * sizeof(struct iwl_wowlan_pattern_v2); |
|---|
| 466 | + |
|---|
| 467 | + pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); |
|---|
| 468 | + if (!pattern_cmd) |
|---|
| 469 | + return -ENOMEM; |
|---|
| 470 | + |
|---|
| 471 | + pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); |
|---|
| 472 | + |
|---|
| 473 | + for (i = 0; i < wowlan->n_patterns; i++) { |
|---|
| 474 | + int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); |
|---|
| 475 | + |
|---|
| 476 | + pattern_cmd->patterns[i].pattern_type = |
|---|
| 477 | + WOWLAN_PATTERN_TYPE_BITMASK; |
|---|
| 478 | + |
|---|
| 479 | + memcpy(&pattern_cmd->patterns[i].u.bitmask.mask, |
|---|
| 480 | + wowlan->patterns[i].mask, mask_len); |
|---|
| 481 | + memcpy(&pattern_cmd->patterns[i].u.bitmask.pattern, |
|---|
| 482 | + wowlan->patterns[i].pattern, |
|---|
| 483 | + wowlan->patterns[i].pattern_len); |
|---|
| 484 | + pattern_cmd->patterns[i].u.bitmask.mask_size = mask_len; |
|---|
| 485 | + pattern_cmd->patterns[i].u.bitmask.pattern_size = |
|---|
| 486 | + wowlan->patterns[i].pattern_len; |
|---|
| 487 | + } |
|---|
| 488 | + |
|---|
| 489 | + cmd.data[0] = pattern_cmd; |
|---|
| 490 | + err = iwl_mvm_send_cmd(mvm, &cmd); |
|---|
| 491 | + kfree(pattern_cmd); |
|---|
| 492 | + return err; |
|---|
| 493 | +} |
|---|
| 494 | + |
|---|
| 429 | 495 | static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
|---|
| 430 | 496 | struct ieee80211_sta *ap_sta) |
|---|
| 431 | 497 | { |
|---|
| .. | .. |
|---|
| 434 | 500 | u8 chains_static, chains_dynamic; |
|---|
| 435 | 501 | struct cfg80211_chan_def chandef; |
|---|
| 436 | 502 | int ret, i; |
|---|
| 437 | | - struct iwl_binding_cmd binding_cmd = {}; |
|---|
| 503 | + struct iwl_binding_cmd_v1 binding_cmd = {}; |
|---|
| 438 | 504 | struct iwl_time_quota_cmd quota_cmd = {}; |
|---|
| 439 | 505 | struct iwl_time_quota_data *quota; |
|---|
| 440 | 506 | u32 status; |
|---|
| 441 | | - int size; |
|---|
| 442 | 507 | |
|---|
| 443 | | - if (fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 444 | | - IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT)) { |
|---|
| 445 | | - size = sizeof(binding_cmd); |
|---|
| 446 | | - if (mvmvif->phy_ctxt->channel->band == NL80211_BAND_2GHZ || |
|---|
| 447 | | - !iwl_mvm_is_cdb_supported(mvm)) |
|---|
| 448 | | - binding_cmd.lmac_id = cpu_to_le32(IWL_LMAC_24G_INDEX); |
|---|
| 449 | | - else |
|---|
| 450 | | - binding_cmd.lmac_id = cpu_to_le32(IWL_LMAC_5G_INDEX); |
|---|
| 451 | | - } else { |
|---|
| 452 | | - size = IWL_BINDING_CMD_SIZE_V1; |
|---|
| 453 | | - } |
|---|
| 508 | + if (WARN_ON_ONCE(iwl_mvm_is_cdb_supported(mvm))) |
|---|
| 509 | + return -EINVAL; |
|---|
| 454 | 510 | |
|---|
| 455 | 511 | /* add back the PHY */ |
|---|
| 456 | 512 | if (WARN_ON(!mvmvif->phy_ctxt)) |
|---|
| .. | .. |
|---|
| 497 | 553 | |
|---|
| 498 | 554 | status = 0; |
|---|
| 499 | 555 | ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, |
|---|
| 500 | | - size, &binding_cmd, &status); |
|---|
| 556 | + IWL_BINDING_CMD_SIZE_V1, &binding_cmd, |
|---|
| 557 | + &status); |
|---|
| 501 | 558 | if (ret) { |
|---|
| 502 | 559 | IWL_ERR(mvm, "Failed to add binding: %d\n", ret); |
|---|
| 503 | 560 | return ret; |
|---|
| .. | .. |
|---|
| 701 | 758 | return 0; |
|---|
| 702 | 759 | } |
|---|
| 703 | 760 | |
|---|
| 704 | | -static void |
|---|
| 705 | | -iwl_mvm_iter_d0i3_ap_keys(struct iwl_mvm *mvm, |
|---|
| 706 | | - struct ieee80211_vif *vif, |
|---|
| 707 | | - void (*iter)(struct ieee80211_hw *hw, |
|---|
| 708 | | - struct ieee80211_vif *vif, |
|---|
| 709 | | - struct ieee80211_sta *sta, |
|---|
| 710 | | - struct ieee80211_key_conf *key, |
|---|
| 711 | | - void *data), |
|---|
| 712 | | - void *data) |
|---|
| 761 | +static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, |
|---|
| 762 | + struct ieee80211_vif *vif, |
|---|
| 763 | + u32 cmd_flags) |
|---|
| 713 | 764 | { |
|---|
| 714 | | - struct ieee80211_sta *ap_sta; |
|---|
| 715 | | - |
|---|
| 716 | | - rcu_read_lock(); |
|---|
| 717 | | - |
|---|
| 718 | | - ap_sta = rcu_dereference(mvm->fw_id_to_mac_id[mvm->d0i3_ap_sta_id]); |
|---|
| 719 | | - if (IS_ERR_OR_NULL(ap_sta)) |
|---|
| 720 | | - goto out; |
|---|
| 721 | | - |
|---|
| 722 | | - ieee80211_iter_keys_rcu(mvm->hw, vif, iter, data); |
|---|
| 723 | | -out: |
|---|
| 724 | | - rcu_read_unlock(); |
|---|
| 725 | | -} |
|---|
| 726 | | - |
|---|
| 727 | | -int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, |
|---|
| 728 | | - struct ieee80211_vif *vif, |
|---|
| 729 | | - bool d0i3, |
|---|
| 730 | | - u32 cmd_flags) |
|---|
| 731 | | -{ |
|---|
| 732 | | - struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {}; |
|---|
| 765 | + struct iwl_wowlan_kek_kck_material_cmd_v3 kek_kck_cmd = {}; |
|---|
| 733 | 766 | struct iwl_wowlan_tkip_params_cmd tkip_cmd = {}; |
|---|
| 734 | 767 | bool unified = fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 735 | 768 | IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); |
|---|
| 736 | 769 | struct wowlan_key_data key_data = { |
|---|
| 737 | | - .configure_keys = !d0i3 && !unified, |
|---|
| 770 | + .configure_keys = !unified, |
|---|
| 738 | 771 | .use_rsc_tsc = false, |
|---|
| 739 | 772 | .tkip = &tkip_cmd, |
|---|
| 740 | 773 | .use_tkip = false, |
|---|
| 774 | + .kek_kck_cmd = &kek_kck_cmd, |
|---|
| 741 | 775 | }; |
|---|
| 742 | 776 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
|---|
| 743 | 777 | int ret; |
|---|
| 778 | + u8 cmd_ver; |
|---|
| 779 | + size_t cmd_size; |
|---|
| 744 | 780 | |
|---|
| 745 | 781 | key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); |
|---|
| 746 | 782 | if (!key_data.rsc_tsc) |
|---|
| .. | .. |
|---|
| 750 | 786 | * if we have to configure keys, call ieee80211_iter_keys(), |
|---|
| 751 | 787 | * as we need non-atomic context in order to take the |
|---|
| 752 | 788 | * required locks. |
|---|
| 753 | | - * for the d0i3 we can't use ieee80211_iter_keys(), as |
|---|
| 754 | | - * taking (almost) any mutex might result in deadlock. |
|---|
| 755 | 789 | */ |
|---|
| 756 | | - if (!d0i3) { |
|---|
| 757 | | - /* |
|---|
| 758 | | - * Note that currently we don't propagate cmd_flags |
|---|
| 759 | | - * to the iterator. In case of key_data.configure_keys, |
|---|
| 760 | | - * all the configured commands are SYNC, and |
|---|
| 761 | | - * iwl_mvm_wowlan_program_keys() will take care of |
|---|
| 762 | | - * locking/unlocking mvm->mutex. |
|---|
| 763 | | - */ |
|---|
| 764 | | - ieee80211_iter_keys(mvm->hw, vif, |
|---|
| 765 | | - iwl_mvm_wowlan_program_keys, |
|---|
| 766 | | - &key_data); |
|---|
| 767 | | - } else { |
|---|
| 768 | | - iwl_mvm_iter_d0i3_ap_keys(mvm, vif, |
|---|
| 769 | | - iwl_mvm_wowlan_program_keys, |
|---|
| 770 | | - &key_data); |
|---|
| 771 | | - } |
|---|
| 790 | + /* |
|---|
| 791 | + * Note that currently we don't propagate cmd_flags |
|---|
| 792 | + * to the iterator. In case of key_data.configure_keys, |
|---|
| 793 | + * all the configured commands are SYNC, and |
|---|
| 794 | + * iwl_mvm_wowlan_program_keys() will take care of |
|---|
| 795 | + * locking/unlocking mvm->mutex. |
|---|
| 796 | + */ |
|---|
| 797 | + ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_program_keys, |
|---|
| 798 | + &key_data); |
|---|
| 772 | 799 | |
|---|
| 773 | 800 | if (key_data.error) { |
|---|
| 774 | 801 | ret = -EIO; |
|---|
| .. | .. |
|---|
| 776 | 803 | } |
|---|
| 777 | 804 | |
|---|
| 778 | 805 | if (key_data.use_rsc_tsc) { |
|---|
| 779 | | - ret = iwl_mvm_send_cmd_pdu(mvm, |
|---|
| 780 | | - WOWLAN_TSC_RSC_PARAM, cmd_flags, |
|---|
| 781 | | - sizeof(*key_data.rsc_tsc), |
|---|
| 806 | + int ver = iwl_fw_lookup_cmd_ver(mvm->fw, LONG_GROUP, |
|---|
| 807 | + WOWLAN_TSC_RSC_PARAM, |
|---|
| 808 | + IWL_FW_CMD_VER_UNKNOWN); |
|---|
| 809 | + int size; |
|---|
| 810 | + |
|---|
| 811 | + if (ver == 4) { |
|---|
| 812 | + size = sizeof(*key_data.rsc_tsc); |
|---|
| 813 | + key_data.rsc_tsc->sta_id = |
|---|
| 814 | + cpu_to_le32(mvmvif->ap_sta_id); |
|---|
| 815 | + |
|---|
| 816 | + } else if (ver == 2 || ver == IWL_FW_CMD_VER_UNKNOWN) { |
|---|
| 817 | + size = sizeof(key_data.rsc_tsc->params); |
|---|
| 818 | + } else { |
|---|
| 819 | + ret = 0; |
|---|
| 820 | + WARN_ON_ONCE(1); |
|---|
| 821 | + goto out; |
|---|
| 822 | + } |
|---|
| 823 | + |
|---|
| 824 | + ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_TSC_RSC_PARAM, |
|---|
| 825 | + cmd_flags, |
|---|
| 826 | + size, |
|---|
| 782 | 827 | key_data.rsc_tsc); |
|---|
| 828 | + |
|---|
| 783 | 829 | if (ret) |
|---|
| 784 | 830 | goto out; |
|---|
| 785 | 831 | } |
|---|
| .. | .. |
|---|
| 787 | 833 | if (key_data.use_tkip && |
|---|
| 788 | 834 | !fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 789 | 835 | IWL_UCODE_TLV_API_TKIP_MIC_KEYS)) { |
|---|
| 836 | + int ver = iwl_fw_lookup_cmd_ver(mvm->fw, LONG_GROUP, |
|---|
| 837 | + WOWLAN_TKIP_PARAM, |
|---|
| 838 | + IWL_FW_CMD_VER_UNKNOWN); |
|---|
| 839 | + int size; |
|---|
| 840 | + |
|---|
| 841 | + if (ver == 2) { |
|---|
| 842 | + size = sizeof(tkip_cmd); |
|---|
| 843 | + key_data.tkip->sta_id = |
|---|
| 844 | + cpu_to_le32(mvmvif->ap_sta_id); |
|---|
| 845 | + } else if (ver == 1 || ver == IWL_FW_CMD_VER_UNKNOWN) { |
|---|
| 846 | + size = sizeof(struct iwl_wowlan_tkip_params_cmd_ver_1); |
|---|
| 847 | + } else { |
|---|
| 848 | + ret = -EINVAL; |
|---|
| 849 | + WARN_ON_ONCE(1); |
|---|
| 850 | + goto out; |
|---|
| 851 | + } |
|---|
| 852 | + |
|---|
| 853 | + /* send relevant data according to CMD version */ |
|---|
| 790 | 854 | ret = iwl_mvm_send_cmd_pdu(mvm, |
|---|
| 791 | 855 | WOWLAN_TKIP_PARAM, |
|---|
| 792 | | - cmd_flags, sizeof(tkip_cmd), |
|---|
| 856 | + cmd_flags, size, |
|---|
| 793 | 857 | &tkip_cmd); |
|---|
| 794 | 858 | if (ret) |
|---|
| 795 | 859 | goto out; |
|---|
| 796 | 860 | } |
|---|
| 797 | 861 | |
|---|
| 798 | 862 | /* configure rekey data only if offloaded rekey is supported (d3) */ |
|---|
| 799 | | - if (mvmvif->rekey_data.valid && !d0i3) { |
|---|
| 800 | | - memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); |
|---|
| 863 | + if (mvmvif->rekey_data.valid) { |
|---|
| 864 | + cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, |
|---|
| 865 | + IWL_ALWAYS_LONG_GROUP, |
|---|
| 866 | + WOWLAN_KEK_KCK_MATERIAL, |
|---|
| 867 | + IWL_FW_CMD_VER_UNKNOWN); |
|---|
| 868 | + if (WARN_ON(cmd_ver != 2 && cmd_ver != 3 && |
|---|
| 869 | + cmd_ver != IWL_FW_CMD_VER_UNKNOWN)) |
|---|
| 870 | + return -EINVAL; |
|---|
| 871 | + if (cmd_ver == 3) |
|---|
| 872 | + cmd_size = sizeof(struct iwl_wowlan_kek_kck_material_cmd_v3); |
|---|
| 873 | + else |
|---|
| 874 | + cmd_size = sizeof(struct iwl_wowlan_kek_kck_material_cmd_v2); |
|---|
| 875 | + |
|---|
| 801 | 876 | memcpy(kek_kck_cmd.kck, mvmvif->rekey_data.kck, |
|---|
| 802 | | - NL80211_KCK_LEN); |
|---|
| 803 | | - kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); |
|---|
| 877 | + mvmvif->rekey_data.kck_len); |
|---|
| 878 | + kek_kck_cmd.kck_len = cpu_to_le16(mvmvif->rekey_data.kck_len); |
|---|
| 804 | 879 | memcpy(kek_kck_cmd.kek, mvmvif->rekey_data.kek, |
|---|
| 805 | | - NL80211_KEK_LEN); |
|---|
| 806 | | - kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); |
|---|
| 880 | + mvmvif->rekey_data.kek_len); |
|---|
| 881 | + kek_kck_cmd.kek_len = cpu_to_le16(mvmvif->rekey_data.kek_len); |
|---|
| 807 | 882 | kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; |
|---|
| 883 | + kek_kck_cmd.akm = cpu_to_le32(mvmvif->rekey_data.akm); |
|---|
| 884 | + |
|---|
| 885 | + IWL_DEBUG_WOWLAN(mvm, "setting akm %d\n", |
|---|
| 886 | + mvmvif->rekey_data.akm); |
|---|
| 808 | 887 | |
|---|
| 809 | 888 | ret = iwl_mvm_send_cmd_pdu(mvm, |
|---|
| 810 | 889 | WOWLAN_KEK_KCK_MATERIAL, cmd_flags, |
|---|
| 811 | | - sizeof(kek_kck_cmd), |
|---|
| 890 | + cmd_size, |
|---|
| 812 | 891 | &kek_kck_cmd); |
|---|
| 813 | 892 | if (ret) |
|---|
| 814 | 893 | goto out; |
|---|
| .. | .. |
|---|
| 830 | 909 | bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, |
|---|
| 831 | 910 | IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); |
|---|
| 832 | 911 | |
|---|
| 912 | + mvm->offload_tid = wowlan_config_cmd->offloading_tid; |
|---|
| 913 | + |
|---|
| 833 | 914 | if (!unified_image) { |
|---|
| 834 | 915 | ret = iwl_mvm_switch_to_d3(mvm); |
|---|
| 835 | 916 | if (ret) |
|---|
| .. | .. |
|---|
| 840 | 921 | return ret; |
|---|
| 841 | 922 | } |
|---|
| 842 | 923 | |
|---|
| 843 | | - if (!iwlwifi_mod_params.swcrypto) { |
|---|
| 844 | | - /* |
|---|
| 845 | | - * This needs to be unlocked due to lock ordering |
|---|
| 846 | | - * constraints. Since we're in the suspend path |
|---|
| 847 | | - * that isn't really a problem though. |
|---|
| 848 | | - */ |
|---|
| 849 | | - mutex_unlock(&mvm->mutex); |
|---|
| 850 | | - ret = iwl_mvm_wowlan_config_key_params(mvm, vif, false, |
|---|
| 851 | | - CMD_ASYNC); |
|---|
| 852 | | - mutex_lock(&mvm->mutex); |
|---|
| 853 | | - if (ret) |
|---|
| 854 | | - return ret; |
|---|
| 855 | | - } |
|---|
| 924 | + /* |
|---|
| 925 | + * This needs to be unlocked due to lock ordering |
|---|
| 926 | + * constraints. Since we're in the suspend path |
|---|
| 927 | + * that isn't really a problem though. |
|---|
| 928 | + */ |
|---|
| 929 | + mutex_unlock(&mvm->mutex); |
|---|
| 930 | + ret = iwl_mvm_wowlan_config_key_params(mvm, vif, CMD_ASYNC); |
|---|
| 931 | + mutex_lock(&mvm->mutex); |
|---|
| 932 | + if (ret) |
|---|
| 933 | + return ret; |
|---|
| 856 | 934 | |
|---|
| 857 | 935 | ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, |
|---|
| 858 | 936 | sizeof(*wowlan_config_cmd), |
|---|
| .. | .. |
|---|
| 860 | 938 | if (ret) |
|---|
| 861 | 939 | return ret; |
|---|
| 862 | 940 | |
|---|
| 863 | | - ret = iwl_mvm_send_patterns(mvm, wowlan); |
|---|
| 941 | + if (fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 942 | + IWL_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE)) |
|---|
| 943 | + ret = iwl_mvm_send_patterns(mvm, wowlan); |
|---|
| 944 | + else |
|---|
| 945 | + ret = iwl_mvm_send_patterns_v1(mvm, wowlan); |
|---|
| 864 | 946 | if (ret) |
|---|
| 865 | 947 | return ret; |
|---|
| 866 | 948 | |
|---|
| .. | .. |
|---|
| 897 | 979 | if (wowlan->rfkill_release) |
|---|
| 898 | 980 | wowlan_config_cmd.wakeup_filter |= |
|---|
| 899 | 981 | cpu_to_le32(IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT); |
|---|
| 982 | + |
|---|
| 983 | + wowlan_config_cmd.sta_id = mvm->aux_sta.sta_id; |
|---|
| 900 | 984 | |
|---|
| 901 | 985 | ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, |
|---|
| 902 | 986 | sizeof(wowlan_config_cmd), |
|---|
| .. | .. |
|---|
| 981 | 1065 | |
|---|
| 982 | 1066 | mutex_lock(&mvm->mutex); |
|---|
| 983 | 1067 | |
|---|
| 1068 | + set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); |
|---|
| 1069 | + |
|---|
| 984 | 1070 | vif = iwl_mvm_get_bss_vif(mvm); |
|---|
| 985 | 1071 | if (IS_ERR_OR_NULL(vif)) { |
|---|
| 986 | 1072 | ret = 1; |
|---|
| .. | .. |
|---|
| 1004 | 1090 | mvm->net_detect = true; |
|---|
| 1005 | 1091 | } else { |
|---|
| 1006 | 1092 | struct iwl_wowlan_config_cmd wowlan_config_cmd = {}; |
|---|
| 1093 | + |
|---|
| 1094 | + wowlan_config_cmd.sta_id = mvmvif->ap_sta_id; |
|---|
| 1007 | 1095 | |
|---|
| 1008 | 1096 | ap_sta = rcu_dereference_protected( |
|---|
| 1009 | 1097 | mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], |
|---|
| .. | .. |
|---|
| 1040 | 1128 | #endif |
|---|
| 1041 | 1129 | |
|---|
| 1042 | 1130 | /* |
|---|
| 1043 | | - * TODO: this is needed because the firmware is not stopping |
|---|
| 1044 | | - * the recording automatically before entering D3. This can |
|---|
| 1045 | | - * be removed once the FW starts doing that. |
|---|
| 1131 | + * Prior to 9000 device family the driver needs to stop the dbg |
|---|
| 1132 | + * recording before entering D3. In later devices the FW stops the |
|---|
| 1133 | + * recording automatically. |
|---|
| 1046 | 1134 | */ |
|---|
| 1047 | | - iwl_fw_dbg_stop_recording(&mvm->fwrt); |
|---|
| 1135 | + if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_9000) |
|---|
| 1136 | + iwl_fw_dbg_stop_restart_recording(&mvm->fwrt, NULL, true); |
|---|
| 1048 | 1137 | |
|---|
| 1049 | 1138 | /* must be last -- this switches firmware state */ |
|---|
| 1050 | 1139 | ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); |
|---|
| .. | .. |
|---|
| 1061 | 1150 | |
|---|
| 1062 | 1151 | clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); |
|---|
| 1063 | 1152 | |
|---|
| 1064 | | - iwl_trans_d3_suspend(mvm->trans, test, !unified_image); |
|---|
| 1153 | + ret = iwl_trans_d3_suspend(mvm->trans, test, !unified_image); |
|---|
| 1065 | 1154 | out: |
|---|
| 1066 | 1155 | if (ret < 0) { |
|---|
| 1067 | 1156 | iwl_mvm_free_nd(mvm); |
|---|
| 1068 | 1157 | |
|---|
| 1069 | 1158 | if (!unified_image) { |
|---|
| 1070 | | - iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); |
|---|
| 1071 | 1159 | if (mvm->fw_restart > 0) { |
|---|
| 1072 | 1160 | mvm->fw_restart--; |
|---|
| 1073 | 1161 | ieee80211_restart_hw(mvm->hw); |
|---|
| 1074 | 1162 | } |
|---|
| 1075 | 1163 | } |
|---|
| 1164 | + |
|---|
| 1165 | + clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); |
|---|
| 1076 | 1166 | } |
|---|
| 1077 | 1167 | out_noreset: |
|---|
| 1078 | 1168 | mutex_unlock(&mvm->mutex); |
|---|
| 1079 | 1169 | |
|---|
| 1080 | | - return ret; |
|---|
| 1081 | | -} |
|---|
| 1082 | | - |
|---|
| 1083 | | -static int iwl_mvm_enter_d0i3_sync(struct iwl_mvm *mvm) |
|---|
| 1084 | | -{ |
|---|
| 1085 | | - struct iwl_notification_wait wait_d3; |
|---|
| 1086 | | - static const u16 d3_notif[] = { D3_CONFIG_CMD }; |
|---|
| 1087 | | - int ret; |
|---|
| 1088 | | - |
|---|
| 1089 | | - iwl_init_notification_wait(&mvm->notif_wait, &wait_d3, |
|---|
| 1090 | | - d3_notif, ARRAY_SIZE(d3_notif), |
|---|
| 1091 | | - NULL, NULL); |
|---|
| 1092 | | - |
|---|
| 1093 | | - ret = iwl_mvm_enter_d0i3(mvm->hw->priv); |
|---|
| 1094 | | - if (ret) |
|---|
| 1095 | | - goto remove_notif; |
|---|
| 1096 | | - |
|---|
| 1097 | | - ret = iwl_wait_notification(&mvm->notif_wait, &wait_d3, HZ); |
|---|
| 1098 | | - WARN_ON_ONCE(ret); |
|---|
| 1099 | | - return ret; |
|---|
| 1100 | | - |
|---|
| 1101 | | -remove_notif: |
|---|
| 1102 | | - iwl_remove_notification(&mvm->notif_wait, &wait_d3); |
|---|
| 1103 | 1170 | return ret; |
|---|
| 1104 | 1171 | } |
|---|
| 1105 | 1172 | |
|---|
| .. | .. |
|---|
| 1109 | 1176 | struct iwl_trans *trans = mvm->trans; |
|---|
| 1110 | 1177 | int ret; |
|---|
| 1111 | 1178 | |
|---|
| 1112 | | - /* make sure the d0i3 exit work is not pending */ |
|---|
| 1113 | | - flush_work(&mvm->d0i3_exit_work); |
|---|
| 1114 | 1179 | iwl_mvm_pause_tcm(mvm, true); |
|---|
| 1115 | 1180 | |
|---|
| 1116 | 1181 | iwl_fw_runtime_suspend(&mvm->fwrt); |
|---|
| .. | .. |
|---|
| 1118 | 1183 | ret = iwl_trans_suspend(trans); |
|---|
| 1119 | 1184 | if (ret) |
|---|
| 1120 | 1185 | return ret; |
|---|
| 1121 | | - |
|---|
| 1122 | | - if (wowlan->any) { |
|---|
| 1123 | | - trans->system_pm_mode = IWL_PLAT_PM_MODE_D0I3; |
|---|
| 1124 | | - |
|---|
| 1125 | | - if (iwl_mvm_enter_d0i3_on_suspend(mvm)) { |
|---|
| 1126 | | - ret = iwl_mvm_enter_d0i3_sync(mvm); |
|---|
| 1127 | | - |
|---|
| 1128 | | - if (ret) |
|---|
| 1129 | | - return ret; |
|---|
| 1130 | | - } |
|---|
| 1131 | | - |
|---|
| 1132 | | - mutex_lock(&mvm->d0i3_suspend_mutex); |
|---|
| 1133 | | - __set_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags); |
|---|
| 1134 | | - mutex_unlock(&mvm->d0i3_suspend_mutex); |
|---|
| 1135 | | - |
|---|
| 1136 | | - iwl_trans_d3_suspend(trans, false, false); |
|---|
| 1137 | | - |
|---|
| 1138 | | - return 0; |
|---|
| 1139 | | - } |
|---|
| 1140 | 1186 | |
|---|
| 1141 | 1187 | trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; |
|---|
| 1142 | 1188 | |
|---|
| .. | .. |
|---|
| 1320 | 1366 | |
|---|
| 1321 | 1367 | mvmsta = iwl_mvm_sta_from_mac80211(sta); |
|---|
| 1322 | 1368 | |
|---|
| 1323 | | - ptk_pn = rcu_dereference_protected(mvmsta->ptk_pn[key->keyidx], |
|---|
| 1324 | | - lockdep_is_held(&mvm->mutex)); |
|---|
| 1325 | | - if (WARN_ON(!ptk_pn)) |
|---|
| 1369 | + rcu_read_lock(); |
|---|
| 1370 | + ptk_pn = rcu_dereference(mvmsta->ptk_pn[key->keyidx]); |
|---|
| 1371 | + if (WARN_ON(!ptk_pn)) { |
|---|
| 1372 | + rcu_read_unlock(); |
|---|
| 1326 | 1373 | return; |
|---|
| 1374 | + } |
|---|
| 1327 | 1375 | |
|---|
| 1328 | 1376 | for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) { |
|---|
| 1329 | 1377 | struct ieee80211_key_seq seq = {}; |
|---|
| .. | .. |
|---|
| 1335 | 1383 | memcpy(ptk_pn->q[i].pn[tid], |
|---|
| 1336 | 1384 | seq.ccmp.pn, IEEE80211_CCMP_PN_LEN); |
|---|
| 1337 | 1385 | } |
|---|
| 1386 | + rcu_read_unlock(); |
|---|
| 1338 | 1387 | } else { |
|---|
| 1339 | 1388 | for (tid = 0; tid < IWL_NUM_RSC; tid++) { |
|---|
| 1340 | 1389 | struct ieee80211_key_seq seq = {}; |
|---|
| .. | .. |
|---|
| 1364 | 1413 | struct ieee80211_key_conf *key, |
|---|
| 1365 | 1414 | struct iwl_wowlan_status *status) |
|---|
| 1366 | 1415 | { |
|---|
| 1367 | | - union iwl_all_tsc_rsc *rsc = &status->gtk.rsc.all_tsc_rsc; |
|---|
| 1416 | + union iwl_all_tsc_rsc *rsc = &status->gtk[0].rsc.all_tsc_rsc; |
|---|
| 1368 | 1417 | |
|---|
| 1369 | 1418 | switch (key->cipher) { |
|---|
| 1370 | 1419 | case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 1420 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 1421 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 1371 | 1422 | iwl_mvm_set_aes_rx_seq(mvm, rsc->aes.multicast_rsc, NULL, key); |
|---|
| 1372 | 1423 | break; |
|---|
| 1373 | 1424 | case WLAN_CIPHER_SUITE_TKIP: |
|---|
| .. | .. |
|---|
| 1404 | 1455 | /* ignore WEP completely, nothing to do */ |
|---|
| 1405 | 1456 | return; |
|---|
| 1406 | 1457 | case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 1458 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 1459 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 1407 | 1460 | case WLAN_CIPHER_SUITE_TKIP: |
|---|
| 1408 | 1461 | /* we support these */ |
|---|
| 1409 | 1462 | break; |
|---|
| .. | .. |
|---|
| 1421 | 1474 | */ |
|---|
| 1422 | 1475 | if (sta) { |
|---|
| 1423 | 1476 | struct ieee80211_key_seq seq = {}; |
|---|
| 1424 | | - union iwl_all_tsc_rsc *sc = &data->status->gtk.rsc.all_tsc_rsc; |
|---|
| 1477 | + union iwl_all_tsc_rsc *sc = |
|---|
| 1478 | + &data->status->gtk[0].rsc.all_tsc_rsc; |
|---|
| 1425 | 1479 | |
|---|
| 1426 | 1480 | if (data->find_phase) |
|---|
| 1427 | 1481 | return; |
|---|
| 1428 | 1482 | |
|---|
| 1429 | 1483 | switch (key->cipher) { |
|---|
| 1430 | 1484 | case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 1485 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 1486 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 1431 | 1487 | iwl_mvm_set_aes_rx_seq(data->mvm, sc->aes.unicast_rsc, |
|---|
| 1432 | 1488 | sta, key); |
|---|
| 1433 | 1489 | atomic64_set(&key->tx_pn, le64_to_cpu(sc->aes.tsc.pn)); |
|---|
| .. | .. |
|---|
| 1496 | 1552 | ieee80211_iter_keys(mvm->hw, vif, |
|---|
| 1497 | 1553 | iwl_mvm_d3_update_keys, >kdata); |
|---|
| 1498 | 1554 | |
|---|
| 1555 | + IWL_DEBUG_WOWLAN(mvm, "num of GTK rekeying %d\n", |
|---|
| 1556 | + le32_to_cpu(status->num_of_gtk_rekeys)); |
|---|
| 1499 | 1557 | if (status->num_of_gtk_rekeys) { |
|---|
| 1500 | 1558 | struct ieee80211_key_conf *key; |
|---|
| 1501 | 1559 | struct { |
|---|
| .. | .. |
|---|
| 1503 | 1561 | u8 key[32]; |
|---|
| 1504 | 1562 | } conf = { |
|---|
| 1505 | 1563 | .conf.cipher = gtkdata.cipher, |
|---|
| 1506 | | - .conf.keyidx = status->gtk.key_index, |
|---|
| 1564 | + .conf.keyidx = |
|---|
| 1565 | + iwlmvm_wowlan_gtk_idx(&status->gtk[0]), |
|---|
| 1507 | 1566 | }; |
|---|
| 1567 | + __be64 replay_ctr; |
|---|
| 1508 | 1568 | |
|---|
| 1569 | + IWL_DEBUG_WOWLAN(mvm, |
|---|
| 1570 | + "Received from FW GTK cipher %d, key index %d\n", |
|---|
| 1571 | + conf.conf.cipher, conf.conf.keyidx); |
|---|
| 1509 | 1572 | switch (gtkdata.cipher) { |
|---|
| 1510 | 1573 | case WLAN_CIPHER_SUITE_CCMP: |
|---|
| 1574 | + case WLAN_CIPHER_SUITE_GCMP: |
|---|
| 1575 | + BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP); |
|---|
| 1576 | + BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_CCMP); |
|---|
| 1511 | 1577 | conf.conf.keylen = WLAN_KEY_LEN_CCMP; |
|---|
| 1512 | | - memcpy(conf.conf.key, status->gtk.decrypt_key, |
|---|
| 1578 | + memcpy(conf.conf.key, status->gtk[0].key, |
|---|
| 1513 | 1579 | WLAN_KEY_LEN_CCMP); |
|---|
| 1514 | 1580 | break; |
|---|
| 1581 | + case WLAN_CIPHER_SUITE_GCMP_256: |
|---|
| 1582 | + BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_GCMP_256); |
|---|
| 1583 | + conf.conf.keylen = WLAN_KEY_LEN_GCMP_256; |
|---|
| 1584 | + memcpy(conf.conf.key, status->gtk[0].key, |
|---|
| 1585 | + WLAN_KEY_LEN_GCMP_256); |
|---|
| 1586 | + break; |
|---|
| 1515 | 1587 | case WLAN_CIPHER_SUITE_TKIP: |
|---|
| 1588 | + BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_TKIP); |
|---|
| 1516 | 1589 | conf.conf.keylen = WLAN_KEY_LEN_TKIP; |
|---|
| 1517 | | - memcpy(conf.conf.key, status->gtk.decrypt_key, 16); |
|---|
| 1590 | + memcpy(conf.conf.key, status->gtk[0].key, 16); |
|---|
| 1518 | 1591 | /* leave TX MIC key zeroed, we don't use it anyway */ |
|---|
| 1519 | 1592 | memcpy(conf.conf.key + |
|---|
| 1520 | 1593 | NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, |
|---|
| 1521 | | - status->gtk.tkip_mic_key, 8); |
|---|
| 1594 | + status->gtk[0].tkip_mic_key, 8); |
|---|
| 1522 | 1595 | break; |
|---|
| 1523 | 1596 | } |
|---|
| 1524 | 1597 | |
|---|
| .. | .. |
|---|
| 1526 | 1599 | if (IS_ERR(key)) |
|---|
| 1527 | 1600 | return false; |
|---|
| 1528 | 1601 | iwl_mvm_set_key_rx_seq(mvm, key, status); |
|---|
| 1529 | | - } |
|---|
| 1530 | 1602 | |
|---|
| 1531 | | - if (status->num_of_gtk_rekeys) { |
|---|
| 1532 | | - __be64 replay_ctr = |
|---|
| 1603 | + replay_ctr = |
|---|
| 1533 | 1604 | cpu_to_be64(le64_to_cpu(status->replay_ctr)); |
|---|
| 1605 | + |
|---|
| 1534 | 1606 | ieee80211_gtk_rekey_notify(vif, vif->bss_conf.bssid, |
|---|
| 1535 | 1607 | (void *)&replay_ctr, GFP_KERNEL); |
|---|
| 1536 | 1608 | } |
|---|
| .. | .. |
|---|
| 1543 | 1615 | return true; |
|---|
| 1544 | 1616 | } |
|---|
| 1545 | 1617 | |
|---|
| 1546 | | -static struct iwl_wowlan_status * |
|---|
| 1547 | | -iwl_mvm_get_wakeup_status(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
|---|
| 1618 | +/* Occasionally, templates would be nice. This is one of those times ... */ |
|---|
| 1619 | +#define iwl_mvm_parse_wowlan_status_common(_ver) \ |
|---|
| 1620 | +static struct iwl_wowlan_status * \ |
|---|
| 1621 | +iwl_mvm_parse_wowlan_status_common_ ## _ver(struct iwl_mvm *mvm, \ |
|---|
| 1622 | + void *_data, int len) \ |
|---|
| 1623 | +{ \ |
|---|
| 1624 | + struct iwl_wowlan_status *status; \ |
|---|
| 1625 | + struct iwl_wowlan_status_ ##_ver *data = _data; \ |
|---|
| 1626 | + int data_size; \ |
|---|
| 1627 | + \ |
|---|
| 1628 | + if (len < sizeof(*data)) { \ |
|---|
| 1629 | + IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \ |
|---|
| 1630 | + return ERR_PTR(-EIO); \ |
|---|
| 1631 | + } \ |
|---|
| 1632 | + \ |
|---|
| 1633 | + data_size = ALIGN(le32_to_cpu(data->wake_packet_bufsize), 4); \ |
|---|
| 1634 | + if (len != sizeof(*data) + data_size) { \ |
|---|
| 1635 | + IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \ |
|---|
| 1636 | + return ERR_PTR(-EIO); \ |
|---|
| 1637 | + } \ |
|---|
| 1638 | + \ |
|---|
| 1639 | + status = kzalloc(sizeof(*status) + data_size, GFP_KERNEL); \ |
|---|
| 1640 | + if (!status) \ |
|---|
| 1641 | + return ERR_PTR(-ENOMEM); \ |
|---|
| 1642 | + \ |
|---|
| 1643 | + /* copy all the common fields */ \ |
|---|
| 1644 | + status->replay_ctr = data->replay_ctr; \ |
|---|
| 1645 | + status->pattern_number = data->pattern_number; \ |
|---|
| 1646 | + status->non_qos_seq_ctr = data->non_qos_seq_ctr; \ |
|---|
| 1647 | + memcpy(status->qos_seq_ctr, data->qos_seq_ctr, \ |
|---|
| 1648 | + sizeof(status->qos_seq_ctr)); \ |
|---|
| 1649 | + status->wakeup_reasons = data->wakeup_reasons; \ |
|---|
| 1650 | + status->num_of_gtk_rekeys = data->num_of_gtk_rekeys; \ |
|---|
| 1651 | + status->received_beacons = data->received_beacons; \ |
|---|
| 1652 | + status->wake_packet_length = data->wake_packet_length; \ |
|---|
| 1653 | + status->wake_packet_bufsize = data->wake_packet_bufsize; \ |
|---|
| 1654 | + memcpy(status->wake_packet, data->wake_packet, \ |
|---|
| 1655 | + le32_to_cpu(status->wake_packet_bufsize)); \ |
|---|
| 1656 | + \ |
|---|
| 1657 | + return status; \ |
|---|
| 1658 | +} |
|---|
| 1659 | + |
|---|
| 1660 | +iwl_mvm_parse_wowlan_status_common(v6) |
|---|
| 1661 | +iwl_mvm_parse_wowlan_status_common(v7) |
|---|
| 1662 | +iwl_mvm_parse_wowlan_status_common(v9) |
|---|
| 1663 | + |
|---|
| 1664 | +struct iwl_wowlan_status *iwl_mvm_send_wowlan_get_status(struct iwl_mvm *mvm) |
|---|
| 1548 | 1665 | { |
|---|
| 1549 | | - u32 base = mvm->error_event_table[0]; |
|---|
| 1550 | | - struct error_table_start { |
|---|
| 1551 | | - /* cf. struct iwl_error_event_table */ |
|---|
| 1552 | | - u32 valid; |
|---|
| 1553 | | - u32 error_id; |
|---|
| 1554 | | - } err_info; |
|---|
| 1666 | + struct iwl_wowlan_status *status; |
|---|
| 1555 | 1667 | struct iwl_host_cmd cmd = { |
|---|
| 1556 | 1668 | .id = WOWLAN_GET_STATUSES, |
|---|
| 1557 | 1669 | .flags = CMD_WANT_SKB, |
|---|
| 1558 | 1670 | }; |
|---|
| 1559 | | - struct iwl_wowlan_status *status, *fw_status; |
|---|
| 1560 | | - int ret, len, status_size; |
|---|
| 1671 | + int ret, len; |
|---|
| 1672 | + u8 notif_ver; |
|---|
| 1561 | 1673 | |
|---|
| 1562 | | - iwl_trans_read_mem_bytes(mvm->trans, base, |
|---|
| 1563 | | - &err_info, sizeof(err_info)); |
|---|
| 1674 | + lockdep_assert_held(&mvm->mutex); |
|---|
| 1564 | 1675 | |
|---|
| 1565 | | - if (err_info.valid) { |
|---|
| 1566 | | - IWL_INFO(mvm, "error table is valid (%d) with error (%d)\n", |
|---|
| 1567 | | - err_info.valid, err_info.error_id); |
|---|
| 1568 | | - if (err_info.error_id == RF_KILL_INDICATOR_FOR_WOWLAN) { |
|---|
| 1569 | | - struct cfg80211_wowlan_wakeup wakeup = { |
|---|
| 1570 | | - .rfkill_release = true, |
|---|
| 1571 | | - }; |
|---|
| 1572 | | - ieee80211_report_wowlan_wakeup(vif, &wakeup, |
|---|
| 1573 | | - GFP_KERNEL); |
|---|
| 1574 | | - } |
|---|
| 1575 | | - return ERR_PTR(-EIO); |
|---|
| 1676 | + ret = iwl_mvm_send_cmd(mvm, &cmd); |
|---|
| 1677 | + if (ret) { |
|---|
| 1678 | + IWL_ERR(mvm, "failed to query wakeup status (%d)\n", ret); |
|---|
| 1679 | + return ERR_PTR(ret); |
|---|
| 1576 | 1680 | } |
|---|
| 1681 | + |
|---|
| 1682 | + len = iwl_rx_packet_payload_len(cmd.resp_pkt); |
|---|
| 1683 | + |
|---|
| 1684 | + /* default to 7 (when we have IWL_UCODE_TLV_API_WOWLAN_KEY_MATERIAL) */ |
|---|
| 1685 | + notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, |
|---|
| 1686 | + WOWLAN_GET_STATUSES, 7); |
|---|
| 1687 | + |
|---|
| 1688 | + if (!fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1689 | + IWL_UCODE_TLV_API_WOWLAN_KEY_MATERIAL)) { |
|---|
| 1690 | + struct iwl_wowlan_status_v6 *v6 = (void *)cmd.resp_pkt->data; |
|---|
| 1691 | + |
|---|
| 1692 | + status = iwl_mvm_parse_wowlan_status_common_v6(mvm, |
|---|
| 1693 | + cmd.resp_pkt->data, |
|---|
| 1694 | + len); |
|---|
| 1695 | + if (IS_ERR(status)) |
|---|
| 1696 | + goto out_free_resp; |
|---|
| 1697 | + |
|---|
| 1698 | + BUILD_BUG_ON(sizeof(v6->gtk.decrypt_key) > |
|---|
| 1699 | + sizeof(status->gtk[0].key)); |
|---|
| 1700 | + BUILD_BUG_ON(sizeof(v6->gtk.tkip_mic_key) > |
|---|
| 1701 | + sizeof(status->gtk[0].tkip_mic_key)); |
|---|
| 1702 | + |
|---|
| 1703 | + /* copy GTK info to the right place */ |
|---|
| 1704 | + memcpy(status->gtk[0].key, v6->gtk.decrypt_key, |
|---|
| 1705 | + sizeof(v6->gtk.decrypt_key)); |
|---|
| 1706 | + memcpy(status->gtk[0].tkip_mic_key, v6->gtk.tkip_mic_key, |
|---|
| 1707 | + sizeof(v6->gtk.tkip_mic_key)); |
|---|
| 1708 | + memcpy(&status->gtk[0].rsc, &v6->gtk.rsc, |
|---|
| 1709 | + sizeof(status->gtk[0].rsc)); |
|---|
| 1710 | + |
|---|
| 1711 | + /* hardcode the key length to 16 since v6 only supports 16 */ |
|---|
| 1712 | + status->gtk[0].key_len = 16; |
|---|
| 1713 | + |
|---|
| 1714 | + /* |
|---|
| 1715 | + * The key index only uses 2 bits (values 0 to 3) and |
|---|
| 1716 | + * we always set bit 7 which means this is the |
|---|
| 1717 | + * currently used key. |
|---|
| 1718 | + */ |
|---|
| 1719 | + status->gtk[0].key_flags = v6->gtk.key_index | BIT(7); |
|---|
| 1720 | + } else if (notif_ver == 7) { |
|---|
| 1721 | + struct iwl_wowlan_status_v7 *v7 = (void *)cmd.resp_pkt->data; |
|---|
| 1722 | + |
|---|
| 1723 | + status = iwl_mvm_parse_wowlan_status_common_v7(mvm, |
|---|
| 1724 | + cmd.resp_pkt->data, |
|---|
| 1725 | + len); |
|---|
| 1726 | + if (IS_ERR(status)) |
|---|
| 1727 | + goto out_free_resp; |
|---|
| 1728 | + |
|---|
| 1729 | + status->gtk[0] = v7->gtk[0]; |
|---|
| 1730 | + status->igtk[0] = v7->igtk[0]; |
|---|
| 1731 | + } else if (notif_ver == 9) { |
|---|
| 1732 | + struct iwl_wowlan_status_v9 *v9 = (void *)cmd.resp_pkt->data; |
|---|
| 1733 | + |
|---|
| 1734 | + status = iwl_mvm_parse_wowlan_status_common_v9(mvm, |
|---|
| 1735 | + cmd.resp_pkt->data, |
|---|
| 1736 | + len); |
|---|
| 1737 | + if (IS_ERR(status)) |
|---|
| 1738 | + goto out_free_resp; |
|---|
| 1739 | + |
|---|
| 1740 | + status->gtk[0] = v9->gtk[0]; |
|---|
| 1741 | + status->igtk[0] = v9->igtk[0]; |
|---|
| 1742 | + |
|---|
| 1743 | + status->tid_tear_down = v9->tid_tear_down; |
|---|
| 1744 | + } else { |
|---|
| 1745 | + IWL_ERR(mvm, |
|---|
| 1746 | + "Firmware advertises unknown WoWLAN status response %d!\n", |
|---|
| 1747 | + notif_ver); |
|---|
| 1748 | + status = ERR_PTR(-EIO); |
|---|
| 1749 | + } |
|---|
| 1750 | + |
|---|
| 1751 | +out_free_resp: |
|---|
| 1752 | + iwl_free_resp(&cmd); |
|---|
| 1753 | + return status; |
|---|
| 1754 | +} |
|---|
| 1755 | + |
|---|
| 1756 | +static struct iwl_wowlan_status * |
|---|
| 1757 | +iwl_mvm_get_wakeup_status(struct iwl_mvm *mvm) |
|---|
| 1758 | +{ |
|---|
| 1759 | + int ret; |
|---|
| 1577 | 1760 | |
|---|
| 1578 | 1761 | /* only for tracing for now */ |
|---|
| 1579 | 1762 | ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, 0, 0, NULL); |
|---|
| 1580 | 1763 | if (ret) |
|---|
| 1581 | 1764 | IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); |
|---|
| 1582 | 1765 | |
|---|
| 1583 | | - ret = iwl_mvm_send_cmd(mvm, &cmd); |
|---|
| 1584 | | - if (ret) { |
|---|
| 1585 | | - IWL_ERR(mvm, "failed to query status (%d)\n", ret); |
|---|
| 1586 | | - return ERR_PTR(ret); |
|---|
| 1587 | | - } |
|---|
| 1588 | | - |
|---|
| 1589 | | - status_size = sizeof(*fw_status); |
|---|
| 1590 | | - |
|---|
| 1591 | | - len = iwl_rx_packet_payload_len(cmd.resp_pkt); |
|---|
| 1592 | | - if (len < status_size) { |
|---|
| 1593 | | - IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); |
|---|
| 1594 | | - fw_status = ERR_PTR(-EIO); |
|---|
| 1595 | | - goto out_free_resp; |
|---|
| 1596 | | - } |
|---|
| 1597 | | - |
|---|
| 1598 | | - status = (void *)cmd.resp_pkt->data; |
|---|
| 1599 | | - if (len != (status_size + |
|---|
| 1600 | | - ALIGN(le32_to_cpu(status->wake_packet_bufsize), 4))) { |
|---|
| 1601 | | - IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); |
|---|
| 1602 | | - fw_status = ERR_PTR(-EIO); |
|---|
| 1603 | | - goto out_free_resp; |
|---|
| 1604 | | - } |
|---|
| 1605 | | - |
|---|
| 1606 | | - fw_status = kmemdup(status, len, GFP_KERNEL); |
|---|
| 1607 | | - |
|---|
| 1608 | | -out_free_resp: |
|---|
| 1609 | | - iwl_free_resp(&cmd); |
|---|
| 1610 | | - return fw_status; |
|---|
| 1766 | + return iwl_mvm_send_wowlan_get_status(mvm); |
|---|
| 1611 | 1767 | } |
|---|
| 1612 | 1768 | |
|---|
| 1613 | 1769 | /* releases the MVM mutex */ |
|---|
| .. | .. |
|---|
| 1620 | 1776 | bool keep; |
|---|
| 1621 | 1777 | struct iwl_mvm_sta *mvm_ap_sta; |
|---|
| 1622 | 1778 | |
|---|
| 1623 | | - fw_status = iwl_mvm_get_wakeup_status(mvm, vif); |
|---|
| 1779 | + fw_status = iwl_mvm_get_wakeup_status(mvm); |
|---|
| 1624 | 1780 | if (IS_ERR_OR_NULL(fw_status)) |
|---|
| 1625 | 1781 | goto out_unlock; |
|---|
| 1782 | + |
|---|
| 1783 | + IWL_DEBUG_WOWLAN(mvm, "wakeup reason 0x%x\n", |
|---|
| 1784 | + le32_to_cpu(fw_status->wakeup_reasons)); |
|---|
| 1626 | 1785 | |
|---|
| 1627 | 1786 | status.pattern_number = le16_to_cpu(fw_status->pattern_number); |
|---|
| 1628 | 1787 | for (i = 0; i < 8; i++) |
|---|
| .. | .. |
|---|
| 1647 | 1806 | mvm_ap_sta->tid_data[i].seq_number = seq; |
|---|
| 1648 | 1807 | } |
|---|
| 1649 | 1808 | |
|---|
| 1809 | + if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { |
|---|
| 1810 | + i = mvm->offload_tid; |
|---|
| 1811 | + iwl_trans_set_q_ptrs(mvm->trans, |
|---|
| 1812 | + mvm_ap_sta->tid_data[i].txq_id, |
|---|
| 1813 | + mvm_ap_sta->tid_data[i].seq_number >> 4); |
|---|
| 1814 | + } |
|---|
| 1815 | + |
|---|
| 1650 | 1816 | /* now we have all the data we need, unlock to avoid mac80211 issues */ |
|---|
| 1651 | 1817 | mutex_unlock(&mvm->mutex); |
|---|
| 1652 | 1818 | |
|---|
| .. | .. |
|---|
| 1664 | 1830 | return false; |
|---|
| 1665 | 1831 | } |
|---|
| 1666 | 1832 | |
|---|
| 1667 | | -void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm, |
|---|
| 1668 | | - struct ieee80211_vif *vif, |
|---|
| 1669 | | - struct iwl_wowlan_status *status) |
|---|
| 1670 | | -{ |
|---|
| 1671 | | - struct iwl_mvm_d3_gtk_iter_data gtkdata = { |
|---|
| 1672 | | - .mvm = mvm, |
|---|
| 1673 | | - .status = status, |
|---|
| 1674 | | - }; |
|---|
| 1675 | | - |
|---|
| 1676 | | - /* |
|---|
| 1677 | | - * rekey handling requires taking locks that can't be taken now. |
|---|
| 1678 | | - * however, d0i3 doesn't offload rekey, so we're fine. |
|---|
| 1679 | | - */ |
|---|
| 1680 | | - if (WARN_ON_ONCE(status->num_of_gtk_rekeys)) |
|---|
| 1681 | | - return; |
|---|
| 1682 | | - |
|---|
| 1683 | | - /* find last GTK that we used initially, if any */ |
|---|
| 1684 | | - gtkdata.find_phase = true; |
|---|
| 1685 | | - iwl_mvm_iter_d0i3_ap_keys(mvm, vif, iwl_mvm_d3_update_keys, >kdata); |
|---|
| 1686 | | - |
|---|
| 1687 | | - gtkdata.find_phase = false; |
|---|
| 1688 | | - iwl_mvm_iter_d0i3_ap_keys(mvm, vif, iwl_mvm_d3_update_keys, >kdata); |
|---|
| 1689 | | -} |
|---|
| 1833 | +#define ND_QUERY_BUF_LEN (sizeof(struct iwl_scan_offload_profile_match) * \ |
|---|
| 1834 | + IWL_SCAN_MAX_PROFILES) |
|---|
| 1690 | 1835 | |
|---|
| 1691 | 1836 | struct iwl_mvm_nd_query_results { |
|---|
| 1692 | 1837 | u32 matched_profiles; |
|---|
| 1693 | | - struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES]; |
|---|
| 1838 | + u8 matches[ND_QUERY_BUF_LEN]; |
|---|
| 1694 | 1839 | }; |
|---|
| 1695 | 1840 | |
|---|
| 1696 | 1841 | static int |
|---|
| .. | .. |
|---|
| 1703 | 1848 | .flags = CMD_WANT_SKB, |
|---|
| 1704 | 1849 | }; |
|---|
| 1705 | 1850 | int ret, len; |
|---|
| 1851 | + size_t query_len, matches_len; |
|---|
| 1852 | + int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); |
|---|
| 1706 | 1853 | |
|---|
| 1707 | 1854 | ret = iwl_mvm_send_cmd(mvm, &cmd); |
|---|
| 1708 | 1855 | if (ret) { |
|---|
| .. | .. |
|---|
| 1710 | 1857 | return ret; |
|---|
| 1711 | 1858 | } |
|---|
| 1712 | 1859 | |
|---|
| 1860 | + if (fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1861 | + IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS)) { |
|---|
| 1862 | + query_len = sizeof(struct iwl_scan_offload_profiles_query); |
|---|
| 1863 | + matches_len = sizeof(struct iwl_scan_offload_profile_match) * |
|---|
| 1864 | + max_profiles; |
|---|
| 1865 | + } else { |
|---|
| 1866 | + query_len = sizeof(struct iwl_scan_offload_profiles_query_v1); |
|---|
| 1867 | + matches_len = sizeof(struct iwl_scan_offload_profile_match_v1) * |
|---|
| 1868 | + max_profiles; |
|---|
| 1869 | + } |
|---|
| 1870 | + |
|---|
| 1713 | 1871 | len = iwl_rx_packet_payload_len(cmd.resp_pkt); |
|---|
| 1714 | | - if (len < sizeof(*query)) { |
|---|
| 1872 | + if (len < query_len) { |
|---|
| 1715 | 1873 | IWL_ERR(mvm, "Invalid scan offload profiles query response!\n"); |
|---|
| 1716 | 1874 | ret = -EIO; |
|---|
| 1717 | 1875 | goto out_free_resp; |
|---|
| .. | .. |
|---|
| 1720 | 1878 | query = (void *)cmd.resp_pkt->data; |
|---|
| 1721 | 1879 | |
|---|
| 1722 | 1880 | results->matched_profiles = le32_to_cpu(query->matched_profiles); |
|---|
| 1723 | | - memcpy(results->matches, query->matches, sizeof(results->matches)); |
|---|
| 1881 | + memcpy(results->matches, query->matches, matches_len); |
|---|
| 1724 | 1882 | |
|---|
| 1725 | 1883 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
|---|
| 1726 | 1884 | mvm->last_netdetect_scans = le32_to_cpu(query->n_scans_done); |
|---|
| .. | .. |
|---|
| 1729 | 1887 | out_free_resp: |
|---|
| 1730 | 1888 | iwl_free_resp(&cmd); |
|---|
| 1731 | 1889 | return ret; |
|---|
| 1890 | +} |
|---|
| 1891 | + |
|---|
| 1892 | +static int iwl_mvm_query_num_match_chans(struct iwl_mvm *mvm, |
|---|
| 1893 | + struct iwl_mvm_nd_query_results *query, |
|---|
| 1894 | + int idx) |
|---|
| 1895 | +{ |
|---|
| 1896 | + int n_chans = 0, i; |
|---|
| 1897 | + |
|---|
| 1898 | + if (fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1899 | + IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS)) { |
|---|
| 1900 | + struct iwl_scan_offload_profile_match *matches = |
|---|
| 1901 | + (struct iwl_scan_offload_profile_match *)query->matches; |
|---|
| 1902 | + |
|---|
| 1903 | + for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN; i++) |
|---|
| 1904 | + n_chans += hweight8(matches[idx].matching_channels[i]); |
|---|
| 1905 | + } else { |
|---|
| 1906 | + struct iwl_scan_offload_profile_match_v1 *matches = |
|---|
| 1907 | + (struct iwl_scan_offload_profile_match_v1 *)query->matches; |
|---|
| 1908 | + |
|---|
| 1909 | + for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1; i++) |
|---|
| 1910 | + n_chans += hweight8(matches[idx].matching_channels[i]); |
|---|
| 1911 | + } |
|---|
| 1912 | + |
|---|
| 1913 | + return n_chans; |
|---|
| 1914 | +} |
|---|
| 1915 | + |
|---|
| 1916 | +static void iwl_mvm_query_set_freqs(struct iwl_mvm *mvm, |
|---|
| 1917 | + struct iwl_mvm_nd_query_results *query, |
|---|
| 1918 | + struct cfg80211_wowlan_nd_match *match, |
|---|
| 1919 | + int idx) |
|---|
| 1920 | +{ |
|---|
| 1921 | + int i; |
|---|
| 1922 | + |
|---|
| 1923 | + if (fw_has_api(&mvm->fw->ucode_capa, |
|---|
| 1924 | + IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS)) { |
|---|
| 1925 | + struct iwl_scan_offload_profile_match *matches = |
|---|
| 1926 | + (struct iwl_scan_offload_profile_match *)query->matches; |
|---|
| 1927 | + |
|---|
| 1928 | + for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN * 8; i++) |
|---|
| 1929 | + if (matches[idx].matching_channels[i / 8] & (BIT(i % 8))) |
|---|
| 1930 | + match->channels[match->n_channels++] = |
|---|
| 1931 | + mvm->nd_channels[i]->center_freq; |
|---|
| 1932 | + } else { |
|---|
| 1933 | + struct iwl_scan_offload_profile_match_v1 *matches = |
|---|
| 1934 | + (struct iwl_scan_offload_profile_match_v1 *)query->matches; |
|---|
| 1935 | + |
|---|
| 1936 | + for (i = 0; i < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 * 8; i++) |
|---|
| 1937 | + if (matches[idx].matching_channels[i / 8] & (BIT(i % 8))) |
|---|
| 1938 | + match->channels[match->n_channels++] = |
|---|
| 1939 | + mvm->nd_channels[i]->center_freq; |
|---|
| 1940 | + } |
|---|
| 1732 | 1941 | } |
|---|
| 1733 | 1942 | |
|---|
| 1734 | 1943 | static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, |
|---|
| .. | .. |
|---|
| 1743 | 1952 | struct iwl_wowlan_status *fw_status; |
|---|
| 1744 | 1953 | unsigned long matched_profiles; |
|---|
| 1745 | 1954 | u32 reasons = 0; |
|---|
| 1746 | | - int i, j, n_matches, ret; |
|---|
| 1955 | + int i, n_matches, ret; |
|---|
| 1747 | 1956 | |
|---|
| 1748 | | - fw_status = iwl_mvm_get_wakeup_status(mvm, vif); |
|---|
| 1957 | + fw_status = iwl_mvm_get_wakeup_status(mvm); |
|---|
| 1749 | 1958 | if (!IS_ERR_OR_NULL(fw_status)) { |
|---|
| 1750 | 1959 | reasons = le32_to_cpu(fw_status->wakeup_reasons); |
|---|
| 1751 | 1960 | kfree(fw_status); |
|---|
| .. | .. |
|---|
| 1771 | 1980 | n_matches = 0; |
|---|
| 1772 | 1981 | } |
|---|
| 1773 | 1982 | |
|---|
| 1774 | | - net_detect = kzalloc(sizeof(*net_detect) + |
|---|
| 1775 | | - (n_matches * sizeof(net_detect->matches[0])), |
|---|
| 1983 | + net_detect = kzalloc(struct_size(net_detect, matches, n_matches), |
|---|
| 1776 | 1984 | GFP_KERNEL); |
|---|
| 1777 | 1985 | if (!net_detect || !n_matches) |
|---|
| 1778 | 1986 | goto out_report_nd; |
|---|
| 1779 | 1987 | |
|---|
| 1780 | 1988 | for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) { |
|---|
| 1781 | | - struct iwl_scan_offload_profile_match *fw_match; |
|---|
| 1782 | 1989 | struct cfg80211_wowlan_nd_match *match; |
|---|
| 1783 | 1990 | int idx, n_channels = 0; |
|---|
| 1784 | 1991 | |
|---|
| 1785 | | - fw_match = &query.matches[i]; |
|---|
| 1992 | + n_channels = iwl_mvm_query_num_match_chans(mvm, &query, i); |
|---|
| 1786 | 1993 | |
|---|
| 1787 | | - for (j = 0; j < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN; j++) |
|---|
| 1788 | | - n_channels += hweight8(fw_match->matching_channels[j]); |
|---|
| 1789 | | - |
|---|
| 1790 | | - match = kzalloc(sizeof(*match) + |
|---|
| 1791 | | - (n_channels * sizeof(*match->channels)), |
|---|
| 1994 | + match = kzalloc(struct_size(match, channels, n_channels), |
|---|
| 1792 | 1995 | GFP_KERNEL); |
|---|
| 1793 | 1996 | if (!match) |
|---|
| 1794 | 1997 | goto out_report_nd; |
|---|
| .. | .. |
|---|
| 1806 | 2009 | if (mvm->n_nd_channels < n_channels) |
|---|
| 1807 | 2010 | continue; |
|---|
| 1808 | 2011 | |
|---|
| 1809 | | - for (j = 0; j < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN * 8; j++) |
|---|
| 1810 | | - if (fw_match->matching_channels[j / 8] & (BIT(j % 8))) |
|---|
| 1811 | | - match->channels[match->n_channels++] = |
|---|
| 1812 | | - mvm->nd_channels[j]->center_freq; |
|---|
| 2012 | + iwl_mvm_query_set_freqs(mvm, &query, match, i); |
|---|
| 1813 | 2013 | } |
|---|
| 1814 | 2014 | |
|---|
| 1815 | 2015 | out_report_nd: |
|---|
| .. | .. |
|---|
| 1827 | 2027 | } |
|---|
| 1828 | 2028 | } |
|---|
| 1829 | 2029 | |
|---|
| 1830 | | -static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) |
|---|
| 1831 | | -{ |
|---|
| 1832 | | -#ifdef CONFIG_IWLWIFI_DEBUGFS |
|---|
| 1833 | | - const struct fw_img *img = &mvm->fw->img[IWL_UCODE_WOWLAN]; |
|---|
| 1834 | | - u32 len = img->sec[IWL_UCODE_SECTION_DATA].len; |
|---|
| 1835 | | - u32 offs = img->sec[IWL_UCODE_SECTION_DATA].offset; |
|---|
| 1836 | | - |
|---|
| 1837 | | - if (!mvm->store_d3_resume_sram) |
|---|
| 1838 | | - return; |
|---|
| 1839 | | - |
|---|
| 1840 | | - if (!mvm->d3_resume_sram) { |
|---|
| 1841 | | - mvm->d3_resume_sram = kzalloc(len, GFP_KERNEL); |
|---|
| 1842 | | - if (!mvm->d3_resume_sram) |
|---|
| 1843 | | - return; |
|---|
| 1844 | | - } |
|---|
| 1845 | | - |
|---|
| 1846 | | - iwl_trans_read_mem_bytes(mvm->trans, offs, mvm->d3_resume_sram, len); |
|---|
| 1847 | | -#endif |
|---|
| 1848 | | -} |
|---|
| 1849 | | - |
|---|
| 1850 | 2030 | static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac, |
|---|
| 1851 | 2031 | struct ieee80211_vif *vif) |
|---|
| 1852 | 2032 | { |
|---|
| .. | .. |
|---|
| 1856 | 2036 | |
|---|
| 1857 | 2037 | if (vif->type == NL80211_IFTYPE_STATION) |
|---|
| 1858 | 2038 | ieee80211_resume_disconnect(vif); |
|---|
| 2039 | +} |
|---|
| 2040 | + |
|---|
| 2041 | +static bool iwl_mvm_rt_status(struct iwl_trans *trans, u32 base, u32 *err_id) |
|---|
| 2042 | +{ |
|---|
| 2043 | + struct error_table_start { |
|---|
| 2044 | + /* cf. struct iwl_error_event_table */ |
|---|
| 2045 | + u32 valid; |
|---|
| 2046 | + __le32 err_id; |
|---|
| 2047 | + } err_info; |
|---|
| 2048 | + |
|---|
| 2049 | + if (!base) |
|---|
| 2050 | + return false; |
|---|
| 2051 | + |
|---|
| 2052 | + iwl_trans_read_mem_bytes(trans, base, |
|---|
| 2053 | + &err_info, sizeof(err_info)); |
|---|
| 2054 | + if (err_info.valid && err_id) |
|---|
| 2055 | + *err_id = le32_to_cpu(err_info.err_id); |
|---|
| 2056 | + |
|---|
| 2057 | + return !!err_info.valid; |
|---|
| 2058 | +} |
|---|
| 2059 | + |
|---|
| 2060 | +static bool iwl_mvm_check_rt_status(struct iwl_mvm *mvm, |
|---|
| 2061 | + struct ieee80211_vif *vif) |
|---|
| 2062 | +{ |
|---|
| 2063 | + u32 err_id; |
|---|
| 2064 | + |
|---|
| 2065 | + /* check for lmac1 error */ |
|---|
| 2066 | + if (iwl_mvm_rt_status(mvm->trans, |
|---|
| 2067 | + mvm->trans->dbg.lmac_error_event_table[0], |
|---|
| 2068 | + &err_id)) { |
|---|
| 2069 | + if (err_id == RF_KILL_INDICATOR_FOR_WOWLAN) { |
|---|
| 2070 | + struct cfg80211_wowlan_wakeup wakeup = { |
|---|
| 2071 | + .rfkill_release = true, |
|---|
| 2072 | + }; |
|---|
| 2073 | + ieee80211_report_wowlan_wakeup(vif, &wakeup, |
|---|
| 2074 | + GFP_KERNEL); |
|---|
| 2075 | + } |
|---|
| 2076 | + return true; |
|---|
| 2077 | + } |
|---|
| 2078 | + |
|---|
| 2079 | + /* check if we have lmac2 set and check for error */ |
|---|
| 2080 | + if (iwl_mvm_rt_status(mvm->trans, |
|---|
| 2081 | + mvm->trans->dbg.lmac_error_event_table[1], NULL)) |
|---|
| 2082 | + return true; |
|---|
| 2083 | + |
|---|
| 2084 | + /* check for umac error */ |
|---|
| 2085 | + if (iwl_mvm_rt_status(mvm->trans, |
|---|
| 2086 | + mvm->trans->dbg.umac_error_event_table, NULL)) |
|---|
| 2087 | + return true; |
|---|
| 2088 | + |
|---|
| 2089 | + return false; |
|---|
| 1859 | 2090 | } |
|---|
| 1860 | 2091 | |
|---|
| 1861 | 2092 | static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) |
|---|
| .. | .. |
|---|
| 1871 | 2102 | |
|---|
| 1872 | 2103 | mutex_lock(&mvm->mutex); |
|---|
| 1873 | 2104 | |
|---|
| 2105 | + clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); |
|---|
| 2106 | + |
|---|
| 1874 | 2107 | /* get the BSS vif pointer again */ |
|---|
| 1875 | 2108 | vif = iwl_mvm_get_bss_vif(mvm); |
|---|
| 1876 | 2109 | if (IS_ERR_OR_NULL(vif)) |
|---|
| 1877 | 2110 | goto err; |
|---|
| 2111 | + |
|---|
| 2112 | + iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); |
|---|
| 2113 | + |
|---|
| 2114 | + if (iwl_mvm_check_rt_status(mvm, vif)) { |
|---|
| 2115 | + set_bit(STATUS_FW_ERROR, &mvm->trans->status); |
|---|
| 2116 | + iwl_mvm_dump_nic_error_log(mvm); |
|---|
| 2117 | + iwl_dbg_tlv_time_point(&mvm->fwrt, |
|---|
| 2118 | + IWL_FW_INI_TIME_POINT_FW_ASSERT, NULL); |
|---|
| 2119 | + iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, |
|---|
| 2120 | + false, 0); |
|---|
| 2121 | + ret = 1; |
|---|
| 2122 | + goto err; |
|---|
| 2123 | + } |
|---|
| 2124 | + |
|---|
| 2125 | + iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_HOST_D3_END, |
|---|
| 2126 | + NULL); |
|---|
| 1878 | 2127 | |
|---|
| 1879 | 2128 | ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !unified_image); |
|---|
| 1880 | 2129 | if (ret) |
|---|
| .. | .. |
|---|
| 1885 | 2134 | goto err; |
|---|
| 1886 | 2135 | } |
|---|
| 1887 | 2136 | |
|---|
| 1888 | | - /* query SRAM first in case we want event logging */ |
|---|
| 1889 | | - iwl_mvm_read_d3_sram(mvm); |
|---|
| 1890 | | - |
|---|
| 1891 | 2137 | if (d0i3_first) { |
|---|
| 1892 | | - ret = iwl_mvm_send_cmd_pdu(mvm, D0I3_END_CMD, 0, 0, NULL); |
|---|
| 2138 | + struct iwl_host_cmd cmd = { |
|---|
| 2139 | + .id = D0I3_END_CMD, |
|---|
| 2140 | + .flags = CMD_WANT_SKB, |
|---|
| 2141 | + }; |
|---|
| 2142 | + int len; |
|---|
| 2143 | + |
|---|
| 2144 | + ret = iwl_mvm_send_cmd(mvm, &cmd); |
|---|
| 1893 | 2145 | if (ret < 0) { |
|---|
| 1894 | 2146 | IWL_ERR(mvm, "Failed to send D0I3_END_CMD first (%d)\n", |
|---|
| 1895 | 2147 | ret); |
|---|
| 1896 | 2148 | goto err; |
|---|
| 2149 | + } |
|---|
| 2150 | + switch (mvm->cmd_ver.d0i3_resp) { |
|---|
| 2151 | + case 0: |
|---|
| 2152 | + break; |
|---|
| 2153 | + case 1: |
|---|
| 2154 | + len = iwl_rx_packet_payload_len(cmd.resp_pkt); |
|---|
| 2155 | + if (len != sizeof(u32)) { |
|---|
| 2156 | + IWL_ERR(mvm, |
|---|
| 2157 | + "Error with D0I3_END_CMD response size (%d)\n", |
|---|
| 2158 | + len); |
|---|
| 2159 | + goto err; |
|---|
| 2160 | + } |
|---|
| 2161 | + if (IWL_D0I3_RESET_REQUIRE & |
|---|
| 2162 | + le32_to_cpu(*(__le32 *)cmd.resp_pkt->data)) { |
|---|
| 2163 | + iwl_write32(mvm->trans, CSR_RESET, |
|---|
| 2164 | + CSR_RESET_REG_FLAG_FORCE_NMI); |
|---|
| 2165 | + iwl_free_resp(&cmd); |
|---|
| 2166 | + } |
|---|
| 2167 | + break; |
|---|
| 2168 | + default: |
|---|
| 2169 | + WARN_ON(1); |
|---|
| 1897 | 2170 | } |
|---|
| 1898 | 2171 | } |
|---|
| 1899 | 2172 | |
|---|
| .. | .. |
|---|
| 1902 | 2175 | * can play it back when we re-intiailize the D0 firmware |
|---|
| 1903 | 2176 | */ |
|---|
| 1904 | 2177 | iwl_mvm_update_changed_regdom(mvm); |
|---|
| 2178 | + |
|---|
| 2179 | + /* Re-configure PPAG settings */ |
|---|
| 2180 | + iwl_mvm_ppag_send_cmd(mvm); |
|---|
| 1905 | 2181 | |
|---|
| 1906 | 2182 | if (!unified_image) |
|---|
| 1907 | 2183 | /* Re-configure default SAR profile */ |
|---|
| .. | .. |
|---|
| 1959 | 2235 | * 2. We are using a unified image but had an error while exiting D3 |
|---|
| 1960 | 2236 | */ |
|---|
| 1961 | 2237 | set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); |
|---|
| 1962 | | - set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); |
|---|
| 1963 | | - /* |
|---|
| 1964 | | - * When switching images we return 1, which causes mac80211 |
|---|
| 1965 | | - * to do a reconfig with IEEE80211_RECONFIG_TYPE_RESTART. |
|---|
| 1966 | | - * This type of reconfig calls iwl_mvm_restart_complete(), |
|---|
| 1967 | | - * where we unref the IWL_MVM_REF_UCODE_DOWN, so we need |
|---|
| 1968 | | - * to take the reference here. |
|---|
| 1969 | | - */ |
|---|
| 1970 | | - iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); |
|---|
| 1971 | 2238 | |
|---|
| 1972 | 2239 | return 1; |
|---|
| 1973 | 2240 | } |
|---|
| .. | .. |
|---|
| 1979 | 2246 | return __iwl_mvm_resume(mvm, false); |
|---|
| 1980 | 2247 | } |
|---|
| 1981 | 2248 | |
|---|
| 1982 | | -static int iwl_mvm_resume_d0i3(struct iwl_mvm *mvm) |
|---|
| 1983 | | -{ |
|---|
| 1984 | | - bool exit_now; |
|---|
| 1985 | | - enum iwl_d3_status d3_status; |
|---|
| 1986 | | - struct iwl_trans *trans = mvm->trans; |
|---|
| 1987 | | - |
|---|
| 1988 | | - iwl_trans_d3_resume(trans, &d3_status, false, false); |
|---|
| 1989 | | - |
|---|
| 1990 | | - /* |
|---|
| 1991 | | - * make sure to clear D0I3_DEFER_WAKEUP before |
|---|
| 1992 | | - * calling iwl_trans_resume(), which might wait |
|---|
| 1993 | | - * for d0i3 exit completion. |
|---|
| 1994 | | - */ |
|---|
| 1995 | | - mutex_lock(&mvm->d0i3_suspend_mutex); |
|---|
| 1996 | | - __clear_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags); |
|---|
| 1997 | | - exit_now = __test_and_clear_bit(D0I3_PENDING_WAKEUP, |
|---|
| 1998 | | - &mvm->d0i3_suspend_flags); |
|---|
| 1999 | | - mutex_unlock(&mvm->d0i3_suspend_mutex); |
|---|
| 2000 | | - if (exit_now) { |
|---|
| 2001 | | - IWL_DEBUG_RPM(mvm, "Run deferred d0i3 exit\n"); |
|---|
| 2002 | | - _iwl_mvm_exit_d0i3(mvm); |
|---|
| 2003 | | - } |
|---|
| 2004 | | - |
|---|
| 2005 | | - iwl_trans_resume(trans); |
|---|
| 2006 | | - |
|---|
| 2007 | | - if (iwl_mvm_enter_d0i3_on_suspend(mvm)) { |
|---|
| 2008 | | - int ret = iwl_mvm_exit_d0i3(mvm->hw->priv); |
|---|
| 2009 | | - |
|---|
| 2010 | | - if (ret) |
|---|
| 2011 | | - return ret; |
|---|
| 2012 | | - /* |
|---|
| 2013 | | - * d0i3 exit will be deferred until reconfig_complete. |
|---|
| 2014 | | - * make sure there we are out of d0i3. |
|---|
| 2015 | | - */ |
|---|
| 2016 | | - } |
|---|
| 2017 | | - return 0; |
|---|
| 2018 | | -} |
|---|
| 2019 | | - |
|---|
| 2020 | 2249 | int iwl_mvm_resume(struct ieee80211_hw *hw) |
|---|
| 2021 | 2250 | { |
|---|
| 2022 | 2251 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
|---|
| 2023 | 2252 | int ret; |
|---|
| 2024 | 2253 | |
|---|
| 2025 | | - if (mvm->trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3) |
|---|
| 2026 | | - ret = iwl_mvm_resume_d0i3(mvm); |
|---|
| 2027 | | - else |
|---|
| 2028 | | - ret = iwl_mvm_resume_d3(mvm); |
|---|
| 2254 | + ret = iwl_mvm_resume_d3(mvm); |
|---|
| 2029 | 2255 | |
|---|
| 2030 | 2256 | mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; |
|---|
| 2031 | 2257 | |
|---|
| .. | .. |
|---|
| 2054 | 2280 | |
|---|
| 2055 | 2281 | file->private_data = inode->i_private; |
|---|
| 2056 | 2282 | |
|---|
| 2057 | | - ieee80211_stop_queues(mvm->hw); |
|---|
| 2058 | 2283 | synchronize_net(); |
|---|
| 2059 | 2284 | |
|---|
| 2060 | 2285 | mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; |
|---|
| .. | .. |
|---|
| 2069 | 2294 | rtnl_unlock(); |
|---|
| 2070 | 2295 | if (err > 0) |
|---|
| 2071 | 2296 | err = -EINVAL; |
|---|
| 2072 | | - if (err) { |
|---|
| 2073 | | - ieee80211_wake_queues(mvm->hw); |
|---|
| 2297 | + if (err) |
|---|
| 2074 | 2298 | return err; |
|---|
| 2075 | | - } |
|---|
| 2299 | + |
|---|
| 2076 | 2300 | mvm->d3_test_active = true; |
|---|
| 2077 | 2301 | mvm->keep_vif = NULL; |
|---|
| 2078 | 2302 | return 0; |
|---|
| .. | .. |
|---|
| 2119 | 2343 | |
|---|
| 2120 | 2344 | mvm->d3_test_active = false; |
|---|
| 2121 | 2345 | |
|---|
| 2346 | + iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); |
|---|
| 2347 | + |
|---|
| 2122 | 2348 | rtnl_lock(); |
|---|
| 2123 | 2349 | __iwl_mvm_resume(mvm, true); |
|---|
| 2124 | 2350 | rtnl_unlock(); |
|---|
| .. | .. |
|---|
| 2149 | 2375 | ieee80211_iterate_active_interfaces_atomic( |
|---|
| 2150 | 2376 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
|---|
| 2151 | 2377 | iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif); |
|---|
| 2152 | | - |
|---|
| 2153 | | - ieee80211_wake_queues(mvm->hw); |
|---|
| 2154 | 2378 | |
|---|
| 2155 | 2379 | return 0; |
|---|
| 2156 | 2380 | } |
|---|