ATH11K Archive mirror
 help / color / mirror / Atom feed
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
To: <ath11k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>, <johannes@sipsolutions.net>,
	"Aditya Kumar Singh" <quic_adisi@quicinc.com>
Subject: [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC
Date: Tue, 12 Sep 2023 10:48:57 +0530	[thread overview]
Message-ID: <20230912051857.2284-4-quic_adisi@quicinc.com> (raw)
In-Reply-To: <20230912051857.2284-1-quic_adisi@quicinc.com>

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


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  parent reply	other threads:[~2023-09-12  5:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Aditya Kumar Singh [this message]
2023-09-12 17:52   ` [PATCH v2 3/3] wifi: ath11k: fix Tx power value during active CAC 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230912051857.2284-4-quic_adisi@quicinc.com \
    --to=quic_adisi@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).