1. 26 Sep, 2022 1 commit
    • Venkateswara Naralasetty's avatar
      wifi: ath11k: Add support to get power save duration for each client · 710a95f9
      Venkateswara Naralasetty authored
      Add support to get the following power save information through debugfs interface,
      
       * Current ps state of the peer
       * Time duration since the peer is in power save
       * Total duration of the peer spent in power save
      
      Above information is helpful in debugging the issues with power save clients.
      
      This patch also add trace log support for PS timekeeper to track the PS state
      change of the peers alongs with the peer MAC address and timestamp.
      
      Use the below commands to get the above power save information,
      
      To know the time_since_station_in_power_save:
      cat /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/stations/
      XX:XX:XX:XX:XX:XX/current_ps_duration
      
      To know power_save_duration:
      cat /sys/kernel/debug/ieee80211/phyX/netdev:wlanX/stations/
      XX:XX:XX:XX:XX:XX/total_ps_duration
      
      To reset the power_save_duration of all stations connected to AP:
      echo 1 > /sys/kernel/debug/ieee80211/phyX/ath11k/reset_ps_duration
      
      To enable/disable the ps_timekeeper:
      echo Y > /sys/kernel/debug/ieee80211/phyX/ath11k/ps_timekeeper_enable
      Y = 1 to enable and Y = 0 to disable.
      
      To record PS timekeeer logs after enabling ps_timekeeper:
      trace-cmd record -e ath11k_ps_timekeeper
      
      Tested-on: Tested-on: IPQ8074 WLAN.HK.2.5.0.1-00991-QCAHKSWPL_SILICONZ-1
      Signed-off-by: default avatarVenkateswara Naralasetty <quic_vnaralas@quicinc.com>
      Signed-off-by: default avatarTamizh Chelvam Raja <quic_tamizhr@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220725054601.14719-1-quic_tamizhr@quicinc.com
      710a95f9
  2. 24 Sep, 2022 1 commit
    • Christian 'Ansuel' Marangi's avatar
      wifi: ath11k: fix peer addition/deletion error on sta band migration · d673cb6f
      Christian 'Ansuel' Marangi authored
      This patch try to fix the following error.
      
      Wed Jun  1 22:19:30 2022 kern.warn kernel: [  119.561227] ath11k c000000.wifi: peer already added vdev id 0 req, vdev id 1 present
      Wed Jun  1 22:19:30 2022 kern.warn kernel: [  119.561282] ath11k c000000.wifi: Failed to add peer: 28:c2:1f:xx:xx:xx for VDEV: 0
      Wed Jun  1 22:19:30 2022 kern.warn kernel: [  119.568053] ath11k c000000.wifi: Failed to add station: 28:c2:1f:xx:xx:xx for VDEV: 0
      Wed Jun  1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: Could not add STA to kernel driver
      Wed Jun  1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: did not acknowledge authentication response
      Wed Jun  1 22:19:31 2022 daemon.notice hostapd: wlan1: AP-STA-DISCONNECTED 28:c2:1f:xx:xx:xx
      Wed Jun  1 22:19:31 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: disassociated due to inactivity
      Wed Jun  1 22:19:32 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
      
      To repro this:
      - Have 2 Wifi with the same bssid and pass on different band (2.4 and
      5GHz)
      - Enable 802.11r Fast Transaction with same mobility domain
      - FT Protocol: FT over the Air
      From a openwrt system issue the command (with the correct mac)
      ubus call hostapd.wlan1 wnm_disassoc_imminent '{"addr":"28:C2:1F:xx:xx:xx"}'
      Notice the log printing the errors.
      
      The cause of this error has been investigated and we found that this is
      related to the WiFi Fast Transaction feature. We observed that this is
      triggered when the router tells the device to change band. In this case
      the device first auth to the other band and then the disconnect path
      from the prev band is triggered.
      This is problematic with the current rhash implementation since the
      addrs is used as key and the logic of "adding first, delete later"
      conflicts with the rhash logic.
      In fact peer addition will fail since the peer is already added and with
      that fixed a peer deletion will cause unitended effect by removing the
      peer just added.
      
      Current solution to this is to add additional logic to the peer delete,
      make sure we are deleting the correct peer taken from the rhash
      table (and fallback to the peer list) and for the peer add logic delete
      the peer entry for the rhash list before adding the new one (counting as
      an error only when a peer with the same vlan_id is asked to be added).
      
      With this change, a sta can correctly transition from 2.4GHz and 5GHZ
      with no drop and no error are printed.
      
      Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
      
      Fixes: 7b0c70d9 ("ath11k: Add peer rhash table support")
      Signed-off-by: default avatarChristian 'Ansuel' Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220603164559.27769-1-ansuelsmth@gmail.com
      d673cb6f
  3. 22 Sep, 2022 9 commits
    • Jesus Fernandez Manzano's avatar
      wifi: ath11k: fix number of VHT beamformee spatial streams · 55b5ee33
      Jesus Fernandez Manzano authored
      The number of spatial streams used when acting as a beamformee in VHT
      mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and
      IPQ8074 which respectively have 2 and 4 sts each. So the firmware should
      report 1 (2 - 1) and 3 (4 - 1).
      
      Fix this by checking that the number of VHT beamformee sts reported by
      the firmware is not greater than the number of receiving antennas - 1.
      The fix is based on the same approach used in this same function for
      sanitizing the number of sounding dimensions reported by the firmware.
      
      Without this change, acting as a beamformee in VHT mode is not working
      properly.
      
      Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
      Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
      
      Fixes: d5c65159 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
      Signed-off-by: default avatarJesus Fernandez Manzano <jesus.manzano@galgus.net>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220616173947.21901-1-jesus.manzano@galgus.net
      55b5ee33
    • Jun Yu's avatar
      wifi: ath11k: retrieve MAC address from system firmware if provided · 176239a9
      Jun Yu authored
      Devices may provide their own MAC address via system firmware (e.g.,
      device tree), especially in the case where the device doesn't have a
      useful EEPROM on which to store its MAC address (e.g., for integrated
      ahb WCN6750).
      
      Use the generic device helper to retrieve the MAC address, and (if
      present) honor it above the MAC address advertised by the card.
      
      Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
      Signed-off-by: default avatarJun Yu <junyuu@chromium.org>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220920003117.841442-1-junyuu@chromium.org
      176239a9
    • Aditya Kumar Singh's avatar
      wifi: ath11k: add get_txpower mac ops · 9a2aa68a
      Aditya Kumar Singh authored
      Driver does not support get_txpower mac ops because of which
      cfg80211 returns vif->bss_conf.txpower to user space. bss_conf.txpower
      gets its value from ieee80211_channel->max_reg_power. However, the final
      txpower is dependent on few other parameters apart from max regulatory
      supported power. It is the firmware which knows about all these
      parameters and considers the minimum for each packet transmission.
      
      All ath11k firmware reports the final tx power in firmware pdev stats
      which falls under fw_stats.
      
      Add get_txpower mac ops to get the tx power from firmware leveraging
      fw_stats and return it accordingly.
      
      Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
      Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      Signed-off-by: default avatarAditya Kumar Singh <quic_adisi@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220603082814.31466-3-quic_adisi@quicinc.com
      9a2aa68a
    • Aditya Kumar Singh's avatar
      wifi: ath11k: move firmware stats out of debugfs · ec8918f9
      Aditya Kumar Singh authored
      Currently, firmware stats, comprising pdev, vdev and beacon stats are
      part of debugfs. In firmware pdev stats, firmware reports the final
      Tx power used to transmit each packet. If driver wants to know the
      final Tx power being used at firmware level, it can leverage from
      firmware pdev stats.
      
      Move firmware stats out of debugfs context in order to leverage
      the final Tx power reported in it even when debugfs is disabled.
      
      Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
      Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      Signed-off-by: default avatarAditya Kumar Singh <quic_adisi@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220603082814.31466-2-quic_adisi@quicinc.com
      ec8918f9
    • Jilin Yuan's avatar
    • Jilin Yuan's avatar
    • Wen Gong's avatar
      wifi: ath10k: reset pointer after memory free to avoid potential use-after-free · 1e1cb8e0
      Wen Gong authored
      When running suspend test, kernel crash happened in ath10k, and it is
      fixed by commit b72a4aff ("ath10k: skip ath10k_halt during suspend
      for driver state RESTARTING").
      
      Currently the crash is fixed, but as a common code style, it is better
      to set the pointer to NULL after memory is free.
      
      This is to address the code style and it will avoid potential bug of
      use-after-free.
      
      Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1
      Signed-off-by: default avatarWen Gong <quic_wgong@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220505092248.787-1-quic_wgong@quicinc.com
      1e1cb8e0
    • Wen Gong's avatar
      wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected · a20ed60b
      Wen Gong authored
      It has a fail log which is ath11k_dbg in ath11k_dp_rx_process_mon_status(),
      as below, it will not print when debug_mask is not set ATH11K_DBG_DATA.
      	ath11k_dbg(ab, ATH11K_DBG_DATA,
      		  "failed to find the peer with peer_id %d\n",
      		   ppdu_info.peer_id);
      
      When run scan with station disconnected, the peer_id is 0 for case
      HAL_RX_MPDU_START in ath11k_hal_rx_parse_mon_status_tlv() which called
      from ath11k_dp_rx_process_mon_status(), and the peer_id of ppdu_info is
      reset to 0 in the while loop, so it does not match condition of the
      check "if (ppdu_info->peer_id == HAL_INVALID_PEERID" in the loop, and
      then the log "failed to find the peer with peer_id 0" print after the
      check in the loop, it is below call stack when debug_mask is set
      ATH11K_DBG_DATA.
      
      The reason is this commit 01d2f285 ("ath11k: decode HE status tlv")
      add "memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info))" in
      ath11k_dp_rx_process_mon_status(), but the commit does not initialize
      the peer_id to HAL_INVALID_PEERID, then lead the check mis-match.
      
      Callstack of the failed log:
      [12335.689072] RIP: 0010:ath11k_dp_rx_process_mon_status+0x9ea/0x1020 [ath11k]
      [12335.689157] Code: 89 ff e8 f9 10 00 00 be 01 00 00 00 4c 89 f7 e8 dc 4b 4e de 48 8b 85 38 ff ff ff c7 80 e4 07 00 00 01 00 00 00 e9 20 f8 ff ff <0f> 0b 41 0f b7 96 be 06 00 00 48 c7 c6 b8 50 44 c1 4c 89 ff e8 fd
      [12335.689180] RSP: 0018:ffffb874001a4ca0 EFLAGS: 00010246
      [12335.689210] RAX: 0000000000000000 RBX: ffff995642cbd100 RCX: 0000000000000000
      [12335.689229] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff99564212cd18
      [12335.689248] RBP: ffffb874001a4dc0 R08: 0000000000000001 R09: 0000000000000000
      [12335.689268] R10: 0000000000000220 R11: ffffb874001a48e8 R12: ffff995642473d40
      [12335.689286] R13: ffff99564212c5b8 R14: ffff9956424736a0 R15: ffff995642120000
      [12335.689303] FS:  0000000000000000(0000) GS:ffff995739000000(0000) knlGS:0000000000000000
      [12335.689323] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [12335.689341] CR2: 00007f43c5d5e039 CR3: 000000011c012005 CR4: 00000000000606e0
      [12335.689360] Call Trace:
      [12335.689377]  <IRQ>
      [12335.689418]  ? rcu_read_lock_held_common+0x12/0x50
      [12335.689447]  ? rcu_read_lock_sched_held+0x25/0x80
      [12335.689471]  ? rcu_read_lock_held_common+0x12/0x50
      [12335.689504]  ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k]
      [12335.689578]  ? ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k]
      [12335.689653]  ? lock_acquire+0xef/0x360
      [12335.689681]  ? rcu_read_lock_sched_held+0x25/0x80
      [12335.689713]  ath11k_dp_service_mon_ring+0x38/0x60 [ath11k]
      [12335.689784]  ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k]
      [12335.689860]  call_timer_fn+0xb2/0x2f0
      [12335.689897]  ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k]
      [12335.689970]  run_timer_softirq+0x21f/0x540
      [12335.689999]  ? ktime_get+0xad/0x160
      [12335.690025]  ? lapic_next_deadline+0x2c/0x40
      [12335.690053]  ? clockevents_program_event+0x82/0x100
      [12335.690093]  __do_softirq+0x151/0x4a8
      [12335.690135]  irq_exit_rcu+0xc9/0x100
      [12335.690165]  sysvec_apic_timer_interrupt+0xa8/0xd0
      [12335.690189]  </IRQ>
      [12335.690204]  <TASK>
      [12335.690225]  asm_sysvec_apic_timer_interrupt+0x12/0x20
      
      Reset the default value to HAL_INVALID_PEERID each time after memset
      of ppdu_info as well as others memset which existed in function
      ath11k_dp_rx_process_mon_status(), then the failed log disappeared.
      
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      
      Fixes: 01d2f285 ("ath11k: decode HE status tlv")
      Signed-off-by: default avatarWen Gong <quic_wgong@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220518033556.31940-1-quic_wgong@quicinc.com
      a20ed60b
    • Wen Gong's avatar
      wifi: ath11k: change complete() to complete_all() for scan.completed · 7855a6ed
      Wen Gong authored
      Currently commit 1f682dc9 ("ath11k: reduce the wait time of 11d scan
      and hw scan while add interface") introduced a wait_for_completion_timeout
      operation for ar->scan.completed, another one is existed in ath11k_scan_stop(),
      then ath11k has two places to wait for the ar->scan.completed and they
      run in different thread, thus it is possible to happend that the two
      thread both enter wait status. To handle this scenario, ath11k should
      change the complete() to complete_all() for the ar->scan.completed. This
      also work well when it is only one thread wait for ar->scan.completed.
      
      Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
      Signed-off-by: default avatarWen Gong <quic_wgong@quicinc.com>
      Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
      Link: https://lore.kernel.org/r/20220919024413.25083-1-quic_wgong@quicinc.com
      7855a6ed
  4. 19 Sep, 2022 5 commits
  5. 16 Sep, 2022 3 commits
  6. 10 Sep, 2022 6 commits
  7. 07 Sep, 2022 1 commit
  8. 02 Sep, 2022 3 commits
  9. 01 Sep, 2022 3 commits
  10. 30 Aug, 2022 2 commits
  11. 29 Aug, 2022 1 commit
  12. 26 Aug, 2022 5 commits