]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Track ending time for remain-on-channel operations
authorJouni Malinen <jouni@codeaurora.org>
Sat, 9 May 2020 14:30:48 +0000 (17:30 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 9 May 2020 14:32:26 +0000 (17:32 +0300)
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>
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/dpp_supplicant.h
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant_i.h

index eae62e2892ac2c8c3cf4d94504ec65886c689bfc..837ddbe049b15268284d5ae31a3aaa80f3475a2a 100644 (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)
 {
index 2ce378dc18f3d72d5b79f99dd46d9d1811360af7..6d70874c43a99ad8aea4683d0f649af2c318637f 100644 (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,
index a25b43db02d71d9a77ee3df6c9716bd0393c799b..46341e93650d217f832f488840a90c04c9b3e648 100644 (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
index 619ae42b624830de6025555da95568aaa27b7935..2ed8e2f85b5bd2e604efb4a5b024a59dbe8795cd 100644 (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;