Search Linux Wireless

RE: [PATCH] wifi: nxpwifi: add debugfs file to mimic radar detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry. It should be "wifi: mwifiex: ...". I will submit correct one later.

> From: David Lin <yu-hao.lin@xxxxxxx>
> Sent: Wednesday, October 9, 2024 2:10 PM
> To: linux-wireless@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx; briannorris@xxxxxxxxxxxx;
> kvalo@xxxxxxxxxx; francesco@xxxxxxxxxx; Pete Hsieh
> <tsung-hsien.hsieh@xxxxxxx>; s.hauer@xxxxxxxxxxxxxx; David Lin
> <yu-hao.lin@xxxxxxx>
> 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@xxxxxxx>
> ---
>  .../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






[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux