]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Make the default p2p_find delay value configurable
authorNirav Shah <nnshah@qti.qualcomm.com>
Mon, 9 Jun 2014 16:43:26 +0000 (19:43 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 9 Jun 2014 16:43:26 +0000 (19:43 +0300)
This makes the p2p_find default delay value configurable as
p2p_search_delay parameter through the configuration file (and through
control interface "SET p2p_search_delay <value>" on the P2P management
interface.

This parameter controls the number milliseconds of extra delay that is
added between search iterations when there is a concurrent operation in
progress. This can be used, e.g., p2p_search_delay=100 to make p2p_find
friendlier to concurrent operations by avoiding it from taking 100% of
the radio resources. The default value is the previous default, i.e.,
500 ms. Smaller values can be used to find peers more quickly at the
cost of larger effect to concurrent operations while a larger value
leaves more time for the concurrent operations at the cost of making
device discovery take longer time.

The optional p2p_find delay argument can still be used to override the
search delay for each search operation.

Since the P2P_CONCURRENT_SEARCH_DELAY macro is not used anymore, the
driver specific build parameter for bcmdhd from Android.mk is also
removed. Similar configuration can now be achieved with
p2p_search_delay=0 in the p2p0 interface configuration file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/Android.mk
wpa_supplicant/README-P2P
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/dbus/dbus_new_handlers_p2p.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/wpa_cli.c
wpa_supplicant/wpa_supplicant.conf

index eaf97058b3b68a2a026a7ea3de2cd89ec63dff1d..43c3eed2db3db9d688974e9a72ad1098f79dd908 100644 (file)
@@ -38,10 +38,6 @@ ifdef CONFIG_NO_ROAMING
 L_CFLAGS += -DCONFIG_NO_ROAMING
 endif
 
-ifeq ($(BOARD_WLAN_DEVICE), bcmdhd)
-L_CFLAGS += -DP2P_CONCURRENT_SEARCH_DELAY=0
-endif
-
 # Use Android specific directory for control interface sockets
 L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\"
 L_CFLAGS += -DCONFIG_CTRL_IFACE_DIR=\"/data/system/wpa_supplicant\"
index bfad501497c16d59683b2868238564898fa2bfe9..5c1e4f927fc4f9c381c6a5b913bf59d2b1aa304d 100644 (file)
@@ -554,6 +554,13 @@ set country <two character country code>
 
 Set country code (this is included in some P2P messages).
 
+set p2p_search_delay <delay>
+
+Set p2p_search_delay which adds extra delay in milliseconds between
+concurrent search iterations to make p2p_find friendlier to concurrent
+operations by avoiding it from taking 100% of radio resources. The
+default value is 500 ms.
+
 Status
 
 p2p_peers [discovered]
index e60bc05ae8680343e43659852c23e35c41b45d14..278ec9b3d7d60d026096015c8762c3bef06ae7f4 100644 (file)
@@ -3266,6 +3266,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
        config->wmm_ac_params[1] = ac_bk;
        config->wmm_ac_params[2] = ac_vi;
        config->wmm_ac_params[3] = ac_vo;
+       config->p2p_search_delay = DEFAULT_P2P_SEARCH_DELAY;
 
        if (ctrl_interface)
                config->ctrl_interface = os_strdup(ctrl_interface);
@@ -3884,6 +3885,7 @@ static const struct global_parse_data global_fields[] = {
        { INT(tdls_external_control), 0},
        { STR(osu_dir), 0 },
        { STR(wowlan_triggers), 0 },
+       { INT(p2p_search_delay), 0},
 };
 
 #undef FUNC
index bf3f3f79a7983b2ec1f4e86ebfc01f4c9f047506..9b7e21d91027f46409ca2a98de18c20fa8229af3 100644 (file)
@@ -25,6 +25,7 @@
 #define DEFAULT_MAX_NUM_STA 128
 #define DEFAULT_ACCESS_NETWORK_TYPE 15
 #define DEFAULT_SCAN_CUR_FREQ 0
+#define DEFAULT_P2P_SEARCH_DELAY 500
 
 #include "config_ssid.h"
 #include "wps/wps.h"
@@ -1029,6 +1030,16 @@ struct wpa_config {
         * If set, these wowlan triggers will be configured.
         */
        char *wowlan_triggers;
+
+       /**
+        * p2p_search_delay - Extra delay between concurrent search iterations
+        *
+        * Add extra delay (in milliseconds) between search iterations when
+        * there is a concurrent operation to make p2p_find friendlier to
+        * concurrent operations by avoiding it from taking 100% of radio
+        * resources.
+        */
+       unsigned int p2p_search_delay;
 };
 
 
index 618e5243d4fad372631fcdeba205303f0e490f4a..d09b942ad0724c8d52dcc00cd33a7e9c6d74d823 100644 (file)
@@ -1165,6 +1165,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
 
        if (config->bgscan)
                fprintf(f, "bgscan=\"%s\"\n", config->bgscan);
+
+       if (config->p2p_search_delay != DEFAULT_P2P_SEARCH_DELAY)
+               fprintf(f, "p2p_search_delay=%u\n",
+                       config->p2p_search_delay);
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
index 20cbeedc0f1d38f10ffab6e9868e62f556024fdc..8be82888c4765e3c9c811007ef199027ba787822 100644 (file)
@@ -834,6 +834,11 @@ dbus_bool_t wpas_dbus_getter_p2p_device_config(DBusMessageIter *iter,
            !dbus_message_iter_close_container(iter, &variant_iter))
                goto err_no_mem;
 
+       /* P2P Search Delay */
+       if (!wpa_dbus_dict_append_uint32(&dict_iter, "p2p_search_delay",
+                                        wpa_s->conf->p2p_search_delay))
+               goto err_no_mem;
+
        return TRUE;
 
 err_no_mem:
@@ -982,6 +987,9 @@ dbus_bool_t wpas_dbus_setter_p2p_device_config(DBusMessageIter *iter,
                else if (os_strcmp(entry.key, "NoGroupIface") == 0 &&
                         entry.type == DBUS_TYPE_BOOLEAN)
                        wpa_s->conf->p2p_no_group_iface = entry.bool_value;
+               else if (os_strcmp(entry.key, "p2p_search_delay") == 0 &&
+                        entry.type == DBUS_TYPE_UINT32)
+                       wpa_s->conf->p2p_search_delay = entry.uint32_value;
                else
                        goto error;
 
index 393f13bb64f1766a353b724ebe44c97a4c41bbc8..50ee1e08c79f7ef75157d357fbbab3707c528308 100644 (file)
 #define P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE 15
 #endif /* P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE */
 
-#ifndef P2P_CONCURRENT_SEARCH_DELAY
-#define P2P_CONCURRENT_SEARCH_DELAY 500
-#endif /* P2P_CONCURRENT_SEARCH_DELAY */
-
 #define P2P_MGMT_DEVICE_PREFIX         "p2p-dev-"
 
 enum p2p_group_removal_reason {
@@ -6764,8 +6760,8 @@ unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s)
        if (wpa_s->wpa_state > WPA_SCANNING) {
                wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search delay due to "
                        "concurrent operation",
-                       P2P_CONCURRENT_SEARCH_DELAY);
-               return P2P_CONCURRENT_SEARCH_DELAY;
+                       wpa_s->conf->p2p_search_delay);
+               return wpa_s->conf->p2p_search_delay;
        }
 
        dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
@@ -6774,8 +6770,9 @@ unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s)
                        wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search "
                                "delay due to concurrent operation on "
                                "interface %s",
-                               P2P_CONCURRENT_SEARCH_DELAY, ifs->ifname);
-                       return P2P_CONCURRENT_SEARCH_DELAY;
+                               wpa_s->conf->p2p_search_delay,
+                               ifs->ifname);
+                       return wpa_s->conf->p2p_search_delay;
                }
        }
 
index b3812cace7eef1b79c59eb0c86f80aaa4a96a6a5..8811d6fd735d3ba12602df71a21d8bb709586239 100644 (file)
@@ -628,7 +628,7 @@ static char ** wpa_cli_complete_set(const char *str, int pos)
                "p2p_go_max_inactivity", "auto_interworking", "okc", "pmf",
                "sae_groups", "dtim_period", "beacon_int", "ap_vendor_elements",
                "ignore_old_scan_res", "freq_list", "external_sim",
-               "tdls_external_control"
+               "tdls_external_control", "p2p_search_delay"
        };
        int i, num_fields = ARRAY_SIZE(fields);
 
index 243787f83fef9cd36c5d996a258f9858f75b858c..191f2063ba8d2df6278f4e0c0d7276e426c381f0 100644 (file)
@@ -269,6 +269,13 @@ fast_reauth=1
 # inactive stations.
 #p2p_go_max_inactivity=300
 
+# Extra delay between concurrent P2P search iterations
+#
+# This value adds extra delay in milliseconds between concurrent search
+# iterations to make p2p_find friendlier to concurrent operations by avoiding
+# it from taking 100% of radio resources. The default value is 500 ms.
+#p2p_search_delay=500
+
 # Opportunistic Key Caching (also known as Proactive Key Caching) default
 # This parameter can be used to set the default behavior for the
 # proactive_key_caching parameter. By default, OKC is disabled unless enabled