introduce background radar detection support
cover introduce background radar detection support
Introduce background radar/CAC detection through a dedicated off-channel chain available on some hw (e.g. mt7915).
Background radar/CAC detection allows to avoid the CAC downtime switching on a different channel during CAC detection on the selected radar channel.
Lorenzo Bianconi (9):
Sync include/uapi/linux/nl80211.h with mac80211-next.git
DFS: introduce dfs_set_valid_channel utility routine
DFS: add capability select radar-only channels
nl80211: report background radar/cac detection capability
DFS: configure background radar/cac detection.
DFS: introduce hostapd_dfs_request_channel_switch routine
DFS: enable CSA for background radar detection
DFS: switch to background radar channel if available
DFS: introduce radar_background parameter to config file
hostapd/config_file.c | 2 + hostapd/hostapd.conf | 7 + src/ap/ap_config.h | 1 + src/ap/ap_drv_ops.c | 9 +- src/ap/ap_drv_ops.h | 3 +- src/ap/dfs.c | 447 +++++++++++++++++++++-------- src/ap/hostapd.h | 15 + src/drivers/driver.h | 7 + src/drivers/driver_nl80211.c | 5 + src/drivers/driver_nl80211_capa.c | 4 + src/drivers/driver_nl80211_event.c | 7 + src/drivers/nl80211_copy.h | 228 ++++++++++++++- 12 files changed, 610 insertions(+), 125 deletions(-)
Signature · 1 line
2.33.1
PATCH 1/9 Sync include/uapi/linux/nl80211.h with mac80211-next.git
--- src/drivers/driver_nl80211_event.c | 7 + src/drivers/nl80211_copy.h | 228 +++++++++++++++++++++++++++-- 2 files changed, 225 insertions(+), 10 deletions(-)
src/drivers/driver_nl80211_event.c +7 -0
@@ -172,6 +172,13 @@ static const char * nl80211_command_to_string(enum nl80211_commands cmd) C2S(NL80211_CMD_UNPROT_BEACON) C2S(NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS) C2S(NL80211_CMD_SET_SAR_SPECS) + C2S(NL80211_CMD_OBSS_COLOR_COLLISION) + C2S(NL80211_CMD_COLOR_CHANGE_REQUEST) + C2S(NL80211_CMD_COLOR_CHANGE_STARTED) + C2S(NL80211_CMD_COLOR_CHANGE_ABORTED) + C2S(NL80211_CMD_COLOR_CHANGE_COMPLETED) + C2S(NL80211_CMD_SET_FILS_AAD) + C2S(NL80211_CMD_ASSOC_COMEBACK) C2S(__NL80211_CMD_AFTER_LAST) } #undef C2S
src/drivers/nl80211_copy.h +218 -10
346 lines not on this page · raw message
Signature · 1 line
2.33.1
PATCH 2/9 DFS: introduce dfs_set_valid_channel utility routine
In reply to Lorenzo BianconiThis is a preliminary patch to introduce radar/CAC background detection support.
--- src/ap/dfs.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
src/ap/dfs.c +22 -14
@@ -567,6 +567,27 @@ dfs_get_valid_channel(struct hostapd_iface *iface,return chan; } +static int dfs_set_valid_channel (struct hostapd_iface *iface,int skip_radar) +{ +struct hostapd_channel_data *channel; +u8 cf1 =0 , cf2 =0 ; +int sec =0 ; + + channel =dfs_get_valid_channel (iface, &sec, &cf1, &cf2, + skip_radar); +if (!channel) { +wpa_printf (MSG_ERROR ,"could not get valid channel" ); +return -1 ; + } + + iface->freq = channel->freq; + iface->conf->channel = channel->chan; + iface->conf->secondary_channel = sec; +hostapd_set_oper_centr_freq_seg0_idx (iface->conf, cf1); +hostapd_set_oper_centr_freq_seg1_idx (iface->conf, cf2); + +return 0 ; +}static int set_dfs_state_freq (struct hostapd_iface *iface,int freq,u32 state) {
@@ -755,7 +776,6 @@ static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,*/ int hostapd_handle_dfs (struct hostapd_iface *iface) { -struct hostapd_channel_data *channel;int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1;int skip_radar =0 ;
@@ -810,22 +830,10 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)wpa_printf (MSG_DEBUG ,"DFS %d chans unavailable - choose other channel: %s" , res, res ?"yes" :"no" );if (res) { -int sec =0 ; -u8 cf1 =0 , cf2 =0 ; - - channel =dfs_get_valid_channel (iface, &sec, &cf1, &cf2, - skip_radar); -if (!channel) { -wpa_printf (MSG_ERROR ,"could not get valid channel" ); +if (dfs_set_valid_channel (iface, skip_radar) <0 ) {hostapd_set_state (iface,HAPD_IFACE_DFS );return 0 ; } - - iface->freq = channel->freq; - iface->conf->channel = channel->chan; - iface->conf->secondary_channel = sec; -hostapd_set_oper_centr_freq_seg0_idx (iface->conf, cf1); -hostapd_set_oper_centr_freq_seg1_idx (iface->conf, cf2); } }while (res);
Signature · 1 line
2.33.1
PATCH 3/9 DFS: add capability select radar-only channels
In reply to Lorenzo BianconiIntroduce flags parameter to dfs_get_valid_channel routine in order to select radar-only channel where the CAC detection has not been performed yet. This is a preliminary patch to enable background radar/CAC detection.
--- src/ap/dfs.c | 57 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 13 deletions(-)
src/ap/dfs.c +44 -13
@@ -50,16 +50,32 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)return n_chans; } - +/* dfs_channel_available: select new channel according to flags parameter +* +* flags: +* - 0: any channel +* - 1: non-radar channel or radar available one +* - 2: radar-only channel not yet available +*/ static int dfs_channel_available (struct hostapd_channel_data *chan, -int skip_radar) +int flags) { +if (flags ==2 ) { +/* Select only radar channel where CAC has not been +* performed yet +*/ +if ((chan->flag &HOSTAPD_CHAN_RADAR ) && + (chan->flag &HOSTAPD_CHAN_DFS_MASK ) == +HOSTAPD_CHAN_DFS_USABLE ) +return 1 ; +return 0 ; + }/* * When radar detection happens, CSA is performed. However, there's no * time for CAC, so radar channels must be skipped when finding a new * channel for CSA, unless they are available for immediate use. */ -if (skip_radar && (chan->flag &HOSTAPD_CHAN_RADAR ) && +if (flags && (chan->flag &HOSTAPD_CHAN_RADAR ) && ((chan->flag &HOSTAPD_CHAN_DFS_MASK ) !=HOSTAPD_CHAN_DFS_AVAILABLE ))return 0 ;
@@ -135,10 +151,15 @@ dfs_get_chan_data(struct hostapd_hw_modes *mode, int freq, int first_chan_idx)return NULL ; } - +/* +* flags: +* - 0: any channel +* - 1: non-radar channel or radar available one +* - 2: radar-only channel not yet available +*/ static int dfs_chan_range_available (struct hostapd_hw_modes *mode,int first_chan_idx,int num_chans, -int skip_radar) +int flags) {struct hostapd_channel_data *first_chan, *chan;int i;
@@ -177,7 +198,7 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,return 0 ; } -if (!dfs_channel_available (chan, skip_radar)) { +if (!dfs_channel_available (chan, flags)) {wpa_printf (MSG_DEBUG ,"DFS: channel not available %d" , first_chan->freq + i *20 );return 0 ;
@@ -204,10 +225,15 @@ static int is_in_chanlist(struct hostapd_iface *iface,* - hapd->secondary_channel * - hapd->vht/he_oper_centr_freq_seg0_idx * - hapd->vht/he_oper_centr_freq_seg1_idx +* +* flags: +* - 0: any channel +* - 1: non-radar channel or radar available one +* - 2: radar-only channel not yet available */ static int dfs_find_channel (struct hostapd_iface *iface,struct hostapd_channel_data **ret_chan, -int idx,int skip_radar) +int idx,int flags) {struct hostapd_hw_modes *mode;struct hostapd_channel_data *chan;
@@ -232,7 +258,7 @@ static int dfs_find_channel(struct hostapd_iface *iface, }/* Skip incompatible chandefs */ -if (!dfs_chan_range_available (mode, i, n_chans, skip_radar)) { +if (!dfs_chan_range_available (mode, i, n_chans, flags)) {wpa_printf (MSG_DEBUG ,"DFS: range not available for %d (%d)" , chan->freq, chan->chan);
@@ -469,13 +495,18 @@ static int dfs_check_chans_unavailable(struct hostapd_iface *iface,return res; } - +/* +* flags: +* - 0: any channel +* - 1: non-radar channel or radar available one +* - 2: radar-only channel not yet available +*/ static struct hostapd_channel_data *dfs_get_valid_channel (struct hostapd_iface *iface,int *secondary_channel,u8 *oper_centr_freq_seg0_idx,u8 *oper_centr_freq_seg1_idx, -int skip_radar) +int flags) {struct hostapd_hw_modes *mode;struct hostapd_channel_data *chan =NULL ;
@@ -499,7 +530,7 @@ dfs_get_valid_channel(struct hostapd_iface *iface,return NULL ;/* Get the count first */ - num_available_chandefs =dfs_find_channel (iface,NULL ,0 , skip_radar); + num_available_chandefs =dfs_find_channel (iface,NULL ,0 , flags);wpa_printf (MSG_DEBUG ,"DFS: num_available_chandefs=%d" , num_available_chandefs);if (num_available_chandefs ==0 )
@@ -508,7 +539,7 @@ dfs_get_valid_channel(struct hostapd_iface *iface,if (os_get_random ((u8 *) &_rand,sizeof (_rand)) <0 )return NULL ; chan_idx = _rand % num_available_chandefs; -dfs_find_channel (iface, &chan, chan_idx, skip_radar); +dfs_find_channel (iface, &chan, chan_idx, flags);if (!chan) {wpa_printf (MSG_DEBUG ,"DFS: no random channel found" );return NULL ;
@@ -537,7 +568,7 @@ dfs_get_valid_channel(struct hostapd_iface *iface,for (i =0 ; i < num_available_chandefs -1 ; i++) {/* start from chan_idx + 1, end when chan_idx - 1 */ chan_idx2 = (chan_idx +1 + i) % num_available_chandefs; -dfs_find_channel (iface, &chan2, chan_idx2, skip_radar); +dfs_find_channel (iface, &chan2, chan_idx2, flags);if (chan2 &&abs (chan2->chan - chan->chan) >12 ) {/* two channels are not adjacent */ sec_chan_idx_80p80 = chan2->chan;
Signature · 1 line
2.33.1
PATCH 4/9 nl80211: report background radar/cac detection capability
In reply to Lorenzo BianconiReport background radar/cac detection capability if supported by the underlying hw.
--- src/drivers/driver.h | 2 ++ src/drivers/driver_nl80211_capa.c | 4 ++++ 2 files changed, 6 insertions(+)
src/drivers/driver.h +2 -0
@@ -2027,6 +2027,8 @@ struct wpa_driver_capa {#define WPA_DRIVER_FLAGS2_OCV 0x0000000000000080ULL/** Driver expects user space implementation of SME in AP mode */ #define WPA_DRIVER_FLAGS2_AP_SME 0x0000000000000100ULL +/** Driver supports background radar/CAC detection */ +#define WPA_DRIVER_RADAR_BACKGROUND 0x0000000000000200ULLu64 flags2;#define FULL_AP_CLIENT_STATE_SUPP (drv_flags) \
src/drivers/driver_nl80211_capa.c +4 -0
@@ -665,6 +665,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,if (ext_feature_isset (ext_features, len,NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION )) capa->flags2 |=WPA_DRIVER_FLAGS2_OCV ; + +if (ext_feature_isset (ext_features, len, +NL80211_EXT_FEATURE_RADAR_BACKGROUND )) + capa->flags2 |=WPA_DRIVER_RADAR_BACKGROUND ; }
Signature · 1 line
2.33.1
PATCH 5/9 DFS: configure background radar/cac detection.
In reply to Lorenzo BianconiIntroduce the capability to perfrom radar/CAC detection on a offchannel radar chain available on some hw (e.g. mt7915). This feature allows to avoid CAC downtime switching on a different channel during CAC detection on the selected radar channel.
--- src/ap/ap_drv_ops.c | 9 ++- src/ap/ap_drv_ops.h | 3 +- src/ap/dfs.c | 129 ++++++++++++++++++++++++++++++++++- src/ap/hostapd.h | 15 ++++ src/drivers/driver.h | 5 ++ src/drivers/driver_nl80211.c | 5 ++ 6 files changed, 160 insertions(+), 6 deletions(-)
src/ap/ap_drv_ops.c +7 -2
@@ -812,7 +812,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int channel, int ht_enabled, int vht_enabled, int he_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1) + int center_segment0, int center_segment1, + int radar_background) { struct hostapd_data *hapd = iface->bss[0];struct hostapd_freq_params data;
@@ -838,10 +839,14 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface,wpa_printf (MSG_ERROR ,"Can't set freq params" );return -1 ; } + data.radar_background = radar_background; res = hapd->driver->start_dfs_cac (hapd->drv_priv, &data);if (!res) { - iface->cac_started =1 ; +if (radar_background) + iface->radar_background.cac_started =1 ; +else + iface->cac_started =1 ;os_get_reltime (&iface->dfs_cac_start); }
src/ap/ap_drv_ops.h +2 -1
@@ -130,7 +130,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int channel, int ht_enabled, int vht_enabled, int he_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1); + int center_segment0, int center_segment1, + int radar_offchan);int hostapd_drv_do_acs (struct hostapd_data *hapd);int hostapd_drv_update_dh_ie (struct hostapd_data *hapd,const u8 *peer,u16 reason_code,const u8 *ie,size_t ielen);
src/ap/dfs.c +126 -3
171 lines not on this page · raw message
src/ap/hostapd.h +15 -0
@@ -520,6 +520,21 @@ struct hostapd_iface {int *basic_rates;int freq; +/* Background radar configuration */ +struct { +int channel; +int secondary_channel; +int freq; +int centr_freq_seg0_idx; +int centr_freq_seg1_idx; +/* Main chain is on temporary channel during +* CAC detection on radar offchain. +*/ +unsigned int temp_ch:1 ; +/* CAC started on radar offchain */ +unsigned int cac_started:1 ; + } radar_background; +u16 hw_flags;/* Number of associated Non-ERP stations (i.e., stations using 802.11b
src/drivers/driver.h +5 -0
@@ -782,6 +782,11 @@ struct hostapd_freq_params {* for IEEE 802.11ay EDMG configuration. */ struct ieee80211_edmg_config edmg; + +/** +* radar_background - Whether radar/CAC background is requested +*/ +int radar_background; };/**
src/drivers/driver_nl80211.c +5 -0
@@ -4896,6 +4896,8 @@ static int nl80211_put_freq_params(struct nl_msg *msg,wpa_printf (MSG_DEBUG ," * he_enabled=%d" , freq->he_enabled);wpa_printf (MSG_DEBUG ," * vht_enabled=%d" , freq->vht_enabled);wpa_printf (MSG_DEBUG ," * ht_enabled=%d" , freq->ht_enabled); +wpa_printf (MSG_DEBUG ," * radar_background=%d" , + freq->radar_background); hw_mode =ieee80211_freq_to_chan (freq->freq, &channel); is_24ghz = hw_mode == HOSTAPD_MODE_IEEE80211G ||
@@ -4973,6 +4975,9 @@ static int nl80211_put_freq_params(struct nl_msg *msg, NL80211_CHAN_NO_HT))return -ENOBUFS ; } +if (freq->radar_background) +nla_put_flag (msg,NL80211_ATTR_RADAR_BACKGROUND ); +return 0 ; }
Signature · 1 line
2.33.1
PATCH 6/9 DFS: introduce hostapd_dfs_request_channel_switch routine
In reply to Lorenzo BianconiThis is a preliminary patch to add Channel Switch Announcement for background radar detection.
--- src/ap/dfs.c | 159 +++++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 75 deletions(-)
src/ap/dfs.c +84 -75
@@ -940,6 +940,85 @@ int hostapd_is_dfs_chan_available(struct hostapd_iface *iface)return dfs_check_chans_available (iface, start_chan_idx, n_chans); } +static int hostapd_dfs_request_channel_switch (struct hostapd_iface *iface, +int channel,int freq, +int secondary_channel, +u8 oper_centr_freq_seg0_idx, +u8 oper_centr_freq_seg1_idx) +{ +struct hostapd_hw_modes *cmode = iface->current_mode; +int ieee80211_mode =IEEE80211_MODE_AP , err, i; +struct csa_settings csa_settings; +u8 new_vht_oper_chwidth; + +wpa_printf (MSG_DEBUG ,"DFS will switch to a new channel %d" , channel); +wpa_msg (iface->bss[0 ]->msg_ctx,MSG_INFO ,DFS_EVENT_NEW_CHANNEL +"freq=%d chan=%d sec_chan=%d" , freq, channel, + secondary_channel); + + new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); +hostapd_set_oper_chwidth (iface->conf, +hostapd_get_oper_chwidth (iface->conf)); + +/* Setup CSA request */ +os_memset (&csa_settings,0 ,sizeof (csa_settings)); + csa_settings.cs_count =5 ; + csa_settings.block_tx =1 ; +#ifdef CONFIG_MESH +if (iface->mconf) + ieee80211_mode =IEEE80211_MODE_MESH ; +#endif /* CONFIG_MESH */ + err =hostapd_set_freq_params (&csa_settings.freq_params, + iface->conf->hw_mode, + freq, channel, + iface->conf->enable_edmg, + iface->conf->edmg_channel, + iface->conf->ieee80211n, + iface->conf->ieee80211ac, + iface->conf->ieee80211ax, + secondary_channel, + new_vht_oper_chwidth, + oper_centr_freq_seg0_idx, + oper_centr_freq_seg1_idx, + cmode->vht_capab, + &cmode->he_capab[ieee80211_mode]); + +if (err) { +wpa_printf (MSG_ERROR ,"DFS failed to calculate CSA freq params" ); +hostapd_disable_iface (iface); +return err; + } + +for (i =0 ; i < iface->num_bss; i++) { + err =hostapd_switch_channel (iface->bss[i], &csa_settings); +if (err) +break ; + } + +if (err) { +wpa_printf (MSG_WARNING ,"DFS failed to schedule CSA (%d) - trying fallback" , + err); + iface->freq = freq; + iface->conf->channel = channel; + iface->conf->secondary_channel = secondary_channel; +hostapd_set_oper_chwidth (iface->conf, new_vht_oper_chwidth); +hostapd_set_oper_centr_freq_seg0_idx (iface->conf, + oper_centr_freq_seg0_idx); +hostapd_set_oper_centr_freq_seg1_idx (iface->conf, + oper_centr_freq_seg1_idx); + +hostapd_disable_iface (iface); +hostapd_enable_iface (iface); + +return 0 ; + } + +/* Channel configuration will be updated once CSA completes and +* ch_switch_notify event is received */ +wpa_printf (MSG_DEBUG ,"DFS waiting channel switch event" ); + +return 0 ; +}static struct hostapd_channel_data * dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
@@ -1179,21 +1258,13 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)return err; } -static int hostapd_dfs_start_channel_switch (struct hostapd_iface *iface) {struct hostapd_channel_data *channel;int secondary_channel;u8 oper_centr_freq_seg0_idx;u8 oper_centr_freq_seg1_idx; -u8 new_vht_oper_chwidth;int skip_radar =1 ; -struct csa_settings csa_settings; -unsigned int i; -int err =1 ; -struct hostapd_hw_modes *cmode = iface->current_mode; -u8 current_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); -int ieee80211_mode =IEEE80211_MODE_AP ; wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)", __func__, iface->cac_started ? "yes" : "no",
@@ -1256,73 +1327,11 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) } } -wpa_printf (MSG_DEBUG ,"DFS will switch to a new channel %d" , - channel->chan); -wpa_msg (iface->bss[0 ]->msg_ctx,MSG_INFO ,DFS_EVENT_NEW_CHANNEL -"freq=%d chan=%d sec_chan=%d" , channel->freq, - channel->chan, secondary_channel); - - new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); -hostapd_set_oper_chwidth (iface->conf, current_vht_oper_chwidth); - -/* Setup CSA request */ -os_memset (&csa_settings,0 ,sizeof (csa_settings)); - csa_settings.cs_count =5 ; - csa_settings.block_tx =1 ; -#ifdef CONFIG_MESH -if (iface->mconf) - ieee80211_mode =IEEE80211_MODE_MESH ; -#endif /* CONFIG_MESH */ - err =hostapd_set_freq_params (&csa_settings.freq_params, - iface->conf->hw_mode, - channel->freq, - channel->chan, - iface->conf->enable_edmg, - iface->conf->edmg_channel, - iface->conf->ieee80211n, - iface->conf->ieee80211ac, - iface->conf->ieee80211ax, - secondary_channel, - new_vht_oper_chwidth, - oper_centr_freq_seg0_idx, - oper_centr_freq_seg1_idx, - cmode->vht_capab, - &cmode->he_capab[ieee80211_mode]); - -if (err) { -wpa_printf (MSG_ERROR ,"DFS failed to calculate CSA freq params" ); -hostapd_disable_iface (iface); -return err; - } - -for (i =0 ; i < iface->num_bss; i++) { - err =hostapd_switch_channel (iface->bss[i], &csa_settings); -if (err) -break ; - } - -if (err) { -wpa_printf (MSG_WARNING ,"DFS failed to schedule CSA (%d) - trying fallback" , - err); - iface->freq = channel->freq; - iface->conf->channel = channel->chan; - iface->conf->secondary_channel = secondary_channel; -hostapd_set_oper_chwidth (iface->conf, new_vht_oper_chwidth); -hostapd_set_oper_centr_freq_seg0_idx (iface->conf, - oper_centr_freq_seg0_idx); -hostapd_set_oper_centr_freq_seg1_idx (iface->conf, - oper_centr_freq_seg1_idx); - -hostapd_disable_iface (iface); -hostapd_enable_iface (iface); -return 0 ; - } - -/* Channel configuration will be updated once CSA completes and -* ch_switch_notify event is received */ - -wpa_printf (MSG_DEBUG ,"DFS waiting channel switch event" ); -return 0 ; +return hostapd_dfs_request_channel_switch (iface, channel->chan, + channel->freq, + secondary_channel, + oper_centr_freq_seg0_idx, + oper_centr_freq_seg1_idx); }
Signature · 1 line
2.33.1
PATCH 7/9 DFS: enable CSA for background radar detection
In reply to Lorenzo BianconiRely on hostapd_dfs_request_channel_switch in order to enable CSA for background radar detection switching back to selected channel.
--- src/ap/dfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
src/ap/dfs.c +4 -3
@@ -1086,10 +1086,11 @@ hostapd_dfs_start_channel_switch_background(struct hostapd_iface *iface) iface->radar_background.centr_freq_seg1_idx);hostpad_dfs_update_background_chain (iface); -hostapd_disable_iface (iface); -hostapd_enable_iface (iface); -return 0 ; +return hostapd_dfs_request_channel_switch (iface, iface->conf->channel, + iface->freq, iface->conf->secondary_channel, +hostapd_get_oper_centr_freq_seg0_idx (iface->conf), +hostapd_get_oper_centr_freq_seg1_idx (iface->conf)); } int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
Signature · 1 line
2.33.1
PATCH 8/9 DFS: switch to background radar channel if available
In reply to Lorenzo BianconiOn radar detection on the main chain switch to the channel monitored by the background chain if we have already performed the CAC there.
--- src/ap/dfs.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 7 deletions(-)
src/ap/dfs.c +53 -7
@@ -1259,6 +1259,48 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)return err; } +static int +hostapd_dfs_background_start_channel_switch (struct hostapd_iface *iface, +int freq) +{ +if (!(iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND )) +return -1 ;/* Background radar chain not supported */ + +wpa_printf (MSG_DEBUG , +"%s called (background CAC active: %s, CSA active: %s)" , + __func__, iface->radar_background.cac_started ?"yes" :"no" , +hostapd_csa_in_progress (iface) ?"yes" :"no" ); + +/* Check if CSA in progress */ +if (hostapd_csa_in_progress (iface)) +return 0 ; + +/* +* If background radar detection is supported and radar channel +* monitored by background chain is available switch to it without +* waiting for the CAC otherwise let's keep a random channel. +* If radar pattern is reported on the background chain, just switch +* monitoring another radar channel. +*/ +if (hostapd_dfs_is_background_event (iface, freq)) { +hostpad_dfs_update_background_chain (iface); +return 0 ; + } + +/* Background channel not available yet. Perform CAC on the +* main chain. +*/ +if (iface->radar_background.cac_started) { +/* We want to switch to monitored channel as soon as +* CAC is completed. +*/ + iface->radar_background.temp_ch =1 ; +return -1 ; + } + +return hostapd_dfs_start_channel_switch_background (iface); +} +static int hostapd_dfs_start_channel_switch (struct hostapd_iface *iface) {struct hostapd_channel_data *channel;
@@ -1359,15 +1401,19 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,if (!res)return 0 ; -/* Skip if reported radar event not overlapped our channels */ - res =dfs_are_channels_overlapped (iface, freq, chan_width, cf1, cf2); -if (!res) -return 0 ; +if (!hostapd_dfs_is_background_event (iface, freq)) { +/* Skip if reported radar event not overlapped our channels */ + res =dfs_are_channels_overlapped (iface, freq, chan_width, + cf1, cf2); +if (!res) +return 0 ; + } -/* radar detected while operating, switch the channel. */ - res =hostapd_dfs_start_channel_switch (iface); +if (hostapd_dfs_background_start_channel_switch (iface, freq)) +/* radar detected while operating, switch the channel. */ +return hostapd_dfs_start_channel_switch (iface); -return res; +return 0 ; }
Signature · 1 line
2.33.1
PATCH 9/9 DFS: introduce radar_background parameter to config file
In reply to Lorenzo BianconiIntroduce radar_background parameter to configuration file in order to enable/disable background radar/CAC detection.
--- hostapd/config_file.c | 2 ++ hostapd/hostapd.conf | 7 +++++++ src/ap/ap_config.h | 1 + src/ap/dfs.c | 21 +++++++++++++-------- 4 files changed, 23 insertions(+), 8 deletions(-)
hostapd/config_file.c +2 -0
@@ -2475,6 +2475,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->ieee80211d =atoi (pos); }else if (os_strcmp (buf,"ieee80211h" ) ==0 ) { conf->ieee80211h =atoi (pos); + }else if (os_strcmp (buf,"radar_background" ) ==0 ) { + conf->radar_background =atoi (pos); }else if (os_strcmp (buf,"ieee8021x" ) ==0 ) { bss->ieee802_1x =atoi (pos); }else if (os_strcmp (buf,"eapol_version" ) ==0 ) {
hostapd/hostapd.conf +7 -0
@@ -143,6 +143,13 @@ ssid=test # ieee80211d=1 and local_pwr_constraint configured. #spectrum_mgmt_required=1 +# Enable radar/CAC detection through a dedicated background chain available on +# some hw. The chain can't be used to transmits or receives frames. +# This feature allows to avoid CAC downtime switching on a different channel +# during CAC detection on the selected radar channel. +# (default: 0 = disabled, 1 = enabled) +#radar_background=0 + # Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz), # g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz); a/g options are used # with IEEE 802.11n (HT), too, to specify band). For IEEE 802.11ac (VHT), this
src/ap/ap_config.h +1 -0
@@ -990,6 +990,7 @@ struct hostapd_config {int ieee80211d;int ieee80211h;/* DFS */ +int radar_background;/* * Local power constraint is an octet encoded as an unsigned integer in
src/ap/dfs.c +13 -8
@@ -798,6 +798,11 @@ static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,return cac_time_ms; } +static int hostapd_is_radar_background_enabled (struct hostapd_iface *iface) +{ +return (iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND ) && + iface->conf->radar_background; +}/* * Main DFS handler
@@ -808,7 +813,7 @@ static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,int hostapd_handle_dfs (struct hostapd_iface *iface) {int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1; -int skip_radar =0 ; +int skip_radar =0 , radar_background;if (is_6ghz_freq (iface->freq))return 1 ;
@@ -870,9 +875,9 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)/* Finally start CAC */ hostapd_set_state (iface,HAPD_IFACE_DFS ); + radar_background =hostapd_is_radar_background_enabled (iface);wpa_printf (MSG_DEBUG ,"DFS start CAC on %d MHz background %d" , - iface->freq, - !!(iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND )); + iface->freq, radar_background); wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds", iface->freq,
@@ -890,14 +895,14 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)hostapd_get_oper_chwidth (iface->conf),hostapd_get_oper_centr_freq_seg0_idx (iface->conf),hostapd_get_oper_centr_freq_seg1_idx (iface->conf), - !!(iface->drv_flags2 & WPA_DRIVER_RADAR_BACKGROUND)); + radar_background);if (res) {wpa_printf (MSG_ERROR ,"DFS start_dfs_cac() failed, %d" , res);return -1 ; } -if (iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND ) { +if (radar_background) {/* Cache background radar parameters */ iface->radar_background.channel = iface->conf->channel; iface->radar_background.secondary_channel =
@@ -1120,7 +1125,7 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,* channel and configure background chain to a new DFS * channel */ -if ((iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND ) && +if (hostapd_is_radar_background_enabled (iface) &&hostapd_dfs_is_background_event (iface, freq)) { iface->radar_background.cac_started =0 ;if (!iface->radar_background.temp_ch)
@@ -1146,7 +1151,7 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, iface->cac_started =0 ; } } - }else if ((iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND ) && + }else if (hostapd_is_radar_background_enabled (iface) &&hostapd_dfs_is_background_event (iface, freq)) { iface->radar_background.cac_started =0 ;hostpad_dfs_update_background_chain (iface);
@@ -1263,7 +1268,7 @@ static int hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface, int freq) { -if (!(iface->drv_flags2 &WPA_DRIVER_RADAR_BACKGROUND )) +if (!hostapd_is_radar_background_enabled (iface))return -1 ;/* Background radar chain not supported */ wpa_printf(MSG_DEBUG,
Signature · 1 line
2.33.1
Re: [PATCH 9/9] DFS: introduce radar_background parameter to config file
Quoted 2 lines · Lorenzo Bianconi
Introduce
radar_backgroundparameter to configuration file in order to enable/disable background radar/CAC detection.
What's the use case for this new parameter and the configuration having to explicitly enable this functionality? Is there a reason for not doing this in cases where the driver supports this capability? It looks like patches 1..8 were enabling this functionality automatically and it is only this final patch that makes it depend on a configuration parameter (which is default by default).
hostapd/hostapd.conf ssid=test · line 148
Quoted 8 lines
hostapd/hostapd.conf +6
-0@@ -143,6 +143,13 @@ ssid=test +# Enable radar/CAC detection through a dedicated background chain available on +# some hw. The chain can't be used to transmits or receives frames. +# This feature allows to avoid CAC downtime switching on a different channel +# during CAC detection on the selected radar channel. +# (default: 0 = disabled, 1 = enabled) +#radar_background=0
How would someone writing hostapd configuration know when to enable this? Or maybe more importantly, when one should not enable this? Would use of that dedicated background chain result in some other capabilities getting reduced?
This is also a bit unclear on what happens if the driver does not support this capability and radar_background=1 is explicitly set in the configuration.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH 1/9] Sync include/uapi/linux/nl80211.h with mac80211-next.git
In reply to Lorenzo BianconiQuoted 3 lines · Lorenzo Bianconi
src/drivers/driver_nl80211_event.c | 7 + src/drivers/nl80211_copy.h | 228 +++++++++++++++++++++++++++-- 2 files changed, 225 insertions(+), 10 deletions(-)
I copy the nl80211_copy.h updates automatically from the kernel repository whenever patches require new definitions, so this type of patches are not actually needed in general.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH 8/9] DFS: switch to background radar channel if available
In reply to Lorenzo BianconiQuoted 2 lines · Lorenzo Bianconi
On radar detection on the main chain switch to the channel monitored by the background chain if we have already performed the CAC there.
Is it clear that the channel on the background chain, if one is available with CAC performed, comply with the ETSI uniform spreading requirements? The comment below feels a bit misleading, but the way patch 5/9 picks the channel for background CAC might be sufficient for this. If so, it would be good to note that in the comment here:
src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1281
Quoted 7 lines
src/ap/dfs.c +5
-0+hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface, +/* +* If background radar detection is supported and radar channel +* monitored by background chain is available switch to it without +* waiting for the CAC otherwise let's keep a random channel.
That first part leaves it a bit open whether the random channel part from the end of the sentence applies in practice for the new operating channel. It is important to make this clearly describe the functionality needed to meet uniform spreading requirement.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [PATCH 6/9] DFS: introduce hostapd_dfs_request_channel_switch routine
In reply to Lorenzo Bianconisrc/ap/dfs.c int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) · line 944
Quoted 10 lines · Lorenzo Bianconi
This is a preliminary patch to add Channel Switch Announcement for background radar detection.
src/ap/dfs.c +3
-0@@ -940,6 +940,85 @@ int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) +static int hostapd_dfs_request_channel_switch (struct hostapd_iface *iface, + struct hostapd_hw_modes *cmode = iface->current_mode; +int ieee80211_mode =IEEE80211_MODE_AP , err, i;
That i needs to be unsigned int (like it was in the function from which it was moved to here) to avoid a compiler warning.
src/ap/dfs.c int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) · line 961
Quoted 5 lines
src/ap/dfs.c +4
-0+u8 new_vht_oper_chwidth; + new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); +hostapd_set_oper_chwidth (iface->conf, +hostapd_get_oper_chwidth (iface->conf));
This looks quite strange.. hostapd_dfs_start_channel_switch() used current_vht_oper_chwidth to store the current value from beginning of the function and restored it at this location. The new version in this helper function seems to something strange, or well, nothing. That does not feel correct.
src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1192
Quoted 3 lines
src/ap/dfs.c +0
-1static int hostapd_dfs_start_channel_switch (struct hostapd_iface *iface) { -unsigned int i;
That's where i was unsigned..
src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1195
Quoted 1 line
src/ap/dfs.c +0
-1-u8 current_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf);
And that's where the current value is picked at the beginning of hostapd_dfs_start_channel_switch().
src/ap/dfs.c static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) · line 1266
Quoted 2 lines
src/ap/dfs.c +0
-2- new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); -hostapd_set_oper_chwidth (iface->conf, current_vht_oper_chwidth);
And this looks quite different compared to what was in the new helper function.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Jouni Malinen
AppliedQuoted 11 lines · Lorenzo Bianconi
Introduce background radar/CAC detection through a dedicated off-channel chain available on some hw (e.g. mt7915).
Background radar/CAC detection allows to avoid the CAC downtime switching on a different channel during CAC detection on the selected radar channel.Lorenzo Bianconi (9):
Syncinclude/uapi/linux/nl80211.hwith mac80211-next.git
DFS: introducedfs_set_valid_channelutility routine
DFS: add capability select radar-only channels
nl80211: report background radar/cac detection capability
Thanks, applied patches 2-4 with some cleanup (mainly, replaced the int flags parameter in 3/9 with an enum to make the code more readable. Patch 1 changes are covered by another commit.
Quoted 5 lines
DFS: configure background radar/cac detection.
DFS: introducehostapd_dfs_request_channel_switchroutine
DFS: enable CSA for background radar detection
DFS: switch to background radar channel if available
DFS: introduceradar_backgroundparameter to config file
These have open questions or dependencies on patches with open questions.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Quoted 17 lines · Lorenzo Bianconi
Quoted 11 lines
Introduce background radar/CAC detection through a dedicated off-channel chain available on some hw (e.g. mt7915).
Background radar/CAC detection allows to avoid the CAC downtime switching on a different channel during CAC detection on the selected radar channel.Lorenzo Bianconi (9):
Syncinclude/uapi/linux/nl80211.hwith mac80211-next.git
DFS: introducedfs_set_valid_channelutility routine
DFS: add capability select radar-only channels
nl80211: report background radar/cac detection capabilityThanks, applied patches 2-4 with some cleanup (mainly, replaced the int flags parameter in 3/9 with an enum to make the code more readable. Patch 1 changes are covered by another commit.
Quoted 8 lines
Quoted 5 lines
DFS: configure background radar/cac detection.
DFS: introducehostapd_dfs_request_channel_switchroutine
DFS: enable CSA for background radar detection
DFS: switch to background radar channel if available
DFS: introduceradar_backgroundparameter to config fileThese have open questions or dependencies on patches with open questions.
Hi Jouni,
Thx for the review, I will address comments in the pending patches.
Regards,
Lorenzo
Quoted 4 lines
Signature · 2 lines
-- Jouni Malinen PGP id EFC895FA
Re: [PATCH 9/9] DFS: introduce radar_background parameter to config file
In reply to Jouni MalinenQuoted 10 lines · Jouni Malinen
Quoted 2 lines · Lorenzo Bianconi
Introduce
radar_backgroundparameter to configuration file in order to enable/disable background radar/CAC detection.What's the use case for this new parameter and the configuration having to explicitly enable this functionality? Is there a reason for not doing this in cases where the driver supports this capability? It looks like patches 1..8 were enabling this functionality automatically and it is only this final patch that makes it depend on a configuration parameter (which is default by default).
I added this parameter just to add the capability to disable radar_background even if the hw supports it (e.g. for testing/debugging).
Quoted 14 lines
hostapd/hostapd.conf ssid=test · line 148
Quoted 9 lines
hostapd/hostapd.conf +6
-0@@ -143,6 +143,13 @@ ssid=test +# Enable radar/CAC detection through a dedicated background chain available on +# some hw. The chain can't be used to transmits or receives frames. +# This feature allows to avoid CAC downtime switching on a different channel +# during CAC detection on the selected radar channel. +# (default: 0 = disabled, 1 = enabled) +#radar_background=0How would someone writing hostapd configuration know when to enable this? Or maybe more importantly, when one should not enable this? Would use of that dedicated background chain result in some other capabilities getting reduced?
nope, the radar_chain is completely independent from the "data" ones.
Quoted 4 lines
This is also a bit unclear on what happens if the driver does not support this capability and radar_background=1 is explicitly set in the configuration.
it will not be enabled since we always check WPA_DRIVER_RADAR_BACKGROUND capability.
Since it is not mandatory, I will drop this patch in the series and always enable RADAR_BACKGROUND if supported by the hw.
Regards,
Lorenzo
Quoted 4 lines
Signature · 2 lines
-- Jouni Malinen PGP id EFC895FA
Re: [PATCH 6/9] DFS: introduce hostapd_dfs_request_channel_switch routine
In reply to Jouni MalinenQuoted 7 lines · Lorenzo Bianconi
Quoted 6 lines
This is a preliminary patch to add Channel Switch Announcement for background radar detection.
src/ap/dfs.c +0
-0@@ -940,6 +940,85 @@ int hostapd_is_dfs_chan_available(struct hostapd_iface *iface)
Quoted 7 lines
src/ap/dfs.c int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) · line 950
Quoted 4 lines
src/ap/dfs.c +3
-0+static int hostapd_dfs_request_channel_switch (struct hostapd_iface *iface, + struct hostapd_hw_modes *cmode = iface->current_mode; +int ieee80211_mode =IEEE80211_MODE_AP , err, i;That i needs to be unsigned int (like it was in the function from which it was moved to here) to avoid a compiler warning.
ack, I will fix it
Quoted 24 lines
src/ap/dfs.c int hostapd_is_dfs_chan_available(struct hostapd_iface *iface) · line 961
Quoted 6 lines
src/ap/dfs.c +4
-0+u8 new_vht_oper_chwidth; + new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); +hostapd_set_oper_chwidth (iface->conf, +hostapd_get_oper_chwidth (iface->conf));This looks quite strange..
hostapd_dfs_start_channel_switch()usedcurrent_vht_oper_chwidthto store the current value from beginning of the function and restored it at this location. The new version in this helper function seems to something strange, or well, nothing. That does not feel correct.src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1192
Quoted 3 lines
src/ap/dfs.c +0
-1static int hostapd_dfs_start_channel_switch (struct hostapd_iface *iface) { -unsigned int i;That's where i was unsigned..
src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1195
Quoted 1 line
src/ap/dfs.c +0
-1-u8 current_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf);And that's where the current value is picked at the beginning of
hostapd_dfs_start_channel_switch().
Quoted 5 lines
src/ap/dfs.c static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) · line 1266
Quoted 2 lines
src/ap/dfs.c +0
-2- new_vht_oper_chwidth =hostapd_get_oper_chwidth (iface->conf); -hostapd_set_oper_chwidth (iface->conf, current_vht_oper_chwidth);And this looks quite different compared to what was in the new helper function.
ack, I will fix it.
Regards,
Lorenzo
Quoted 4 lines
Signature · 2 lines
-- Jouni Malinen PGP id EFC895FA
Re: [PATCH 8/9] DFS: switch to background radar channel if available
In reply to Jouni MalinenQuoted 9 lines · Lorenzo Bianconi
Quoted 2 lines
On radar detection on the main chain switch to the channel monitored by the background chain if we have already performed the CAC there.
Is it clear that the channel on the background chain, if one is available with CAC performed, comply with the ETSI uniform spreading requirements? The comment below feels a bit misleading, but the way patch 5/9 picks the channel for background CAC might be sufficient for this. If so, it would be good to note that in the comment here:
ack, got your point here. We should force channel_type to DFS_ANY_CHANNEL for ETSI regdmain in hostpad_dfs_update_background_chain() and not just DFS_NO_CAC_YET. I will fix it in next revision. Thanks.
Regards,
Lorenzo
Quoted 17 lines
src/ap/dfs.c static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) · line 1281
Quoted 8 lines
src/ap/dfs.c +5
-0+hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface, +/* +* If background radar detection is supported and radar channel +* monitored by background chain is available switch to it without +* waiting for the CAC otherwise let's keep a random channel. That first part leaves it a bit open whether the random channel part from the end of the sentence applies in practice for the new operating channel. It is important to make this clearly describe the functionality needed to meet uniform spreading requirement.
Signature · 1 line
Jouni Malinen PGP id EFC895FA