All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shayne Chen <shayne.chen@mediatek.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	Bo Jiao <Bo.Jiao@mediatek.com>,
	linux-mediatek <linux-mediatek@lists.infradead.org>,
	StanleyYP Wang <StanleyYP.Wang@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>
Subject: [PATCH 08/10] wifi: mt76: mt7996: add sanity checks for background radar trigger
Date: Wed, 20 Mar 2024 19:09:16 +0800	[thread overview]
Message-ID: <20240320110918.3488-8-shayne.chen@mediatek.com> (raw)
In-Reply-To: <20240320110918.3488-1-shayne.chen@mediatek.com>

From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>

Check if background radar is enabled or not before manually triggering it,
and also add more checks in radar detected event.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c | 5 +++++
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c     | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
index 9bd953586b04..62c03d088925 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c
@@ -225,6 +225,11 @@ mt7996_radar_trigger(void *data, u64 val)
 	if (val > MT_RX_SEL2)
 		return -EINVAL;
 
+	if (val == MT_RX_SEL2 && !dev->rdd2_phy) {
+		dev_err(dev->mt76.dev, "Background radar is not enabled\n");
+		return -EINVAL;
+	}
+
 	return mt7996_mcu_rdd_cmd(dev, RDD_RADAR_EMULATE,
 				  val, 0, 0);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index ccae954a22f8..c024f138f1ca 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -355,7 +355,10 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
 	if (r->band_idx >= ARRAY_SIZE(dev->mt76.phys))
 		return;
 
-	if (dev->rdd2_phy && r->band_idx == MT_RX_SEL2)
+	if (r->band_idx == MT_RX_SEL2 && !dev->rdd2_phy)
+		return;
+
+	if (r->band_idx == MT_RX_SEL2)
 		mphy = dev->rdd2_phy->mt76;
 	else
 		mphy = dev->mt76.phys[r->band_idx];
-- 
2.39.2


  parent reply	other threads:[~2024-03-20 11:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 11:09 [PATCH 01/10] wifi: mt76: connac: use peer address for station BMC entry Shayne Chen
2024-03-20 11:09 ` [PATCH 02/10] wifi: mt76: mt7996: disable rx header translation for " Shayne Chen
2024-03-20 11:09 ` [PATCH 03/10] wifi: mt76: mt7996: set RCPI value in rate control command Shayne Chen
2024-03-20 11:09 ` [PATCH 04/10] wifi: mt76: connac: enable HW CSO module for mt7996 Shayne Chen
2024-03-20 11:09 ` [PATCH 05/10] wifi: mt76: mt7996: fix non-main BSS no beacon issue for MBSS scenario Shayne Chen
2024-03-20 11:09 ` [PATCH 06/10] wifi: mt76: mt7996: fix potential memory leakage when reading chip temperature Shayne Chen
2024-03-20 11:09 ` [PATCH 07/10] wifi: mt76: connac: enable critical packet mode support for mt7992 Shayne Chen
2024-03-20 11:09 ` Shayne Chen [this message]
2024-03-20 11:09 ` [PATCH 09/10] wifi: mt76: mt7996: let upper layer handle MGMT frame protection Shayne Chen
2024-04-03 10:56   ` Felix Fietkau
2024-04-08  6:07     ` shayne.chen
2024-04-08  6:07       ` Shayne Chen (陳軒丞)
2024-03-20 11:09 ` [PATCH 10/10] wifi: mt76: mt7996: add sanity check for NAPI schedule Shayne Chen
2024-04-03 10:57   ` Felix Fietkau
2024-04-08  5:57     ` shayne.chen
2024-04-08  5:57       ` Shayne Chen (陳軒丞)

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=20240320110918.3488-8-shayne.chen@mediatek.com \
    --to=shayne.chen@mediatek.com \
    --cc=Bo.Jiao@mediatek.com \
    --cc=StanleyYP.Wang@mediatek.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.