* [PATCH v2 0/3] wifi: ath11k: fix CAC running state
@ 2023-09-12 5:18 Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-09-12 5:18 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, johannes, Aditya Kumar Singh
Currently CAC running flag in ath11k is not set if DFS radar is required in
secondary channel. This is due to the fact that only primary channel's DFS
state and CAC time is being checked before setting the flag.
Fix this issue by checking the DFS state of all the sub-channels inside a
channel definition and not just the primary channel.
Also, make minor change in debug prints to show the CAC time
Aditya Kumar Singh (3):
wifi: cfg80211: export DFS CAC time and usable state helper functions
wifi: ath11k: fix CAC running state during virtual interface start
wifi: ath11k: fix Tx power value during active CAC
---
v2: rebased on ToT
---
drivers/net/wireless/ath/ath11k/mac.c | 27 +++++++++++++++++++--------
include/net/cfg80211.h | 24 ++++++++++++++++++++++++
net/wireless/chan.c | 2 ++
net/wireless/core.h | 17 -----------------
4 files changed, 45 insertions(+), 25 deletions(-)
base-commit: 0263687f4441d5a5eab8074d56b4693c8f0acf85
--
2.17.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions
2023-09-12 5:18 [PATCH v2 0/3] wifi: ath11k: fix CAC running state Aditya Kumar Singh
@ 2023-09-12 5:18 ` Aditya Kumar Singh
2023-09-12 17:50 ` Jeff Johnson
2023-09-13 9:28 ` Johannes Berg
2023-09-12 5:18 ` [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC Aditya Kumar Singh
2 siblings, 2 replies; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-09-12 5:18 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, johannes, Aditya Kumar Singh
cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
at least one channel in the chandef is in usable state or not. Also,
cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
time required for the given chandef.
Make these two functions visible to drivers by exporting their symbol
to global list of kernel symbols.
Lower level drivers can make use of these two functions to be aware
if CAC is required on the given chandef and for how long. For example
drivers which maintains the CAC state internally can make use of these.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
include/net/cfg80211.h | 24 ++++++++++++++++++++++++
net/wireless/chan.c | 2 ++
net/wireless/core.h | 17 -----------------
3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3a4b684f89bf..92072a0f0ea6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -953,6 +953,30 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
const struct cfg80211_chan_def *chandef,
enum nl80211_iftype iftype);
+/**
+ * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we
+ * can/need start CAC on such channel
+ * @wiphy: the wiphy to validate against
+ * @chandef: the channel definition to check
+ *
+ * Return: true if all channels available and at least
+ * one channel requires CAC (NL80211_DFS_USABLE)
+ */
+bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
+ const struct cfg80211_chan_def *chandef);
+
+/**
+ * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given
+ * channel definition
+ * @wiphy: the wiphy to validate against
+ * @chandef: the channel definition to check
+ *
+ * Returns: DFS CAC time (in ms) which applies for this channel definition
+ */
+unsigned int
+cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
+ const struct cfg80211_chan_def *chandef);
+
/**
* nl80211_send_chandef - sends the channel definition.
* @msg: the msg to send channel definition
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 0b7e81db383d..a78a6183d11e 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -666,6 +666,7 @@ bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
return (r1 + r2 > 0);
}
+EXPORT_SYMBOL(cfg80211_chandef_dfs_usable);
/*
* Checks if center frequency of chan falls with in the bandwidth
@@ -965,6 +966,7 @@ cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
return max(t1, t2);
}
+EXPORT_SYMBOL(cfg80211_chandef_dfs_cac_time);
static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
u32 center_freq, u32 bandwidth,
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 507d184b8b40..cc4eb3906c0c 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -469,29 +469,12 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev);
extern struct work_struct cfg80211_disconnect_work;
-/**
- * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable
- * @wiphy: the wiphy to validate against
- * @chandef: the channel definition to check
- *
- * Checks if chandef is usable and we can/need start CAC on such channel.
- *
- * Return: true if all channels available and at least
- * one channel requires CAC (NL80211_DFS_USABLE)
- */
-bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
- const struct cfg80211_chan_def *chandef);
-
void cfg80211_set_dfs_state(struct wiphy *wiphy,
const struct cfg80211_chan_def *chandef,
enum nl80211_dfs_state dfs_state);
void cfg80211_dfs_channels_update_work(struct work_struct *work);
-unsigned int
-cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
- const struct cfg80211_chan_def *chandef);
-
void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev);
int
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start
2023-09-12 5:18 [PATCH v2 0/3] wifi: ath11k: fix CAC running state Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
@ 2023-09-12 5:18 ` Aditya Kumar Singh
2023-09-12 17:51 ` Jeff Johnson
2023-10-05 6:23 ` Kalle Valo
2023-09-12 5:18 ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC Aditya Kumar Singh
2 siblings, 2 replies; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-09-12 5:18 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, johannes, Aditya Kumar Singh
Currently channel definition's primary channel's DFS CAC time
as well as primary channel's state i.e usable are used to set
the CAC_RUNNING flag for the ath11k radio structure. However,
this is wrong since certain channel definition are possbile
where primary channel may not be a DFS channel but, secondary
channel is a DFS channel. For example - channel 36 with 160 MHz
bandwidth.
In such cases, the flag will not be set which is wrong.
Fix this issue by using cfg80211_chandef_dfs_usable() function
from cfg80211 which return trues if at least one channel is in
usable state.
While at it, modify the CAC running debug log message to print
the CAC time as well in milli-seconds.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index c071bf5841af..6b5f032197ff 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5,6 +5,7 @@
*/
#include <net/mac80211.h>
+#include <net/cfg80211.h>
#include <linux/etherdevice.h>
#include <linux/bitfield.h>
#include <linux/inetdevice.h>
@@ -7193,6 +7194,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif,
struct wmi_vdev_start_req_arg arg = {};
const struct cfg80211_chan_def *chandef = &ctx->def;
int ret = 0;
+ unsigned int dfs_cac_time;
lockdep_assert_held(&ar->conf_mutex);
@@ -7272,20 +7274,21 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif,
ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n",
arvif->vif->addr, arvif->vdev_id);
- /* Enable CAC Flag in the driver by checking the channel DFS cac time,
- * i.e dfs_cac_ms value which will be valid only for radar channels
- * and state as NL80211_DFS_USABLE which indicates CAC needs to be
+ /* Enable CAC Flag in the driver by checking the all sub-channel's DFS
+ * state as NL80211_DFS_USABLE which indicates CAC needs to be
* done before channel usage. This flags is used to drop rx packets.
* during CAC.
*/
/* TODO Set the flag for other interface types as required */
- if (arvif->vdev_type == WMI_VDEV_TYPE_AP &&
- chandef->chan->dfs_cac_ms &&
- chandef->chan->dfs_state == NL80211_DFS_USABLE) {
+ if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled &&
+ cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) {
set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags);
+ dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy,
+ chandef);
ath11k_dbg(ab, ATH11K_DBG_MAC,
- "CAC Started in chan_freq %d for vdev %d\n",
- arg.channel.freq, arg.vdev_id);
+ "CAC (for %u ms) Started in center_freq %d center_freq1 %d for vdev %d\n",
+ dfs_cac_time, arg.channel.freq, chandef->center_freq1,
+ arg.vdev_id);
}
ret = ath11k_mac_set_txbf_conf(arvif);
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-09-12 5:18 [PATCH v2 0/3] wifi: ath11k: fix CAC running state Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start Aditya Kumar Singh
@ 2023-09-12 5:18 ` Aditya Kumar Singh
2023-09-12 17:52 ` Jeff Johnson
2023-10-03 14:31 ` Kalle Valo
2 siblings, 2 replies; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-09-12 5:18 UTC (permalink / raw)
To: ath11k; +Cc: linux-wireless, johannes, Aditya Kumar Singh
Tx power is fetched from firmware's pdev stats. However, during active
CAC, firmware does not fill the current Tx power and sends the max
initialised value filled during firmware init. If host sends this power
to user space, this is wrong since in certain situations, the Tx power
could be greater than the max allowed by the regulatory. Hence, host
should not be fetching the Tx power during an active CAC.
Fix this issue by returning Tx power as 0 during active CAC since it
is known that during CAC, there will be no transmission happening.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Fixes: 9a2aa68afe3d ("wifi: ath11k: add get_txpower mac ops")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 6b5f032197ff..a36698688f89 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9045,6 +9045,14 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
if (ar->state != ATH11K_STATE_ON)
goto err_fallback;
+ /* Firmware doesn't provide Tx power during CAC hence no need to fetch
+ * the stats.
+ */
+ if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
+ mutex_unlock(&ar->conf_mutex);
+ return -EAGAIN;
+ }
+
req_param.pdev_id = ar->pdev->pdev_id;
req_param.stats_id = WMI_REQUEST_PDEV_STAT;
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
@ 2023-09-12 17:50 ` Jeff Johnson
2023-09-13 9:28 ` Johannes Berg
1 sibling, 0 replies; 15+ messages in thread
From: Jeff Johnson @ 2023-09-12 17:50 UTC (permalink / raw)
To: Aditya Kumar Singh, ath11k; +Cc: linux-wireless, johannes
On 9/11/2023 10:18 PM, Aditya Kumar Singh wrote:
> cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
> at least one channel in the chandef is in usable state or not. Also,
> cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
> time required for the given chandef.
>
> Make these two functions visible to drivers by exporting their symbol
> to global list of kernel symbols.
>
> Lower level drivers can make use of these two functions to be aware
> if CAC is required on the given chandef and for how long. For example
> drivers which maintains the CAC state internally can make use of these.
>
> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---
> include/net/cfg80211.h | 24 ++++++++++++++++++++++++
> net/wireless/chan.c | 2 ++
> net/wireless/core.h | 17 -----------------
> 3 files changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 3a4b684f89bf..92072a0f0ea6 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -953,6 +953,30 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
> const struct cfg80211_chan_def *chandef,
> enum nl80211_iftype iftype);
>
> +/**
> + * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we
> + * can/need start CAC on such channel
> + * @wiphy: the wiphy to validate against
> + * @chandef: the channel definition to check
> + *
> + * Return: true if all channels available and at least
> + * one channel requires CAC (NL80211_DFS_USABLE)
> + */
> +bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
> + const struct cfg80211_chan_def *chandef);
> +
> +/**
> + * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given
> + * channel definition
> + * @wiphy: the wiphy to validate against
> + * @chandef: the channel definition to check
> + *
> + * Returns: DFS CAC time (in ms) which applies for this channel definition
> + */
> +unsigned int
> +cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
> + const struct cfg80211_chan_def *chandef);
> +
> /**
> * nl80211_send_chandef - sends the channel definition.
> * @msg: the msg to send channel definition
> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> index 0b7e81db383d..a78a6183d11e 100644
> --- a/net/wireless/chan.c
> +++ b/net/wireless/chan.c
> @@ -666,6 +666,7 @@ bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
>
> return (r1 + r2 > 0);
> }
> +EXPORT_SYMBOL(cfg80211_chandef_dfs_usable);
>
> /*
> * Checks if center frequency of chan falls with in the bandwidth
> @@ -965,6 +966,7 @@ cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
>
> return max(t1, t2);
> }
> +EXPORT_SYMBOL(cfg80211_chandef_dfs_cac_time);
>
> static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
> u32 center_freq, u32 bandwidth,
> diff --git a/net/wireless/core.h b/net/wireless/core.h
> index 507d184b8b40..cc4eb3906c0c 100644
> --- a/net/wireless/core.h
> +++ b/net/wireless/core.h
> @@ -469,29 +469,12 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev);
>
> extern struct work_struct cfg80211_disconnect_work;
>
> -/**
> - * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable
> - * @wiphy: the wiphy to validate against
> - * @chandef: the channel definition to check
> - *
> - * Checks if chandef is usable and we can/need start CAC on such channel.
> - *
> - * Return: true if all channels available and at least
> - * one channel requires CAC (NL80211_DFS_USABLE)
> - */
> -bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
> - const struct cfg80211_chan_def *chandef);
> -
> void cfg80211_set_dfs_state(struct wiphy *wiphy,
> const struct cfg80211_chan_def *chandef,
> enum nl80211_dfs_state dfs_state);
>
> void cfg80211_dfs_channels_update_work(struct work_struct *work);
>
> -unsigned int
> -cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
> - const struct cfg80211_chan_def *chandef);
> -
> void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev);
>
> int
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start
2023-09-12 5:18 ` [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start Aditya Kumar Singh
@ 2023-09-12 17:51 ` Jeff Johnson
2023-10-05 6:23 ` Kalle Valo
1 sibling, 0 replies; 15+ messages in thread
From: Jeff Johnson @ 2023-09-12 17:51 UTC (permalink / raw)
To: Aditya Kumar Singh, ath11k; +Cc: linux-wireless, johannes
On 9/11/2023 10:18 PM, Aditya Kumar Singh wrote:
> Currently channel definition's primary channel's DFS CAC time
> as well as primary channel's state i.e usable are used to set
> the CAC_RUNNING flag for the ath11k radio structure. However,
> this is wrong since certain channel definition are possbile
> where primary channel may not be a DFS channel but, secondary
> channel is a DFS channel. For example - channel 36 with 160 MHz
> bandwidth.
> In such cases, the flag will not be set which is wrong.
>
> Fix this issue by using cfg80211_chandef_dfs_usable() function
> from cfg80211 which return trues if at least one channel is in
> usable state.
>
> While at it, modify the CAC running debug log message to print
> the CAC time as well in milli-seconds.
>
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---
> drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
> index c071bf5841af..6b5f032197ff 100644
> --- a/drivers/net/wireless/ath/ath11k/mac.c
> +++ b/drivers/net/wireless/ath/ath11k/mac.c
> @@ -5,6 +5,7 @@
> */
>
> #include <net/mac80211.h>
> +#include <net/cfg80211.h>
> #include <linux/etherdevice.h>
> #include <linux/bitfield.h>
> #include <linux/inetdevice.h>
> @@ -7193,6 +7194,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif,
> struct wmi_vdev_start_req_arg arg = {};
> const struct cfg80211_chan_def *chandef = &ctx->def;
> int ret = 0;
> + unsigned int dfs_cac_time;
>
> lockdep_assert_held(&ar->conf_mutex);
>
> @@ -7272,20 +7274,21 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif,
> ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n",
> arvif->vif->addr, arvif->vdev_id);
>
> - /* Enable CAC Flag in the driver by checking the channel DFS cac time,
> - * i.e dfs_cac_ms value which will be valid only for radar channels
> - * and state as NL80211_DFS_USABLE which indicates CAC needs to be
> + /* Enable CAC Flag in the driver by checking the all sub-channel's DFS
> + * state as NL80211_DFS_USABLE which indicates CAC needs to be
> * done before channel usage. This flags is used to drop rx packets.
> * during CAC.
> */
> /* TODO Set the flag for other interface types as required */
> - if (arvif->vdev_type == WMI_VDEV_TYPE_AP &&
> - chandef->chan->dfs_cac_ms &&
> - chandef->chan->dfs_state == NL80211_DFS_USABLE) {
> + if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled &&
> + cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) {
> set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags);
> + dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy,
> + chandef);
> ath11k_dbg(ab, ATH11K_DBG_MAC,
> - "CAC Started in chan_freq %d for vdev %d\n",
> - arg.channel.freq, arg.vdev_id);
> + "CAC (for %u ms) Started in center_freq %d center_freq1 %d for vdev %d\n",
> + dfs_cac_time, arg.channel.freq, chandef->center_freq1,
> + arg.vdev_id);
> }
>
> ret = ath11k_mac_set_txbf_conf(arvif);
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-09-12 5:18 ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC Aditya Kumar Singh
@ 2023-09-12 17:52 ` Jeff Johnson
2023-10-03 14:31 ` Kalle Valo
1 sibling, 0 replies; 15+ messages in thread
From: Jeff Johnson @ 2023-09-12 17:52 UTC (permalink / raw)
To: Aditya Kumar Singh, ath11k; +Cc: linux-wireless, johannes
On 9/11/2023 10:18 PM, Aditya Kumar Singh wrote:
> Tx power is fetched from firmware's pdev stats. However, during active
> CAC, firmware does not fill the current Tx power and sends the max
> initialised value filled during firmware init. If host sends this power
> to user space, this is wrong since in certain situations, the Tx power
> could be greater than the max allowed by the regulatory. Hence, host
> should not be fetching the Tx power during an active CAC.
>
> Fix this issue by returning Tx power as 0 during active CAC since it
> is known that during CAC, there will be no transmission happening.
>
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>
> Fixes: 9a2aa68afe3d ("wifi: ath11k: add get_txpower mac ops")
> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---
> drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
> index 6b5f032197ff..a36698688f89 100644
> --- a/drivers/net/wireless/ath/ath11k/mac.c
> +++ b/drivers/net/wireless/ath/ath11k/mac.c
> @@ -9045,6 +9045,14 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
> if (ar->state != ATH11K_STATE_ON)
> goto err_fallback;
>
> + /* Firmware doesn't provide Tx power during CAC hence no need to fetch
> + * the stats.
> + */
> + if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
> + mutex_unlock(&ar->conf_mutex);
> + return -EAGAIN;
> + }
> +
> req_param.pdev_id = ar->pdev->pdev_id;
> req_param.stats_id = WMI_REQUEST_PDEV_STAT;
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
2023-09-12 17:50 ` Jeff Johnson
@ 2023-09-13 9:28 ` Johannes Berg
2023-09-13 10:16 ` Aditya Kumar Singh
1 sibling, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2023-09-13 9:28 UTC (permalink / raw)
To: Aditya Kumar Singh, ath11k; +Cc: linux-wireless, Jeff Johnson
On Tue, 2023-09-12 at 10:48 +0530, Aditya Kumar Singh wrote:
> cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
> at least one channel in the chandef is in usable state or not. Also,
> cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
> time required for the given chandef.
>
Should we really export the time function just for a debug messages?
That seems like a waste of space?
johannes
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions
2023-09-13 9:28 ` Johannes Berg
@ 2023-09-13 10:16 ` Aditya Kumar Singh
2023-09-13 10:17 ` Johannes Berg
0 siblings, 1 reply; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-09-13 10:16 UTC (permalink / raw)
To: Johannes Berg, ath11k; +Cc: linux-wireless, Jeff Johnson
On 9/13/23 14:58, Johannes Berg wrote:
> On Tue, 2023-09-12 at 10:48 +0530, Aditya Kumar Singh wrote:
>> cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
>> at least one channel in the chandef is in usable state or not. Also,
>> cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
>> time required for the given chandef.
>>
>
> Should we really export the time function just for a debug messages?
> That seems like a waste of space?
>
Yes absolutely. But actually as a follow up of this patch, we have
Background DFS patch in pipeline which requires us to send the CAC time
to firmware. So its actually needed there. And may be once we do this,
other drivers also may start using this?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions
2023-09-13 10:16 ` Aditya Kumar Singh
@ 2023-09-13 10:17 ` Johannes Berg
0 siblings, 0 replies; 15+ messages in thread
From: Johannes Berg @ 2023-09-13 10:17 UTC (permalink / raw)
To: Aditya Kumar Singh, ath11k; +Cc: linux-wireless, Jeff Johnson
On Wed, 2023-09-13 at 15:46 +0530, Aditya Kumar Singh wrote:
> On 9/13/23 14:58, Johannes Berg wrote:
> > On Tue, 2023-09-12 at 10:48 +0530, Aditya Kumar Singh wrote:
> > > cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
> > > at least one channel in the chandef is in usable state or not. Also,
> > > cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
> > > time required for the given chandef.
> > >
> >
> > Should we really export the time function just for a debug messages?
> > That seems like a waste of space?
> >
> Yes absolutely. But actually as a follow up of this patch, we have
> Background DFS patch in pipeline which requires us to send the CAC time
> to firmware. So its actually needed there. And may be once we do this,
> other drivers also may start using this?
OK, fair enough :)
johannes
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-09-12 5:18 ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC Aditya Kumar Singh
2023-09-12 17:52 ` Jeff Johnson
@ 2023-10-03 14:31 ` Kalle Valo
2023-10-04 2:09 ` Aditya Kumar Singh
1 sibling, 1 reply; 15+ messages in thread
From: Kalle Valo @ 2023-10-03 14:31 UTC (permalink / raw)
To: Aditya Kumar Singh; +Cc: ath11k, linux-wireless, johannes, Aditya Kumar Singh
Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:
> Tx power is fetched from firmware's pdev stats. However, during active
> CAC, firmware does not fill the current Tx power and sends the max
> initialised value filled during firmware init. If host sends this power
> to user space, this is wrong since in certain situations, the Tx power
> could be greater than the max allowed by the regulatory. Hence, host
> should not be fetching the Tx power during an active CAC.
>
> Fix this issue by returning Tx power as 0 during active CAC since it
> is known that during CAC, there will be no transmission happening.
The returning as 0 doesn't seem to match the code. Should I change the sentence to:
"Fix this issue by returning -EAGAIN error so that the user space knows there's
no value available right now."
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230912051857.2284-4-quic_adisi@quicinc.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-10-03 14:31 ` Kalle Valo
@ 2023-10-04 2:09 ` Aditya Kumar Singh
2023-10-04 4:54 ` Kalle Valo
0 siblings, 1 reply; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-10-04 2:09 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath11k, linux-wireless
On 10/3/23 20:01, Kalle Valo wrote:
> Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:
>
>> Tx power is fetched from firmware's pdev stats. However, during active
>> CAC, firmware does not fill the current Tx power and sends the max
>> initialised value filled during firmware init. If host sends this power
>> to user space, this is wrong since in certain situations, the Tx power
>> could be greater than the max allowed by the regulatory. Hence, host
>> should not be fetching the Tx power during an active CAC.
>>
>> Fix this issue by returning Tx power as 0 during active CAC since it
>> is known that during CAC, there will be no transmission happening.
>
> The returning as 0 doesn't seem to match the code. Should I change the sentence to:
>
> "Fix this issue by returning -EAGAIN error so that the user space knows there's
> no value available right now."
Oops. Looks like only in commit message its still zero. Its changed to
return -EAGAIN in code.
+ if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
+ mutex_unlock(&ar->conf_mutex);
+ return -EAGAIN;
+ }
So could you just rectify while applying or should I resend?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-10-04 4:54 ` Kalle Valo
@ 2023-10-04 4:54 ` Aditya Kumar Singh
0 siblings, 0 replies; 15+ messages in thread
From: Aditya Kumar Singh @ 2023-10-04 4:54 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath11k, linux-wireless
On 10/4/23 10:24, Kalle Valo wrote:
> Aditya Kumar Singh <quic_adisi@quicinc.com> writes:
>
>> On 10/3/23 20:01, Kalle Valo wrote:
>>> Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:
>>>
>>>> Tx power is fetched from firmware's pdev stats. However, during active
>>>> CAC, firmware does not fill the current Tx power and sends the max
>>>> initialised value filled during firmware init. If host sends this power
>>>> to user space, this is wrong since in certain situations, the Tx power
>>>> could be greater than the max allowed by the regulatory. Hence, host
>>>> should not be fetching the Tx power during an active CAC.
>>>>
>>>> Fix this issue by returning Tx power as 0 during active CAC since it
>>>> is known that during CAC, there will be no transmission happening.
>>> The returning as 0 doesn't seem to match the code. Should I change
>>> the sentence to:
>>> "Fix this issue by returning -EAGAIN error so that the user space
>>> knows there's
>>> no value available right now."
>> Oops. Looks like only in commit message its still zero. Its changed to
>> return -EAGAIN in code.
>>
>> + if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
>> + mutex_unlock(&ar->conf_mutex);
>> + return -EAGAIN;
>> + }
>>
>> So could you just rectify while applying or should I resend?
>
> No need to resend because of this. I changed the commit message now to
> this in the pending branch:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6eacc3b5a70ab3f92f9410839870edbb21c9d051Sure, thanks!
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
2023-10-04 2:09 ` Aditya Kumar Singh
@ 2023-10-04 4:54 ` Kalle Valo
2023-10-04 4:54 ` Aditya Kumar Singh
0 siblings, 1 reply; 15+ messages in thread
From: Kalle Valo @ 2023-10-04 4:54 UTC (permalink / raw)
To: Aditya Kumar Singh; +Cc: ath11k, linux-wireless
Aditya Kumar Singh <quic_adisi@quicinc.com> writes:
> On 10/3/23 20:01, Kalle Valo wrote:
>> Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:
>>
>>> Tx power is fetched from firmware's pdev stats. However, during active
>>> CAC, firmware does not fill the current Tx power and sends the max
>>> initialised value filled during firmware init. If host sends this power
>>> to user space, this is wrong since in certain situations, the Tx power
>>> could be greater than the max allowed by the regulatory. Hence, host
>>> should not be fetching the Tx power during an active CAC.
>>>
>>> Fix this issue by returning Tx power as 0 during active CAC since it
>>> is known that during CAC, there will be no transmission happening.
>> The returning as 0 doesn't seem to match the code. Should I change
>> the sentence to:
>> "Fix this issue by returning -EAGAIN error so that the user space
>> knows there's
>> no value available right now."
> Oops. Looks like only in commit message its still zero. Its changed to
> return -EAGAIN in code.
>
> + if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
> + mutex_unlock(&ar->conf_mutex);
> + return -EAGAIN;
> + }
>
> So could you just rectify while applying or should I resend?
No need to resend because of this. I changed the commit message now to
this in the pending branch:
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=6eacc3b5a70ab3f92f9410839870edbb21c9d051
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start
2023-09-12 5:18 ` [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start Aditya Kumar Singh
2023-09-12 17:51 ` Jeff Johnson
@ 2023-10-05 6:23 ` Kalle Valo
1 sibling, 0 replies; 15+ messages in thread
From: Kalle Valo @ 2023-10-05 6:23 UTC (permalink / raw)
To: Aditya Kumar Singh; +Cc: ath11k, linux-wireless, johannes, Aditya Kumar Singh
Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:
> Currently channel definition's primary channel's DFS CAC time
> as well as primary channel's state i.e usable are used to set
> the CAC_RUNNING flag for the ath11k radio structure. However,
> this is wrong since certain channel definition are possbile
> where primary channel may not be a DFS channel but, secondary
> channel is a DFS channel. For example - channel 36 with 160 MHz
> bandwidth.
> In such cases, the flag will not be set which is wrong.
>
> Fix this issue by using cfg80211_chandef_dfs_usable() function
> from cfg80211 which return trues if at least one channel is in
> usable state.
>
> While at it, modify the CAC running debug log message to print
> the CAC time as well in milli-seconds.
>
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
2 patches applied to ath-next branch of ath.git, thanks.
69fcb5259056 wifi: ath11k: fix CAC running state during virtual interface start
77f1ee6fd8b6 wifi: ath11k: fix Tx power value during active CAC
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230912051857.2284-3-quic_adisi@quicinc.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2023-10-05 16:16 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12 5:18 [PATCH v2 0/3] wifi: ath11k: fix CAC running state Aditya Kumar Singh
2023-09-12 5:18 ` [PATCH v2 1/3] wifi: cfg80211: export DFS CAC time and usable state helper functions Aditya Kumar Singh
2023-09-12 17:50 ` Jeff Johnson
2023-09-13 9:28 ` Johannes Berg
2023-09-13 10:16 ` Aditya Kumar Singh
2023-09-13 10:17 ` Johannes Berg
2023-09-12 5:18 ` [PATCH v2 2/3] wifi: ath11k: fix CAC running state during virtual interface start Aditya Kumar Singh
2023-09-12 17:51 ` Jeff Johnson
2023-10-05 6:23 ` Kalle Valo
2023-09-12 5:18 ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC Aditya Kumar Singh
2023-09-12 17:52 ` Jeff Johnson
2023-10-03 14:31 ` Kalle Valo
2023-10-04 2:09 ` Aditya Kumar Singh
2023-10-04 4:54 ` Kalle Valo
2023-10-04 4:54 ` Aditya Kumar Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).