From 82cd40e7b712dd9886ebb61e4ca468458d58849c Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 24 Sep 2012 12:51:20 +0200 Subject: P2P: don't handle concurrency conflicts in multi-chan mode (ANDROID) When the multi-channel flag is on, don't try to force specific p2p connection modes or change go_intent. Signed-off-by: Arik Nemtsov --- wpa_supplicant/ctrl_iface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 2fdd535..8aad951 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2974,6 +2974,9 @@ int p2p_handle_concurrency_conflicts(struct wpa_supplicant *wpa_s, int *go_inten struct wpa_supplicant *iface = NULL; struct p2p_data *p2p = wpa_s->global->p2p; + if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) + return 0; + wpa_printf(MSG_INFO, "p2p: handling concurrency conflicts"); /* we only fear frequency conflicts */ -- cgit v1.1 From 6fdeed26208ecd0b2ec210a650df0b7c0ecfc2fe Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 24 Sep 2012 16:13:33 +0200 Subject: P2P: fix oper channel selection (SQUASH) Handles the forgotten p2p_process_go_neg_resp() case of patch: commit 66b8140a08b9f6297cd49a3428ada713bf668300 Author: Arik Nemtsov Date: Thu Aug 30 21:06:45 2012 +0300 P2P: always re-select oper channel if not hard coded Signed-off-by: Arik Nemtsov --- src/p2p/p2p_go_neg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 8c2ad3a..2d31f4b 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -1043,7 +1043,8 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa, wpa_hexdump(MSG_DEBUG, "P2P: channels", c->channel, c->channels); } - if (!p2p_channels_includes(&intersection, p2p->op_reg_class, + if (!p2p->cfg->cfg_op_channel || + !p2p_channels_includes(&intersection, p2p->op_reg_class, p2p->op_channel)) p2p_reselect_channel(p2p, &intersection); -- cgit v1.1 From 61d59eaa7ebf59c926d40b00228e227b3d27f8c9 Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 24 Sep 2012 17:39:23 +0200 Subject: 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 --- wpa_supplicant/config.c | 1 + wpa_supplicant/config.h | 8 ++++++++ wpa_supplicant/config_file.c | 2 ++ wpa_supplicant/p2p_supplicant.c | 18 +++++++++++------- 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) { -- cgit v1.1 From 326e560fb8f6a93fb7067be167c5f4dc870aa026 Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Mon, 24 Sep 2012 17:56:18 +0200 Subject: android: wpa_s template: allow p2p multi channel operation (ANDROID) Set the p2p_multi_chan parameter to 1 by default. It will have no effect if the current driver doesn't support multi-channel. Otherwise it will allow the P2P channel to be set while disregarding other connected interfaces on the phy. Signed-off-by: Arik Nemtsov --- wpa_supplicant/wpa_supplicant_template.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/wpa_supplicant_template.conf b/wpa_supplicant/wpa_supplicant_template.conf index 917ade4..9a1ace7 100644 --- a/wpa_supplicant/wpa_supplicant_template.conf +++ b/wpa_supplicant/wpa_supplicant_template.conf @@ -13,3 +13,4 @@ p2p_conc_mode=2 driver_param=use_p2p_group_interface=1 p2p_go_max_inactivity=30 p2p_go_ht40=1 +p2p_multi_chan=1 -- cgit v1.1 From 4e69322725093ebd07be1c874c22483827074696 Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Tue, 25 Sep 2012 10:36:36 +0200 Subject: P2P: correct p2p_mult_chan operation (SQUASH) Should be squashed with: commit 61d59eaa7ebf59c926d40b00228e227b3d27f8c9 Author: Arik Nemtsov Date: Mon Sep 24 17:39:23 2012 +0200 P2P: add conf param to prefer p2p multi channel Reported-by: Eyal Shapira Signed-off-by: Arik Nemtsov --- wpa_supplicant/p2p_supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index bad6c5a..5e0edfd 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3264,7 +3264,7 @@ int wpas_p2p_connect(struct wpa_supplicant *wpa_s, const u8 *peer_addr, return ret; } - if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) && + 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 && -- cgit v1.1 From a4b1942c82d2540cedcf76dbdd6ce7a23d7805fd Mon Sep 17 00:00:00 2001 From: Vishal Mahaveer Date: Mon, 24 Sep 2012 15:07:11 -0500 Subject: nl80211: dummy DRIVER SETBAND handler SETBAND command is handled in wpa_supplicant_driver_cmd API. Add a dummy handler in driver_nl80211 for avoiding misleading log, "Unsupported command: SETBAND ". Signed-off-by: Vishal Mahaveer --- src/drivers/driver_nl80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index a1a09a5..7e07c60 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9789,6 +9789,9 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, return nl80211_set_wowlan_triggers(bss, 1); } else if (os_strcasecmp(cmd, "RXFILTER-STOP") == 0) { return nl80211_set_wowlan_triggers(bss, 0); + } else if (os_strcasecmp(cmd, "SETBAND") == 0) { + /* Do nothing: Handled by wpa_supplicant_driver_cmd */ + ret = 0; } else { wpa_printf(MSG_ERROR, "Unsupported command: %s", cmd); ret = -1; -- cgit v1.1 From 4ecf5147c1fc48c18f1af2d20e6f131fcac76191 Mon Sep 17 00:00:00 2001 From: Victor Goldenshtein Date: Thu, 27 Sep 2012 11:54:11 +0200 Subject: wpa_s: handle channel conflicts on GO+STA shared interface Stop blocking GO role if its operational channel differs from the STA channel, as now the driver can handle channel conflicts by sending channel switch request to the userspace. Signed-off-by: Victor Goldenshtein --- wpa_supplicant/p2p_supplicant.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 5e0edfd..6603091 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5036,6 +5036,12 @@ int wpas_p2p_handle_frequency_conflicts(struct wpa_supplicant *wpa_s, int freq) iface->current_ssid->frequency = freq; continue; } + + /* some drivers can handle this on their own */ + if (wpa_s->driver->hapd_channel_switch) { + wpa_printf(MSG_INFO, "P2P: GO Ch. switch will be initiated by the driver"); + continue; + } } /* -- cgit v1.1 From 67bd4fc9ab47f1300edd8696c36b9773c91e6b30 Mon Sep 17 00:00:00 2001 From: Vishal Mahaveer Date: Thu, 27 Sep 2012 14:11:18 -0500 Subject: Revisit "nl80211: dummy DRIVER SETBAND handler" Used the wrong string compare API before. Fix it by using the correst API. Signed-off-by: Vishal Mahaveer --- src/drivers/driver_nl80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 7e07c60..7254ecc 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9785,13 +9785,13 @@ static int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, if(i < 0) return i; return nl80211_toggle_wowlan_trigger(bss, i, 0); + } else if (os_strncasecmp(cmd, "SETBAND ", 8) == 0) { + /* Do nothing: Handled by wpa_supplicant_driver_cmd */ + return 0; } else if (os_strcasecmp(cmd, "RXFILTER-START") == 0) { return nl80211_set_wowlan_triggers(bss, 1); } else if (os_strcasecmp(cmd, "RXFILTER-STOP") == 0) { return nl80211_set_wowlan_triggers(bss, 0); - } else if (os_strcasecmp(cmd, "SETBAND") == 0) { - /* Do nothing: Handled by wpa_supplicant_driver_cmd */ - ret = 0; } else { wpa_printf(MSG_ERROR, "Unsupported command: %s", cmd); ret = -1; -- cgit v1.1 From a9c73cbf768e920f4adc9573577efbcbe39ed721 Mon Sep 17 00:00:00 2001 From: Eyal Shapira Date: Tue, 25 Sep 2012 10:54:09 +0200 Subject: P2P: block find if P2P GO or CLI are active (INTERNAL) The roc on a channel for 100+ ms which is part of the find disturbs the P2P GO/CLI as these scenarios are unsupported in non multi channel driver. Therefore block the find in this case. Signed-off-by: Eyal Shapira --- wpa_supplicant/p2p_supplicant.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 6603091..3c650c3 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3969,6 +3969,18 @@ static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s) wpa_s->pending_action_tx = NULL; } +static int wpas_p2p_connected(struct wpa_supplicant *wpa_s) +{ + struct wpa_supplicant *iface; + + for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { + if (iface->p2p_group_interface == P2P_GROUP_INTERFACE_GO || + iface->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT) + return 1; + } + + return 0; +} int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout, enum p2p_discovery_type type, @@ -3985,6 +3997,14 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout, wpa_s->p2p_in_provisioning) return -1; + + if (!(wpa_s->drv_flags & + WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) && + wpas_p2p_connected(wpa_s)) { + wpa_printf(MSG_DEBUG, "P2P: find blocked due to active GO/CLI"); + return -1; + } + wpa_supplicant_cancel_sched_scan(wpa_s); return p2p_find(wpa_s->global->p2p, timeout, type, -- cgit v1.1 From 7b2121a7d004d5859a8e37e107338279db042fe5 Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Wed, 3 Oct 2012 11:39:34 +0200 Subject: android: wpa_s template: disassoc on low ack by default (ANDROID) When operating as a GO, disassoc the peer station on aging/Tx failure Signed-off-by: Arik Nemtsov --- wpa_supplicant/wpa_supplicant_template.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/wpa_supplicant/wpa_supplicant_template.conf b/wpa_supplicant/wpa_supplicant_template.conf index 9a1ace7..ac1a663 100644 --- a/wpa_supplicant/wpa_supplicant_template.conf +++ b/wpa_supplicant/wpa_supplicant_template.conf @@ -14,3 +14,4 @@ driver_param=use_p2p_group_interface=1 p2p_go_max_inactivity=30 p2p_go_ht40=1 p2p_multi_chan=1 +disassoc_low_ack=1 -- cgit v1.1 From ba611a1c583af871c72ad50ec0bace0ce03689d2 Mon Sep 17 00:00:00 2001 From: Eyal Shapira Date: Tue, 9 Oct 2012 23:26:09 +0200 Subject: P2P: Don't delete group on non P2P interfaces (UPSTREAM) p2p_group_remove * calls wpas_p2p_disconnect on all interfaces including non P2P ones. This has undesired effects such as disconnecting concurrent connected STA interfaces as well as emitting P2P-GROUP-REMOVED events on all interfaces including ones that didn't actually have a P2P CLI or GO running. Instead fail explicitly when attempting to p2p disconnect an interface with no P2P activity. Signed-off-by: Eyal Shapira --- wpa_supplicant/p2p_supplicant.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 3c650c3..b0eb594 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4916,6 +4916,24 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr) return p2p_unauthorize(p2p, peer); } +int wpas_is_p2p_iface(struct wpa_supplicant *wpa_s) +{ + struct wpa_ssid *ssid; + + if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) + return 1; + + /* P2P GO in case no group iface */ + if (wpa_s->p2p_group) + return 1; + + /* P2P CLI in case no group iface */ + ssid = wpa_s->current_ssid; + if (ssid && ssid->p2p_group) + return 1; + + return 0; +} /** * wpas_p2p_disconnect - Disconnect from a P2P Group @@ -4934,6 +4952,12 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s) if (wpa_s == NULL) return -1; + if (!wpas_is_p2p_iface(wpa_s)) { + wpa_printf(MSG_DEBUG, "P2P: No group to disconnect on %s", + wpa_s->ifname); + return -1; + } + wpa_s->removal_reason = P2P_GROUP_REMOVAL_REQUESTED; wpas_p2p_group_delete(wpa_s, 0); -- cgit v1.1