return freqs;
}
+
+
+void wpas_nan_usd_state_change_notif(struct wpa_supplicant *wpa_s)
+{
+ struct wpa_supplicant *ifs;
+ unsigned int n_active = 0;
+ struct nan_de_cfg cfg;
+
+ if (!wpa_s->radio)
+ return;
+
+ os_memset(&cfg, 0, sizeof(cfg));
+
+ dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
+ radio_list) {
+ if (ifs->wpa_state >= WPA_AUTHENTICATING)
+ n_active++;
+ }
+
+ wpa_printf(MSG_DEBUG,
+ "NAN: state change notif: n_active=%u, p2p_in_progress=%u",
+ n_active, wpas_p2p_in_progress(wpa_s));
+
+ if (n_active) {
+ cfg.n_max = 3;
+
+ if (!wpas_p2p_in_progress(wpa_s)) {
+ /* Limit the USD operation on channel to 100 - 300 TUs
+ * to allow more time for other interfaces.
+ */
+ cfg.n_min = 1;
+ } else {
+ /* Limit the USD operation on channel to 200 - 300 TUs
+ * to allow P2P operation to complete.
+ */
+ cfg.n_min = 2;
+ }
+
+ /* Each 500 ms suspend USD operation for 300 ms */
+ cfg.cycle = 500;
+ cfg.suspend = 300;
+ }
+
+ dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
+ radio_list) {
+ if (ifs->nan_de)
+ nan_de_config(ifs->nan_de, &cfg);
+ }
+}
#include "wps_supplicant.h"
#include "p2p_supplicant.h"
#include "wifi_display.h"
+#include "nan_usd.h"
/*
struct wpa_supplicant *tmp, *ifs = NULL;
struct hostapd_data *hapd;
+ wpa_printf(MSG_DEBUG, "P2P: GO security config callback");
+
+#ifdef CONFIG_NAN_USD
+ wpas_nan_usd_state_change_notif(wpa_s);
+#endif /* CONFIG_NAN_USD */
+
if (!params->p2p2)
return;
}
#endif /* CONFIG_PASN */
+#ifdef CONFIG_NAN_USD
+ wpas_nan_usd_state_change_notif(wpa_s);
+#endif /* CONFIG_NAN_USD */
+
if (res->status) {
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_GO_NEG_FAILURE "status=%d",
struct wpa_ssid *ssid, unsigned int pref_freq,
u16 bootstrap, const char *password)
{
+ int ret;
+
if (persistent_group && wpa_s->conf->persistent_reconnect)
persistent_group = 2;
- return p2p_authorize(wpa_s->global->p2p, peer_addr, wps_method,
- go_intent, own_interface_addr, force_freq,
- persistent_group, ssid ? ssid->ssid : NULL,
- ssid ? ssid->ssid_len : 0, pref_freq,
- wps_method == WPS_NFC ? wpa_s->p2p_oob_dev_pw_id :
- 0, bootstrap, password);
+ ret = p2p_authorize(wpa_s->global->p2p, peer_addr, wps_method,
+ go_intent, own_interface_addr, force_freq,
+ persistent_group, ssid ? ssid->ssid : NULL,
+ ssid ? ssid->ssid_len : 0, pref_freq,
+ wps_method == WPS_NFC ? wpa_s->p2p_oob_dev_pw_id :
+ 0, bootstrap, password);
+ if (!ret) {
+ wpa_printf(MSG_DEBUG, "P2P: Peer authorized");
+#ifdef CONFIG_NAN_USD
+ wpas_nan_usd_state_change_notif(wpa_s);
+#endif /* CONFIG_NAN_USD */
+ }
+ return ret;
}