aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-09-24 17:39:23 +0200
committerArik Nemtsov <arik@wizery.com>2012-09-24 21:14:06 +0200
commit61d59eaa7ebf59c926d40b00228e227b3d27f8c9 (patch)
tree8a6fcea38b3c8f0c5b1a5d0baafc65d2be95cc1d
parent6fdeed26208ecd0b2ec210a650df0b7c0ecfc2fe (diff)
downloadexternal_wpa_supplicant_8_ti-61d59eaa7ebf59c926d40b00228e227b3d27f8c9.zip
external_wpa_supplicant_8_ti-61d59eaa7ebf59c926d40b00228e227b3d27f8c9.tar.gz
external_wpa_supplicant_8_ti-61d59eaa7ebf59c926d40b00228e227b3d27f8c9.tar.bz2
P2P: add conf param to prefer p2p multi channel
When p2p_multi_chan=1 is set in the wpa_supplicant.conf file, don't set the P2P operating channel according to any existing shared frequency. Normally we would force the operating channel to be the same as that of other interfaces operating on the same phy. This param allow us to optimize P2P user experience by allowing an arbitrary operating channel. Signed-off-by: Arik Nemtsov <arik@wizery.com>
-rw-r--r--wpa_supplicant/config.c1
-rw-r--r--wpa_supplicant/config.h8
-rw-r--r--wpa_supplicant/config_file.c2
-rw-r--r--wpa_supplicant/p2p_supplicant.c18
4 files changed, 22 insertions, 7 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 8bae7b7..69eb7d0 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2995,6 +2995,7 @@ static const struct global_parse_data global_fields[] = {
{ BIN(wps_nfc_dev_pw), 0 },
{ INT(p2p_go_max_inactivity), 0 },
{ INT(p2p_go_ht40), 0 },
+ { INT(p2p_multi_chan), 0 },
{ INT_RANGE(sched_scan_num_short_intervals, 0,
MAX_NUM_SCHED_SCAN_SHORT_INTERVALS), 0 },
{ INT_RANGE(sched_scan_short_interval, 1, MAX_SCHED_SCAN_INTERVAL), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 568af0d..eb7dbf0 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -702,6 +702,14 @@ struct wpa_config {
int p2p_go_ht40;
/**
+ * p2p_multi_chan - Default to multi-channel operation when operating
+ * as p2p. We will try to optimize throughput instead of trying to make
+ * sure P2P starts on the same channel as another interface that's
+ * currently connected.
+ */
+ int p2p_multi_chan;
+
+ /**
* sched_scan_short_interval - Initial interval for sched scan in secs
* sched scan will start with this interval for num_short_intervals
* intervals and then switch to a longer interval defined by
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 32c6990..cbece8e 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -898,6 +898,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
config->p2p_go_max_inactivity);
if (config->p2p_go_ht40)
fprintf(f, "p2p_go_ht40=%u\n", config->p2p_go_ht40);
+ if (config->p2p_multi_chan)
+ fprintf(f, "p2p_multi_chan=%u\n", config->p2p_multi_chan);
if (config->sched_scan_num_short_intervals !=
DEFAULT_SCHED_SCAN_NUM_SHORT_INTERVALS)
fprintf(f, "sched_scan_num_short_intervals=%u\n",
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 89bd5ae..bad6c5a 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3264,13 +3264,17 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
return ret;
}
- if (wpa_s->current_ssid && wpa_drv_get_bssid(wpa_s, bssid) == 0 &&
- wpa_s->assoc_freq)
- oper_freq = wpa_s->assoc_freq;
- else {
- oper_freq = wpa_drv_shared_freq(wpa_s);
- if (oper_freq < 0)
- oper_freq = 0;
+ if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
+ !wpa_s->conf->p2p_multi_chan) {
+ if (wpa_s->current_ssid &&
+ wpa_drv_get_bssid(wpa_s, bssid) == 0 &&
+ wpa_s->assoc_freq)
+ oper_freq = wpa_s->assoc_freq;
+ else {
+ oper_freq = wpa_drv_shared_freq(wpa_s);
+ if (oper_freq < 0)
+ oper_freq = 0;
+ }
}
if (freq > 0) {