mbox series

[v6,00/11] wifi: ath12k: P2P support for WCN7850

Message ID 20240130040303.370590-1-quic_kangyang@quicinc.com
Headers show
Series wifi: ath12k: P2P support for WCN7850 | expand

Message

kangyang Jan. 30, 2024, 4:02 a.m. UTC
Add P2P support for WCN7850.

Kang Yang (11):
  wifi: ath12k: fix broken structure wmi_vdev_create_cmd
  wifi: ath12k: fix incorrect logic of calculating vdev_stats_id
  wifi: ath12k: change interface combination for P2P mode
  wifi: ath12k: add P2P IE in beacon template
  wifi: ath12k: implement handling of P2P NoA event
  wifi: ath12k: implement remain on channel for P2P mode
  wifi: ath12k: change WLAN_SCAN_PARAMS_MAX_IE_LEN from 256 to 512
  wifi: ath12k: allow specific mgmt frame tx while vdev is not up
  wifi: ath12k: move peer delete after vdev stop of station for WCN7850
  wifi: ath12k: designating channel frequency for ROC scan
  wifi: ath12k: advertise P2P dev support for WCN7850

v6: move patch #7, #8 to patch #1, #2(Jeff).
v5:
    1. move patch #10 to patch #8.
    2. change commit log for patch #6 and patch #8.
    3. simplify assignment logic for patch #7(Jeff).
v4: add a new patch #10 to fix warning(Kalle).
v3: rebase on new ath-tag, use ath12k_ah_to_ar() get ar(Karthikeyan).
v2:
    1. add Tested-on tag of QCN9274.
    2. update copyright in patch #1, #2, #4 and #10(Jeff).

 drivers/net/wireless/ath/ath12k/Makefile |   3 +-
 drivers/net/wireless/ath/ath12k/core.c   |   1 +
 drivers/net/wireless/ath/ath12k/hw.c     |   7 +-
 drivers/net/wireless/ath/ath12k/mac.c    | 368 +++++++++++++++++++----
 drivers/net/wireless/ath/ath12k/p2p.c    | 142 +++++++++
 drivers/net/wireless/ath/ath12k/p2p.h    |  23 ++
 drivers/net/wireless/ath/ath12k/wmi.c    | 114 ++++++-
 drivers/net/wireless/ath/ath12k/wmi.h    |  50 ++-
 8 files changed, 642 insertions(+), 66 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath12k/p2p.c
 create mode 100644 drivers/net/wireless/ath/ath12k/p2p.h


base-commit: 17f4b952f067b1f87d14e6df4c8c216fe7a245d1

Comments

Jeff Johnson Jan. 30, 2024, 4:52 p.m. UTC | #1
On 1/29/2024 8:02 PM, Kang Yang wrote:
> Current interface combination doesn't support P2P mode. Change the
> combination for P2P mode.
> 
> Also, there is a bug that when mesh is enabled but ap is not enabled.
> In this situation, the mesh's max_interface of interface combination
> won't be set.
> 
> So assign the max_interfaces for mesh directly.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Jeff Johnson Jan. 30, 2024, 5:14 p.m. UTC | #2
On 1/29/2024 8:02 PM, Kang Yang wrote:
> The NoA(Notice of Absence) attribute is used by the P2P Group Owner to
> signal its absence due to power save timing, concurrent operation, or
> off-channel scanning. It is also used in the P2P Presence Request-Response
> mechanism.
> 
> The NoA attribute shall be present in the P2P IE in the beacon frames
> transmitted by a P2P Group Owner when a NoA schedule is being advertised,
> or when the CTWindow is non-zero.
> 
> So add support to update P2P information after P2P GO is up through
> event WMI_P2P_NOA_EVENTID, and always put it in probe resp.
> 
> Create p2p.c and p2p.h for P2P related functions and definitions.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Jeff Johnson Jan. 30, 2024, 5:25 p.m. UTC | #3
On 1/29/2024 8:03 PM, Kang Yang wrote:
> Now that all the necessary pieces are implemented we can enable P2P
> support for WCN7850.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo Feb. 5, 2024, 3:40 p.m. UTC | #4
Kang Yang <quic_kangyang@quicinc.com> writes:

> Add P2P support for WCN7850.
>
> Kang Yang (11):
>   wifi: ath12k: fix broken structure wmi_vdev_create_cmd
>   wifi: ath12k: fix incorrect logic of calculating vdev_stats_id
>   wifi: ath12k: change interface combination for P2P mode
>   wifi: ath12k: add P2P IE in beacon template
>   wifi: ath12k: implement handling of P2P NoA event
>   wifi: ath12k: implement remain on channel for P2P mode
>   wifi: ath12k: change WLAN_SCAN_PARAMS_MAX_IE_LEN from 256 to 512
>   wifi: ath12k: allow specific mgmt frame tx while vdev is not up
>   wifi: ath12k: move peer delete after vdev stop of station for WCN7850
>   wifi: ath12k: designating channel frequency for ROC scan
>   wifi: ath12k: advertise P2P dev support for WCN7850

I did some quick tests by running various p2p commands with wpa_cli and
noticed the warning below. We might have some issues with our RCU usage,
please check. But no need to resend because of this, followup patch
fixing this is fine.

[ 1108.916980] =============================
[ 1108.917068] WARNING: suspicious RCU usage
[ 1108.917151] 6.8.0-rc2-wt-ath+ #1273 Not tainted
[ 1108.917235] -----------------------------
[ 1108.917318] drivers/net/wireless/ath/ath12k/mac.c:583 suspicious rcu_dereference_check() usage!
[ 1108.917400] #012[ 1108.917400] other info that might help us debug this:#012[ 1108.917400] 
[ 1108.917484] #012[ 1108.917484] rcu_scheduler_active = 2, debug_locks = 1
[ 1108.917566] no locks held by swapper/3/0.
[ 1108.917649] #012[ 1108.917649] stack backtrace:
[ 1108.917729] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 6.8.0-rc2-wt-ath+ #1273
[ 1108.917810] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
[ 1108.917892] Call Trace:
[ 1108.917968]  <IRQ>
[ 1108.918046]  dump_stack_lvl+0x82/0xc0
[ 1108.918132]  dump_stack+0x10/0x20
[ 1108.918206]  lockdep_rcu_suspicious+0x210/0x3a0
[ 1108.918285]  ath12k_mac_get_ar_by_vdev_id+0x18e/0x210 [ath12k]
[ 1108.918403]  ath12k_wmi_op_rx+0x2bb/0x1a30 [ath12k]
[ 1108.918511]  ? ath12k_chan_info_event+0x970/0x970 [ath12k]
[ 1108.918624]  ? __lock_acquire+0xd45/0x1de0
[ 1108.918706]  ? __kasan_check_read+0x11/0x20
[ 1108.918789]  ? debug_smp_processor_id+0x17/0x20
[ 1108.918863]  ? __lock_release.isra.0+0x49d/0xae0
[ 1108.918934]  ? debug_smp_processor_id+0x17/0x20
[ 1108.919007]  ? reacquire_held_locks+0x4d0/0x4d0
[ 1108.919080]  ? ath12k_ce_recv_process_cb+0x4b3/0x960 [ath12k]
[ 1108.919195]  ath12k_htc_rx_completion_handler+0x361/0x650 [ath12k]
[ 1108.919302]  ? ath12k_ce_recv_process_cb+0x4b3/0x960 [ath12k]
[ 1108.919409]  ? trace_hardirqs_on+0x49/0x50
[ 1108.919485]  ath12k_ce_recv_process_cb+0x5c6/0x960 [ath12k]
[ 1108.919591]  ? ath12k_ce_rx_post_pipe+0x990/0x990 [ath12k]
[ 1108.919658]  ? __wake_up_bit+0x120/0x120
[ 1108.919705]  ? handle_irq_event+0x10e/0x1c0
[ 1108.919752]  ath12k_ce_per_engine_service+0xda/0x110 [ath12k]
[ 1108.919817]  ath12k_pci_ce_tasklet+0x65/0x120 [ath12k]
[ 1108.919879]  ? trace_tasklet_entry+0xe4/0x110
[ 1108.919945]  tasklet_action_common.isra.0+0x24c/0x3d0
[ 1108.920007]  tasklet_action+0x4f/0x70
[ 1108.920068]  __do_softirq+0x1c2/0x868
[ 1108.920116]  irq_exit_rcu+0xab/0x110
[ 1108.920159]  common_interrupt+0xad/0xd0
[ 1108.920201]  </IRQ>
[ 1108.920309]  <TASK>
[ 1108.920355]  asm_common_interrupt+0x27/0x40
[ 1108.920399] RIP: 0010:cpuidle_enter_state+0xdc/0x580
[ 1108.920448] Code: ff ff ff ff 49 89 c7 e8 e2 fa 55 ff 31 ff e8 cb 29 54 fd 80 7d d0 00 0f 85 4a 02 00 00 e8 0c f9 55 ff 84 c0 0f 84 32 02 00 00 <45> 85 f6 0f 88 95 01 00 00 49 63 d6 48 83 fa 0a 0f 83 dd 02 00 00
[ 1108.920496] RSP: 0018:ffffc900001afd20 EFLAGS: 00000202
[ 1108.920545] RAX: 000000000065289d RBX: ffff888116413400 RCX: 1ffffffff47726c1
[ 1108.920593] RDX: 0000000000000000 RSI: ffffffffa2278020 RDI: ffffffffa24176e0
[ 1108.920639] RBP: ffffc900001afd70 R08: 0000000000000001 R09: fffffbfff4772c1a
[ 1108.920686] R10: ffffffffa3b960d7 R11: 0000000000000000 R12: ffffffffa34c1740
[ 1108.920733] R13: 0000000000000002 R14: 0000000000000002 R15: 000001023093b5a2
[ 1108.920793]  cpuidle_enter+0x4a/0xa0
[ 1108.920840]  call_cpuidle+0x42/0xb0
[ 1108.920882]  ? tick_nohz_idle_retain_tick+0x70/0xa0
[ 1108.920946]  cpuidle_idle_call+0x1c9/0x290
[ 1108.921002]  ? arch_cpu_idle_exit+0x30/0x30
[ 1108.921045]  ? debug_smp_processor_id+0x17/0x20
[ 1108.921092]  do_idle+0xfb/0x160
[ 1108.921137]  cpu_startup_entry+0x54/0x60
[ 1108.921182]  start_secondary+0x201/0x290
[ 1108.921227]  ? set_cpu_sibling_map+0x1f20/0x1f20
[ 1108.921273]  secondary_startup_64_no_verify+0x15e/0x16b
[ 1108.921324]  </TASK>
kangyang Feb. 7, 2024, 6:50 a.m. UTC | #5
On 2/5/2024 11:40 PM, Kalle Valo wrote:
> Kang Yang <quic_kangyang@quicinc.com> writes:
> 
>> Add P2P support for WCN7850.
>>
>> Kang Yang (11):
>>    wifi: ath12k: fix broken structure wmi_vdev_create_cmd
>>    wifi: ath12k: fix incorrect logic of calculating vdev_stats_id
>>    wifi: ath12k: change interface combination for P2P mode
>>    wifi: ath12k: add P2P IE in beacon template
>>    wifi: ath12k: implement handling of P2P NoA event
>>    wifi: ath12k: implement remain on channel for P2P mode
>>    wifi: ath12k: change WLAN_SCAN_PARAMS_MAX_IE_LEN from 256 to 512
>>    wifi: ath12k: allow specific mgmt frame tx while vdev is not up
>>    wifi: ath12k: move peer delete after vdev stop of station for WCN7850
>>    wifi: ath12k: designating channel frequency for ROC scan
>>    wifi: ath12k: advertise P2P dev support for WCN7850
> 
> I did some quick tests by running various p2p commands with wpa_cli and
> noticed the warning below. We might have some issues with our RCU usage,
> please check. But no need to resend because of this, followup patch
> fixing this is fine.
> 
> [ 1108.916980] =============================
> [ 1108.917068] WARNING: suspicious RCU usage
> [ 1108.917151] 6.8.0-rc2-wt-ath+ #1273 Not tainted
> [ 1108.917235] -----------------------------
> [ 1108.917318] drivers/net/wireless/ath/ath12k/mac.c:583 suspicious rcu_dereference_check() usage!
> [ 1108.917400] #012[ 1108.917400] other info that might help us debug this:#012[ 1108.917400]
> [ 1108.917484] #012[ 1108.917484] rcu_scheduler_active = 2, debug_locks = 1
> [ 1108.917566] no locks held by swapper/3/0.


I conducted a simple test, but cannot reproduce.

It seems i need to use rcu_read_lock() and rcu_read_unlock() for 
rcu_dereference().

Will fix it in a separate patch.


> [ 1108.917649] #012[ 1108.917649] stack backtrace:
> [ 1108.917729] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 6.8.0-rc2-wt-ath+ #1273
> [ 1108.917810] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
> [ 1108.917892] Call Trace:
> [ 1108.917968]  <IRQ>
> [ 1108.918046]  dump_stack_lvl+0x82/0xc0
> [ 1108.918132]  dump_stack+0x10/0x20
> [ 1108.918206]  lockdep_rcu_suspicious+0x210/0x3a0
> [ 1108.918285]  ath12k_mac_get_ar_by_vdev_id+0x18e/0x210 [ath12k]
> [ 1108.918403]  ath12k_wmi_op_rx+0x2bb/0x1a30 [ath12k]
> [ 1108.918511]  ? ath12k_chan_info_event+0x970/0x970 [ath12k]
> [ 1108.918624]  ? __lock_acquire+0xd45/0x1de0
> [ 1108.918706]  ? __kasan_check_read+0x11/0x20
> [ 1108.918789]  ? debug_smp_processor_id+0x17/0x20
> [ 1108.918863]  ? __lock_release.isra.0+0x49d/0xae0
> [ 1108.918934]  ? debug_smp_processor_id+0x17/0x20
> [ 1108.919007]  ? reacquire_held_locks+0x4d0/0x4d0
> [ 1108.919080]  ? ath12k_ce_recv_process_cb+0x4b3/0x960 [ath12k]
> [ 1108.919195]  ath12k_htc_rx_completion_handler+0x361/0x650 [ath12k]
> [ 1108.919302]  ? ath12k_ce_recv_process_cb+0x4b3/0x960 [ath12k]
> [ 1108.919409]  ? trace_hardirqs_on+0x49/0x50
> [ 1108.919485]  ath12k_ce_recv_process_cb+0x5c6/0x960 [ath12k]
> [ 1108.919591]  ? ath12k_ce_rx_post_pipe+0x990/0x990 [ath12k]
> [ 1108.919658]  ? __wake_up_bit+0x120/0x120
> [ 1108.919705]  ? handle_irq_event+0x10e/0x1c0
> [ 1108.919752]  ath12k_ce_per_engine_service+0xda/0x110 [ath12k]
> [ 1108.919817]  ath12k_pci_ce_tasklet+0x65/0x120 [ath12k]
> [ 1108.919879]  ? trace_tasklet_entry+0xe4/0x110
> [ 1108.919945]  tasklet_action_common.isra.0+0x24c/0x3d0
> [ 1108.920007]  tasklet_action+0x4f/0x70
> [ 1108.920068]  __do_softirq+0x1c2/0x868
> [ 1108.920116]  irq_exit_rcu+0xab/0x110
> [ 1108.920159]  common_interrupt+0xad/0xd0
> [ 1108.920201]  </IRQ>
> [ 1108.920309]  <TASK>
> [ 1108.920355]  asm_common_interrupt+0x27/0x40
> [ 1108.920399] RIP: 0010:cpuidle_enter_state+0xdc/0x580
> [ 1108.920448] Code: ff ff ff ff 49 89 c7 e8 e2 fa 55 ff 31 ff e8 cb 29 54 fd 80 7d d0 00 0f 85 4a 02 00 00 e8 0c f9 55 ff 84 c0 0f 84 32 02 00 00 <45> 85 f6 0f 88 95 01 00 00 49 63 d6 48 83 fa 0a 0f 83 dd 02 00 00
> [ 1108.920496] RSP: 0018:ffffc900001afd20 EFLAGS: 00000202
> [ 1108.920545] RAX: 000000000065289d RBX: ffff888116413400 RCX: 1ffffffff47726c1
> [ 1108.920593] RDX: 0000000000000000 RSI: ffffffffa2278020 RDI: ffffffffa24176e0
> [ 1108.920639] RBP: ffffc900001afd70 R08: 0000000000000001 R09: fffffbfff4772c1a
> [ 1108.920686] R10: ffffffffa3b960d7 R11: 0000000000000000 R12: ffffffffa34c1740
> [ 1108.920733] R13: 0000000000000002 R14: 0000000000000002 R15: 000001023093b5a2
> [ 1108.920793]  cpuidle_enter+0x4a/0xa0
> [ 1108.920840]  call_cpuidle+0x42/0xb0
> [ 1108.920882]  ? tick_nohz_idle_retain_tick+0x70/0xa0
> [ 1108.920946]  cpuidle_idle_call+0x1c9/0x290
> [ 1108.921002]  ? arch_cpu_idle_exit+0x30/0x30
> [ 1108.921045]  ? debug_smp_processor_id+0x17/0x20
> [ 1108.921092]  do_idle+0xfb/0x160
> [ 1108.921137]  cpu_startup_entry+0x54/0x60
> [ 1108.921182]  start_secondary+0x201/0x290
> [ 1108.921227]  ? set_cpu_sibling_map+0x1f20/0x1f20
> [ 1108.921273]  secondary_startup_64_no_verify+0x15e/0x16b
> [ 1108.921324]  </TASK>
> 
>