DPP: Track ending time for remain-on-channel operations

This may be needed to optimize use of offchannel TX operations with
wait-for-response when near the end of a pending remain-on-channel
operation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-05-09 17:30:48 +03:00 committed by Jouni Malinen
parent 046f2d1fb9
commit 0a488ef35c
4 changed files with 26 additions and 0 deletions

View file

@ -938,6 +938,24 @@ void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s)
}
void wpas_dpp_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
unsigned int freq, unsigned int duration)
{
if (wpa_s->dpp_listen_freq != freq)
return;
wpa_printf(MSG_DEBUG,
"DPP: Remain-on-channel started for listen on %u MHz for %u ms",
freq, duration);
os_get_reltime(&wpa_s->dpp_listen_end);
wpa_s->dpp_listen_end.usec += duration * 1000;
while (wpa_s->dpp_listen_end.usec >= 1000000) {
wpa_s->dpp_listen_end.sec++;
wpa_s->dpp_listen_end.usec -= 1000000;
}
}
void wpas_dpp_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
unsigned int freq)
{

View file

@ -19,6 +19,8 @@ int wpas_dpp_nfc_handover_sel(struct wpa_supplicant *wpa_s, const char *cmd);
int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd);
int wpas_dpp_listen(struct wpa_supplicant *wpa_s, const char *cmd);
void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s);
void wpas_dpp_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
unsigned int freq, unsigned int duration);
void wpas_dpp_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
unsigned int freq);
void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src,

View file

@ -5005,6 +5005,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
wpas_p2p_remain_on_channel_cb(
wpa_s, data->remain_on_channel.freq,
data->remain_on_channel.duration);
#ifdef CONFIG_DPP
wpas_dpp_remain_on_channel_cb(
wpa_s, data->remain_on_channel.freq,
data->remain_on_channel.duration);
#endif /* CONFIG_DPP */
break;
case EVENT_CANCEL_REMAIN_ON_CHANNEL:
#ifdef CONFIG_OFFCHANNEL

View file

@ -1249,6 +1249,7 @@ struct wpa_supplicant {
struct wpa_radio_work *dpp_listen_work;
unsigned int dpp_pending_listen_freq;
unsigned int dpp_listen_freq;
struct os_reltime dpp_listen_end;
u8 dpp_allowed_roles;
int dpp_qr_mutual;
int dpp_netrole;