Commit Graph

363 Commits

Author SHA1 Message Date
Jose Ignacio Tornos Martinez e43fd6301c wifi: iwlwifi: mvm: reduce maximum RX A-MPDU size
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 09212dd727397a401aff8dfc98311697b084e507
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Aug 30 11:31:02 2023 +0300

    wifi: iwlwifi: mvm: reduce maximum RX A-MPDU size
    
    Since 1024 isn't being tested right now, allow only 512
    for now.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230830112059.6e80366716ad.I19022084ac978b9960b12b205c052a83ab141203@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:59 +01:00
Jose Ignacio Tornos Martinez a8c9ae9394 wifi: iwlwifi: add some FW misbehaviour check infrastructure
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 568db7fd27fad183d186742dc7ae6ca211ba51ff
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Jun 14 12:41:31 2023 +0300

    wifi: iwlwifi: add some FW misbehaviour check infrastructure
    
    When the firmware misbehaves (according to the driver), we
    often either ignore that, or WARN_ON, which is very noisy
    but doesn't really help.
    
    Add a little helper macro IWL_FW_CHECK() that can be used
    in place of WARN_ON() in conditions, and make it take a
    message that's printed in this case. We can also add more
    behaviour to this in the future.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230614123446.2e12ac670cea.Ia0198036b7a626876d836bd41a4b2d2b1e65c5ca@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:35 +01:00
Jose Ignacio Tornos Martinez 1deda1c51d wifi: mac80211: add helpers to access sband iftype data
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 1ec7291e247055fab3a088e1a333a31e7c06e2dd
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Jun 4 12:11:24 2023 +0300

    wifi: mac80211: add helpers to access sband iftype data
    
    There's quite a bit of code accessing sband iftype data
    (HE, HE 6 GHz, EHT) and we always need to remember to use
    the ieee80211_vif_type_p2p() helper. Add new helpers to
    directly get it from the sband/vif rather than having to
    call ieee80211_vif_type_p2p().
    
    Convert most code with the following spatch:
    
        @@
        expression vif, sband;
        @@
        -ieee80211_get_he_iftype_cap(sband, ieee80211_vif_type_p2p(vif))
        +ieee80211_get_he_iftype_cap_vif(sband, vif)
    
        @@
        expression vif, sband;
        @@
        -ieee80211_get_eht_iftype_cap(sband, ieee80211_vif_type_p2p(vif))
        +ieee80211_get_eht_iftype_cap_vif(sband, vif)
    
        @@
        expression vif, sband;
        @@
        -ieee80211_get_he_6ghz_capa(sband, ieee80211_vif_type_p2p(vif))
        +ieee80211_get_he_6ghz_capa_vif(sband, vif)
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230604120651.db099f49e764.Ie892966c49e22c7b7ee1073bc684f142debfdc84@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:26 +01:00
Jose Ignacio Tornos Martinez 626aabc5f0 wifi: iwlwifi: api: remove unused commands
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit d6b0e44e49bc55ec45b25133ba5de3bc20fbd82a
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Jun 1 17:20:05 2023 +0300

    wifi: iwlwifi: api: remove unused commands
    
    Some commands are no longer used and have broken kernel-doc links,
    so just remove them.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230601171633.3dad4ad9b53e.I018abd02d6925950b8748dfb7a59db87255fc670@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:14 +01:00
Íñigo Huguet fd9650cb20 wifi: iwlwifi: pull from TXQs with softirqs disabled
Bugzilla: https://bugzilla.redhat.com/2196821

commit 96fb6f47db24a712d650b0a9b9074873f273fb0e
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Jun 14 12:41:22 2023 +0300

    wifi: iwlwifi: pull from TXQs with softirqs disabled
    
    In mac80211, it's required that we pull from TXQs by calling
    ieee80211_tx_dequeue() only with softirqs disabled. However,
    in iwl_mvm_queue_state_change() we're often called with them
    enabled, e.g. from flush if anything was flushed, triggering
    a mac80211 warning.
    
    Fix that by disabling the softirqs across the TX call.
    
    Fixes: cfbc6c4c5b ("iwlwifi: mvm: support mac80211 TXQs model")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230614123446.0feef7fa81db.I4dd62542d955b40dd8f0af34fa4accb9d0d17c7e@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:16:40 +02:00
Íñigo Huguet a24f814536 wifi: iwlwifi: mvm: fix RFKILL report when driver is going down
Bugzilla: https://bugzilla.redhat.com/2196821

commit 22b68fc6d693e7a2b1c0eb852463f4a72522fa08
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Tue Apr 18 12:28:14 2023 +0300

    wifi: iwlwifi: mvm: fix RFKILL report when driver is going down
    
    When CSME takes ownership, the driver sets RFKILL on, and this
    triggers driver unload and sending the confirmation SAP message.
    However, when IWL_MVM_MEI_REPORT_RFKILL is set, RFKILL was not
    reported and as a result, the driver did not confirm the ownership
    transition. Fix it.
    
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230418122405.29ac3cd3df73.I96b32bc274bfe1e3871e54d3fa29c7ac4f40446f@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:16:24 +02:00
Íñigo Huguet fcb98844a3 wifi: iwlwifi: modify scan request and results when in link protection
Bugzilla: https://bugzilla.redhat.com/2196821

commit 0d2558838ee815540eb89feb9a468cb88b189661
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Tue Apr 18 12:28:11 2023 +0300

    wifi: iwlwifi: modify scan request and results when in link protection
    
    When CSME is connected and has link protection set, the driver must
    connect to the same AP CSME is connected to.
    When in link protection, modify scan request parameters to include
    only the channel of the AP CSME is connected to and scan for the
    same SSID. In addition, filter the scan results to include only
    results from the same AP. This will make sure the driver will connect
    to the same AP and will do it fast enough to keep the session alive.
    
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230418122405.c1b55de3d704.I3895eebe18b3b672607695c887d728e113fc85ec@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:16:23 +02:00
Íñigo Huguet 0bc002a7f3 wifi: iwlwifi: mvm: avoid iterating over an un-initialized list
Bugzilla: https://bugzilla.redhat.com/2196821

commit 85eb75c34eadb892d89e506619c6c49b194a392b
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Sun Apr 16 15:47:31 2023 +0300

    wifi: iwlwifi: mvm: avoid iterating over an un-initialized list
    
    The initiator smooth list is initialized only in iwl_mvm_up(), but is
    cleared in iwl_mvm_mac_stop. This may result in iterating over the
    list before it was initialized in case iwl_mvm_up() failed early.
    Fix it by moving the list initialization to an earlier stage.
    
    Fixes: b68bd2e314 ("iwlwifi: mvm: Add FTM initiator RTT smoothing logic")
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230416154301.b50b1fe9a576.Ie348ffae110612d2e252ac120a3ba0aea063b1b6@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:15:56 +02:00
Íñigo Huguet 61a8d0b501 wifi: iwlwifi: mvm: fix the order of TIMING_MEASUREMENT notifications
Bugzilla: https://bugzilla.redhat.com/2196821

commit d8f975594da8dc59b463db9bcc0bec3fd961630b
Author: Gregory Greenman <gregory.greenman@intel.com>
Date:   Mon Apr 10 17:07:20 2023 +0300

    wifi: iwlwifi: mvm: fix the order of TIMING_MEASUREMENT notifications
    
    Host commands and notifications are expected to be ordered in
    iwl_mvm_groups array. Fix the order of two new TIMING_MEASUREMENT
    notifications.
    
    Fixes: c7eca79def44 ("wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status")
    Reported-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/linux-wireless/20230331175121.GA3127046@dev-arch.thelio-3990X/
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Tested-by: Nathan Chancellor <nathan@kernel.org>
    Link: https://lore.kernel.org/r/20230410140721.897683-1-gregory.greenman@intel.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:15:31 +02:00
Íñigo Huguet f563491464 wifi: iwlwifi: mvm: adjust SMPS for MLO
Bugzilla: https://bugzilla.redhat.com/2196821

commit 1a3e70391e55d12010073935e383629ab856528a
Author: Gregory Greenman <gregory.greenman@intel.com>
Date:   Tue Mar 28 10:59:01 2023 +0300

    wifi: iwlwifi: mvm: adjust SMPS for MLO
    
    Configure SMPS per-link. Add link_id parameter to
    iwl_mvm_update_smps() and refactor iwl_mvm_intf_dual_chain_req()
    since it has to handle all active links.
    
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230328104949.da6a19db562c.Ic88b02338c8973f2934439ac3ee77c7451bc0054@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:15:12 +02:00
Íñigo Huguet 4a9437e15a wifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops
Bugzilla: https://bugzilla.redhat.com/2196821

commit cbce62a315f67e3badfd3f4a7b33e21c90ddc415
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Tue Mar 28 10:58:50 2023 +0300

    wifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops
    
    Add all the callbacks that are not changing with the
    new MLD API and register to mac80211 with the new ops.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230328104948.a2f724342522.I5d1d6a8f5f14e6275da56ea704c3c0063fee5226@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:15:09 +02:00
Íñigo Huguet 76e30f1382 wifi: iwlwifi: mvm: add an indication that the new MLD API is used
Bugzilla: https://bugzilla.redhat.com/2196821

commit 9e2de88d28b235a65db6209e331496f8f2fd203a
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Tue Mar 28 10:58:43 2023 +0300

    wifi: iwlwifi: mvm: add an indication that the new MLD API is used
    
    WE can't mix between the new MLD API and the old API.
    I.e. - we can't send one of the new cmds and then one of the old ones.
    This will cause a FW assert. So we need an indication what API should be
    used. We use the new API if:
    1. FW supports it
    2. We are registered to mac80211 with the new MLD ops
    Add an indication which will only be true if both conditions are true.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230328104948.5756b0907403.I0adce36d1783cce23d0e080e3c4a8953db33b515@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:15:07 +02:00
Íñigo Huguet c09521aa93 wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status
Bugzilla: https://bugzilla.redhat.com/2196821

commit c7eca79def44f1faf024d8442044287bef749818
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Mon Mar 20 12:33:04 2023 +0200

    wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status
    
    For TM/FTM frames, report the hardware timestamps reported by the
    fw as part of the RX/TX status. Since the fw reports the timestamps
    in a dedicated notification (and not as part of the RX/TX status),
    hold the frame until the fw timestamps notification is received.
    Timestamping is enabled when a station is connected and disabled
    when disconnected. For AP interface, only the first station will
    have timestamping enabled since the fw only supports timestamping
    for one peer.
    
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230320122330.e0392d498101.I9bf12c8ecfb3f17253a13dc48a48647ddd6e7855@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:14:55 +02:00
Íñigo Huguet 53d3aedce9 wifi: iwlwifi: mvm: add support for PTP HW clock (PHC)
Bugzilla: https://bugzilla.redhat.com/2196821

commit 1595ecce1cf32688760281f40b58b7a1d4a69aa9
Author: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
Date:   Mon Mar 20 12:33:02 2023 +0200

    wifi: iwlwifi: mvm: add support for PTP HW clock (PHC)
    
    Add support to enable/disable PHC clock. The PHC clock includes support
    for fetching the cross timestamp i.e. a non-atomic snapshot of the current
    time from the hardware (WiFi device) clock and system clock (wall-clock)
    simultaneously.
    
    Signed-off-by: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230320122330.ae1d64f513b9.Ib3b6ad61c9fa2fc5908f1e0d6f59f4af6eec1a77@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:14:54 +02:00
Íñigo Huguet 28389a2a93 wifi: iwlwifi: mvm: add support for the new STA related commands
Bugzilla: https://bugzilla.redhat.com/2196821

commit 006c152ac9e56ac7871efa995854c3ff8cf6915a
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Tue Mar 14 19:49:20 2023 +0200

    wifi: iwlwifi: mvm: add support for the new STA related commands
    
    As a part of the new MLD FW API changes, we have new commands for STA
    related operations (add/remove/aux/disable tx).
    Add structures and enum definitions, along with part of the functions
    that sends this commands.
    This functions will be in used and more will be added in the next patches.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230314194113.132873ce015c.I7b12a77e5be066730762e6ceeeaa7190293c3df1@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:14:48 +02:00
Íñigo Huguet c82cff760e wifi: iwlwifi: mvm: add support for the new LINK command
Bugzilla: https://bugzilla.redhat.com/2196821

commit 55eb1c5fa4b260491d8be3299d4546d0b34465f4
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Tue Mar 14 19:49:19 2023 +0200

    wifi: iwlwifi: mvm: add support for the new LINK command
    
    As a part of the new MLD FW API changes, we have a new LINK command
    to add/remove/configure a link.
    Add structures and enum definitions, along with the functions that
    sends this command (i.e. add, remove and change mac ctxt).
    These functions will be in used in the next patches.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230314194113.d7808329effb.I13bea2db206b78540bc866bc3ab755ad5be78c53@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:14:48 +02:00
Íñigo Huguet 9d48d238dc wifi: iwlwifi: mvm: add support for the new MAC CTXT command
Bugzilla: https://bugzilla.redhat.com/2196821

commit 9be162a7b670b7e8dbada3c139d77961f457a34d
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Tue Mar 14 19:49:18 2023 +0200

    wifi: iwlwifi: mvm: add support for the new MAC CTXT command
    
    As a part of the new MLD FW API changes, we have a new MAC CTXT command.
    Add structures and enum definitions, along with the functions that
    sends this command (i.e. add, remove and change mac ctxt).
    This functions will be in used in the next patches.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230314194113.99a41a5bc55f.I310312c829f5f2f69b64fcddce487b1eab80165b@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:14:48 +02:00
Jose Ignacio Tornos Martinez 844d94f4d1 wifi: iwlwifi: mvm: Support STEP equalizer settings from BIOS.
Bugzilla: https://bugzilla.redhat.com/2178526

commit 09b4c35d73a59c092cf8466958b62cf896786472
Author: Ayala Barazani <ayala.barazani@intel.com>
Date:   Fri Jan 27 00:28:20 2023 +0200

    wifi: iwlwifi: mvm: Support STEP equalizer settings from BIOS.
    
    Read the STEP equalizer parameters from the BIOS during init
    and transfer it to the firmware.
    
    This table provides values to configure an equalizer at the transmitter
    that can be used to compensate for PCB channel attenuation.
    
    Signed-off-by: Ayala Barazani <ayala.barazani@intel.com>
    Link: https://lore.kernel.org/r/20230127002430.f25f871c5e17.I8390ab916c8f681229433ebc576ed37a594c6d30@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:17:57 +02:00
Jose Ignacio Tornos Martinez 792ad000c4 wifi: iwlwifi: mvm: Don't use deprecated register
Bugzilla: https://bugzilla.redhat.com/2178526

commit b201944af11f7b2c860bef5cb562eb7163427724
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Mon Dec 5 10:35:44 2022 +0200

    wifi: iwlwifi: mvm: Don't use deprecated register
    
    The CSR_HW_IF_CONFIG_REG register is no longer in use from
    IWL_DEVICE_FAMILY_AX210 and on.
    This register uses now for CSR_CTXT_INFO_BOOT_CTRL
    which has a different meaning and a different format.
    Currently we're writing to the register according to
    CSR_HW_IF_CONFIG_REGs format, regardless to the device family.
    This causes to miss-interpretation of the register value, as it is
    parsed according to CSR_CTXT_INFO_BOOT_CTRLs format for devices
    families >= IWL_DEVICE_FAMILY_AX210.
    Fix this by writing to the register according to the old format
    only for the relevant hardware.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20221205102808.8e91eb10dc7d.I3882a2452785ef8b455d99af235e4477917bf46d@changeid

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:17:04 +02:00
Jose Ignacio Tornos Martinez 7228b1c11c wifi: iwlwifi: mvm: trigger PCI re-enumeration in case of PLDR sync
Bugzilla: https://bugzilla.redhat.com/2178526

commit b8133439bda70ff24e3bdb89bb55d204c3fea606
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Wed Nov 23 23:02:07 2022 +0200

    wifi: iwlwifi: mvm: trigger PCI re-enumeration in case of PLDR sync
    
    When doing the PLDR flow, the fw goes through a re-read and needs
    PCI re-enumeration in order to recover. In this case, skip the mac
    start retry and fw dumps as all the fw and registers are invalid
    until the PCI re-enumeration.
    
    In addition, print the register that shows the re-read counter
    when loading the fw.
    
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Link: https://lore.kernel.org/r/20221123225313.9ae77968961e.Ie06e886cef4b5921b65dacb7724db1276bed38cb@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:16:09 +02:00
Jose Ignacio Tornos Martinez d12ba2938a wifi: iwlwifi: mvm: add support for EHT 1K aggregation size
Bugzilla: https://bugzilla.redhat.com/2178526

commit 64e7dd3f9be68a53e760f184a6d8049a1121a060
Author: Mordechay Goodstein <mordechay.goodstein@intel.com>
Date:   Tue Nov 22 22:10:35 2022 +0200

    wifi: iwlwifi: mvm: add support for EHT 1K aggregation size
    
    In 11be we can receive 1K aggregation size so update our max HW rx
    aggregation for mac80211 usage.
    
    Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
    Link: https://lore.kernel.org/r/20221122220713.ef0431f64975.Ie4d90c376c822694f4523ff0fb5731f20004c24d@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:16:08 +02:00
Jose Ignacio Tornos Martinez 21dc129c46 wifi: iwlwifi: mvm: support new key API
Bugzilla: https://bugzilla.redhat.com/2178526

commit 5c75a208c2449c6ea24f07610cc052f6a352246c
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Nov 2 16:59:53 2022 +0200

    wifi: iwlwifi: mvm: support new key API
    
    In order to support MLD, the key API is also changing to have
    station masks instead of just the station ID etc. Change the
    driver to support this, and add the new code in a new file so
    it's more clearly separated.
    
    For now this isn't separated at the mac80211 ops level, which
    we wanted to do, but we're calling these functions in a place
    when pre-start keys are installed in iwl_mvm_start_ap_ibss(),
    and the function has some glue logic to mac80211. We may want
    to change that later.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20221102165239.ed9ccd814abc.Iacc7360de68807fbac19e5b67c86504b39cc15df@changeid

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:15:56 +02:00
Jose Ignacio Tornos Martinez 1560e263cf wifi: iwlwifi: mei: make sure ownership confirmed message is sent
Bugzilla: https://bugzilla.redhat.com/2178526

commit 5aa7ce31bd84c2f4f059200f06c537c920cbb458
Author: Avraham Stern <avraham.stern@intel.com>
Date:   Sun Oct 30 19:17:41 2022 +0200

    wifi: iwlwifi: mei: make sure ownership confirmed message is sent
    
    It is possible that CSME will try to take ownership while the driver
    is stopping. In this case, if the CSME takes ownership message arrives
    after the driver started unregistering, the iwl_mei_cache->ops is
    already invalid, so the host will not answer with the ownership
    confirmed message.
    Similarly, if the take ownership message arrived after the mac was
    stopped or when iwl_mvm_up() failed, setting rfkill will not trigger
    sending the confirm message. As a result, CSME will not take
    ownership, which will result in a disconnection.
    
    Fix it by sending the ownership confirmed message immediately in such
    cases.
    
    Fixes: 2da4366f9e2c ("iwlwifi: mei: add the driver to allow cooperation with CSME")
    Signed-off-by: Avraham Stern <avraham.stern@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20221030191011.b2a4c009e3e6.I7f931b7ee8b168e8ac88b11f23bff98b7ed3cb19@changeid

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-09 08:15:54 +02:00
Jose Ignacio Tornos Martinez 4d443217de wifi: iwlwifi: mvm: protect TXQ list manipulation
Bugzilla: https://bugzilla.redhat.com/2183490

commit 923bf981eb6ecc027227716e30701bdcc1845fbf
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Mar 17 10:53:25 2023 +0100

    wifi: iwlwifi: mvm: protect TXQ list manipulation
    
    Some recent upstream debugging uncovered the fact that in
    iwlwifi, the TXQ list manipulation is racy.
    
    Introduce a new state bit for when the TXQ is completely
    ready and can be used without locking, and if that's not
    set yet acquire the lock to check everything correctly.
    
    Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
    Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-03-31 14:56:07 +02:00
Jose Ignacio Tornos Martinez 11d7b51846 wifi: iwlwifi: mvm: fix mvmtxq->stopped handling
Bugzilla: https://bugzilla.redhat.com/2183490

commit b58e3d4311b54b6dd0e37165277965da0c9eb21d
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Mar 17 10:53:24 2023 +0100

    wifi: iwlwifi: mvm: fix mvmtxq->stopped handling
    
    This could race if the queue is redirected while full, then
    the flushing internally would start it while it's not yet
    usable again. Fix it by using two state bits instead of just
    one.
    
    Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
    Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-03-31 14:56:07 +02:00
Jose Ignacio Tornos Martinez 103fcd2675 wifi: iwlwifi: Track scan_cmd allocation size explicitly
Bugzilla: https://bugzilla.redhat.com/2136124

commit 72c08d9f4c72787dde541ae5ed278e46771c9f2a
Author: Kees Cook <keescook@chromium.org>
Date:   Fri Sep 23 15:08:53 2022 -0700

    wifi: iwlwifi: Track scan_cmd allocation size explicitly
    
    In preparation for reducing the use of ksize(), explicitly track the
    size of scan_cmd allocations. This also allows for noticing if the scan
    size changes unexpectedly. Note that using ksize() was already incorrect
    here, in the sense that ksize() would not match the actual allocation
    size, which would trigger future run-time allocation bounds checking.
    (In other words, memset() may know how large scan_cmd was allocated for,
    but ksize() will return the upper bounds of the actually allocated memory,
    causing a run-time warning about an overflow.)
    
    Cc: Gregory Greenman <gregory.greenman@intel.com>
    Cc: Kalle Valo <kvalo@kernel.org>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Cc: Luca Coelho <luciano.coelho@intel.com>
    Cc: Johannes Berg <johannes.berg@intel.com>
    Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    Cc: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Cc: Ilan Peer <ilan.peer@intel.com>
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20220923220853.3302056-1-keescook@chromium.org

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:42:08 +01:00
Jose Ignacio Tornos Martinez fa83bec81b wifi: iwlwifi: mvm: Add handling for scan offload match info notification
Bugzilla: https://bugzilla.redhat.com/2136124

commit 5ac54afd4d97ad8d94fe250c83b1924eb6d2268c
Author: Ilan Peer <ilan.peer@intel.com>
Date:   Tue Sep 6 16:42:16 2022 +0300

    wifi: iwlwifi: mvm: Add handling for scan offload match info notification
    
    To support FW versions that send the scan match information as
    an asynchronous notification.
    
    Signed-off-by: Ilan Peer <ilan.peer@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20220906161827.bbc5602d0b6f.I1329c231f82e7bf18f7dba0ccbd9f2d4080cbfc1@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:41:09 +01:00
Jose Ignacio Tornos Martinez ebf72a178e wifi: iwlwifi: mvm: Add support for d3 end notification
Bugzilla: https://bugzilla.redhat.com/2136124

commit c39e718a28d8e48f9b41b9ad3bed031188a07bd9
Author: Haim Dreyfuss <haim.dreyfuss@intel.com>
Date:   Tue Sep 6 16:42:14 2022 +0300

    wifi: iwlwifi: mvm: Add support for d3 end notification
    
    Due to IMR, when host returns from hibernate, commands cannot
    be sent as part of the resume flow, and so after ending
    d3 the FW needs to send notifications instead of responses.
    This notification indicates whether a fw reset is required.
    
    Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
    Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20220906161827.898ecba881b2.I13eb69bb5af08b9ac33043647eaed6b8d50e8659@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:41:09 +01:00
Jose Ignacio Tornos Martinez 53e0f759b4 wifi: iwlwifi: mvm: Add support for wowlan wake packet notification
Bugzilla: https://bugzilla.redhat.com/2136124

commit 219ed58feda9829a3df595aad65bdaacb005512d
Author: Haim Dreyfuss <haim.dreyfuss@intel.com>
Date:   Tue Sep 6 16:42:13 2022 +0300

    wifi: iwlwifi: mvm: Add support for wowlan wake packet notification
    
    The wowlan info notification is quite big.
    (~750 bytes without the wake packet itself).
    The max FW notification size is ~2K.
    There might be cases where the wake packet gets truncated because of
    this limit.
    
    Separating the wake packet from the wowlan info notification allows us to
    get more data without trimming it.
    
    Note: we currently limit the wake packet to 1600 bytes.
    
    Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
    Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20220906161827.06d1e6aecf10.Ib3d6a46ffe71d10cbc69bdb5654e6b14c28df245@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:41:08 +01:00
Jose Ignacio Tornos Martinez 5f356b36db wifi: iwlwifi: mvm: Add support for wowlan info notification
Bugzilla: https://bugzilla.redhat.com/2136124

commit 4da46a06d4430a18fddaa43b88dc1fcefdb8cf04
Author: Haim Dreyfuss <haim.dreyfuss@intel.com>
Date:   Tue Sep 6 16:42:12 2022 +0300

    wifi: iwlwifi: mvm: Add support for wowlan info notification
    
    IMR (Isolated Memory Regions) is a mechanism to protect memory regions
    from unwarranted access by agents in the system that should not have access
    to that memory.
    
    When IMR is enabled, pages in the DRAM will be located within the IMR
    memory space, accessible only by the device.
    As a side effect, during S4 (a.k.a hibernate) the IMR memory space
    is not retained.
    
    While the DRAM is saved to the disk and restored by the OS upon resume,
    the IMR, which is hidden from the OS neither saved upon suspend nor
    restored upon resume.
    
    As a consequence of the above, it turned out that commands cannot
    be sent as part of the resume flow, and so after ending
    d3 the FW needs to use notifications instead of cmd-resp.
    
    The resume flow becomes asynchronous, with a series
    of notifications, starting with wowlan_info_notif, through
    wowlan_pkt_notif and complete the resume flow by d3_end_notif.
    
    This patch adds the support for wowlan info notification.
    
    The wake packet has been removed from the wowlan info struct
    and will be handled in a dedicated notification.
    
    Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
    Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20220906161827.3ce8deefd929.Ieba8610e8bb4bec788076371ae38becb4a3d20d5@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:41:07 +01:00
Jose Ignacio Tornos Martinez 6a36e19958 wifi: iwlwifi: mvm: don't check D0I3 version
Bugzilla: https://bugzilla.redhat.com/2136124

commit 731d5aa91cf58fe7a082c0165f33ec8433d792cc
Author: Haim Dreyfuss <haim.dreyfuss@intel.com>
Date:   Tue Sep 6 16:42:11 2022 +0300

    wifi: iwlwifi: mvm: don't check D0I3 version
    
    This code is dead, even old FW versions don't use it.
    The IWL_D0I3_RESET_REQUIRE flag will be sent by the FW via a notification,
    instead of command, the notification handler will be introduced later
    in the series.
    
    Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20220906161827.87c82482229a.I70456c38ed8f7beb7d62dd618f58e7dc0a7d33b2@changeid
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:41:07 +01:00
Íñigo Huguet eb710d34a5 wifi: mac80211: move interface config to new struct
Bugzilla: https://bugzilla.redhat.com/2136122

Conflicts: removed chunks of unsupported drivers wfx, wcn36xx and vt6655

commit f276e20b182dbfc069d192fda259d85feea71143
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue May 10 17:05:04 2022 +0200

    wifi: mac80211: move interface config to new struct
    
    We'll use bss_conf for per-link configuration later, so
    move out all the non-link-specific data out into a new
    struct ieee80211_vif_cfg used in the vif.
    
    Some adjustments were done with the following spatch:
    
        @@
        expression sdata;
        struct ieee80211_vif *vifp;
        identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
        @@
        (
        -sdata->vif.bss_conf.var
        +sdata->vif.cfg.var
        |
        -vifp->bss_conf.var
        +vifp->cfg.var
        )
    
        @bss_conf@
        struct ieee80211_bss_conf *bss_conf;
        identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
        @@
        -bss_conf->var
        +vif_cfg->var
    
    (though more manual fixups were needed, e.g. replacing
    "vif_cfg->" by "vif->cfg." in many files.)
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:56:58 +01:00
Íñigo Huguet 2a8f41a69c iwlwifi: support new queue allocation command
Bugzilla: https://bugzilla.redhat.com/2059999

commit 227f25972c5adc86aeae86494c0269256b235489
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Feb 10 18:22:30 2022 +0200

    iwlwifi: support new queue allocation command
    
    Newer firmware versions will support a new queue allocation
    command, in order to deal with MLD where multiple stations
    are used for a single queue. Add support for the new command.
    
    This requires some refactoring of the queue allocation API,
    which now gets
     - the station mask instead of the station ID
     - the flags without the "enable" flag, since that's no longer
       used in the new API
    
    Additionally, this new API now requires that we remove queues
    before removing a station, the firmware will no longer do that
    internally. Also add support for that.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220210181930.acbf22ac2b66.I2bf38578c5ca1f7ffb2011a782f772db92fc4965@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:56 +02:00
Íñigo Huguet 06867f68e0 iwlwifi: mvm: rfi: handle deactivation notification
Bugzilla: https://bugzilla.redhat.com/2059999

commit 63b62a2df04135ca1da7c735ac18fc34cd87bbfb
Author: Gregory Greenman <gregory.greenman@intel.com>
Date:   Sat Feb 5 11:21:31 2022 +0200

    iwlwifi: mvm: rfi: handle deactivation notification
    
    Sometimes RFIm can be deactivated in FW due to internal
    errors. In this case, FW will send a notification to the
    driver about that. Add a log message in this case since
    FW logs are not always available.
    
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220205112029.48d0a1624fec.I8f9271959fc53223fa329ab097b12fd69b498b71@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:53 +02:00
Íñigo Huguet 655920ee80 iwlwifi: remove unused DC2DC_CONFIG_CMD definitions
Bugzilla: https://bugzilla.redhat.com/2059999

commit ad8860fc2ce2badcbfe40f49dec13e8ce49c0c65
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Sun Jan 30 11:53:02 2022 +0200

    iwlwifi: remove unused DC2DC_CONFIG_CMD definitions
    
    We haven't used this command for a long time, if ever, so we can
    remove all related definitions.
    
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220130115024.26c0044110cc.Ie0d215a22618e7a3ecc39eca349914981b608b4d@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:50 +02:00
Íñigo Huguet 30a812d698 iwlwifi: move symbols into a separate namespace
Bugzilla: https://bugzilla.redhat.com/2059999

commit 872f6bb08fc23c6750a3923f74cfaaacd0971ca3
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Jan 30 11:53:00 2022 +0200

    iwlwifi: move symbols into a separate namespace
    
    Nobody other than iwlwifi itself should be accessing the symbols
    that it exports, so make that clear by moving them into a separate
    new namespace ("IWLWIFI").
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220130115024.67eba0b9867d.I6291815892746956c36489081f24f4f95b5160e4@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:50 +02:00
Íñigo Huguet c33f65f97c iwlwifi: fw: make dump_start callback void
Bugzilla: https://bugzilla.redhat.com/2059999

commit f5cdcb866741bebc36b2f41d595b8272f308b4c5
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Jan 30 11:52:59 2022 +0200

    iwlwifi: fw: make dump_start callback void
    
    We never return errors there, so just make it void.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220130115024.375b3a28d89e.Ia76e9bf13e26eb148abfebdaf859eab1b81d2af1@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:50 +02:00
Íñigo Huguet 0fdf25c478 iwlwifi: mvm: don't iterate unadded vifs when handling FW SMPS req
Bugzilla: https://bugzilla.redhat.com/2059999

commit 8a265d1a619c16400406c9d598411850ee104aed
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Sat Jan 29 13:16:15 2022 +0200

    iwlwifi: mvm: don't iterate unadded vifs when handling FW SMPS req
    
    We may not have all the interfaces added to the driver when we get the
    THERMAL_DUAL_CHAIN_REQUEST notification from the FW, so instead of
    iterating all vifs to update SMPS, iterate only the ones that are
    already assigned.  The interfaces that were not assigned yet, will be
    updated accordingly when we start using them.
    
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Fixes: 2a7ce54ccc ("iwlwifi: mvm: honour firmware SMPS requests")
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220129105618.9416aade2ba0.I0b71142f89e3f158aa058a1dfb2517c8c1fa3726@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:48 +02:00
Íñigo Huguet ded21aefdd iwlwifi: de-const properly where needed
Bugzilla: https://bugzilla.redhat.com/2059999

commit 0301bcd599e552c38adf6771c25ff99680b9c4ee
Author: Bjoern A. Zeeb <bz@FreeBSD.ORG>
Date:   Fri Jan 28 15:34:26 2022 +0200

    iwlwifi: de-const properly where needed
    
    In order to de-const variables simply casting through (void *) is
    not enough: "cast from 'const .. *' to 'void *' drops const qualifier".
    Cast through (uintptr_t) as well [1] to make this compile on systems
    with more strict requirements.
    In addition passing const void *data to dma_map_single() also
    drops the (const) qualifier.  De-constify on variable on assignment
    which may be overwritten later.  In either case the (void *) cast
    to dma_map_single() is not needed (anymore) either.
    
    [1] See __DECONST() in sys/sys/cdefs.h in FreeBSD
    
    Sponsored by:  The FreeBSD Foundation
    Signed-off-by: Bjoern A. Zeeb <bz@FreeBSD.ORG>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220128153014.eb696eb56bf6.Ide1dd041f9b908c5154a600286a7453750b0704a@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:46 +02:00
Íñigo Huguet 1d66275465 iwlwifi: mvm: offload channel switch timing to FW
Bugzilla: https://bugzilla.redhat.com/2059999

commit ad12b23131242714c814de8a3ba4e099674ab6a9
Author: Nathan Errera <nathan.errera@intel.com>
Date:   Fri Jan 28 15:34:21 2022 +0200

    iwlwifi: mvm: offload channel switch timing to FW
    
    Since FW is now in charge of timing the channel switch, there is no need
    to send the add/modify/remove time event command to fw with every (e)CSA
    element.
    However, the driver needs to cancel the channel switch if the CS start
    notification arrives and it does not know about an ongoing channel switch.
    
    Signed-off-by: Nathan Errera <nathan.errera@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20220128153013.ac3af0ff22c7.Ie87c62047b71b93b12aa80b5dc5391b4798dbe97@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:46 +02:00
Íñigo Huguet 57c5d7680e ieee80211: add EHT 1K aggregation definitions
Bugzilla: https://bugzilla.redhat.com/2059999

commit 2a2c86f15e17c5013b9897b67d895e64a25ae3cb
Author: Mordechay Goodstein <mordechay.goodstein@intel.com>
Date:   Mon Feb 14 17:29:52 2022 +0100

    ieee80211: add EHT 1K aggregation definitions
    
    We add the fields for parsing extended ADDBA request/respond,
    and new max 1K aggregation for limit ADDBA request/respond.
    
    Adjust drivers to use the proper macro, IEEE80211_MAX_AMPDU_BUF ->
    IEEE80211_MAX_AMPDU_BUF_HE.
    
    Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
    Link: https://lore.kernel.org/r/20220214173004.b8b447ce95b7.I0ee2554c94e89abc7a752b0f7cc7fd79c273efea@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:43 +02:00
Íñigo Huguet a96ff8184a iwlwifi: remove deprecated broadcast filtering feature
Bugzilla: https://bugzilla.redhat.com/2059999

commit 92883a524ae918736a7b8acef98698075507b8c1
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Fri Jan 28 14:48:50 2022 +0200

    iwlwifi: remove deprecated broadcast filtering feature
    
    This feature has been deprecated and should not be used anymore.  With
    newer firmwares, namely *-67.ucode and above, trying to use it causes an
    assertion failure in the FW, similar to this:
    
    [Tue Jan 11 20:05:24 2022] iwlwifi 0000:04:00.0: 0x00001062 | ADVANCED_SYSASSERT
    
    In order to prevent this feature from being used, remove it entirely
    and get rid of the Kconfig option that
    enables it (IWLWIFI_BCAST_FILTERING).
    
    Fixes: cbaa6aeedee5 ("iwlwifi: bump FW API to 67 for AX devices")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=215488
    Cc: stable@vger.kernel.org # 5.16.x
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/iwlwifi.20220128144623.9241e049f13e.Ia4f282813ca2ddd24c13427823519113f2bbebf2@changeid

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:07 +02:00
Íñigo Huguet fa85cef2a6 codel: remove unnecessary pkt_sched.h include
Bugzilla: https://bugzilla.redhat.com/2059999

commit e6e5904455815626b711c7d48cacd253f4d72f84
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Tue Dec 21 11:39:41 2021 -0800

    codel: remove unnecessary pkt_sched.h include
    
    Commit d068ca2ae2 ("codel: split into multiple files") moved all
    Qdisc-related code to codel_qdisc.h, move the include of pkt_sched.h
    as well.
    
    This is similar to the previous commit, although we don't care as
    much about incremental builds after pkt_sched.h was touched itself
    it is included by net/sch_generic.h which is modified ~20 times
    a year.
    
    This decreases the incremental build size after touching pkt_sched.h
    from 1592 to 617 objects.
    
    Fix unmasked missing includes in WiFi drivers.
    
    Acked-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20211221193941.3805147-2-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:04 +02:00
Íñigo Huguet 5016b42a34 iwlwifi: mvm: remove card state notification code
Bugzilla: https://bugzilla.redhat.com/2059999

commit 73ca8763eb5a524c2cfadb6ee429ab0da3a42102
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Dec 19 13:28:33 2021 +0200

    iwlwifi: mvm: remove card state notification code
    
    This notification ID was actually used for something else we
    never implemented, but luckily we only had some debug code
    here. Just remove it.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211219132536.a67b5b9db259.Ic55b306fcd2a3525b3993f4b7e00622dd95053ba@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:02 +02:00
Íñigo Huguet 10c9581694 iwlwifi: return op_mode only in case the failure is from MEI
Bugzilla: https://bugzilla.redhat.com/2059999

commit 22a1ee8e1e59ccbe6eb9072604e0625ac736228c
Author: Mordechay Goodstein <mordechay.goodstein@intel.com>
Date:   Sun Dec 19 13:28:30 2021 +0200

    iwlwifi: return op_mode only in case the failure is from MEI
    
    Currently we always return the op_mode with valid pointer in case
    getting NVM failed, while it's only relevant for cases that CSME is the
    owner of the nic.
    
    Fix this by checking also who's the owner of the nic.
    
    Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211219132536.b1e96021b616.Id0164855f2dd01ecdecf79b239d6ee5974882245@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:02 +02:00
Íñigo Huguet 2a26130e1b iwlwifi: yoyo: support TLV-based firmware reset
Bugzilla: https://bugzilla.redhat.com/2059999

commit ddb6b76b6f96afb2977c3c460acf18cc0dd13cae
Author: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Date:   Sun Dec 19 12:18:13 2021 +0200

    iwlwifi: yoyo: support TLV-based firmware reset
    
    Support resetting the firmware via TLV-based debugging.  When applied,
    this will cause the driver to reset the firmware when the debugging
    is triggered.
    
    Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211219121514.d59b29653a1e.I7b3be4a1ad1a9d5d0e86259740e89ac113c9348b@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:01 +02:00
Íñigo Huguet f2a5a11776 iwlwifi: mvm: don't trust hardware queue number
Bugzilla: https://bugzilla.redhat.com/2059999

commit 6438e3e0c5e8171d461428bc83f90d2a52a4db5a
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Dec 19 12:18:11 2021 +0200

    iwlwifi: mvm: don't trust hardware queue number
    
    We don't really have much reason to mistrust the hardware
    queue number, but if it gets mixed up we still don't want
    to access some data out of bounds, so drop such frames.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211219121514.539aecb91247.I6e555a5185bad30d7d1a4659f9c0b99325425f18@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:01 +02:00
Íñigo Huguet 6a3fe69566 iwlwifi: mvm: fix imbalanced locking in iwl_mvm_start_get_nvm()
Bugzilla: https://bugzilla.redhat.com/2059999

commit 97c0979d0d729cded6eae0d7b22d06a2eeeca3a4
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Sun Dec 19 11:01:28 2021 +0200

    iwlwifi: mvm: fix imbalanced locking in iwl_mvm_start_get_nvm()
    
    If iwl_transt_start_hw() failed, we were returning without calling
    wiphy_unlock() and rtnl_unlock(), causing a locking imbalance:
    
    drivers/net/wireless/intel/iwlwifi/mvm/ops.c:686:12: warning: context imbalance in 'iwl_mvm_start_get_nvm' - wrong count at exit
    
    Fix that by adding the unlock calls.
    
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/20211219090128.42417-2-luca@coelho.fi

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:58 +02:00
Íñigo Huguet e4463d8f26 iwlwifi: mvm: add missing min_size to kernel-doc
Bugzilla: https://bugzilla.redhat.com/2059999

commit 80cba44ff61bb2fd84af7b5f7d59511a8553d3f3
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Dec 19 11:01:26 2021 +0200

    iwlwifi: mvm: add missing min_size to kernel-doc
    
    On struct iwl_rx_handlers we should document the min_size
    member, do that.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/iwlwifi.20211219110000.0c42c428bc6b.I8bfa49d534acc5f513f2fb3dff2d6f22f6c45071@changeid

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:57 +02:00
Íñigo Huguet 918228dc1a iwlwifi: mvm: optionally suppress assert log
Bugzilla: https://bugzilla.redhat.com/2059999

Conflicts: minor content conflicts due to later commits already backported
  5283dd677e52a iwlwifi: mvm: retry init flow if failed

commit 4b992db6ebdaaee244a7931753f5b49d049a760a
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Dec 4 17:49:44 2021 +0200

    iwlwifi: mvm: optionally suppress assert log
    
    Normally, when we hit an assert, we print out all the
    assert data. However, in certain tests, when we trigger
    it from debugfs intentionally, that can be useless and
    confusing.
    
    Allow writing the string "nolog\n" to the fw_nmi and
    fw_restart files suppressing the assert dump as well
    as - in the case of fw_restart - the
    
      iwlwifi 0000:00:00.0: FW error in SYNC CMD REPLY_ERROR
    
    message.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204174546.75e29a2ab68d.Id3064feda2ce7a77c116c6d6e71ce5ff447c6e86@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:43 +02:00
Íñigo Huguet 0771f06ff8 iwlwifi: support SAR GEO Offset Mapping override via BIOS
Bugzilla: https://bugzilla.redhat.com/2059999

commit c593d2fae592aefaec86f012e1354400b8ac4715
Author: Ayala Barazani <ayala.barazani@intel.com>
Date:   Sat Dec 4 17:49:37 2021 +0200

    iwlwifi: support SAR GEO Offset Mapping override via BIOS
    
    Support reading the SAR Geographic Offset Mapping (SGOM) table from UEFI
    to allow OEMs to override the values according to geographical regions.
    
    Signed-off-by: Ayala Barazani <ayala.barazani@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204174546.e6dfd8b5dd40.Ibc9a8fe2bfde345f49df5d57ec56663da6a53dc4@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:42 +02:00
Íñigo Huguet 03c8175924 iwlwifi: mvm: always use 4K RB size by default
Bugzilla: https://bugzilla.redhat.com/2059999

commit b780c10f1f8c504264dfb7da3c735ce80c586a6b
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Dec 4 17:49:35 2021 +0200

    iwlwifi: mvm: always use 4K RB size by default
    
    When we use 2K RBs, we cannot receive all valid 802.11 frames,
    including e.g. long beacons, since up to 2304 bytes are valid
    (plus metadata and also encryption overhead etc.). Increase
    the RB size to be always 4K to avoid that.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204174545.675781ab0da5.I5c653f4c7dd726f8ad40077e4a109b85e7c0cdb1@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:42 +02:00
Íñigo Huguet b3f6455a8e iwlwifi: mvm/api: define system control command
Bugzilla: https://bugzilla.redhat.com/2059999

commit e93d4aaf4b13963bdd50d11e154ecc251cba4ac7
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Dec 4 17:49:34 2021 +0200

    iwlwifi: mvm/api: define system control command
    
    The firmware is exposing a new system features control command,
    define the necessary data structures etc. Rename "soc.h" to
    "system.h" since the SoC command is also in the system group
    and adding another file for just one more struct seemed like a
    waste of files.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204174545.94a120687887.I79acffcf0793ea9e4ddec24b06420961bfb4fe94@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:42 +02:00
Íñigo Huguet fac8ec365c iwlwifi: mvm: add some missing command strings
Bugzilla: https://bugzilla.redhat.com/2059999

commit 1e8b7f43774aa15b95d93923a032b0fee1ed1964
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Dec 4 13:10:53 2021 +0200

    iwlwifi: mvm: add some missing command strings
    
    Some command strings in the system group weren't added
    for debug, add them now.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204130722.5bbda292908e.I53cefd74547a745fd29261a795c94611e7ee8d1d@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:42 +02:00
Íñigo Huguet a9972c8a01 iwlwifi: mvm: support RLC configuration command
Bugzilla: https://bugzilla.redhat.com/2059999

commit c48e93a65487aedc9334bcaec4abce63e204241f
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sat Dec 4 08:35:52 2021 +0200

    iwlwifi: mvm: support RLC configuration command
    
    There's an RLC configuration command in the firmware that's
    going to replace the chain information in the PHY context.
    Add support for this command, while leaving the PHY context
    fields unset when we know the RLC command will be used.
    
    Also add support to send only the RLC configuration command
    if only the # of chains used on the PHY context changes.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211204083238.55faa3782bb0.I3f9d0071e680cab513c59b093d0827af99d41c51@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:40 +02:00
Íñigo Huguet 3266277da3 iwlwifi: mvm: read the rfkill state and feed it to iwlmei
Bugzilla: https://bugzilla.redhat.com/2059999

Conflicts: minor content conflicts due to later commits already backported
  5283dd677e52a iwlwifi: mvm: retry init flow if failed

commit 7ce1f2157e14170413ba5ecb462153131704754c
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Fri Nov 12 08:28:14 2021 +0200

    iwlwifi: mvm: read the rfkill state and feed it to iwlmei
    
    Read the rfkill state upon boot, mac start and mac stop.
    
    Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
    Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20211112062814.7502-6-emmanuel.grumbach@intel.com

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:38 +02:00
Íñigo Huguet e9d3c8f3db iwlwifi: integrate with iwlmei
Bugzilla: https://bugzilla.redhat.com/2059999

Conflicts: minor content conflicts due to later commits already backported
  5283dd677e52a iwlwifi: mvm: retry init flow if failed
  f5cecf1d4c5ff iwlwifi: fix warnings produced by kernel debug options

commit 6d19a5eba5cda26310f83f5ea87eef54e68afc34
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Fri Nov 12 08:28:12 2021 +0200

    iwlwifi: integrate with iwlmei
    
    iwlmei needs to know about the follwing events:
    
    * Association
    * De-association
    * Country Code change
    * SW Rfkill change
    * SAR table changes
    
    iwlmei can take the device away from us, so report the new
    rfkill type when this happens.
    Advertise the required data from the CSME firmware to the
    usersapce: mostly, the AP that the CSME firmware is currently
    associated to in case there is an active link protection
    session.
    Generate the HOST_ASSOC / HOST_DISSASSOC messages.
    
    Don't support WPA1 (non-RSNA) for now.
    Don't support shared wep either.
    We can then determine the AUTH parameter by checking the AKM.
    Feed the cipher from the key installation.
    
    SW Rfkill will be implemented later when cfg80211 will
    allow us to read the SW Rfkill state.
    
    Co-Developed-by: Ayala Beker <ayala.beker@intel.com>
    Signed-off-by: Ayala Beker <ayala.beker@intel.com>
    Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    
    v7: Ayala added her signed-off
        remove pointless function declaration
        fix a bug due to merge conflict in the HOST_ASSOC message
    v8: leave a print if we have a SAP connection on a device we do
        not support (yet)
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20211112062814.7502-4-emmanuel.grumbach@intel.com

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:38 +02:00
Íñigo Huguet 93a9364124 iwlwifi: support 4-bits in MAC step value
Bugzilla: http://bugzilla.redhat.com/2043454

commit 55c6d8f89dab6d9bed0165dd4c134856975bd000
Author: Mike Golant <michael.golant@intel.com>
Date:   Tue Dec 7 16:05:51 2021 +0200

    iwlwifi: support 4-bits in MAC step value
    
    We have a MAC component (which is inside the SoC) and it has several
    different HW steps.  3 bits used to be enough but now we need 4-bits
    to represent all the different steps.
    
    Properly support 4-bits in the MAC step value by refactoring all the
    current handling of the MAC step/dash.
    
    Already from family 8000 and up the dash (bits 0-1) no longer exists
    and the step (until 8000 bits 2-3) consists of the dash bits as well.
    
    To do this remove the CSR_HW_REV_STEP and the CSR_HW_REV_DASH
    macros, replace them with CSR_HW_REV_STEP_DASH and add hw_rev_step
    into the trans struct.
    
    In addition remove the CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP and
    CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH macros and create a new macro
    combining the 2 (this way we don't need shifting or anything else.)
    
    Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
    Signed-off-by: Mike Golant <michael.golant@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211207160459.2e81a14d1f80.Ia5287e37fb3439d805336837361f6491f958e465@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:50 +01:00
Íñigo Huguet bd2d4b49ca iwlwifi: fix warnings produced by kernel debug options
Bugzilla: http://bugzilla.redhat.com/2043454

commit f5cecf1d4c5ff76172928bc32e99ca56a5ca2f56
Author: Łukasz Bartosik <lb@semihalf.com>
Date:   Wed Nov 10 22:57:44 2021 +0100

    iwlwifi: fix warnings produced by kernel debug options
    
    Fix warnings produced by:
    - lockdep_assert_wiphy() in function reg_process_self_managed_hint(),
    - wiphy_dereference() in function iwl_mvm_init_fw_regd().
    Both function are expected to be called in critical section.
    
    The warnings were discovered when running v5.15 kernel
    with debug options enabled:
    
    1)
    Hardware name: Google Delbin/Delbin
    RIP: 0010:reg_process_self_managed_hint+0x254/0x347 [cfg80211]
    ...
    Call Trace:
    regulatory_set_wiphy_regd_sync+0x3d/0xb0
    iwl_mvm_init_mcc+0x49d/0x5a2
    iwl_op_mode_mvm_start+0x1b58/0x2507
    ? iwl_mvm_reprobe_wk+0x94/0x94
    _iwl_op_mode_start+0x146/0x1a3
    iwl_opmode_register+0xda/0x13d
    init_module+0x28/0x1000
    
    2)
    drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:263 suspicious rcu_dereference_protected() usage!
    ...
    Hardware name: Google Delbin/Delbin, BIOS Google_Delbin
    Call Trace:
    dump_stack_lvl+0xb1/0xe6
    iwl_mvm_init_fw_regd+0x2e7/0x379
    iwl_mvm_init_mcc+0x2c6/0x5a2
    iwl_op_mode_mvm_start+0x1b58/0x2507
    ? iwl_mvm_reprobe_wk+0x94/0x94
    _iwl_op_mode_start+0x146/0x1a3
    iwl_opmode_register+0xda/0x13d
    init_module+0x28/0x100
    
    Fixes: a05829a722 ("cfg80211: avoid holding the RTNL when calling the driver")
    Signed-off-by: Łukasz Bartosik <lb@semihalf.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20211110215744.5487-1-lukasz.bartosik@semihalf.com

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:39 +01:00
Íñigo Huguet 5ef7d1848d iwlwifi: mvm: retry init flow if failed
Bugzilla: http://bugzilla.redhat.com/2043454

commit 5283dd677e52af9db6fe6ad11b2f12220d519d0c
Author: Mordechay Goodstein <mordechay.goodstein@intel.com>
Date:   Wed Nov 10 15:01:59 2021 +0200

    iwlwifi: mvm: retry init flow if failed
    
    In some very rare cases the init flow may fail.  In many cases, this is
    recoverable, so we can retry.  Implement a loop to retry two more times
    after the first attempt failed.
    
    This can happen in two different situations, namely during probe and
    during mac80211 start.  For the first case, a simple loop is enough.
    For the second case, we need to add a flag to prevent mac80211 from
    trying to restart it as well, leaving full control with the driver.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/iwlwifi.20211110150132.57514296ecab.I52a0411774b700bdc7dedb124d8b59bf99456eb2@changeid

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:39 +01:00
Íñigo Huguet b5709f982e iwlwifi: rename CHANNEL_SWITCH_NOA_NOTIF to CHANNEL_SWITCH_START_NOTIF
Bugzilla: http://bugzilla.redhat.com/2043454

commit 6905eb1c3b9ee4580f5d2c7fd9f2bbcc74ec26eb
Author: Nathan Errera <nathan.errera@intel.com>
Date:   Sun Oct 24 18:20:35 2021 +0300

    iwlwifi: rename CHANNEL_SWITCH_NOA_NOTIF to CHANNEL_SWITCH_START_NOTIF
    
    There is no relation between the name and the purpose of the
    notification. This notification is sent from FW when the channel switch
    starts.
    
    Signed-off-by: Nathan Errera <nathan.errera@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211024181719.24b71b0cb741.I97deb70e18f259de51395a1e7c7e58c7b006c317@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:38 +01:00
Íñigo Huguet 1072ebacac iwlwifi: rename GEO_TX_POWER_LIMIT to PER_CHAIN_LIMIT_OFFSET_CMD
Bugzilla: http://bugzilla.redhat.com/2043454

commit 523de6c872ca89e2a636f5c03ab48fc0769e132b
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Sun Oct 24 18:20:32 2021 +0300

    iwlwifi: rename GEO_TX_POWER_LIMIT to PER_CHAIN_LIMIT_OFFSET_CMD
    
    When this code was implemented, there was no official FW API
    description yet, so a placeholder name was used (GEO_TX_POWER_LIMIT).
    But then the command became actually called
    PER_CHAIN_LIMIT_OFFSET_CMD.  Rename the command (and change related
    comments) to PER_CHAIN_LIMIT_OFFSET_CMD to avoid confusion.
    
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211024181719.672fa727ef75.I6572df5d1e3441a0214993a59985da9a9431f3e5@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:38 +01:00
Íñigo Huguet 1931b9b82f iwlwifi: mvm: Support new version of ranging response notification
Bugzilla: http://bugzilla.redhat.com/2043454

commit bd8b5f30fa2c059ec3a2b48db1a24c8c64f3f53c
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Sun Oct 17 12:40:18 2021 +0300

    iwlwifi: mvm: Support new version of ranging response notification
    
    As part of the new rate_n_flags, FW added a new version for
    LOCATION_RANGE_RSP_NTFY, and it's internal structure -
    LOCATION_RANGE_RSP_AP_ETRY_NTFY. Add support for this.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211017123741.c5c6c863631e.I4b493f4eeabbfa1dc965ae012b72fc57de7d5f4f@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:33 +01:00
Íñigo Huguet eb4a0a8e26 iwlwifi: mvm: scrub key material in firmware dumps
Bugzilla: http://bugzilla.redhat.com/2043454

commit 12d60c1efc29e19f4dc0dc70cd48ce097fce6447
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Oct 17 12:40:13 2021 +0300

    iwlwifi: mvm: scrub key material in firmware dumps
    
    Use the previously added infrastructure to scrub key material
    in firmware dumps:
     * in the TX FIFO data, just search for each key that we
       know about and override such data
     * scrub various commands that we sent to the firmware if
       they're present
     * in firmware memory, where advertised by firmware TLVs
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211017123741.d1514964e6a7.I18f8c2ce8082952af7cfe5f8fe75fe51851b8853@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:33 +01:00
Íñigo Huguet 42734d6ffa iwlwifi: fw dump: add infrastructure for dump scrubbing
Bugzilla: http://bugzilla.redhat.com/2043454

commit fdb70083dd2886e45dc2575b8b21dbf63505c29b
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Oct 17 12:40:11 2021 +0300

    iwlwifi: fw dump: add infrastructure for dump scrubbing
    
    In firmware dumps, currently all kinds of key material may be
    included, e.g. in host commands (if firmware crashes during the
    processing of a key-related command) or in the TX FIFO(s) if
    we have been using in-TX-command key material.
    
    Additionally, some firmware versions will advertise sections
    of their internal data to not dump, due to them containing some
    sensitive data.
    
    Add some infrastructure to allow scrubbing this data out, as
    dependent on the opmode's idea of what will need to be done.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211017123741.360cc8fe55b1.Ie3bd3ece38043969f7e116e61a6ec1197a58d78b@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:33 +01:00
Íñigo Huguet b82f7b558f iwlwifi: remove MODULE_AUTHOR() statements
Bugzilla: http://bugzilla.redhat.com/2043454

commit e0e0d16641cd8fa163ba21b98f8da9c5780ded5f
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Sun Oct 17 11:43:47 2021 +0300

    iwlwifi: remove MODULE_AUTHOR() statements
    
    Consensus seems to be emerging that corporations or groups
    shouldn't be listed as module authors, and we will not
    maintain this email address any longer. Just remove it.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20211017113927.32109514aad0.I91a7d745f4ab50ee8ef918ece00dda8251541595@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:32 +01:00
Íñigo Huguet a3890f07bd iwlwifi: mvm: add rtnl_lock() in iwl_mvm_start_get_nvm()
Bugzilla: http://bugzilla.redhat.com/2033354

commit 75ae663d053bddf7c70a24cccf53c83ae03deff8
Author: Luca Coelho <luciano.coelho@intel.com>
Date:   Thu Sep 2 13:11:01 2021 +0300

    iwlwifi: mvm: add rtnl_lock() in iwl_mvm_start_get_nvm()
    
    Due to a rebase damage, we lost the rtnl_lock() when the patch was
    sent out.  This causes an RTNL imbalance and failed assertions, due to
    missing RTNL protection, for instance:
    
      RTNL: assertion failed at net/wireless/reg.c (4025)
      WARNING: CPU: 60 PID: 1720 at net/wireless/reg.c:4025 regulatory_set_wiphy_regd_sync+0x7f/0x90 [cfg80211]
      Call Trace:
       iwl_mvm_init_mcc+0x170/0x190 [iwlmvm]
       iwl_op_mode_mvm_start+0x824/0xa60 [iwlmvm]
       iwl_opmode_register+0xd0/0x130 [iwlwifi]
       init_module+0x23/0x1000 [iwlmvm]
    
    Fix this by adding the missing rtnl_lock() back to the code.
    
    Fixes: eb09ae93dabf ("iwlwifi: mvm: load regdomain at INIT stage")
    Link: https://lore.kernel.org/lkml/CAHk-=wjB_zBwZ+WR9LOpvgjvaQn=cqryoKigod8QnZs=iYGEhA@mail.gmail.com/
    Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Acked-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:06 +01:00
Íñigo Huguet 9dfce93296 iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3
Bugzilla: http://bugzilla.redhat.com/2033354

commit fb3fac5fafa8a6d45853b183c36cda4c13e1c279
Author: Gregory Greenman <gregory.greenman@intel.com>
Date:   Thu Aug 26 22:47:40 2021 +0300

    iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3
    
    The new version sends station id in the notification. It's still not
    used, but need to adjust the code since the offset of the data was
    changed.
    
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210826224715.87bc9e45c40b.I770493dc4a293ed8bdf059518e94dccf5dd1b3a7@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:05 +01:00
Íñigo Huguet e31d0e4b7c iwlwifi: mvm: load regdomain at INIT stage
Bugzilla: http://bugzilla.redhat.com/2033354

commit eb09ae93dabfd0980f5226dfd0bd531eb87902f5
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Thu Aug 5 14:21:57 2021 +0300

    iwlwifi: mvm: load regdomain at INIT stage
    
    We used to load the regdomain only in the load stage,
    this caused the 'iw phy phy0 reg get' command to fail if we
    booted a machine with wifi off.
    Therefor we should load it in INIT stage already.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210805141826.a6077801d7d5.I7d8d5c895bc467efbf81ea055dde366ea01cced1@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:02 +01:00
Íñigo Huguet 987c726f33 iwlwifi: mvm: Read the PPAG and SAR tables at INIT stage
Bugzilla: http://bugzilla.redhat.com/2033354

commit 78a19d5285d93e281b40c3b8d5a959fbbd2fe006
Author: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date:   Thu Aug 5 14:21:56 2021 +0300

    iwlwifi: mvm: Read the PPAG and SAR tables at INIT stage
    
    We used to read the PPAG, WRDS, EWRD, WGDS tables from ACPI
    in the load stage only. This prevented vendor commands from
    being executed before bringing the interface up. Move reading those tables
    to INIT stage.
    
    Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210805141826.ce3b60f0b426.I3643bf00e714aae930880cc7d6cf390b142eaccb@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:02 +01:00
Íñigo Huguet bf47e8d812 iwlwifi: yoyo: cleanup internal buffer allocation in D3
Bugzilla: http://bugzilla.redhat.com/2033354

commit e75bc5f3f110aa6c4c372e574bd2c37a8cad495f
Author: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Date:   Mon Aug 2 21:58:47 2021 +0300

    iwlwifi: yoyo: cleanup internal buffer allocation in D3
    
    With recent changes in the firmware SRAM debug during D3 is
    enabled by default and need not be enabled by driver.
    cleaning the code to align the same.
    
    Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802215208.8535203d0ef7.Ib1695ce5de921b0472d0b1052e729e071573b863@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:45:59 +01:00
Íñigo Huguet 9b1c1e742c iwlwifi: mvm: avoid static queue number aliasing
Bugzilla: http://bugzilla.redhat.com/2033354

commit c6ce1c74ef2923b8ffd85f7f8b486f804f343b39
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 2 17:28:27 2021 +0300

    iwlwifi: mvm: avoid static queue number aliasing
    
    When TVQM is enabled (iwl_mvm_has_new_tx_api() is true), then
    queue numbers are just sequentially assigned 0, 1, 2, ...
    Prior to TVQM, in DQA, there were some statically allocated
    queue numbers:
     * IWL_MVM_DQA_AUX_QUEUE == 1,
     * both IWL_MVM_DQA_INJECT_MONITOR_QUEUE and
       IWL_MVM_DQA_P2P_DEVICE_QUEUE == 2, and
     * IWL_MVM_DQA_AP_PROBE_RESP_QUEUE == 9.
    
    Now, these values are assigned to the members mvm->aux_queue,
    mvm->snif_queue, mvm->probe_queue and mvm->p2p_dev_queue by
    default. Normally, this doesn't really matter, and if TVQM is
    in fact available we override them to the real values after
    allocating a queue for use there.
    
    However, this allocation doesn't always happen. For example,
    for mvm->p2p_dev_queue (== 2) it only happens when the P2P
    Device interface is started, if any. If it's not started, the
    value in mvm->p2p_dev_queue remains 2. This wouldn't really
    matter all that much if it weren't for iwl_mvm_is_static_queue()
    which checks a queue number against one of those four static
    numbers.
    
    Now, if no P2P Device or monitor interface is added then queue
    2 may be dynamically allocated, yet alias mvm->p2p_dev_queue or
    mvm->snif_queue, and thus iwl_mvm_is_static_queue() erroneously
    returns true for it. If it then gets full, all interface queues
    are stopped, instead of just backpressuring against the one TXQ
    that's really the only affected one.
    
    This clearly can lead to issues, as everything is stopped even
    if just a single TXQ filled its corresponding HW queue, if it
    happens to have an appropriate number (2 or 9, AUX is always
    reassigned.) Due to a mac80211 bug, this also led to a situation
    in which the queues remained stopped across a deauthentication
    and then attempts to connect to a new AP started failing, but
    that's fixed separately.
    
    Fix all of this by simply initializing the queue numbers to
    the invalid value until they're used, if TVQM is enabled, and
    also setting them back to that value when the queues are later
    freed again.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802172232.2e47e623f9e2.I9b0830dafbb68ef35b7b8f0f46160abec02ac7d0@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:45:59 +01:00
Íñigo Huguet e5c407f54c iwlwifi: mvm: restrict FW SMPS request
Bugzilla: http://bugzilla.redhat.com/2033354

commit de34d1c1d30d6d9373f536522c04b86b54711c3b
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 2 17:28:20 2021 +0300

    iwlwifi: mvm: restrict FW SMPS request
    
    The firmware SMPS request should only be honoured if the
    connection is currently with HE and on 160 MHz, so check
    that and then potentially reapply any request if the BW
    changes.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802172232.0cdcac5660da.I9ee7956fd4f48399855d1f97728bc58b36caf112@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:45:58 +01:00
Íñigo Huguet 6f14a20cad iwlwifi: prepare for synchronous error dumps
Bugzilla: http://bugzilla.redhat.com/2033354

commit b8221b0f750a05a7ae9cbca84932e2a36a3ee658
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 2 17:09:39 2021 +0300

    iwlwifi: prepare for synchronous error dumps
    
    In some cases it may be necessary to synchronously create
    a firmware error report, add the necessary infrastructure
    for this.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802170640.481b6642f0fc.I7c9c958408a285e3d19aceed2a5a3341cfc08382@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:45:57 +01:00
Íñigo Huguet edf488f7d2 iwlwifi: mvm: avoid FW restart while shutting down
Bugzilla: http://bugzilla.redhat.com/2033354

commit 2f308f008f1ccda4dcf9816c7dad0a33fbffdd18
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 2 17:09:36 2021 +0300

    iwlwifi: mvm: avoid FW restart while shutting down
    
    If the firmware crashes while we're already shutting down
    the system, there isn't much we can do since the shutdown
    process is continuing and we wanted to do that. Don't do
    a FW restart, with the implied debug collection, in this
    case.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802170640.43a7351ae6bd.I164d48ce4379accf76ea0637983fd946d52dc6f5@changeid
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:45:57 +01:00
Johannes Berg 2a7ce54ccc iwlwifi: mvm: honour firmware SMPS requests
The firmware can now request SMPS (due to thermal conditions), add
some code to honour such requests and bubble them up through the
stack, subject to our other SMPS constraints, e.g. from Bluetooth.

Then, if the firmware requests SMPS, then we know that it supports
a small extension to the PHY configuration API where a chain mask
of 0 means "use 1 but pick which one yourself", so in this case we
use that extension.

During firmware restart, we stay in the previous state, and the FW
will send us a notification at startup (only) if the temperature is
below the lower or above the high threshold, to sync the state.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210617100544.85656b7684b9.I7a661a0758d070a750d3a91874d1a0f5fab9febc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-06-22 15:11:34 +03:00
Luca Coelho 7a9a44456d iwlwifi: remove unused REMOTE_WAKE_CONFIG_CMD definitions
We don't use this command anymore and it is going to be removed from
the FW.  Remove all related definitions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210612142637.549b282ae9a4.Iced05882d73b869e19f50e6a6e7bf9ce6cd7899b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-06-22 15:11:11 +03:00
Emmanuel Grumbach 13b5fa9582 iwlwifi: mvm: get NVM later in the mvm_start flow
We don't need the NVM until fairly late in the flow and
since this flow will be split soon, get the NVM later to
unite it with the parts that really need it.
Gather all what needs the NVM into a function.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.bab0e65c4909.I789f3eb577b216ad1688269e036ce9fa4880f532@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-11 01:52:11 +02:00
Emmanuel Grumbach aacee681e3 iwlwifi: mvm: isolate the get nvm flow
This will soon be a bit more complicated. Take it out
to a function.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.431f31a86ea0.I9db96647eb9c7142051e26cd5be3f52c5ffc5534@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-11 01:52:08 +02:00
Emmanuel Grumbach 8c082a99ed iwlwifi: mvm: simplify iwl_mvm_dbgfs_register
No need to pass the dbgfs_dir just to assign it to mvm.
Assign to mvm and then call iwl_mvm_dbgfs_register.

This is a preparation towards the addition of a delayed
op_mode_start flow.
This will allow to split the op_mode_start flow.
Registration to debugfs must happen after we register to
mac80211 and the registration to mac80211 will soon be
delayed in certain cases. In order not to have to remember
the debugfs_dir in a separate variable, just set it into
the mvm structure so that it can be usable later.

Declare mvm->debugfs_dir in the iwl_mvm structure even when
IWLWIFI_DEBUGFS isn't enabled to simplify the source code.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.a92ee491863d.I047923aa3598fbf4fb6fce2cdff75a4969fedd76@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-11 01:52:07 +02:00
Emmanuel Grumbach 46ad1ff977 iwlwifi: mvm: register to mac80211 last
All the actions that were taken after the registration can
be taken before the registration to mac80211.
This will help to defer part of the op_mode_mvm_start
function to a later stage in case the device is not
available.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.c03cc5db67c1.Ia928ca34d25a73d959a345ffbe4f1217c3f17394@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-11 01:52:07 +02:00
Mordechay Goodstein d01293154c iwlwifi: dbg: add op_mode callback for collecting debug data.
The first use is collecting debug data when transport stops the device.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210142629.d282d0a9ee7b.I9a0ad29f80daba8956a6aa077ba865e19b2150be@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-10 14:39:39 +02:00
Kalle Valo b7e6725df7 iwlwifi patches intended for v5.12
* Check FW notification sizes for robustness;
 * Improvements in the NAPI implementation;
 * Implement a workaround for CCA-EXT;
 * Add new FW API support;
 * Fix a CSA bug;
 * Implement PHY integration version parsing;
 * A bit of refactoring;
 * One more CSA bug fix, this time in the AP side;
 * Support for new So devices and a bit of reorg;
 * Per Platform Antenna Gain (PPAG) fixes and improvements;
 * Improvements in the debug framework;
 * Some other clean-ups and small fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEF3LNfgb2BPWm68smoUecoho8xfoFAmAdGCUACgkQoUecoho8
 xfqbGxAAlKXsYDTey4bCNbG3aimBGyNkmOBrAAcsH/zxZ4UHzUGLl0xflMZwpT9S
 XXYBnR/q8lb7lZ+0zj/Jc4R2D8DKGhKwQ1Q+ZINRm7pEgJ3hZZlgvPgWeyOi+z0Y
 DnCD8Ga2lJPmyqwxipMgL1wi5POKOTFjWwTe8cCQ5xy6EkGVpNi+PdZitFubq0Oj
 oAOe6st6v/GgtqGHh8TNX11pWadoBhqkkdlPEnuSvx9MAxSYtrued4vs8MowNP9i
 tkak8+eeEfLbfyY/sxvgClFR4T072/QvUoofPMyoCyo+cBa42EMXHRzk6fAUxZ1t
 brjJFOUnuACCmU2CfzoZTdZPMDB/x4vk6UWIf2p0kL7paRt/IVMb2/DNuTo042Z1
 6xPBoUXyPzL7sH2leZ/Pj9aNMxfK5mhLVMn/htedaMfjdNX52MfgVmyAR2zcq0iC
 r4xtq1xi/+GFmT1AYXIYGVqkwE/aSTNqi+0oTRK8u2g5CbokRVJnWnUido0Hnlg0
 yS2l0gU7UyNFj9LHOVR8UP0oD7myDkkrqTeY9Us+ncLtYXmqx0dnFbvWucIrSHvL
 BVKZzgYXnFbCghSlHb2ZJN4nxKzq8rxkBBv7CZMPneK1VYEyTichUo3b4gzFTfIy
 9EP0GzKPQStxaDzAfr9cju0IvvCW1O0vA6gGAe0D+bHVYhqi/TA=
 =c570
 -----END PGP SIGNATURE-----

Merge tag 'iwlwifi-next-for-kalle-2021-02-05' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

iwlwifi patches intended for v5.12

* Check FW notification sizes for robustness;
* Improvements in the NAPI implementation;
* Implement a workaround for CCA-EXT;
* Add new FW API support;
* Fix a CSA bug;
* Implement PHY integration version parsing;
* A bit of refactoring;
* One more CSA bug fix, this time in the AP side;
* Support for new So devices and a bit of reorg;
* Per Platform Antenna Gain (PPAG) fixes and improvements;
* Improvements in the debug framework;
* Some other clean-ups and small fixes.

# gpg: Signature made Fri 05 Feb 2021 12:04:21 PM EET using RSA key ID 1A3CC5FA
# gpg: Good signature from "Luciano Roth Coelho (Luca) <luca@coelho.fi>"
# gpg:                 aka "Luciano Roth Coelho (Intel) <luciano.coelho@intel.com>"
2021-02-08 18:52:00 +02:00
Johannes Berg f7d6ef33a7 iwlwifi: mvm: handle CCA-EXT delay firmware notification
If there are frequent CCA delays due to the extension channel
as detected by the firmware, and we're on 2.4 GHz, then handle
this by disconnecting (with a reconnect hint).

When we disconnect, we'll also update our capabilities to use
only 20 MHz on the next connection (if it's on 2.4 GHz) as to
avoid the use of the extension channel that has too much noise.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.4de9c363b0b5.I709b7e6f73a7537c53f22d7418927691259de8a8@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05 11:52:30 +02:00
Johannes Berg 88181e6e21 iwlwifi: mvm: remove debugfs injection limitations
For testing features where the firmware may send some
notifications it can often be a lot easier to do that
from a test script. Remove most injection limitations
from debugfs to be able to do this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.9aff3c6b4607.I03b0ae7df094734451445ffcb7f9f0274969f1c0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05 11:52:28 +02:00
Johannes Berg afc857bc2a iwlwifi: mvm: add notification size checks
We shouldn't trust the firmware with the sizes (or contents)
of notifications, accessing too much data could cause page
faults if the data doesn't fit into the allocated space. This
applies more on older NICs where multiple notifications can
be in a single RX buffer.

Add a general framework for checking a minimum size of any
notification in the RX handlers and use it for most. Some RX
handlers were already checking and I've moved the checks,
some more complex checks I left and made them _NO_SIZE for
the RX handlers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.3e155d5e5f90.I2121fa4ac7cd7eb98970d84b793796646afa3eed@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05 11:52:24 +02:00
Johannes Berg 7a21b1d4a7 iwlwifi: mvm: guard against device removal in reprobe
If we get into a problem severe enough to attempt a reprobe,
we schedule a worker to do that. However, if the problem gets
more severe and the device is actually destroyed before this
worker has a chance to run, we use a free device. Bump up the
reference count of the device until the worker runs to avoid
this situation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20210122144849.871f0892e4b2.I94819e11afd68d875f3e242b98bef724b8236f1e@changeid
2021-01-25 15:59:24 +02:00
Gregory Greenman e223e42aac iwlwifi: mvm: invalidate IDs of internal stations at mvm start
Having sta_id not set for aux_sta and snif_sta can potentially lead to a
hard to debug issue in case remove station is called without an add. In
this case sta_id 0, an unrelated regular station, will be removed.

In fact, we do have a FW assert that occures rarely and from the debug
data analysis it looks like sta_id 0 is removed by mistake, though it's
hard to pinpoint the exact flow. The WARN_ON in this patch should help
to find it.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20210122144849.5dc6dd9b22d5.I2add1b5ad24d0d0a221de79d439c09f88fcaf15d@changeid
2021-01-25 15:59:13 +02:00
Johannes Berg 8a59d39033 iwlwifi: mvm: hook up missing RX handlers
The RX handlers for probe response data and channel switch weren't
hooked up properly, fix that.

Fixes: 86e177d80f ("iwlwifi: mvm: add NOA and CSA to a probe response")
Fixes: d3a108a48d ("iwlwifi: mvm: Support CSA countdown offloading")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.2d07dcee0d35.I07a61b5d734478db57d9434ff303e4c90bf6c32b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:16:06 +02:00
Johannes Berg 906d4eb844 iwlwifi: support firmware reset handshake
There are some races in the hardware that can possibly lead to
a bus lockup later during a restart when we manage to kill the
firmware at a bad time (while it's accessing the bus).

To work around this, add support for a new handshake between
firmware and driver to ensure that the firmware is in a well-
known state before we kill it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.7756fcc9865c.I13de65e0ffcb4186dd4c1a465f66df2e98c9a947@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:16:03 +02:00
Johannes Berg 8e99ea8d09 iwlwifi: use SPDX tags
Use SPDX tags instead of the long copyright notices.  Also cleanup
some duplicate copyright notices and combine the years where possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201210000603.481bcb512a6f.I8146abe5a637079e7336209f23cb26af98b12b31@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:15:31 +02:00
Johannes Berg 2f7a04c7b0 iwlwifi: mvm: do more useful queue sync accounting
We're currently doing accounting on the queue sync with an
atomic variable that counts down the number of remaining
notifications that we still need.

As we've been hitting issues in this area, modify this to
track a bitmap of queues, not just the number of queues,
and print out the remaining bitmap in the warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.0a3fa177cd6b.I7c69ff999419368266279ec27dd618eb450908b3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:14:18 +02:00
Johannes Berg cf5b462768 iwlwifi: mvm: move iwl_mvm_stop_device() out of line
This function has grown quite a bit over time, move it
out of line before we grow it even further.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.1a0211e66906.I572eb69dc3738319310c9cbe03a36d942f4f68f7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:14:16 +02:00
Emmanuel Grumbach 59fa61f3fd iwlwifi: remove sw_csum_tx
This was a hack done to test the data path of devices that
didn't support well CSUM offload in Tx. This is not needed
anymore.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.6c9fc9fb48d5.I2aaebf90e6fe81860105d049a8d35746fa8d86c2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:14:15 +02:00
Mordechay Goodstein 861bae42e1 iwlwifi: avoid endless HW errors at assert time
Curretly we only mark HW error state "after" trying to collect HW data,
but if any HW error happens while colleting HW data we go into endless
loop. avoid this by setting HW error state "before" collecting HW data.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.4c7e5a87da15.Ic35b2f28ff08f7ac23143c80f224d52eb97a0454@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:14:11 +02:00
Emmanuel Grumbach 3b25f1aff5 iwlwifi: mvm: remove the read_nvm from iwl_run_init_mvm_ucode
If we already read the NVM, we don't need to read it again.
Make sure that this is the case with a WARNING.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.8e0ffce7f873.Ie526042c4d4b93d9116c90f53180cbadef0b32cb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10 00:11:19 +02:00
Luca Coelho b7d96bca1f Revert "iwlwifi: remove wide_cmd_header field"
This reverts commit 0a8159cbd1.

It turns out that this flag is used by iwldvm, so we can't get rid of
it.  This broke iwldvm devices with BAD_COMMAND errors.

Fixes: 0a8159cbd1 ("iwlwifi: remove wide_cmd_header field")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201009122123.3e4ee0ad7a71.Id6d95ae601f048aeb4d2ed63a1712e469da84369@changeid
2020-10-09 18:04:50 +03:00
Nathan Errera be9ae34ead iwlwifi: mvm: get number of stations from TLV
FW is changing the max number of supported stations. To adapt to the
change we get the max number from the TLV and act according to the new
number.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.863ab470babc.I393223392f36436663c4e66add03fefe77b74e60@changeid
2020-10-08 20:09:25 +03:00
Lee Jones 707c528a8d iwlwifi: mvm: ops: Remove unused static struct 'iwl_mvm_debug_names'
Looks as if it's never been used.

Fixes the following W=1 kernel build warning(s):

 drivers/net/wireless/intel/iwlwifi/mvm/ops.c:466:36: warning: ‘iwl_mvm_debug_names’ defined but not used [-Wunused-const-variable=]

Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Intel Linux Wireless <linuxwifi@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910065431.657636-9-lee.jones@linaro.org
2020-10-08 13:43:44 +03:00
Mordechay Goodstein 16b2afe07a iwlwifi: yoyo: add support for internal buffer allocation in D3
With yoyo a user can configure the internal buffer allocation in
SMEM to hold more log space, which is used for debugging D3 state.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930191738.29b61ff6c78e.I235614bb2c255ee8ac49c2835796ac95a25215bf@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-01 22:02:28 +03:00