Skip to content
  1. Jan 27, 2021
    • Daniel Jurgens's avatar
      net/mlx5: Maintain separate page trees for ECPF and PF functions · 0aa12847
      Daniel Jurgens authored
      Pages for the host PF and ECPF were stored in the same tree, so the ECPF
      pages were being freed along with the host PF's when the host driver
      unloaded.
      
      Combine the function ID and ECPF flag to use as an index into the
      x-array containing the trees to get a different tree for the host PF and
      ECPF.
      
      Fixes: c6168161
      
       ("net/mlx5: Add support for release all pages event")
      Signed-off-by: default avatarDaniel Jurgens <danielj@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      0aa12847
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix IPSEC stats · 45c9a308
      Maxim Mikityanskiy authored
      When IPSEC offload isn't active, the number of stats is not zero, but
      the strings are not filled, leading to exposing stats with empty names.
      Fix this by using the same condition for NUM_STATS and FILL_STRS.
      
      Fixes: 0aab3e1b
      
       ("net/mlx5e: IPSec, Expose IPsec HW stat only for supporting HW")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarRaed Salem <raeds@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      45c9a308
    • Maor Dickman's avatar
      net/mlx5e: Reduce tc unsupported key print level · 48470a90
      Maor Dickman authored
      "Unsupported key used:" appears in kernel log when flows with
      unsupported key are used, arp fields for example.
      
      OpenVSwitch was changed to match on arp fields by default that
      caused this warning to appear in kernel log for every arp rule, which
      can be a lot.
      
      Fix by lowering print level from warning to debug.
      
      Fixes: e3a2b7ed
      
       ("net/mlx5e: Support offload cls_flower with drop action")
      Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      48470a90
    • Pan Bian's avatar
      net/mlx5e: free page before return · 258ed19f
      Pan Bian authored
      Instead of directly return, goto the error handling label to free
      allocated page.
      
      Fixes: 5f29458b
      
       ("net/mlx5e: Support dump callback in TX reporter")
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      258ed19f
    • Parav Pandit's avatar
      net/mlx5e: E-switch, Fix rate calculation for overflow · 1fe3e316
      Parav Pandit authored
      rate_bytes_ps is a 64-bit field. It passed as 32-bit field to
      apply_police_params(). Due to this when police rate is higher
      than 4Gbps, 32-bit calculation ignores the carry. This results
      in incorrect rate configurationn the device.
      
      Fix it by performing 64-bit calculation.
      
      Fixes: fcb64c0f
      
       ("net/mlx5: E-Switch, add ingress rate support")
      Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
      Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      1fe3e316
    • Roi Dayan's avatar
      net/mlx5: Fix memory leak on flow table creation error flow · 487c6ef8
      Roi Dayan authored
      When we create the ft object we also init rhltable in ft->fgs_hash.
      So in error flow before kfree of ft we need to destroy that rhltable.
      
      Fixes: 693c6883
      
       ("net/mlx5: Add hash table for flow groups in flow table")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      487c6ef8
    • Jakub Kicinski's avatar
      Merge tag 'mac80211-for-net-2021-01-26' of... · c5e9e8d4
      Jakub Kicinski authored
      
      Merge tag 'mac80211-for-net-2021-01-26' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
      
      Johannes Berg says:
      
      ====================
      A couple of fixes:
       * fix 160 MHz channel switch in mac80211
       * fix a staging driver to not deadlock due to some
         recent cfg80211 changes
       * fix NULL-ptr deref if cfg80211 returns -EINPROGRESS
         to wext (syzbot)
       * pause TX in mac80211 in type change to prevent crashes
         (syzbot)
      
      * tag 'mac80211-for-net-2021-01-26' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211:
        staging: rtl8723bs: fix wireless regulatory API misuse
        mac80211: pause TX while changing interface type
        wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
        mac80211: 160MHz with extended NSS BW in CSA
      ====================
      
      Link: https://lore.kernel.org/r/20210126130529.75225-1-johannes@sipsolutions.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c5e9e8d4
    • Jakub Kicinski's avatar
      Merge tag 'wireless-drivers-2021-01-26' of... · db22ce68
      Jakub Kicinski authored
      
      Merge tag 'wireless-drivers-2021-01-26' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
      
      Kalle Valo says:
      
      ====================
      wireless-drivers fixes for v5.11
      
      Second set of fixes for v5.11. Like in last time we again have more
      fixes than usual Actually a bit too much for my liking in this state
      of the cycle, but due to unrelated challenges I was only able to
      submit them now.
      
      We have few important crash fixes, iwlwifi modifying read-only data
      being the most reported issue, and also smaller fixes to iwlwifi.
      
      mt76
       * fix a clang warning about enum usage
       * fix rx buffer refcounting crash
      
      mt7601u
       * fix rx buffer refcounting crash
       * fix crash when unbplugging the device
      
      iwlwifi
       * fix a crash where we were modifying read-only firmware data
       * lots of smaller fixes all over the driver
      
      * tag 'wireless-drivers-2021-01-26' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers: (24 commits)
        mt7601u: fix kernel crash unplugging the device
        iwlwifi: queue: bail out on invalid freeing
        iwlwifi: mvm: guard against device removal in reprobe
        iwlwifi: Fix IWL_SUBDEVICE_NO_160 macro to use the correct bit.
        iwlwifi: mvm: clear IN_D3 after wowlan status cmd
        iwlwifi: pcie: add rules to match Qu with Hr2
        iwlwifi: mvm: invalidate IDs of internal stations at mvm start
        iwlwifi: mvm: fix the return type for DSM functions 1 and 2
        iwlwifi: pcie: reschedule in long-running memory reads
        iwlwifi: pcie: use jiffies for memory read spin time limit
        iwlwifi: pcie: fix context info memory leak
        iwlwifi: pcie: add a NULL check in iwl_pcie_txq_unmap
        iwlwifi: pcie: set LTR on more devices
        iwlwifi: queue: don't crash if txq->entries is NULL
        iwlwifi: fix the NMI flow for old devices
        iwlwifi: pnvm: don't try to load after failures
        iwlwifi: pnvm: don't skip everything when not reloading
        iwlwifi: pcie: avoid potential PNVM leaks
        iwlwifi: mvm: take mutex for calling iwl_mvm_get_sync_time()
        iwlwifi: mvm: skip power command when unbinding vif during CSA
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20210126092202.6A367C433CA@smtp.codeaurora.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      db22ce68
    • Eric Dumazet's avatar
      iwlwifi: provide gso_type to GSO packets · 81a86e1b
      Eric Dumazet authored
      net/core/tso.c got recent support for USO, and this broke iwlfifi
      because the driver implemented a limited form of GSO.
      
      Providing ->gso_type allows for skb_is_gso_tcp() to provide
      a correct result.
      
      Fixes: 3d5b459b
      
       ("net: tso: add UDP segmentation support")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarBen Greear <greearb@candelatech.com>
      Tested-by: default avatarBen Greear <greearb@candelatech.com>
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=209913
      Link: https://lore.kernel.org/r/20210125150949.619309-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      81a86e1b
  2. Jan 26, 2021
    • Johannes Berg's avatar
      staging: rtl8723bs: fix wireless regulatory API misuse · 81f153fa
      Johannes Berg authored
      
      
      This code ends up calling wiphy_apply_custom_regulatory(), for which
      we document that it should be called before wiphy_register(). This
      driver doesn't do that, but calls it from ndo_open() with the RTNL
      held, which caused deadlocks.
      
      Since the driver just registers static regdomain data and then the
      notifier applies the channel changes if any, there's no reason for
      it to call this in ndo_open(), move it earlier to fix the deadlock.
      
      Reported-and-tested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Fixes: 51d62f2f
      
       ("cfg80211: Save the regulatory domain with a lock")
      Link: https://lore.kernel.org/r/20210126115409.d5fd6f8fe042.Ib5823a6feb2e2aa01ca1a565d2505367f38ad246@changeid
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      81f153fa
    • Johannes Berg's avatar
      mac80211: pause TX while changing interface type · 054c9939
      Johannes Berg authored
      syzbot reported a crash that happened when changing the interface
      type around a lot, and while it might have been easy to fix just
      the symptom there, a little deeper investigation found that really
      the reason is that we allowed packets to be transmitted while in
      the middle of changing the interface type.
      
      Disallow TX by stopping the queues while changing the type.
      
      Fixes: 34d4bc4d
      
       ("mac80211: support runtime interface type changes")
      Reported-by: default avatar <syzbot+d7a3b15976bf7de2238a@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20210122171115.b321f98f4d4f.I6997841933c17b093535c31d29355be3c0c39628@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      054c9939
    • Johannes Berg's avatar
      wext: fix NULL-ptr-dereference with cfg80211's lack of commit() · 51225651
      Johannes Berg authored
      
      
      Since cfg80211 doesn't implement commit, we never really cared about
      that code there (and it's configured out w/o CONFIG_WIRELESS_EXT).
      After all, since it has no commit, it shouldn't return -EIWCOMMIT to
      indicate commit is needed.
      
      However, EIWCOMMIT is actually an alias for EINPROGRESS, which _can_
      happen if e.g. we try to change the frequency but we're already in
      the process of connecting to some network, and drivers could return
      that value (or even cfg80211 itself might).
      
      This then causes us to crash because dev->wireless_handlers is NULL
      but we try to check dev->wireless_handlers->standard[0].
      
      Fix this by also checking dev->wireless_handlers. Also simplify the
      code a little bit.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatar <syzbot+444248c79e117bc99f46@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+8b2a88a09653d4084179@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/r/20210121171621.2076e4a37d5a.I5d9c72220fe7bb133fb718751da0180a57ecba4e@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      51225651
    • Justin Iurman's avatar
      uapi: fix big endian definition of ipv6_rpl_sr_hdr · 07d46d93
      Justin Iurman authored
      Following RFC 6554 [1], the current order of fields is wrong for big
      endian definition. Indeed, here is how the header looks like:
      
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Next Header  |  Hdr Ext Len  | Routing Type  | Segments Left |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | CmprI | CmprE |  Pad  |               Reserved                |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      
      This patch reorders fields so that big endian definition is now correct.
      
        [1] https://tools.ietf.org/html/rfc6554#section-3
      
      Fixes: cfa933d9
      
       ("include: uapi: linux: add rpl sr header definition")
      Signed-off-by: default avatarJustin Iurman <justin.iurman@uliege.be>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      07d46d93
  3. Jan 25, 2021
    • Lorenzo Bianconi's avatar
      mt7601u: fix kernel crash unplugging the device · 0acb20a5
      Lorenzo Bianconi authored
      The following crash log can occur unplugging the usb dongle since,
      after the urb poison in mt7601u_free_tx_queue(), usb_submit_urb() will
      always fail resulting in a skb kfree while the skb has been already
      queued.
      
      Fix the issue enqueuing the skb only if usb_submit_urb() succeed.
      
      Hardware name: Hewlett-Packard 500-539ng/2B2C, BIOS 80.06 04/01/2015
      Workqueue: usb_hub_wq hub_event
      RIP: 0010:skb_trim+0x2c/0x30
      RSP: 0000:ffffb4c88005bba8 EFLAGS: 00010206
      RAX: 000000004ad483ee RBX: ffff9a236625dee0 RCX: 000000000000662f
      RDX: 000000000000000c RSI: 0000000000000000 RDI: ffff9a2343179300
      RBP: ffff9a2343179300 R08: 0000000000000001 R09: 0000000000000000
      R10: ffff9a23748f7840 R11: 0000000000000001 R12: ffff9a236625e4d4
      R13: ffff9a236625dee0 R14: 0000000000001080 R15: 0000000000000008
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fd410a34ef8 CR3: 00000001416ee001 CR4: 00000000001706f0
      Call Trace:
       mt7601u_tx_status+0x3e/0xa0 [mt7601u]
       mt7601u_dma_cleanup+0xca/0x110 [mt7601u]
       mt7601u_cleanup+0x22/0x30 [mt7601u]
       mt7601u_disconnect+0x22/0x60 [mt7601u]
       usb_unbind_interface+0x8a/0x270
       ? kernfs_find_ns+0x35/0xd0
       __device_release_driver+0x17a/0x230
       device_release_driver+0x24/0x30
       bus_remove_device+0xdb/0x140
       device_del+0x18b/0x430
       ? kobject_put+0x98/0x1d0
       usb_disable_device+0xc6/0x1f0
       usb_disconnect.cold+0x7e/0x20a
       hub_event+0xbf3/0x1870
       process_one_work+0x1b6/0x350
       worker_thread+0x53/0x3e0
       ? process_one_work+0x350/0x350
       kthread+0x11b/0x140
       ? __kthread_bind_mask+0x60/0x60
       ret_from_fork+0x22/0x30
      
      Fixes: 23377c20
      
       ("mt7601u: fix possible memory leak when the device is disconnected")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Acked-by: default avatarJakub Kicinski <kubakici@wp.pl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/3b85219f669a63a8ced1f43686de05915a580489.1610919247.git.lorenzo@kernel.org
      0acb20a5
    • Johannes Berg's avatar
      iwlwifi: queue: bail out on invalid freeing · 0bed6a2a
      Johannes Berg authored
      
      
      If we find an entry without an SKB, we currently continue, but
      that will just result in an infinite loop since we won't increment
      the read pointer, and will try the same thing over and over again.
      Fix this.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.abe2dedcc3ac.Ia6b03f9eeb617fd819e56dd5376f4bb8edc7b98a@changeid
      0bed6a2a
    • Johannes Berg's avatar
      iwlwifi: mvm: guard against device removal in reprobe · 7a21b1d4
      Johannes Berg authored
      
      
      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: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.871f0892e4b2.I94819e11afd68d875f3e242b98bef724b8236f1e@changeid
      7a21b1d4
    • Matti Gottlieb's avatar
      iwlwifi: Fix IWL_SUBDEVICE_NO_160 macro to use the correct bit. · 4886460c
      Matti Gottlieb authored
      
      
      The bit that indicates if the device supports 160MHZ
      is bit #9. The macro checks bit #8.
      
      Fix IWL_SUBDEVICE_NO_160 macro to use the correct bit.
      
      Signed-off-by: default avatarMatti Gottlieb <matti.gottlieb@intel.com>
      Fixes: d6f2134a
      
       ("iwlwifi: add mac/rf types and 160MHz to the device tables")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.bddbf9b57a75.I16e09e2b1404b16bfff70852a5a654aa468579e2@changeid
      4886460c
    • Shaul Triebitz's avatar
      iwlwifi: mvm: clear IN_D3 after wowlan status cmd · 96d2bfb7
      Shaul Triebitz authored
      
      
      In D3 resume flow, avoid the following race where sending
      packets before updating the sequence number (sequence
      number received from the wowlan status command response):
      Thread 1:
      __iwl_mvm_resume clears IWL_MVM_STATUS_IN_D3 and is cut
      by thread 2 before reaching iwl_mvm_query_wakeup_reasons.
      Thread 2:
      iwl_mvm_mac_itxq_xmit calls iwl_mvm_tx_skb since
      IWL_MVM_STATUS_IN_D3 is not set using a wrong sequence number.
      Thread 1:
      __iwl_mvm_resume continues and calls iwl_mvm_query_wakeup_reasons
      updating the sequence number received from the firmware.
      
      The next packet that will be sent now will cause sysassert 0x1096.
      
      Fix the bug by moving 'clear IWL_MVM_STATUS_IN_D3' to after
      sending the wowlan status command and updating the sequence
      number.
      
      Signed-off-by: default avatarShaul Triebitz <shaul.triebitz@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.fe927ec939c6.I103d3321fb55da7e6c6c51582cfadf94eb8b6c58@changeid
      96d2bfb7
    • Luca Coelho's avatar
      iwlwifi: pcie: add rules to match Qu with Hr2 · 16062c12
      Luca Coelho authored
      
      
      Until now we have been relying on matching the PCI ID and subsystem
      device ID in order to recognize Qu devices with Hr2.  Add rules to
      match these devices, so that we don't have to add a new rule for every
      new ID we get.
      
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.591ce253ddd8.Ia4b9cc2c535625890c6d6b560db97ee9f2d5ca3b@changeid
      16062c12
    • Gregory Greenman's avatar
      iwlwifi: mvm: invalidate IDs of internal stations at mvm start · e223e42a
      Gregory Greenman authored
      
      
      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: default avatarGregory Greenman <gregory.greenman@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.5dc6dd9b22d5.I2add1b5ad24d0d0a221de79d439c09f88fcaf15d@changeid
      e223e42a
    • Matt Chen's avatar
      iwlwifi: mvm: fix the return type for DSM functions 1 and 2 · aefbe5c4
      Matt Chen authored
      
      
      The return type value of functions 1 and 2 were considered to be an
      integer inside a buffer, but they can also be only an integer, without
      the buffer.  Fix the code in iwl_acpi_get_dsm_u8() to handle it as a
      single integer value, as well as packed inside a buffer.
      
      Signed-off-by: default avatarMatt Chen <matt.chen@intel.com>
      Fixes: 9db93491
      
       ("iwlwifi: acpi: support device specific method (DSM)")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210122144849.5757092adcd6.Ic24524627b899c9a01af38107a62a626bdf5ae3a@changeid
      aefbe5c4
    • Johannes Berg's avatar
      iwlwifi: pcie: reschedule in long-running memory reads · 3d372c4e
      Johannes Berg authored
      
      
      If we spin for a long time in memory reads that (for some reason in
      hardware) take a long time, then we'll eventually get messages such
      as
      
        watchdog: BUG: soft lockup - CPU#2 stuck for 24s! [kworker/2:2:272]
      
      This is because the reading really does take a very long time, and
      we don't schedule, so we're hogging the CPU with this task, at least
      if CONFIG_PREEMPT is not set, e.g. with CONFIG_PREEMPT_VOLUNTARY=y.
      
      Previously I misinterpreted the situation and thought that this was
      only going to happen if we had interrupts disabled, and then fixed
      this (which is good anyway, however), but that didn't always help;
      looking at it again now I realized that the spin unlock will only
      reschedule if CONFIG_PREEMPT is used.
      
      In order to avoid this issue, change the code to cond_resched() if
      we've been spinning for too long here.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: 04516706
      
       ("iwlwifi: pcie: limit memory read spin time")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130253.217a9d6a6a12.If964cb582ab0aaa94e81c4ff3b279eaafda0fd3f@changeid
      3d372c4e
    • Johannes Berg's avatar
      iwlwifi: pcie: use jiffies for memory read spin time limit · 67013174
      Johannes Berg authored
      
      
      There's no reason to use ktime_get() since we don't need any better
      precision than jiffies, and since we no longer disable interrupts
      around this code (when grabbing NIC access), jiffies will work fine.
      Use jiffies instead of ktime_get().
      
      This cleanup is preparation for the following patch "iwlwifi: pcie: reschedule
      in long-running memory reads". The code gets simpler with the weird clock use
      etc. removed before we add cond_resched().
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130253.621c948b1fad.I3ee9f4bc4e74a0c9125d42fb7c35cd80df4698a1@changeid
      67013174
    • Johannes Berg's avatar
      iwlwifi: pcie: fix context info memory leak · 2d6bc752
      Johannes Berg authored
      
      
      If the image loader allocation fails, we leak all the previously
      allocated memory. Fix this.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.97172cbaa67c.I3473233d0ad01a71aa9400832fb2b9f494d88a11@changeid
      2d6bc752
    • Emmanuel Grumbach's avatar
      iwlwifi: pcie: add a NULL check in iwl_pcie_txq_unmap · 98c7d21f
      Emmanuel Grumbach authored
      
      
      I hit a NULL pointer exception in this function when the
      init flow went really bad.
      
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.2e8da9f2c132.I0234d4b8ddaf70aaa5028a20c863255e05bc1f84@changeid
      98c7d21f
    • Johannes Berg's avatar
      iwlwifi: pcie: set LTR on more devices · ed0022da
      Johannes Berg authored
      
      
      To avoid completion timeouts during device boot, set up the
      LTR timeouts on more devices - similar to what we had before
      for AX210.
      
      This also corrects the AX210 workaround to be done only on
      discrete (non-integrated) devices, otherwise the registers
      have no effect.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: edb62520
      
       ("iwlwifi: pcie: set LTR to avoid completion timeout")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.fb819e19530b.I0396f82922db66426f52fbb70d32a29c8fd66951@changeid
      ed0022da
    • Emmanuel Grumbach's avatar
      iwlwifi: queue: don't crash if txq->entries is NULL · 0f8d5656
      Emmanuel Grumbach authored
      
      
      The code was really awkward, we would first dereference
      txq->entries when calling iwl_txq_genX_tfd_unmap and then
      we would check that txq->entries is non-NULL.
      Fix that by exiting if txq->entries is NULL.
      
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.173359fc236d.I75c7c2397d20df8d7fbc24cb16a5232d5c551889@changeid
      0f8d5656
    • Emmanuel Grumbach's avatar
      iwlwifi: fix the NMI flow for old devices · a800f958
      Emmanuel Grumbach authored
      
      
      I noticed that the flow that triggers an NMI on the firmware
      for old devices (tested on 7265) doesn't work.
      Apparently, the firmware / device is still in low power when
      we write the register that triggers the NMI. We call the
      "grab_nic_access" function to make sure the device is awake
      but that wasn't enough. I played with this and noticed that
      if we wait 1 ms after the device reports it is awake before
      we write to the NMI register, the device always sees our
      write and the firmware gets properly asserted.
      
      Triggering an NMI to the firmware can be done with the
      debugfs hook:
      echo 1 > /sys/kernel/debug/iwlwifi/0000\:00\:03.0/iwlmvm/fw_nmi
      
      What happened before is that the firmware would just stall
      without running its NMI routine. Because of that the driver
      wouldn't get the "firmware crashed" interrupt. After a while
      the driver would notice that the firmware is not responding
      to some command and it would read the error data from the
      firmware, but this data is populated in the NMI service
      routine in the firmware which was not called. So in the logs
      it looked like:
      
      iwlwifi 0000:00:03.0: Error sending REPLY_ERROR: time out after 2000ms.
      iwlwifi 0000:00:03.0: Current CMD queue read_ptr 33 write_ptr 34
      iwlwifi 0000:00:03.0: Loaded firmware version: 29.09bd31e1.0 7265D-29.ucode
      iwlwifi 0000:00:03.0: 0x00000000 | ADVANCED_SYSASSERT
      iwlwifi 0000:00:03.0: 0x00000000 | trm_hw_status0
      iwlwifi 0000:00:03.0: 0x00000000 | trm_hw_status1
      iwlwifi 0000:00:03.0: 0x00000000 | branchlink2
      iwlwifi 0000:00:03.0: 0x00000000 | interruptlink1
      iwlwifi 0000:00:03.0: 0x00000000 | interruptlink2
      iwlwifi 0000:00:03.0: 0x00000000 | data1
      iwlwifi 0000:00:03.0: 0x00000000 | data2
      iwlwifi 0000:00:03.0: 0x00000000 | data3
      iwlwifi 0000:00:03.0: 0x00000000 | beacon time
      iwlwifi 0000:00:03.0: 0x00000000 | tsf low
      ...
      
      With this fix, immediately after we trigger the NMI to the
      firmware, we get the expected:
      iwlwifi 0000:00:03.0: Microcode SW error detected.  Restarting 0x2000000.
      iwlwifi 0000:00:03.0: Start IWL Error Log Dump:
      iwlwifi 0000:00:03.0: Status: 0x00000040, count: 6
      iwlwifi 0000:00:03.0: Loaded firmware version: 29.09bd31e1.0 7265D-29.ucode
      iwlwifi 0000:00:03.0: 0x00000084 | NMI_INTERRUPT_UNKNOWN
      iwlwifi 0000:00:03.0: 0x000002F1 | trm_hw_status0
      iwlwifi 0000:00:03.0: 0x00000000 | trm_hw_status1
      iwlwifi 0000:00:03.0: 0x00043D6C | branchlink2
      iwlwifi 0000:00:03.0: 0x0004AFD6 | interruptlink1
      iwlwifi 0000:00:03.0: 0x000008C4 | interruptlink2
      iwlwifi 0000:00:03.0: 0x00000000 | data1
      iwlwifi 0000:00:03.0: 0x00000080 | data2
      iwlwifi 0000:00:03.0: 0x07030000 | data3
      iwlwifi 0000:00:03.0: 0x003FD4C3 | beacon time
      iwlwifi 0000:00:03.0: 0x00C22AC3 | tsf low
      iwlwifi 0000:00:03.0: 0x00000000 | tsf hi
      iwlwifi 0000:00:03.0: 0x00000000 | time gp1
      iwlwifi 0000:00:03.0: 0x00C22AC3 | time gp2
      iwlwifi 0000:00:03.0: 0x00000001 | uCode revision type
      iwlwifi 0000:00:03.0: 0x0000001D | uCode version major
      
      Notice the first line: "Microcode SW error detected:" which
      is printed in the driver's ISR, which means that the driver
      actually got an interrupt from the firmware saying that it
      crashed. And then we have the properly populated error data.
      
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.70e67cc75d88.I6615cad4361862e7f3c9f2d3cafb6a8c61e16781@changeid
      a800f958
    • Johannes Berg's avatar
      iwlwifi: pnvm: don't try to load after failures · 82a08d0c
      Johannes Berg authored
      
      
      If loading the PNVM file failed on the first try during the
      interface up, the file is unlikely to show up later, and we
      already don't try to reload it if it changes, so just don't
      try loading it again and again.
      
      This also fixes some issues where we may try to load it at
      resume time, which may not be possible yet.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: 69725928
      
       ("iwlwifi: read and parse PNVM file")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.5ac6828a0bbe.I7d308358b21d3c0c84b1086999dbc7267f86e219@changeid
      82a08d0c
    • Johannes Berg's avatar
      iwlwifi: pnvm: don't skip everything when not reloading · 1c58bed4
      Johannes Berg authored
      
      
      Even if we don't reload the file from disk, we still need to
      trigger the PNVM load flow with the device; fix that.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: 69725928
      
       ("iwlwifi: read and parse PNVM file")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.85ef56c4ef8c.I3b853ce041a0755d45e448035bef1837995d191b@changeid
      1c58bed4
    • Johannes Berg's avatar
      iwlwifi: pcie: avoid potential PNVM leaks · 34b9434c
      Johannes Berg authored
      
      
      If we erroneously try to set the PNVM data again after it has
      already been set, we could leak the old DMA memory. Avoid that
      and warn, we shouldn't be doing this.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Fixes: 69725928
      
       ("iwlwifi: read and parse PNVM file")
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.929c2d680429.I086b9490e6c005f3bcaa881b617e9f61908160f3@changeid
      34b9434c
    • Johannes Berg's avatar
      iwlwifi: mvm: take mutex for calling iwl_mvm_get_sync_time() · 5c56d862
      Johannes Berg authored
      
      
      We need to take the mutex to call iwl_mvm_get_sync_time(), do it.
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.4bb5ccf881a6.I62973cbb081e80aa5b0447a5c3b9c3251a65cf6b@changeid
      5c56d862
    • Sara Sharon's avatar
      iwlwifi: mvm: skip power command when unbinding vif during CSA · bf544e9a
      Sara Sharon authored
      
      
      In the new CSA flow, we remain associated during CSA, but
      still do a unbind-bind to the vif. However, sending the power
      command right after when vif is unbound but still associated
      causes FW to assert (0x3400) since it cannot tell the LMAC id.
      
      Just skip this command, we will send it again in a bit, when
      assigning the new context.
      
      Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/iwlwifi.20210115130252.64a2254ac5c3.Iaa3a9050bf3d7c9cd5beaf561e932e6defc12ec3@changeid
      bf544e9a
  4. Jan 24, 2021