[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<PA4PR04MB9638896E46E752E1C4898F98D17F2@PA4PR04MB9638.eurprd04.prod.outlook.com>
Date: Wed, 9 Oct 2024 06:24:23 +0000
From: David Lin <yu-hao.lin@....com>
To: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"briannorris@...omium.org" <briannorris@...omium.org>, "kvalo@...nel.org"
<kvalo@...nel.org>, "francesco@...cini.it" <francesco@...cini.it>, Pete Hsieh
<tsung-hsien.hsieh@....com>, "s.hauer@...gutronix.de"
<s.hauer@...gutronix.de>
Subject: RE: [PATCH] wifi: nxpwifi: add debugfs file to mimic radar detection
Sorry. It should be "wifi: mwifiex: ...". I will submit correct one later.
> From: David Lin <yu-hao.lin@....com>
> Sent: Wednesday, October 9, 2024 2:10 PM
> To: linux-wireless@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org; briannorris@...omium.org;
> kvalo@...nel.org; francesco@...cini.it; Pete Hsieh
> <tsung-hsien.hsieh@....com>; s.hauer@...gutronix.de; David Lin
> <yu-hao.lin@....com>
> Subject: [PATCH] wifi: nxpwifi: add debugfs file to mimic radar detection
>
> Debugfs file "fake_radar_detect" is created to mimic radar detection. Echo 1
> to this file will generate radar event to cfg80211, which can be used to test AP
> DFS mode without real radar detection from firmware.
>
> Signed-off-by: David Lin <yu-hao.lin@....com>
> ---
> .../net/wireless/marvell/mwifiex/debugfs.c | 43 +++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c
> b/drivers/net/wireless/marvell/mwifiex/debugfs.c
> index 9deaf59dcb62..cf9604661aed 100644
> --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
> +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
> @@ -909,6 +909,47 @@ mwifiex_reset_write(struct file *file,
> return count;
> }
>
> +static ssize_t
> +mwifiex_fake_radar_detect_write(struct file *file,
> + const char __user *ubuf,
> + size_t count, loff_t *ppos)
> +{
> + struct mwifiex_private *priv = file->private_data;
> + struct mwifiex_adapter *adapter = priv->adapter;
> + bool result;
> + int rc;
> +
> + rc = kstrtobool_from_user(ubuf, count, &result);
> + if (rc)
> + return rc;
> +
> + if (!result)
> + return -EINVAL;
> +
> + if (priv->wdev.links[0].cac_started) {
> + mwifiex_dbg(adapter, MSG,
> + "Generate fake radar detected during CAC\n");
> + if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
> + mwifiex_dbg(adapter, ERROR,
> + "Failed to stop CAC in FW\n");
> + cancel_delayed_work_sync(&priv->dfs_cac_work);
> + cfg80211_cac_event(priv->netdev, &priv->dfs_chandef,
> + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, 0);
> + cfg80211_radar_event(adapter->wiphy, &priv->dfs_chandef,
> + GFP_KERNEL);
> + } else {
> + if (priv->bss_chandef.chan->dfs_cac_ms) {
> + mwifiex_dbg(adapter, MSG,
> + "Generate fake radar detected\n");
> + cfg80211_radar_event(adapter->wiphy,
> + &priv->dfs_chandef,
> + GFP_KERNEL);
> + }
> + }
> +
> + return count;
> +}
> +
> #define MWIFIEX_DFS_ADD_FILE(name) do
> { \
> debugfs_create_file(#name, 0644, priv->dfs_dev_dir, priv, \
> &mwifiex_dfs_##name##_fops); \
> @@ -945,6 +986,7 @@ MWIFIEX_DFS_FILE_OPS(histogram);
> MWIFIEX_DFS_FILE_OPS(debug_mask);
> MWIFIEX_DFS_FILE_OPS(timeshare_coex);
> MWIFIEX_DFS_FILE_WRITE_OPS(reset);
> +MWIFIEX_DFS_FILE_WRITE_OPS(fake_radar_detect);
> MWIFIEX_DFS_FILE_OPS(verext);
>
> /*
> @@ -971,6 +1013,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private
> *priv)
> MWIFIEX_DFS_ADD_FILE(debug_mask);
> MWIFIEX_DFS_ADD_FILE(timeshare_coex);
> MWIFIEX_DFS_ADD_FILE(reset);
> + MWIFIEX_DFS_ADD_FILE(fake_radar_detect);
> MWIFIEX_DFS_ADD_FILE(verext);
> }
>
>
> base-commit: 5a4d42c1688c88f3be6aef46b0ea6c32694cd2b8
> prerequisite-patch-id: ababe4f5cc6f52d23552f4ada6efb26655f247e3
> --
> 2.34.1
Powered by blists - more mailing lists