aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-08-01 09:59:19 +0300
committerArik Nemtsov <arik@wizery.com>2012-08-02 13:04:02 +0300
commit0172b9bb527a29d6ab3aceec1521ba0eafe64a19 (patch)
treebefb80c0d26530fb640d4eb3e5496fe72db2c5bc /wpa_supplicant
parentb0f48bcc8a61cf620412202166d0d6947f3ba26e (diff)
downloadexternal_wpa_supplicant_8_ti-0172b9bb527a29d6ab3aceec1521ba0eafe64a19.zip
external_wpa_supplicant_8_ti-0172b9bb527a29d6ab3aceec1521ba0eafe64a19.tar.gz
external_wpa_supplicant_8_ti-0172b9bb527a29d6ab3aceec1521ba0eafe64a19.tar.bz2
wpa_s: support different p2p concurrency modes when connecting STA
support p2p concurrency modes using the p2p_conc_mode=0/1/2 config file parameter. Meaning is as follows: 0 - support STA + P2P CL/GO on the same channel (BRCM default) 1 - support only one connection at a time (WL8) 2 - support STA + P2P GO on same channel, but not P2P CL (WL6/7) When connecting STA, disallow the connection or disconnect existing p2p connection, according to existing concurrency preference. Signed-off-by: Arik Nemtsov <arik@wizery.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/config.c1
-rw-r--r--wpa_supplicant/config.h7
-rw-r--r--wpa_supplicant/config_file.c4
-rw-r--r--wpa_supplicant/p2p_supplicant.c37
-rw-r--r--wpa_supplicant/wpa_supplicant.c3
5 files changed, 42 insertions, 10 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 17952fc..de633b8 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2970,6 +2970,7 @@ static const struct global_parse_data global_fields[] = {
#endif /* CONFIG_P2P */
#ifdef ANDROID_P2P
{ STR_RANGE(prioritize, 0, 32), CFG_CHANGED_IFACE_PRIORITY },
+ { INT_RANGE(p2p_conc_mode, 0, 2), 0 },
#endif
{ FUNC(country), CFG_CHANGED_COUNTRY },
{ INT(bss_max_count), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index caa051e..8624e40 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -706,6 +706,13 @@ struct wpa_config {
* UTF-8
*/
char *prioritize;
+
+ /*
+ * 0 - support STA + P2P CL/GO on the same channel (BRCM default)
+ * 1 - support only one connection at a time (WL8)
+ * 2 - support STA + P2P GO on same channel, but not P2P CL (WL6/7)
+ */
+ int p2p_conc_mode;
#endif
};
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 1f650d9..a365b09 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -905,6 +905,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
DEFAULT_SCHED_SCAN_LONG_INTERVAL)
fprintf(f, "sched_scan_long_intervals=%u\n",
config->sched_scan_long_interval);
+#ifdef ANDROID_P2P
+ if (config->p2p_conc_mode)
+ fprintf(f, "p2p_conc_mode=%u\n", config->p2p_conc_mode);
+#endif
}
#endif /* CONFIG_NO_CONFIG_WRITE */
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 8117c74..30e8fd7 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4942,10 +4942,25 @@ int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int freq)
(iface->current_ssid->mode == WPAS_MODE_P2P_GO ||
iface->current_ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION ||
/* different interface */
- iface->p2p_group_interface) &&
- (iface->current_ssid->frequency != freq)) {
+ iface->p2p_group_interface)) {
- if (iface->current_ssid->mode == WPAS_MODE_P2P_GO) {
+ /* we support P2P GO + STA in same frequency */
+ if (wpa_s->conf->p2p_conc_mode == 2 &&
+ iface->current_ssid->mode == WPAS_MODE_P2P_GO &&
+ iface->current_ssid->frequency == freq)
+ continue;
+
+ /* we don't support dual interfaces */
+ if (wpa_s->conf->p2p_conc_mode == 1)
+ goto remove_interface;
+
+ /* we only fear frequency conflicts */
+ if (wpa_s->conf->p2p_conc_mode == 0 &&
+ iface->current_ssid->frequency == freq)
+ continue;
+
+ if (iface->current_ssid->mode == WPAS_MODE_P2P_GO &&
+ iface->current_ssid->frequency != freq) {
/* Try to see whether we can move the GO. If it
* is not possible, remove the GO interface
*/
@@ -4956,20 +4971,26 @@ int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int freq)
}
}
- /* If GO cannot be moved or if the conflicting interface is a
- * P2P Client, remove the interface depending up on the connection
- * priority */
+ /*
+ * We don't support a P2P + STA in this constellation
+ * - one of them has to go. Remove depending on
+ * connection priority.
+ */
+remove_interface:
if(!wpas_is_p2p_prioritized(wpa_s)) {
/* STA connection has priority over existing
* P2P connection. So remove the interface */
- wpa_printf(MSG_DEBUG, "P2P: Removing P2P connection due to Single channel"
- "concurrent mode frequency conflict");
+ wpa_printf(MSG_INFO, "P2P: Removing P2P "
+ "connection due to Single channel "
+ "concurrent mode conflict");
iface->removal_reason = P2P_GROUP_REMOVAL_FREQ_CONFLICT;
wpas_p2p_group_delete(iface, 0);
} else {
/* Existing connection has the priority. Disable the newly
* selected network and let the application know about it.
*/
+ wpa_printf(MSG_INFO, "P2P: Disallow STA due to "
+ "STA + P2P concurrent mode conflict");
return -1;
}
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c2300dc..56a8fe1 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1194,8 +1194,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
* conflict and take appropriate action.
*/
if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
- bss && ((freq = wpa_drv_shared_freq(wpa_s)) > 0) &&
- (freq != bss->freq)) {
+ bss && ((freq = wpa_drv_shared_freq(wpa_s)) > 0)) {
wpa_printf(MSG_DEBUG,
"Shared interface with conflicting frequency found (%d != %d)",
freq, bss->freq);