diff mbox series

wifi: ath12k: add support to handle beacon miss for WCN7850

Message ID 20240319023032.719-1-quic_kangyang@quicinc.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: add support to handle beacon miss for WCN7850 | expand

Commit Message

kangyang March 19, 2024, 2:30 a.m. UTC
From: Kang Yang <quic_kangyang@quicinc.com>

When AP goes down or too far away without indication to STA, beacon miss
will be detected. Then for WCN7850's firmware, it will use roam event
to send beacon miss to host.

If STA doesn't handle the beacon miss, will keep the fake connection
and unable to roam.

So add support for WCN7850 to trigger disconnection from AP when
receiving this event from firmware.

It has to be noted that beacon miss event notification for QCN9274
to be handled in a separate patch as it uses STA kickout WMI event
to notify beacon miss and the current STA kickout event is processed
as low_ack.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/core.h |  2 +
 drivers/net/wireless/ath/ath12k/mac.c  | 79 ++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath12k/mac.h  |  2 +
 drivers/net/wireless/ath/ath12k/wmi.c  | 34 +++++------
 drivers/net/wireless/ath/ath12k/wmi.h  |  3 +
 5 files changed, 98 insertions(+), 22 deletions(-)


base-commit: a2a4cf3541db8066af7e6d4eb6e9e6445f6d9658

Comments

Jeff Johnson March 19, 2024, 3:37 p.m. UTC | #1
On 3/18/2024 7:30 PM, kangyang wrote:
> From: Kang Yang <quic_kangyang@quicinc.com>
> 
> When AP goes down or too far away without indication to STA, beacon miss
> will be detected. Then for WCN7850's firmware, it will use roam event
> to send beacon miss to host.
> 
> If STA doesn't handle the beacon miss, will keep the fake connection
> and unable to roam.
> 
> So add support for WCN7850 to trigger disconnection from AP when
> receiving this event from firmware.
> 
> It has to be noted that beacon miss event notification for QCN9274
> to be handled in a separate patch as it uses STA kickout WMI event
> to notify beacon miss and the current STA kickout event is processed
> as low_ack.
> 
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> 
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo April 11, 2024, 9:56 a.m. UTC | #2
kangyang <quic_kangyang@quicinc.com> writes:

> From: Kang Yang <quic_kangyang@quicinc.com>
>
> When AP goes down or too far away without indication to STA, beacon miss
> will be detected. Then for WCN7850's firmware, it will use roam event
> to send beacon miss to host.
>
> If STA doesn't handle the beacon miss, will keep the fake connection
> and unable to roam.
>
> So add support for WCN7850 to trigger disconnection from AP when
> receiving this event from firmware.
>
> It has to be noted that beacon miss event notification for QCN9274
> to be handled in a separate patch as it uses STA kickout WMI event
> to notify beacon miss and the current STA kickout event is processed
> as low_ack.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>

There were conflicts but I fixed in the pending branch, though I admit I
did that hastily:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e5b7eced753bc7e5af133624f6ff37141c5b3442

But now I see warnings like below, I don't if it's caused my conflict
fixes or was there originally.

[ 2248.795411] ------------[ cut here ]------------
[ 2248.796912] WARNING: CPU: 0 PID: 7431 at kernel/workqueue.c:4201 __flush_work+0x15b/0x170
[ 2248.797566] Modules linked in: ath12k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr nvme nvme_core [last unloaded: mhi]
[ 2248.798430] CPU: 0 PID: 7431 Comm: wpa_supplicant Tainted: G        W          6.9.0-rc2-wt-ath+ #1383
[ 2248.799332] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
[ 2248.800150] RIP: 0010:__flush_work+0x15b/0x170
[ 2248.800882] Code: 00 00 00 48 8b 55 d0 65 48 2b 14 25 28 00 00 00 75 28 48 81 c4 48 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 31 c0 eb b7 <0f> 0b 31 c0 eb b1 e8 3a c4 60 00 e9 55 ff ff ff e8 70 b3 bf 02 55
[ 2248.802403] RSP: 0018:ffffc900020e70a0 EFLAGS: 00010246
[ 2248.803186] RAX: dffffc0000000000 RBX: 1ffff9200041ce15 RCX: ffffffffa24c3106
[ 2248.803986] RDX: 1ffff11024ee5c54 RSI: 0000000000000001 RDI: ffff88812772e2a0
[ 2248.804788] RBP: ffffc900020e7210 R08: 0000000000000001 R09: fffffbfff6e6fa48
[ 2248.805575] R10: ffffffffb737d247 R11: 0000000000000006 R12: ffff88812772e288
[ 2248.806371] R13: 0000000000000001 R14: ffffc900020e71e8 R15: 0000000000000001
[ 2248.807168] FS:  00007fd218478140(0000) GS:ffff88821ba00000(0000) knlGS:0000000000000000
[ 2248.807979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2248.808780] CR2: 000055cb2ce7aa88 CR3: 000000013a101005 CR4: 00000000003706f0
[ 2248.809579] Call Trace:
[ 2248.810422]  <TASK>
[ 2248.811311]  ? show_regs+0x5b/0x70
[ 2248.812173]  ? __warn+0xc7/0x300
[ 2248.813027]  ? reacquire_held_locks+0x4d0/0x4d0
[ 2248.813897]  ? __flush_work+0x15b/0x170
[ 2248.814794]  ? report_bug+0x310/0x3f0
[ 2248.815690]  ? handle_bug+0x71/0x90
[ 2248.816503]  ? exc_invalid_op+0x18/0x40
[ 2248.817338]  ? asm_exc_invalid_op+0x1b/0x20
[ 2248.818200]  ? mark_lock+0xe6/0x1470
[ 2248.819064]  ? __flush_work+0x15b/0x170
[ 2248.820032]  ? start_flush_work+0x9c0/0x9c0
[ 2248.820870]  ? __kasan_check_read+0x11/0x20
[ 2248.821717]  ? mark_lock+0xe6/0x1470
[ 2248.822516]  ? mark_lock_irq+0x1cc0/0x1cc0
[ 2248.823352]  ? detach_if_pending+0x370/0x370
[ 2248.824170]  ? debug_smp_processor_id+0x17/0x20
[ 2248.825052]  ? __cancel_work_sync+0x32f/0x480
[ 2248.825942]  ? __this_cpu_preempt_check+0x13/0x20
[ 2248.826805]  __cancel_work_sync+0x325/0x480
[ 2248.827606]  ? flush_rcu_work+0x70/0x70
[ 2248.828457]  cancel_delayed_work_sync+0xe/0x10
[ 2248.829294]  ath12k_mac_assign_vif_to_vdev.isra.0+0x318/0xb00 [ath12k]
[ 2248.830171]  ath12k_mac_op_add_interface+0x2d6/0x410 [ath12k]
[ 2248.831079]  drv_add_interface+0x141/0x710 [mac80211]
[ 2248.832043]  ieee80211_do_open+0xf20/0x1720 [mac80211]
[ 2248.833009]  ? __this_cpu_preempt_check+0x13/0x20
[ 2248.833931]  ieee80211_start_p2p_device+0x67/0xf0 [mac80211]
[ 2248.834924]  nl80211_start_p2p_device+0x226/0x4c0 [cfg80211]
[ 2248.835889]  genl_family_rcv_msg_doit+0x1f0/0x2e0
[ 2248.836789]  ? genl_family_rcv_msg_attrs_parse.isra.0+0x250/0x250
[ 2248.837603]  ? ns_capable+0x57/0xd0
[ 2248.838432]  genl_family_rcv_msg+0x34c/0x600
[ 2248.839303]  ? genl_family_rcv_msg_dumpit+0x310/0x310
[ 2248.840117]  ? __lock_acquire+0xd43/0x1dd0
[ 2248.840974]  ? he_set_mcs_mask.isra.0+0x8d0/0x8d0 [cfg80211]
[ 2248.841888]  ? nl80211_associate+0x2720/0x2720 [cfg80211]
[ 2248.842832]  ? cfg80211_external_auth_request+0x690/0x690 [cfg80211]
[ 2248.843747]  genl_rcv_msg+0xa0/0x130
[ 2248.844537]  netlink_rcv_skb+0x14c/0x400
[ 2248.845355]  ? genl_family_rcv_msg+0x600/0x600
[ 2248.846153]  ? netlink_ack+0xd70/0xd70
[ 2248.846954]  ? rwsem_optimistic_spin+0x4f0/0x4f0
[ 2248.847796]  ? genl_rcv+0x14/0x40
[ 2248.848546]  ? rwsem_down_read_slowpath+0xb10/0xb10
[ 2248.849348]  ? netlink_deliver_tap+0x143/0x350
[ 2248.850171]  ? __this_cpu_preempt_check+0x13/0x20
[ 2248.851022]  genl_rcv+0x23/0x40
[ 2248.851812]  netlink_unicast+0x45c/0x790
[ 2248.852514]  ? netlink_attachskb+0x7f0/0x7f0
[ 2248.853270]  netlink_sendmsg+0x7eb/0xdb0
[ 2248.854030]  ? netlink_unicast+0x790/0x790
[ 2248.854739]  ? __this_cpu_preempt_check+0x13/0x20
[ 2248.855429]  ? selinux_socket_sendmsg+0x31/0x40
[ 2248.856131]  ? netlink_unicast+0x790/0x790
[ 2248.856851]  __sock_sendmsg+0xc9/0x160
[ 2248.857469]  ____sys_sendmsg+0x620/0x9a0
[ 2248.858150]  ? kernel_sendmsg+0x30/0x30
[ 2248.858858]  ? __copy_msghdr+0x410/0x410
[ 2248.859468]  ? reacquire_held_locks+0x4d0/0x4d0
[ 2248.860137]  ? lock_sync+0x1a0/0x1a0
[ 2248.860790]  ___sys_sendmsg+0xe9/0x170
[ 2248.861393]  ? copy_msghdr_from_user+0x120/0x120
[ 2248.862049]  ? __might_fault+0xc0/0x170
[ 2248.862694]  ? __kasan_check_write+0x14/0x20
[ 2248.863306]  ? _copy_from_user+0x5b/0xa0
[ 2248.863969]  ? copy_from_sockptr_offset.constprop.0+0xe7/0x110
[ 2248.864600]  ? vfs_getattr+0x50/0x50
[ 2248.865237]  ? netlink_seq_show+0x330/0x330
[ 2248.865884]  ? __kasan_check_write+0x14/0x20
[ 2248.866481]  ? __kasan_check_read+0x11/0x20
[ 2248.867139]  ? __fget_light+0x53/0x1e0
[ 2248.867820]  ? __fdget+0xe/0x10
[ 2248.868412]  ? sockfd_lookup_light+0x1a/0x170
[ 2248.869100]  __sys_sendmsg+0xd2/0x180
[ 2248.869770]  ? __sys_sendmsg_sock+0x20/0x20
[ 2248.870352]  ? __sys_setsockopt+0xf4/0x1b0
[ 2248.871016]  ? debug_smp_processor_id+0x17/0x20
[ 2248.871667]  __x64_sys_sendmsg+0x72/0xb0
[ 2248.872264]  do_syscall_64+0x65/0x130
[ 2248.872920]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
[ 2248.873553] RIP: 0033:0x7fd218804807
[ 2248.874202] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
[ 2248.875567] RSP: 002b:00007ffd1e970b98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[ 2248.876277] RAX: ffffffffffffffda RBX: 000055cb2ce3dac0 RCX: 00007fd218804807
[ 2248.877048] RDX: 0000000000000000 RSI: 00007ffd1e970bd0 RDI: 0000000000000006
[ 2248.877802] RBP: 000055cb2ce3d9d0 R08: 0000000000000004 R09: 00007fd2188d0b80
[ 2248.878494] R10: 00007ffd1e970ca4 R11: 0000000000000246 R12: 000055cb2ce6d480
[ 2248.879230] R13: 00007ffd1e970bd0 R14: 00007ffd1e970ca4 R15: 000055cb2ce6d340
[ 2248.880017]  </TASK>
[ 2248.880643] irq event stamp: 90483
[ 2248.881359] hardirqs last  enabled at (90495): [<ffffffffa24f114e>] console_unlock+0x1ae/0x280
[ 2248.882102] hardirqs last disabled at (90516): [<ffffffffa24f1133>] console_unlock+0x193/0x280
[ 2248.882899] softirqs last  enabled at (90512): [<ffffffffa4feac7a>] __do_softirq+0x58a/0x8e5
[ 2248.883608] softirqs last disabled at (90503): [<ffffffffa236f03a>] irq_exit_rcu+0xaa/0x110
[ 2248.884340] ---[ end trace 0000000000000000 ]---
kangyang April 11, 2024, 10:14 a.m. UTC | #3
On 4/11/24 5:56 PM, Kalle Valo <kvalo@kernel.org> wrote:
> kangyang <quic_kangyang@quicinc.com> writes:
> 
> > From: Kang Yang <quic_kangyang@quicinc.com>
> >
> > When AP goes down or too far away without indication to STA, beacon miss
> > will be detected. Then for WCN7850's firmware, it will use roam event
> > to send beacon miss to host.
> >
> > If STA doesn't handle the beacon miss, will keep the fake connection
> > and unable to roam.
> >
> > So add support for WCN7850 to trigger disconnection from AP when
> > receiving this event from firmware.
> >
> > It has to be noted that beacon miss event notification for QCN9274
> > to be handled in a separate patch as it uses STA kickout WMI event
> > to notify beacon miss and the current STA kickout event is processed
> > as low_ack.
> >
> > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
> >
> > Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
> 
> There were conflicts but I fixed in the pending branch, though I admit I
> did that hastily:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e5b7eced753bc7e5af133624f6ff37141c5b3442
> 
> But now I see warnings like below, I don't if it's caused my conflict
> fixes or was there originally.


Maybe i need to rebase on latest tag...Code changes a lot.


> 
> [ 2248.795411] ------------[ cut here ]------------
> [ 2248.796912] WARNING: CPU: 0 PID: 7431 at kernel/workqueue.c:4201 __flush_work+0x15b/0x170
> [ 2248.797566] Modules linked in: ath12k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr nvme nvme_core [last unloaded: mhi]
> [ 2248.798430] CPU: 0 PID: 7431 Comm: wpa_supplicant Tainted: G        W          6.9.0-rc2-wt-ath+ #1383
> [ 2248.799332] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
> [ 2248.800150] RIP: 0010:__flush_work+0x15b/0x170
> [ 2248.800882] Code: 00 00 00 48 8b 55 d0 65 48 2b 14 25 28 00 00 00 75 28 48 81 c4 48 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 31 c0 eb b7 <0f> 0b 31 c0 eb b1 e8 3a c4 60 00 e9 55 ff ff ff e8 70 b3 bf 02 55
> [ 2248.802403] RSP: 0018:ffffc900020e70a0 EFLAGS: 00010246
> [ 2248.803186] RAX: dffffc0000000000 RBX: 1ffff9200041ce15 RCX: ffffffffa24c3106
> [ 2248.803986] RDX: 1ffff11024ee5c54 RSI: 0000000000000001 RDI: ffff88812772e2a0
> [ 2248.804788] RBP: ffffc900020e7210 R08: 0000000000000001 R09: fffffbfff6e6fa48
> [ 2248.805575] R10: ffffffffb737d247 R11: 0000000000000006 R12: ffff88812772e288
> [ 2248.806371] R13: 0000000000000001 R14: ffffc900020e71e8 R15: 0000000000000001
> [ 2248.807168] FS:  00007fd218478140(0000) GS:ffff88821ba00000(0000) knlGS:0000000000000000
> [ 2248.807979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 2248.808780] CR2: 000055cb2ce7aa88 CR3: 000000013a101005 CR4: 00000000003706f0
> [ 2248.809579] Call Trace:
> [ 2248.810422]  <TASK>
> [ 2248.811311]  ? show_regs+0x5b/0x70
> [ 2248.812173]  ? __warn+0xc7/0x300
> [ 2248.813027]  ? reacquire_held_locks+0x4d0/0x4d0
> [ 2248.813897]  ? __flush_work+0x15b/0x170
> [ 2248.814794]  ? report_bug+0x310/0x3f0
> [ 2248.815690]  ? handle_bug+0x71/0x90
> [ 2248.816503]  ? exc_invalid_op+0x18/0x40
> [ 2248.817338]  ? asm_exc_invalid_op+0x1b/0x20
> [ 2248.818200]  ? mark_lock+0xe6/0x1470
> [ 2248.819064]  ? __flush_work+0x15b/0x170
> [ 2248.820032]  ? start_flush_work+0x9c0/0x9c0
> [ 2248.820870]  ? __kasan_check_read+0x11/0x20
> [ 2248.821717]  ? mark_lock+0xe6/0x1470
> [ 2248.822516]  ? mark_lock_irq+0x1cc0/0x1cc0
> [ 2248.823352]  ? detach_if_pending+0x370/0x370
> [ 2248.824170]  ? debug_smp_processor_id+0x17/0x20
> [ 2248.825052]  ? __cancel_work_sync+0x32f/0x480
> [ 2248.825942]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.826805]  __cancel_work_sync+0x325/0x480
> [ 2248.827606]  ? flush_rcu_work+0x70/0x70
> [ 2248.828457]  cancel_delayed_work_sync+0xe/0x10
> [ 2248.829294]  ath12k_mac_assign_vif_to_vdev.isra.0+0x318/0xb00 [ath12k]
> [ 2248.830171]  ath12k_mac_op_add_interface+0x2d6/0x410 [ath12k]
> [ 2248.831079]  drv_add_interface+0x141/0x710 [mac80211]
> [ 2248.832043]  ieee80211_do_open+0xf20/0x1720 [mac80211]
> [ 2248.833009]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.833931]  ieee80211_start_p2p_device+0x67/0xf0 [mac80211]
> [ 2248.834924]  nl80211_start_p2p_device+0x226/0x4c0 [cfg80211]
> [ 2248.835889]  genl_family_rcv_msg_doit+0x1f0/0x2e0
> [ 2248.836789]  ? genl_family_rcv_msg_attrs_parse.isra.0+0x250/0x250
> [ 2248.837603]  ? ns_capable+0x57/0xd0
> [ 2248.838432]  genl_family_rcv_msg+0x34c/0x600
> [ 2248.839303]  ? genl_family_rcv_msg_dumpit+0x310/0x310
> [ 2248.840117]  ? __lock_acquire+0xd43/0x1dd0
> [ 2248.840974]  ? he_set_mcs_mask.isra.0+0x8d0/0x8d0 [cfg80211]
> [ 2248.841888]  ? nl80211_associate+0x2720/0x2720 [cfg80211]
> [ 2248.842832]  ? cfg80211_external_auth_request+0x690/0x690 [cfg80211]
> [ 2248.843747]  genl_rcv_msg+0xa0/0x130
> [ 2248.844537]  netlink_rcv_skb+0x14c/0x400
> [ 2248.845355]  ? genl_family_rcv_msg+0x600/0x600
> [ 2248.846153]  ? netlink_ack+0xd70/0xd70
> [ 2248.846954]  ? rwsem_optimistic_spin+0x4f0/0x4f0
> [ 2248.847796]  ? genl_rcv+0x14/0x40
> [ 2248.848546]  ? rwsem_down_read_slowpath+0xb10/0xb10
> [ 2248.849348]  ? netlink_deliver_tap+0x143/0x350
> [ 2248.850171]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.851022]  genl_rcv+0x23/0x40
> [ 2248.851812]  netlink_unicast+0x45c/0x790
> [ 2248.852514]  ? netlink_attachskb+0x7f0/0x7f0
> [ 2248.853270]  netlink_sendmsg+0x7eb/0xdb0
> [ 2248.854030]  ? netlink_unicast+0x790/0x790
> [ 2248.854739]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.855429]  ? selinux_socket_sendmsg+0x31/0x40
> [ 2248.856131]  ? netlink_unicast+0x790/0x790
> [ 2248.856851]  __sock_sendmsg+0xc9/0x160
> [ 2248.857469]  ____sys_sendmsg+0x620/0x9a0
> [ 2248.858150]  ? kernel_sendmsg+0x30/0x30
> [ 2248.858858]  ? __copy_msghdr+0x410/0x410
> [ 2248.859468]  ? reacquire_held_locks+0x4d0/0x4d0
> [ 2248.860137]  ? lock_sync+0x1a0/0x1a0
> [ 2248.860790]  ___sys_sendmsg+0xe9/0x170
> [ 2248.861393]  ? copy_msghdr_from_user+0x120/0x120
> [ 2248.862049]  ? __might_fault+0xc0/0x170
> [ 2248.862694]  ? __kasan_check_write+0x14/0x20
> [ 2248.863306]  ? _copy_from_user+0x5b/0xa0
> [ 2248.863969]  ? copy_from_sockptr_offset.constprop.0+0xe7/0x110
> [ 2248.864600]  ? vfs_getattr+0x50/0x50
> [ 2248.865237]  ? netlink_seq_show+0x330/0x330
> [ 2248.865884]  ? __kasan_check_write+0x14/0x20
> [ 2248.866481]  ? __kasan_check_read+0x11/0x20
> [ 2248.867139]  ? __fget_light+0x53/0x1e0
> [ 2248.867820]  ? __fdget+0xe/0x10
> [ 2248.868412]  ? sockfd_lookup_light+0x1a/0x170
> [ 2248.869100]  __sys_sendmsg+0xd2/0x180
> [ 2248.869770]  ? __sys_sendmsg_sock+0x20/0x20
> [ 2248.870352]  ? __sys_setsockopt+0xf4/0x1b0
> [ 2248.871016]  ? debug_smp_processor_id+0x17/0x20
> [ 2248.871667]  __x64_sys_sendmsg+0x72/0xb0
> [ 2248.872264]  do_syscall_64+0x65/0x130
> [ 2248.872920]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
> [ 2248.873553] RIP: 0033:0x7fd218804807
> [ 2248.874202] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
> [ 2248.875567] RSP: 002b:00007ffd1e970b98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> [ 2248.876277] RAX: ffffffffffffffda RBX: 000055cb2ce3dac0 RCX: 00007fd218804807
> [ 2248.877048] RDX: 0000000000000000 RSI: 00007ffd1e970bd0 RDI: 0000000000000006
> [ 2248.877802] RBP: 000055cb2ce3d9d0 R08: 0000000000000004 R09: 00007fd2188d0b80
> [ 2248.878494] R10: 00007ffd1e970ca4 R11: 0000000000000246 R12: 000055cb2ce6d480
> [ 2248.879230] R13: 00007ffd1e970bd0 R14: 00007ffd1e970ca4 R15: 000055cb2ce6d340
> [ 2248.880017]  </TASK>
> [ 2248.880643] irq event stamp: 90483
> [ 2248.881359] hardirqs last  enabled at (90495): [<ffffffffa24f114e>] console_unlock+0x1ae/0x280
> [ 2248.882102] hardirqs last disabled at (90516): [<ffffffffa24f1133>] console_unlock+0x193/0x280
> [ 2248.882899] softirqs last  enabled at (90512): [<ffffffffa4feac7a>] __do_softirq+0x58a/0x8e5
> [ 2248.883608] softirqs last disabled at (90503): [<ffffffffa236f03a>] irq_exit_rcu+0xaa/0x110
> [ 2248.884340] ---[ end trace 0000000000000000 ]---
> 
>
kangyang April 11, 2024, 11:31 a.m. UTC | #4
On 4/11/2024 5:56 PM, Kalle Valo wrote:
> kangyang <quic_kangyang@quicinc.com> writes:
> 
>> From: Kang Yang <quic_kangyang@quicinc.com>
>>
>> When AP goes down or too far away without indication to STA, beacon miss
>> will be detected. Then for WCN7850's firmware, it will use roam event
>> to send beacon miss to host.
>>
>> If STA doesn't handle the beacon miss, will keep the fake connection
>> and unable to roam.
>>
>> So add support for WCN7850 to trigger disconnection from AP when
>> receiving this event from firmware.
>>
>> It has to be noted that beacon miss event notification for QCN9274
>> to be handled in a separate patch as it uses STA kickout WMI event
>> to notify beacon miss and the current STA kickout event is processed
>> as low_ack.
>>
>> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>>
>> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
> 
> There were conflicts but I fixed in the pending branch, though I admit I
> did that hastily:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e5b7eced753bc7e5af133624f6ff37141c5b3442
> 
> But now I see warnings like below, I don't if it's caused my conflict
> fixes or was there originally.
> 
> [ 2248.795411] ------------[ cut here ]------------
> [ 2248.796912] WARNING: CPU: 0 PID: 7431 at kernel/workqueue.c:4201 __flush_work+0x15b/0x170
> [ 2248.797566] Modules linked in: ath12k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr nvme nvme_core [last unloaded: mhi]
> [ 2248.798430] CPU: 0 PID: 7431 Comm: wpa_supplicant Tainted: G        W          6.9.0-rc2-wt-ath+ #1383
> [ 2248.799332] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021
> [ 2248.800150] RIP: 0010:__flush_work+0x15b/0x170
> [ 2248.800882] Code: 00 00 00 48 8b 55 d0 65 48 2b 14 25 28 00 00 00 75 28 48 81 c4 48 01 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 31 c0 eb b7 <0f> 0b 31 c0 eb b1 e8 3a c4 60 00 e9 55 ff ff ff e8 70 b3 bf 02 55
> [ 2248.802403] RSP: 0018:ffffc900020e70a0 EFLAGS: 00010246
> [ 2248.803186] RAX: dffffc0000000000 RBX: 1ffff9200041ce15 RCX: ffffffffa24c3106
> [ 2248.803986] RDX: 1ffff11024ee5c54 RSI: 0000000000000001 RDI: ffff88812772e2a0
> [ 2248.804788] RBP: ffffc900020e7210 R08: 0000000000000001 R09: fffffbfff6e6fa48
> [ 2248.805575] R10: ffffffffb737d247 R11: 0000000000000006 R12: ffff88812772e288
> [ 2248.806371] R13: 0000000000000001 R14: ffffc900020e71e8 R15: 0000000000000001
> [ 2248.807168] FS:  00007fd218478140(0000) GS:ffff88821ba00000(0000) knlGS:0000000000000000
> [ 2248.807979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 2248.808780] CR2: 000055cb2ce7aa88 CR3: 000000013a101005 CR4: 00000000003706f0
> [ 2248.809579] Call Trace:
> [ 2248.810422]  <TASK>
> [ 2248.811311]  ? show_regs+0x5b/0x70
> [ 2248.812173]  ? __warn+0xc7/0x300
> [ 2248.813027]  ? reacquire_held_locks+0x4d0/0x4d0
> [ 2248.813897]  ? __flush_work+0x15b/0x170
> [ 2248.814794]  ? report_bug+0x310/0x3f0
> [ 2248.815690]  ? handle_bug+0x71/0x90
> [ 2248.816503]  ? exc_invalid_op+0x18/0x40
> [ 2248.817338]  ? asm_exc_invalid_op+0x1b/0x20
> [ 2248.818200]  ? mark_lock+0xe6/0x1470
> [ 2248.819064]  ? __flush_work+0x15b/0x170
> [ 2248.820032]  ? start_flush_work+0x9c0/0x9c0
> [ 2248.820870]  ? __kasan_check_read+0x11/0x20
> [ 2248.821717]  ? mark_lock+0xe6/0x1470
> [ 2248.822516]  ? mark_lock_irq+0x1cc0/0x1cc0
> [ 2248.823352]  ? detach_if_pending+0x370/0x370
> [ 2248.824170]  ? debug_smp_processor_id+0x17/0x20
> [ 2248.825052]  ? __cancel_work_sync+0x32f/0x480
> [ 2248.825942]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.826805]  __cancel_work_sync+0x325/0x480
> [ 2248.827606]  ? flush_rcu_work+0x70/0x70
> [ 2248.828457]  cancel_delayed_work_sync+0xe/0x10
> [ 2248.829294]  ath12k_mac_assign_vif_to_vdev.isra.0+0x318/0xb00 [ath12k]
> [ 2248.830171]  ath12k_mac_op_add_interface+0x2d6/0x410 [ath12k]
> [ 2248.831079]  drv_add_interface+0x141/0x710 [mac80211]



Hi, kalle:

	I just tried on latest ath.tag. After i fixed conflict, there is no 
warning.


	I saw conflict only happen at add/remove_interface(). Could you show me 
your conflict fix? I cannot reproduce this warning.

	


> [ 2248.832043]  ieee80211_do_open+0xf20/0x1720 [mac80211]
> [ 2248.833009]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.833931]  ieee80211_start_p2p_device+0x67/0xf0 [mac80211]
> [ 2248.834924]  nl80211_start_p2p_device+0x226/0x4c0 [cfg80211]
> [ 2248.835889]  genl_family_rcv_msg_doit+0x1f0/0x2e0
> [ 2248.836789]  ? genl_family_rcv_msg_attrs_parse.isra.0+0x250/0x250
> [ 2248.837603]  ? ns_capable+0x57/0xd0
> [ 2248.838432]  genl_family_rcv_msg+0x34c/0x600
> [ 2248.839303]  ? genl_family_rcv_msg_dumpit+0x310/0x310
> [ 2248.840117]  ? __lock_acquire+0xd43/0x1dd0
> [ 2248.840974]  ? he_set_mcs_mask.isra.0+0x8d0/0x8d0 [cfg80211]
> [ 2248.841888]  ? nl80211_associate+0x2720/0x2720 [cfg80211]
> [ 2248.842832]  ? cfg80211_external_auth_request+0x690/0x690 [cfg80211]
> [ 2248.843747]  genl_rcv_msg+0xa0/0x130
> [ 2248.844537]  netlink_rcv_skb+0x14c/0x400
> [ 2248.845355]  ? genl_family_rcv_msg+0x600/0x600
> [ 2248.846153]  ? netlink_ack+0xd70/0xd70
> [ 2248.846954]  ? rwsem_optimistic_spin+0x4f0/0x4f0
> [ 2248.847796]  ? genl_rcv+0x14/0x40
> [ 2248.848546]  ? rwsem_down_read_slowpath+0xb10/0xb10
> [ 2248.849348]  ? netlink_deliver_tap+0x143/0x350
> [ 2248.850171]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.851022]  genl_rcv+0x23/0x40
> [ 2248.851812]  netlink_unicast+0x45c/0x790
> [ 2248.852514]  ? netlink_attachskb+0x7f0/0x7f0
> [ 2248.853270]  netlink_sendmsg+0x7eb/0xdb0
> [ 2248.854030]  ? netlink_unicast+0x790/0x790
> [ 2248.854739]  ? __this_cpu_preempt_check+0x13/0x20
> [ 2248.855429]  ? selinux_socket_sendmsg+0x31/0x40
> [ 2248.856131]  ? netlink_unicast+0x790/0x790
> [ 2248.856851]  __sock_sendmsg+0xc9/0x160
> [ 2248.857469]  ____sys_sendmsg+0x620/0x9a0
> [ 2248.858150]  ? kernel_sendmsg+0x30/0x30
> [ 2248.858858]  ? __copy_msghdr+0x410/0x410
> [ 2248.859468]  ? reacquire_held_locks+0x4d0/0x4d0
> [ 2248.860137]  ? lock_sync+0x1a0/0x1a0
> [ 2248.860790]  ___sys_sendmsg+0xe9/0x170
> [ 2248.861393]  ? copy_msghdr_from_user+0x120/0x120
> [ 2248.862049]  ? __might_fault+0xc0/0x170
> [ 2248.862694]  ? __kasan_check_write+0x14/0x20
> [ 2248.863306]  ? _copy_from_user+0x5b/0xa0
> [ 2248.863969]  ? copy_from_sockptr_offset.constprop.0+0xe7/0x110
> [ 2248.864600]  ? vfs_getattr+0x50/0x50
> [ 2248.865237]  ? netlink_seq_show+0x330/0x330
> [ 2248.865884]  ? __kasan_check_write+0x14/0x20
> [ 2248.866481]  ? __kasan_check_read+0x11/0x20
> [ 2248.867139]  ? __fget_light+0x53/0x1e0
> [ 2248.867820]  ? __fdget+0xe/0x10
> [ 2248.868412]  ? sockfd_lookup_light+0x1a/0x170
> [ 2248.869100]  __sys_sendmsg+0xd2/0x180
> [ 2248.869770]  ? __sys_sendmsg_sock+0x20/0x20
> [ 2248.870352]  ? __sys_setsockopt+0xf4/0x1b0
> [ 2248.871016]  ? debug_smp_processor_id+0x17/0x20
> [ 2248.871667]  __x64_sys_sendmsg+0x72/0xb0
> [ 2248.872264]  do_syscall_64+0x65/0x130
> [ 2248.872920]  entry_SYSCALL_64_after_hwframe+0x46/0x4e
> [ 2248.873553] RIP: 0033:0x7fd218804807
> [ 2248.874202] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
> [ 2248.875567] RSP: 002b:00007ffd1e970b98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> [ 2248.876277] RAX: ffffffffffffffda RBX: 000055cb2ce3dac0 RCX: 00007fd218804807
> [ 2248.877048] RDX: 0000000000000000 RSI: 00007ffd1e970bd0 RDI: 0000000000000006
> [ 2248.877802] RBP: 000055cb2ce3d9d0 R08: 0000000000000004 R09: 00007fd2188d0b80
> [ 2248.878494] R10: 00007ffd1e970ca4 R11: 0000000000000246 R12: 000055cb2ce6d480
> [ 2248.879230] R13: 00007ffd1e970bd0 R14: 00007ffd1e970ca4 R15: 000055cb2ce6d340
> [ 2248.880017]  </TASK>
> [ 2248.880643] irq event stamp: 90483
> [ 2248.881359] hardirqs last  enabled at (90495): [<ffffffffa24f114e>] console_unlock+0x1ae/0x280
> [ 2248.882102] hardirqs last disabled at (90516): [<ffffffffa24f1133>] console_unlock+0x193/0x280
> [ 2248.882899] softirqs last  enabled at (90512): [<ffffffffa4feac7a>] __do_softirq+0x58a/0x8e5
> [ 2248.883608] softirqs last disabled at (90503): [<ffffffffa236f03a>] irq_exit_rcu+0xaa/0x110
> [ 2248.884340] ---[ end trace 0000000000000000 ]---

>
Kalle Valo April 11, 2024, 4:11 p.m. UTC | #5
Kang Yang <quic_kangyang@quicinc.com> writes:

> On 4/11/2024 5:56 PM, Kalle Valo wrote:
>> kangyang <quic_kangyang@quicinc.com> writes:
>> 
>>> From: Kang Yang <quic_kangyang@quicinc.com>
>>>
>>> When AP goes down or too far away without indication to STA, beacon miss
>>> will be detected. Then for WCN7850's firmware, it will use roam event
>>> to send beacon miss to host.
>>>
>>> If STA doesn't handle the beacon miss, will keep the fake connection
>>> and unable to roam.
>>>
>>> So add support for WCN7850 to trigger disconnection from AP when
>>> receiving this event from firmware.
>>>
>>> It has to be noted that beacon miss event notification for QCN9274
>>> to be handled in a separate patch as it uses STA kickout WMI event
>>> to notify beacon miss and the current STA kickout event is processed
>>> as low_ack.
>>>
>>> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>>>
>>> Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
>>
>> There were conflicts but I fixed in the pending branch, though I
>> admit I
>> did that hastily:
>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e5b7eced753bc7e5af133624f6ff37141c5b3442
>> But now I see warnings like below, I don't if it's caused my
>> conflict
>> fixes or was there originally.

[...]

> 	I just tried on latest ath.tag. After i fixed conflict, there
> 	is no warning.
>
>
> 	I saw conflict only happen at add/remove_interface(). Could
> 	you show me your conflict fix? I cannot reproduce this
> 	warning.

I already gave you the URL of my rebased commit above but here it is again:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=e5b7eced753bc7e5af133624f6ff37141c5b3442

But please submit your rebased version as v2 and I'll test that one.
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 97e5a0ccd233..9b82e98375aa 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -46,6 +46,7 @@ 
 #define ATH12K_SMBIOS_BDF_EXT_MAGIC "BDF_"
 
 #define ATH12K_INVALID_HW_MAC_ID	0xFF
+#define ATH12K_CONNECTION_LOSS_HZ	(3 * HZ)
 #define	ATH12K_RX_RATE_TABLE_NUM	320
 #define	ATH12K_RX_RATE_TABLE_11AX_NUM	576
 
@@ -256,6 +257,7 @@  struct ath12k_vif {
 	u32 aid;
 	u8 bssid[ETH_ALEN];
 	struct cfg80211_bitrate_mask bitrate_mask;
+	struct delayed_work connection_loss_work;
 	int num_legacy_stations;
 	int rtscts_prot_mode;
 	int txpower;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 52a5fb8b03e9..67f1242412dd 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1345,6 +1345,75 @@  static void ath12k_control_beaconing(struct ath12k_vif *arvif,
 	ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id);
 }
 
+static void ath12k_mac_handle_beacon_iter(void *data, u8 *mac,
+					  struct ieee80211_vif *vif)
+{
+	struct sk_buff *skb = data;
+	struct ieee80211_mgmt *mgmt = (void *)skb->data;
+	struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
+
+	if (vif->type != NL80211_IFTYPE_STATION)
+		return;
+
+	if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid))
+		return;
+
+	cancel_delayed_work(&arvif->connection_loss_work);
+}
+
+void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb)
+{
+	ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar),
+						   IEEE80211_IFACE_ITER_NORMAL,
+						   ath12k_mac_handle_beacon_iter,
+						   skb);
+}
+
+static void ath12k_mac_handle_beacon_miss_iter(void *data, u8 *mac,
+					       struct ieee80211_vif *vif)
+{
+	u32 *vdev_id = data;
+	struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
+	struct ath12k *ar = arvif->ar;
+	struct ieee80211_hw *hw = ath12k_ar_to_hw(ar);
+
+	if (arvif->vdev_id != *vdev_id)
+		return;
+
+	if (!arvif->is_up)
+		return;
+
+	ieee80211_beacon_loss(vif);
+
+	/* Firmware doesn't report beacon loss events repeatedly. If AP probe
+	 * (done by mac80211) succeeds but beacons do not resume then it
+	 * doesn't make sense to continue operation. Queue connection loss work
+	 * which can be cancelled when beacon is received.
+	 */
+	ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work,
+				     ATH12K_CONNECTION_LOSS_HZ);
+}
+
+void ath12k_mac_handle_beacon_miss(struct ath12k *ar, u32 vdev_id)
+{
+	ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar),
+						   IEEE80211_IFACE_ITER_NORMAL,
+						   ath12k_mac_handle_beacon_miss_iter,
+						   &vdev_id);
+}
+
+static void ath12k_mac_vif_sta_connection_loss_work(struct work_struct *work)
+{
+	struct ath12k_vif *arvif = container_of(work, struct ath12k_vif,
+						connection_loss_work.work);
+	struct ieee80211_vif *vif = arvif->vif;
+
+	if (!arvif->is_up)
+		return;
+
+	ieee80211_connection_loss(vif);
+}
+
 static void ath12k_peer_assoc_h_basic(struct ath12k *ar,
 				      struct ieee80211_vif *vif,
 				      struct ieee80211_sta *sta,
@@ -2517,7 +2586,7 @@  static void ath12k_bss_disassoc(struct ath12k *ar,
 
 	arvif->is_up = false;
 
-	/* TODO: cancel connection_loss_work */
+	cancel_delayed_work(&arvif->connection_loss_work);
 }
 
 static u32 ath12k_mac_get_rate_hw_value(int bitrate)
@@ -5774,10 +5843,8 @@  static int ath12k_mac_op_add_interface(struct ieee80211_hw *hw,
 	arvif->vif = vif;
 
 	INIT_LIST_HEAD(&arvif->list);
-
-	/* Should we initialize any worker to handle connection loss indication
-	 * from firmware in sta mode?
-	 */
+	INIT_DELAYED_WORK(&arvif->connection_loss_work,
+			  ath12k_mac_vif_sta_connection_loss_work);
 
 	for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) {
 		arvif->bitrate_mask.control[i].legacy = 0xffffffff;
@@ -6020,6 +6087,8 @@  static void ath12k_mac_op_remove_interface(struct ieee80211_hw *hw,
 	ar = ath12k_ah_to_ar(ah);
 	ab = ar->ab;
 
+	cancel_delayed_work_sync(&arvif->connection_loss_work);
+
 	mutex_lock(&ar->conf_mutex);
 
 	ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n",
diff --git a/drivers/net/wireless/ath/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h
index 3f5e1be0dff9..bfc655a4dfce 100644
--- a/drivers/net/wireless/ath/ath12k/mac.h
+++ b/drivers/net/wireless/ath/ath12k/mac.h
@@ -78,4 +78,6 @@  enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw b
 enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher);
 int ath12k_mac_rfkill_enable_radio(struct ath12k *ar, bool enable);
 int ath12k_mac_rfkill_config(struct ath12k *ar);
+void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb);
+void ath12k_mac_handle_beacon_miss(struct ath12k *ar, u32 vdev_id);
 #endif
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 9d69a1769926..30de5ebde648 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -5927,10 +5927,8 @@  static void ath12k_mgmt_rx_event(struct ath12k_base *ab, struct sk_buff *skb)
 		}
 	}
 
-	/* TODO: Pending handle beacon implementation
-	 *if (ieee80211_is_beacon(hdr->frame_control))
-	 *	ath12k_mac_handle_beacon(ar, skb);
-	 */
+	if (ieee80211_is_beacon(hdr->frame_control))
+		ath12k_mac_handle_beacon(ar, skb);
 
 	ath12k_dbg(ab, ATH12K_DBG_MGMT,
 		   "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
@@ -6137,42 +6135,44 @@  static void ath12k_roam_event(struct ath12k_base *ab, struct sk_buff *skb)
 {
 	struct wmi_roam_event roam_ev = {};
 	struct ath12k *ar;
+	u32 vdev_id;
+	u8 roam_reason;
 
 	if (ath12k_pull_roam_ev(ab, skb, &roam_ev) != 0) {
 		ath12k_warn(ab, "failed to extract roam event");
 		return;
 	}
 
+	vdev_id = le32_to_cpu(roam_ev.vdev_id);
+	roam_reason = u32_get_bits(le32_to_cpu(roam_ev.reason),
+				   WMI_ROAM_REASON_MASK);
+
 	ath12k_dbg(ab, ATH12K_DBG_WMI,
-		   "wmi roam event vdev %u reason 0x%08x rssi %d\n",
-		   roam_ev.vdev_id, roam_ev.reason, roam_ev.rssi);
+		   "wmi roam event vdev %u reason %d rssi %d\n",
+		   vdev_id, roam_reason, roam_ev.rssi);
 
 	rcu_read_lock();
-	ar = ath12k_mac_get_ar_by_vdev_id(ab, le32_to_cpu(roam_ev.vdev_id));
+	ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id);
 	if (!ar) {
-		ath12k_warn(ab, "invalid vdev id in roam ev %d",
-			    roam_ev.vdev_id);
+		ath12k_warn(ab, "invalid vdev id in roam ev %d", vdev_id);
 		rcu_read_unlock();
 		return;
 	}
 
-	if (le32_to_cpu(roam_ev.reason) >= WMI_ROAM_REASON_MAX)
+	if (roam_reason >= WMI_ROAM_REASON_MAX)
 		ath12k_warn(ab, "ignoring unknown roam event reason %d on vdev %i\n",
-			    roam_ev.reason, roam_ev.vdev_id);
+			    roam_reason, vdev_id);
 
-	switch (le32_to_cpu(roam_ev.reason)) {
+	switch (roam_reason) {
 	case WMI_ROAM_REASON_BEACON_MISS:
-		/* TODO: Pending beacon miss and connection_loss_work
-		 * implementation
-		 * ath12k_mac_handle_beacon_miss(ar, vdev_id);
-		 */
+		ath12k_mac_handle_beacon_miss(ar, vdev_id);
 		break;
 	case WMI_ROAM_REASON_BETTER_AP:
 	case WMI_ROAM_REASON_LOW_RSSI:
 	case WMI_ROAM_REASON_SUITABLE_AP_FOUND:
 	case WMI_ROAM_REASON_HO_FAILED:
 		ath12k_warn(ab, "ignoring not implemented roam event reason %d on vdev %i\n",
-			    roam_ev.reason, roam_ev.vdev_id);
+			    roam_reason, vdev_id);
 		break;
 	}
 
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 2492082b4524..27904a4deb18 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -4186,6 +4186,9 @@  struct wmi_peer_sta_kickout_event {
 	struct ath12k_wmi_mac_addr_params peer_macaddr;
 } __packed;
 
+#define WMI_ROAM_REASON_MASK		GENMASK(3, 0)
+#define WMI_ROAM_SUBNET_STATUS_MASK	GENMASK(5, 4)
+
 enum wmi_roam_reason {
 	WMI_ROAM_REASON_BETTER_AP = 1,
 	WMI_ROAM_REASON_BEACON_MISS = 2,