2024-04-29 08:15:56

by Kang Yang

[permalink] [raw]
Subject: [PATCH 0/5] prepare work for monitor mode on WCN7850

From: Kang Yang <[email protected]>

Preliminary plan:
1. prepare work.
2. bring up monitor mode on WCN7850.
3. add handling of reported TLVs for monitor mode, such as
HAL_PHYRX_GENERIC_U_SIG, HAL_PHYRX_COMMON_USER_INFO. Then can support
parsing EHT information.

This patch-set is only to do some preparation work for monitor mode.

Kang Yang (5):
wifi: ath12k: remove unused variable monitor_flags
wifi: ath12k: avoid duplicated vdev stop
wifi: ath12k: avoid duplicated vdev down
wifi: ath12k: remove redundant peer delete
wifi: ath12k: remove invalid peer create logic

drivers/net/wireless/ath/ath12k/core.h | 5 ----
drivers/net/wireless/ath/ath12k/mac.c | 38 ++------------------------
2 files changed, 3 insertions(+), 40 deletions(-)


base-commit: bf99bc7423e18aa3475ef00a7a6fb773c31ce6df
--
2.34.1



2024-04-29 08:16:01

by Kang Yang

[permalink] [raw]
Subject: [PATCH 1/5] wifi: ath12k: remove unused variable monitor_flags

From: Kang Yang <[email protected]>

monitor_flags is defined in struct ath12k. Although it is changed in
some places, but it is not actually used.

So remove related code.

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

Signed-off-by: Kang Yang <[email protected]>
---
drivers/net/wireless/ath/ath12k/core.h | 5 -----
drivers/net/wireless/ath/ath12k/mac.c | 10 +---------
2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 47dde4401210..db139152e372 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -212,10 +212,6 @@ enum ath12k_dev_flags {
ATH12K_FLAG_EXT_IRQ_ENABLED,
};

-enum ath12k_monitor_flags {
- ATH12K_FLAG_MONITOR_ENABLED,
-};
-
struct ath12k_tx_conf {
bool changed;
u16 ac;
@@ -533,7 +529,6 @@ struct ath12k {

unsigned long dev_flags;
unsigned int filter_flags;
- unsigned long monitor_flags;
u32 min_tx_power;
u32 max_tx_power;
u32 txpower_limit_2g;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 56b1f8b6844e..3e9a7dec7eba 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -6492,7 +6492,6 @@ static int ath12k_mac_vdev_delete(struct ath12k *ar, struct ieee80211_vif *vif)

/* Recalc txpower for remaining vdev */
ath12k_mac_txpower_recalc(ar);
- clear_bit(ATH12K_FLAG_MONITOR_ENABLED, &ar->monitor_flags);

/* TODO: recal traffic pause state based on the available vdevs */
arvif->is_created = false;
@@ -6563,15 +6562,9 @@ static void ath12k_mac_configure_filter(struct ath12k *ar,
reset_flag = !(ar->filter_flags & FIF_BCN_PRBRESP_PROMISC);

ret = ath12k_dp_tx_htt_monitor_mode_ring_config(ar, reset_flag);
- if (!ret) {
- if (!reset_flag)
- set_bit(ATH12K_FLAG_MONITOR_ENABLED, &ar->monitor_flags);
- else
- clear_bit(ATH12K_FLAG_MONITOR_ENABLED, &ar->monitor_flags);
- } else {
+ if (ret)
ath12k_warn(ar->ab,
"fail to set monitor filter: %d\n", ret);
- }

ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
"total_flags:0x%x, reset_flag:%d\n",
@@ -8832,7 +8825,6 @@ static void ath12k_mac_setup(struct ath12k *ar)

INIT_WORK(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work);
skb_queue_head_init(&ar->wmi_mgmt_tx_queue);
- clear_bit(ATH12K_FLAG_MONITOR_ENABLED, &ar->monitor_flags);
}

int ath12k_mac_register(struct ath12k_base *ab)
--
2.34.1


2024-04-29 08:16:06

by Kang Yang

[permalink] [raw]
Subject: [PATCH 2/5] wifi: ath12k: avoid duplicated vdev stop

From: Kang Yang <[email protected]>

ath12k_mac_op_unassign_vif_chanctx() will do vdev stop in
ath12k_mac_monitor_stop(). This ath12k_mac_vdev_stop() will do vdev stop
again, then might trigger firmware crash.

So add judgement to avoid duplicated vdev stop.

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

Fixes: c9e4e41e71ff ("wifi: ath12k: move peer delete after vdev stop of station for WCN7850")
Signed-off-by: Kang Yang <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 3e9a7dec7eba..4f553f2a7165 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7369,7 +7369,8 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
arvif->is_started = false;
}

- if (arvif->vdev_type != WMI_VDEV_TYPE_STA) {
+ if (arvif->vdev_type != WMI_VDEV_TYPE_STA &&
+ arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) {
ath12k_bss_disassoc(ar, arvif);
ret = ath12k_mac_vdev_stop(arvif);
if (ret)
--
2.34.1


2024-04-29 08:16:12

by Kang Yang

[permalink] [raw]
Subject: [PATCH 4/5] wifi: ath12k: remove redundant peer delete

From: Kang Yang <[email protected]>

Firmware will create internal peer for monitor mode. For host no need to
do peer create and peer delete.

So remove related code.

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

Signed-off-by: Kang Yang <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 9a2823bcf8fc..f994a78e7dc5 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7354,11 +7354,6 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,

WARN_ON(!arvif->is_started);

- if (ab->hw_params->vdev_start_delay &&
- arvif->vdev_type == WMI_VDEV_TYPE_MONITOR &&
- ath12k_peer_find_by_addr(ab, ar->mac_addr))
- ath12k_peer_delete(ar, arvif->vdev_id, ar->mac_addr);
-
if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
ret = ath12k_mac_monitor_stop(ar);
if (ret) {
--
2.34.1


2024-04-29 08:16:18

by Kang Yang

[permalink] [raw]
Subject: [PATCH 5/5] wifi: ath12k: remove invalid peer create logic

From: Kang Yang <[email protected]>

In ath12k_mac_op_assign_vif_chanctx(), there is a logic to
create peer using ar->mac_addr for a STA vdev. This is invalid
because a STA vdev should have a peer created using AP's
MAC address. Besides, if we run into that logic, it means a peer
has already been created earlier, we should not create it again.
So remove it.

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

Signed-off-by: Kang Yang <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 16 ----------------
1 file changed, 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index f994a78e7dc5..be961de26c6d 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7242,7 +7242,6 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ath12k_base *ab;
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
int ret;
- struct ath12k_wmi_peer_create_arg param;

/* For multi radio wiphy, the vdev was not created during add_interface
* create now since we have a channel ctx now to assign to a specific ar/fw
@@ -7278,21 +7277,6 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
goto out;
}

- if (ab->hw_params->vdev_start_delay &&
- arvif->vdev_type != WMI_VDEV_TYPE_AP &&
- arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) {
- param.vdev_id = arvif->vdev_id;
- param.peer_type = WMI_PEER_TYPE_DEFAULT;
- param.peer_addr = ar->mac_addr;
-
- ret = ath12k_peer_create(ar, arvif, NULL, &param);
- if (ret) {
- ath12k_warn(ab, "failed to create peer after vdev start delay: %d",
- ret);
- goto out;
- }
- }
-
if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
ret = ath12k_mac_monitor_start(ar);
if (ret)
--
2.34.1


2024-04-29 08:16:27

by Kang Yang

[permalink] [raw]
Subject: [PATCH 3/5] wifi: ath12k: avoid duplicated vdev down

From: Kang Yang <[email protected]>

ath12k_mac_op_unassign_vif_chanctx() will do vdev down in function
ath12k_mac_monitor_stop(). So no need to do vdev down again.

remove the duplicated one.

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

Signed-off-by: Kang Yang <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 4f553f2a7165..9a2823bcf8fc 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7379,10 +7379,6 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
}
arvif->is_started = false;

- if (ab->hw_params->vdev_start_delay &&
- arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
- ath12k_wmi_vdev_down(ar, arvif->vdev_id);
-
if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR &&
ar->num_started_vdevs == 1 && ar->monitor_vdev_created)
ath12k_mac_monitor_stop(ar);
--
2.34.1


2024-04-30 01:49:54

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 1/5] wifi: ath12k: remove unused variable monitor_flags

On 4/29/2024 1:15 AM, kangyang wrote:
> From: Kang Yang <[email protected]>
>
> monitor_flags is defined in struct ath12k. Although it is changed in
> some places, but it is not actually used.
>
> So remove related code.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-04-30 01:52:22

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 3/5] wifi: ath12k: avoid duplicated vdev down

On 4/29/2024 1:15 AM, kangyang wrote:
> From: Kang Yang <[email protected]>
>
> ath12k_mac_op_unassign_vif_chanctx() will do vdev down in function
> ath12k_mac_monitor_stop(). So no need to do vdev down again.
>
> remove the duplicated one.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-04-30 01:52:39

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 2/5] wifi: ath12k: avoid duplicated vdev stop

On 4/29/2024 1:15 AM, kangyang wrote:
> From: Kang Yang <[email protected]>
>
> ath12k_mac_op_unassign_vif_chanctx() will do vdev stop in
> ath12k_mac_monitor_stop(). This ath12k_mac_vdev_stop() will do vdev stop

s/This/Then/?

Kalle can fix this in the pending branch

> again, then might trigger firmware crash.
>
> So add judgement to avoid duplicated vdev stop.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Fixes: c9e4e41e71ff ("wifi: ath12k: move peer delete after vdev stop of station for WCN7850")
> Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-04-30 01:53:15

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 4/5] wifi: ath12k: remove redundant peer delete

On 4/29/2024 1:15 AM, kangyang wrote:
> From: Kang Yang <[email protected]>
>
> Firmware will create internal peer for monitor mode. For host no need to
> do peer create and peer delete.
>
> So remove related code.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-04-30 01:56:07

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 5/5] wifi: ath12k: remove invalid peer create logic

On 4/29/2024 1:15 AM, kangyang wrote:
> From: Kang Yang <[email protected]>
>
> In ath12k_mac_op_assign_vif_chanctx(), there is a logic to
> create peer using ar->mac_addr for a STA vdev. This is invalid
> because a STA vdev should have a peer created using AP's
> MAC address. Besides, if we run into that logic, it means a peer
> has already been created earlier, we should not create it again.
> So remove it.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>


2024-05-07 10:18:45

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/5] wifi: ath12k: remove unused variable monitor_flags

kangyang <[email protected]> wrote:

> monitor_flags is defined in struct ath12k. Although it is changed in
> some places, but it is not actually used.
>
> So remove related code.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
> Acked-by: Jeff Johnson <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

4 patches applied to ath-next branch of ath.git, thanks.

782615f280ce wifi: ath12k: remove unused variable monitor_flags
3b0989e925f3 wifi: ath12k: avoid duplicated vdev stop
f40aaca07bf7 wifi: ath12k: avoid duplicated vdev down
efd920f48d1f wifi: ath12k: remove invalid peer create logic

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2024-05-07 10:20:10

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/5] wifi: ath12k: remove redundant peer delete

kangyang <[email protected]> wrote:

> Firmware will create internal peer for monitor mode. For host no need to
> do peer create and peer delete.
>
> So remove related code.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Kang Yang <[email protected]>
> Acked-by: Jeff Johnson <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

What about QCN9274? The commit message doesn't mention that at all. Is it safe
to assume that QCN9274 firmware acts the same?

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2024-05-07 11:20:48

by Kang Yang

[permalink] [raw]
Subject: Re: [PATCH 4/5] wifi: ath12k: remove redundant peer delete



On 5/7/2024 6:20 PM, Kalle Valo wrote:
> kangyang <[email protected]> wrote:
>
>> Firmware will create internal peer for monitor mode. For host no need to
>> do peer create and peer delete.
>>
>> So remove related code.
>>
>> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>>
>> Signed-off-by: Kang Yang <[email protected]>
>> Acked-by: Jeff Johnson <[email protected]>
>> Signed-off-by: Kalle Valo <[email protected]>
>
> What about QCN9274? The commit message doesn't mention that at all. Is it safe
> to assume that QCN9274 firmware acts the same?
>


The first judgement 'ab->hw_params->vdev_start_delay' only works for
WCN7850. It won't affect QCN9274.

Sorry, i should mention.