From: Christian Lamparter <chunkeey@gmail.com>
To: Masi Osmani <mas-i@hotmail.de>,
Christian Lamparter <chunkeey@googlemail.com>
Cc: linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com
Subject: Re: [PATCH 09/10] carl9170: fw: enable DFS radar detection
Date: Sat, 21 Mar 2026 21:11:22 +0100 [thread overview]
Message-ID: <093b7bad-2ecc-47af-9763-958283a102d6@gmail.com> (raw)
In-Reply-To: <AM7PPF5613FA0B6E8DE143A385080A72F139444A@AM7PPF5613FA0B6.EURP251.PROD.OUTLOOK.COM>
On 3/12/26 11:38 AM, Masi Osmani wrote:
> Enable DFS (Dynamic Frequency Selection) radar detection on the
> AR9170. The hardware has radar detection registers (RADAR_0,
> RADAR_1, RADAR_EXT) and the firmware already sends
> CARL9170_RSP_RADAR events, but the driver never programmed the
> detection parameters and only logged a "please report" message.
>
> Changes:
> - Program radar detection pulse parameters in phy.c when the
> current channel has IEEE80211_CHAN_RADAR set. Values are
> based on ath9k defaults for FCC/ETSI compliance.
Which values did you use? The best I can find are in ar5008_phy.c
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/ath/ath9k/ar5008_phy.c?h=v7.0-rc4#n1268>
| conf->fir_power = -33;
| conf->radar_rssi = 20;
| conf->pulse_height = 10;
| conf->pulse_rssi = 15;
| conf->pulse_inband = 15;
| conf->pulse_maxlen = 255;
| conf->pulse_inband_step = 12;
| conf->radar_inband = 8;
the one in the patch look a little bit different.
Can I ask, how did you tune them? Do you have a setup to mimic
those air-port or weather radars? Or are you living close to one?
> - Advertise radar_detect_widths in the interface combination
> (fw.c) for 20 MHz noHT, 20 MHz HT, and 40 MHz HT.
> - Replace the old "please report" message with a call to
> ieee80211_radar_detected() so mac80211 can trigger the
> proper DFS state machine (channel switch / CAC).
>
> Signed-off-by: Masi Osmani <mas-i@hotmail.de>
> ---
> drivers/net/wireless/ath/carl9170/fw.c | 3 ++
> drivers/net/wireless/ath/carl9170/phy.c | 45 +++++++++++++++++++++++++
> drivers/net/wireless/ath/carl9170/rx.c | 7 ++--
> 3 files changed, 50 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c
> index 419f553..a730593 100644
> --- a/drivers/net/wireless/ath/carl9170/fw.c
> +++ b/drivers/net/wireless/ath/carl9170/fw.c
> @@ -215,6 +215,9 @@ static void carl9170_fw_set_if_combinations(struct ar9170 *ar,
> ar->if_combs[0].max_interfaces = ar->fw.vif_num;
> ar->if_combs[0].limits = ar->if_comb_limits;
> ar->if_combs[0].n_limits = ARRAY_SIZE(ar->if_comb_limits);
> + ar->if_combs[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
> + BIT(NL80211_CHAN_WIDTH_20) |
> + BIT(NL80211_CHAN_WIDTH_40);
>
> ar->hw->wiphy->iface_combinations = ar->if_combs;
> ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ar->if_combs);
> diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
> index bcd9066..c294df7 100644
> --- a/drivers/net/wireless/ath/carl9170/phy.c
> +++ b/drivers/net/wireless/ath/carl9170/phy.c
> @@ -1637,6 +1637,47 @@ void carl9170_update_channel_maxpower(struct ar9170 *ar)
> }
> }
>
> +static int carl9170_set_radar_detection(struct ar9170 *ar,
> + struct ieee80211_channel *channel)
> +{
> + bool enable = channel->flags & IEEE80211_CHAN_RADAR;
> +
> + carl9170_regwrite_begin(ar);
> +
> + if (enable) {
> + /*
> + * Configure radar detection pulse parameters.
> + * Values based on ath9k's defaults for FCC/ETSI.
> + */
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_0,
> + AR9170_PHY_RADAR_0_ENA |
> + AR9170_PHY_RADAR_0_FFT_ENA |
> + SET_CONSTVAL(AR9170_PHY_RADAR_0_INBAND, 5) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_0_PRSSI, 1) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_0_HEIGHT, 6) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_0_RRSSI, 12) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_0_FIRPWR, 33));
> +
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_1,
> + AR9170_PHY_RADAR_1_MAX_RRSSI |
> + AR9170_PHY_RADAR_1_BLOCK_CHECK |
> + AR9170_PHY_RADAR_1_RELSTEP_CHECK |
> + SET_CONSTVAL(AR9170_PHY_RADAR_1_RELSTEP_THRESH, 8) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_1_RELPWR_THRESH, 12) |
> + SET_CONSTVAL(AR9170_PHY_RADAR_1_MAXLEN, 255));
> +
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_EXT,
> + AR9170_PHY_RADAR_EXT_ENA);
This seems to be based on ar5008_hw_set_radar_params except that:
| if (conf->ext_channel)
| REG_SET_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA);
| else
| REG_CLR_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA);
you always set the EXT_ENA bit?
> + } else {
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_0, 0);
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_1, 0);
> + carl9170_regwrite(AR9170_PHY_REG_RADAR_EXT, 0);
> + }
> +
> + carl9170_regwrite_finish();
> + return carl9170_regwrite_result();
> +}
> +
> int carl9170_get_noisefloor(struct ar9170 *ar)
> {
> static const u32 phy_regs[] = {
> @@ -1739,6 +1780,10 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
> if (err)
> return err;
>
> + err = carl9170_set_radar_detection(ar, channel);
> + if (err)
> + return err;
> +
> tmp = AR9170_PHY_TURBO_FC_SINGLE_HT_LTF1 |
> AR9170_PHY_TURBO_FC_HT_EN;
>
> diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
> index bb909b5..1fe727c 100644
> --- a/drivers/net/wireless/ath/carl9170/rx.c
> +++ b/drivers/net/wireless/ath/carl9170/rx.c
> @@ -259,11 +259,8 @@ void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
> break;
>
> case CARL9170_RSP_RADAR:
> - if (!net_ratelimit())
> - break;
> -
> - wiphy_info(ar->hw->wiphy, "FW: RADAR! Please report this "
> - "incident to linux-wireless@vger.kernel.org !\n");
> + wiphy_info(ar->hw->wiphy, "FW: radar pulse detected\n");
> + ieee80211_radar_detected(ar->hw, NULL);
> break;
>
> case CARL9170_RSP_GPIO:
next prev parent reply other threads:[~2026-03-21 20:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1773277728.git.mas-i@hotmail.de>
2026-03-12 10:37 ` [PATCH 01/10] carl9170: mac80211: enable Short Guard Interval for 20 MHz Masi Osmani
2026-03-21 18:41 ` Christian Lamparter
2026-03-31 19:06 ` Masi Osmani
2026-03-31 19:19 ` [PATCH v2 01/10] carl9170: mac80211: enable Short Guard Interval for 20 MHz (experimental) Masi Osmani
2026-07-17 15:06 ` (subset) [PATCH 01/10] carl9170: mac80211: enable Short Guard Interval for 20 MHz Jeff Johnson
2026-03-12 10:37 ` [PATCH 02/10] carl9170: mac80211: advertise RX STBC capability Masi Osmani
2026-03-21 18:47 ` Christian Lamparter
2026-03-31 19:06 ` Masi Osmani
2026-03-12 10:37 ` [PATCH 03/10] carl9170: mac80211: document spatial multiplexing power save handler Masi Osmani
2026-03-21 18:57 ` Christian Lamparter
2026-03-12 10:37 ` [PATCH 04/10] carl9170: rx: wire up dropped frame counter Masi Osmani
2026-03-21 19:03 ` Christian Lamparter
2026-03-31 19:06 ` Masi Osmani
2026-03-31 19:20 ` [PATCH v2 04/10] carl9170: rx: remove stale TODO comment in carl9170_rx_mac_status Masi Osmani
2026-03-12 10:38 ` [PATCH 05/10] carl9170: rx: track PHY errors via debugfs Masi Osmani
2026-03-21 20:29 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 06/10] carl9170: phy: populate per-channel TX power from EEPROM Masi Osmani
2026-03-21 19:24 ` Christian Lamparter
2026-03-31 19:06 ` Masi Osmani
2026-03-12 10:38 ` [PATCH 07/10] carl9170: main: add exponential restart backoff Masi Osmani
2026-03-21 20:42 ` Christian Lamparter
2026-03-31 18:58 ` Masi Osmani
2026-03-31 19:20 ` [PATCH v2 " Masi Osmani
2026-03-12 10:38 ` [PATCH 08/10] carl9170: phy: enable antenna diversity for 2-chain devices Masi Osmani
2026-03-21 19:53 ` Christian Lamparter
2026-03-31 18:58 ` Masi Osmani
2026-03-12 10:38 ` [PATCH 09/10] carl9170: fw: enable DFS radar detection Masi Osmani
2026-03-21 20:11 ` Christian Lamparter [this message]
2026-03-31 19:06 ` Masi Osmani
2026-04-29 4:46 ` John Scott
2026-03-12 10:38 ` [PATCH 10/10] carl9170: phy: add periodic runtime IQ calibration Masi Osmani
2026-03-21 21:25 ` Christian Lamparter
2026-03-31 19:06 ` Masi Osmani
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=093b7bad-2ecc-47af-9763-958283a102d6@gmail.com \
--to=chunkeey@gmail.com \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=chunkeey@googlemail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=mas-i@hotmail.de \
/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.