An error occurred fetching the project authors.
  1. 07 Dec, 2021 1 commit
    • Johannes Berg's avatar
      iwlwifi: mvm: fix delBA vs. NSSN queue sync race · 2438d430
      Johannes Berg authored
      If we happen to decide an NSSN queue sync (IWL_MVM_RXQ_NSSN_SYNC)
      for some remaining packets that are still on the queue, but just
      after we've decided to do a delBA (which causes its own queues
      sync with IWL_MVM_RXQ_NOTIF_DEL_BA) we can end up with a sequence
      of events like this:
      
       CPU 1                              CPU 2
      
      remove BA session with baid N
      send IWL_MVM_RXQ_NOTIF_DEL_BA
      send IWL_MVM_RXQ_NSSN_SYNC
      get IWL_MVM_RXQ_NOTIF_DEL_BA
                                          get IWL_MVM_RXQ_NOTIF_DEL_BA
      get IWL_MVM_RXQ_NSSN_SYNC
      complete IWL_MVM_RXQ_NOTIF_DEL_BA
      remove N from baid_map[]
                                          get IWL_MVM_RXQ_NSSN_SYNC
                                          WARN_ON(!baid_map[N])
      
      Thus, there's a race that leads in hitting the WARN_ON, but more
      importantly, it's a race that potentially even results in a new
      aggregation session getting assigned to baid N.
      
      To fix this, remove the WARN_ON() in the NSSN_SYNC case, we can't
      completely protect against hitting this case, so we shouldn't be
      warning. However, guard ourselves against BAID reuse by doing yet
      another round of queue synchronization after the entry is removed
      from the baid_map, so that it cannot be reused with any in-flight
      IWL_MVM_RXQ_NSSN_SYNC messages.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Link: https://lore.kernel.org/r/iwlwifi.20211204083237.44abbbc50f40.I5492600dfe513356555abe2d7df0e2835846e3d8@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      2438d430
  2. 22 Oct, 2021 4 commits
  3. 26 Aug, 2021 2 commits
  4. 22 Jun, 2021 1 commit
  5. 14 Apr, 2021 1 commit
  6. 06 Apr, 2021 1 commit
  7. 05 Feb, 2021 3 commits
  8. 11 Dec, 2020 1 commit
  9. 09 Dec, 2020 7 commits
  10. 08 Oct, 2020 1 commit
  11. 01 Oct, 2020 2 commits
  12. 22 Jan, 2020 1 commit
  13. 20 Nov, 2019 1 commit
  14. 15 Nov, 2019 1 commit
  15. 25 Oct, 2019 1 commit
  16. 06 Sep, 2019 5 commits
  17. 30 Jul, 2019 4 commits
    • Emmanuel Grumbach's avatar
      iwlwifi: mvm: fix frame drop from the reordering buffer · ecd09ddc
      Emmanuel Grumbach authored
      An earlier patch made sure that the queues are not lagging
      too far behind. This means that iwl_mvm_release_frames
      should not be called with a head_sn too far behind NSSN.
      
      Don't take the risk to change completely the entry
      condition to iwl_mvm_release_frames, but don't update
      the head_sn is the NSSN is more than 2048 packets ahead
      of us. Since this just cannot be right. This means that
      the scenario described here happened. We are queue 0.
      
      	Q:0				Q:1
      	head_sn: 0    -> 2047
      					head_sn: 2048
      
      	Lots of packets arrive:
      	head_sn: 2047 -> 2150
      
      					send NSSN_SYNC notification
      
      	Handle notification
      	from the firmware and
      	do NOT move the head_sn
      	back to 2048
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      ecd09ddc
    • Emmanuel Grumbach's avatar
      iwlwifi: mvm: add a loose synchronization of the NSSN across Rx queues · 3c514bf8
      Emmanuel Grumbach authored
      In order to support MSI-X efficiently, we want to avoid
      communication across Rx queues. Each Rx queue should have
      all the data it needs to process a packet.
      
      The reordering buffer is a challenge in the MSI-X world
      since we can have a single BA session whose packets are
      directed to different queues. This is why each queue has
      its own reordering buffer. The hardware is able to hint
      the driver whether we have a hole or not, which allows
      the driver to know whether it can release a packet or not.
      This indication is called NSSN. Roughly, if the packet's
      SN is lower than the NSSN, we can release the packet to
      the stack. The NSSN is the SN of the newest packet received
      without any holes + 1.
      
      This is working as long as we don't have packets that we
      release because of a timeout. When that happens, we could
      have taken the decision to release a packet after we have
      been waiting for its predecessor for too long. If this
      predecessor comes later, we have to drop it because we
      can't release packets out of order. In that case, the
      hardware will give us an indication that we can we release
      the packet (SN < NSSN), but the packet still needs to be
      dropped.
      This is why we sometimes need to ignore the NSSN and we
      track the head_sn in software.
      Here is a specific example of this:
      
      1) Rx queue 1 got packets: 480, 482, 483
      2) We release 480 to to the stack and wait for 481
      3) NSSN is now 481
      4) The timeout expires
      5) We release 482 and 483, NSSN is still 480
      6) 481 arrives its NSSN is 484.
      
      We need to drop 481 even if 481 < 484. This is why we'll
      update the head_sn to 484 at step 2. The flow now is:
      
      1) Rx queue 1 got packets: 480, 482, 483
      2) We release 480 to to the stack and wait for 481
      3) NSSN is now 481 / head_sn is 481
      4) The timeout expires
      5) We release 482 and 483, NSSN is still 480 but head_sn is 484.
      6) 481 arrives its NSSN is 484, but head_sn is 484 and we drop it.
      
      This code introduces another problem in case all the traffic
      goes well (no hole, no timeout):
      
      Rx queue 1: 0   -> 483   (head_sn = 484)
      Rx queue 2: 501 -> 4095  (head_sn = 0)
      Rx queue 2: 0   -> 480   (head_sn = 481)
      Rx queue 1: 481 but head_sn = 484 and we drop it.
      
      At this point, the SN of queue 1 is far behind: more than
      4040 packets behind. Queue 1 will consider 481 "old"
      because 481 is in [501-64:501] whereas it is a very new
      packet.
      
      In order to fix that, send an Rx notification from time to
      time (twice across the full set of 4096 packets) to make
      sure no Rx queue is lagging too far behind.
      
      What will happen then is:
      
      Rx queue 1: 0    -> 483       (head_sn = 484)
      Rx queue 2: 501  -> 2047      (head_sn = 2048)
      Rx queue 1: Sync nofication   (head_sn = 2048)
      Rx queue 2: 2048 -> 4095      (head_sn = 0)
      Rx queue 1: Sync notification (head_sn = 0)
      Rx queue 2: 1    -> 481       (head_sn = 482)
      Rx queue 1: 481 and head_sn = 0.
      
      In queue 1's data, head_sn is now 0, the packet coming in
      is 481, it'll understand that the new packet is new and it
      won't be dropped.
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      3c514bf8
    • Emmanuel Grumbach's avatar
      iwlwiif: mvm: refactor iwl_mvm_notify_rx_queue · 521dc6c7
      Emmanuel Grumbach authored
      Instead of allocating memory for which we have an upper
      limit, use a small buffer on stack.
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      521dc6c7
    • Emmanuel Grumbach's avatar
      iwlwifi: mvm: add a new RSS sync notification for NSSN sync · c61b655a
      Emmanuel Grumbach authored
      We will soon be using a new notification that will be
      initiated by the driver, sent to the firmware and sent
      back to all the RSS queues by the firmware. This new
      notification will be useful to synchronize the NSSN across
      all the queues.
      
      For now, don't send the notification, just add the code to
      handle it. Later patch will add the code to actually send
      it.
      
      While at it, validate the baid coming from the firmware to
      avoid accessing an array with a bad index in the driver.
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      c61b655a
  18. 22 Jun, 2019 1 commit
  19. 28 Apr, 2019 1 commit
    • Luca Coelho's avatar
      iwlwifi: mvm: check for length correctness in iwl_mvm_create_skb() · de1887c0
      Luca Coelho authored
      We don't check for the validity of the lengths in the packet received
      from the firmware.  If the MPDU length received in the rx descriptor
      is too short to contain the header length and the crypt length
      together, we may end up trying to copy a negative number of bytes
      (headlen - hdrlen < 0) which will underflow and cause us to try to
      copy a huge amount of data.  This causes oopses such as this one:
      
      BUG: unable to handle kernel paging request at ffff896be2970000
      PGD 5e201067 P4D 5e201067 PUD 5e205067 PMD 16110d063 PTE 8000000162970161
      Oops: 0003 [#1] PREEMPT SMP NOPTI
      CPU: 2 PID: 1824 Comm: irq/134-iwlwifi Not tainted 4.19.33-04308-geea41cf4930f #1
      Hardware name: [...]
      RIP: 0010:memcpy_erms+0x6/0x10
      Code: 90 90 90 90 eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 <f3> a4 c3
       0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe
      RSP: 0018:ffffa4630196fc60 EFLAGS: 00010287
      RAX: ffff896be2924618 RBX: ffff896bc8ecc600 RCX: 00000000fffb4610
      RDX: 00000000fffffff8 RSI: ffff896a835e2a38 RDI: ffff896be2970000
      RBP: ffffa4630196fd30 R08: ffff896bc8ecc600 R09: ffff896a83597000
      R10: ffff896bd6998400 R11: 000000000200407f R12: ffff896a83597050
      R13: 00000000fffffff8 R14: 0000000000000010 R15: ffff896a83597038
      FS:  0000000000000000(0000) GS:ffff896be8280000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffff896be2970000 CR3: 000000005dc12002 CR4: 00000000003606e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       iwl_mvm_rx_mpdu_mq+0xb51/0x121b [iwlmvm]
       iwl_pcie_rx_handle+0x58c/0xa89 [iwlwifi]
       iwl_pcie_irq_rx_msix_handler+0xd9/0x12a [iwlwifi]
       irq_thread_fn+0x24/0x49
       irq_thread+0xb0/0x122
       kthread+0x138/0x140
       ret_from_fork+0x1f/0x40
      
      Fix that by checking the lengths for correctness and trigger a warning
      to show that we have received wrong data.
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      de1887c0
  20. 22 Mar, 2019 1 commit