[RFC 2/4] P2P: Handling single channel concurrency

Jouni Malinen j
Sun Apr 8 10:17:30 PDT 2012


On Tue, Mar 06, 2012 at 10:33:55AM +0530, Jithu Jance wrote:
> Single channel concurrency Patch [2/4]
> 
> This patch handles the case where a p2p join fails due to a freq conflict
> with the existing STA connection.

Like Johannes pointed out, it would be nice to get a patch file that is
not corrupted (tabs were removed or converted to a single space, etc.,
that prevented the patch from applying). Similarly, it would be good to
get the D-Bus indication added, too.

> diff --git a/wpa_supplicant/p2p_supplicant.c
> @@ -2644,6 +2645,14 @@ static void wpas_p2p_scan_res_join(struct
> wpa_supplicant *wpa_s,
>   wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
>     "from P2P peer table: %d MHz", freq);
>   }
> +
> + if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT) &&
> + ((shared_freq = wpa_drv_shared_freq(wpa_s)) > 0) && (shared_freq !=
> freq)) {
> + wpa_msg(wpa_s->parent, MSG_INFO,
> + P2P_EVENT_GROUP_FORMATION_FAILURE "reason=FREQ_CONFLICT");
> + return;
> + }

This is not enough and not in the correct location. The following freq
update based on BSS table is needed for many cases. In addition, the
wpa_s->global->ifaces list should be iterated in search of an
conflicting operating channel.

I added a more complete version of this type of validation:


commit 4b156206092d1d500407abbed7007071deee47d0

    P2P: Abort join-group operation if concurrent group cannot be supported
    
    If the driver does not indicate support for multi-channel concurrency,
    abort join-group operation if the end result would result in use of
    multiple operating frequencies with the same radio.
    
    Signed-hostap: Jouni Malinen <j at w1.fi>

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 1c339d2..fa675fe 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2605,6 +2605,44 @@ static void wpas_p2p_pd_before_join_timeout(void *eloop_ctx, void *timeout_ctx)
 }
 
 
+static int wpas_check_freq_conflict(struct wpa_supplicant *wpa_s, int freq)
+{
+	struct wpa_supplicant *iface;
+	int shared_freq;
+	u8 bssid[ETH_ALEN];
+
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT)
+		return 0;
+
+	for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
+		if (!wpas_p2p_create_iface(wpa_s) && iface == wpa_s)
+			continue;
+		if (iface->current_ssid == NULL || iface->assoc_freq == 0)
+			continue;
+		if (wpa_drv_get_bssid(iface, bssid) == 0) {
+			if (freq != (int) wpa_s->assoc_freq) {
+				wpa_printf(MSG_DEBUG, "P2P: Frequency "
+					   "conflict - %s connected on %d MHz "
+					   "- new connection on %d MHz",
+					   wpa_s->ifname, wpa_s->assoc_freq,
+					   freq);
+				return 1;
+			}
+		}
+	}
+
+	shared_freq = wpa_drv_shared_freq(wpa_s);
+	if (shared_freq > 0 && shared_freq != freq) {
+		wpa_printf(MSG_DEBUG, "P2P: Frequency conflict - shared "
+			   "virtual interface connected on %d MHz - new "
+			   "connection on %d MHz", shared_freq, freq);
+		return 1;
+	}
+
+	return 0;
+}
+
+
 static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 				   struct wpa_scan_results *scan_res)
 {
@@ -2655,6 +2693,13 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
 	if (freq > 0) {
 		u16 method;
 
+		if (wpas_check_freq_conflict(wpa_s, freq) > 0) {
+			wpa_msg(wpa_s->parent, MSG_INFO,
+				P2P_EVENT_GROUP_FORMATION_FAILURE
+				"reason=FREQ_CONFLICT");
+			return;
+		}
+
 		wpa_printf(MSG_DEBUG, "P2P: Send Provision Discovery Request "
 			   "prior to joining an existing group (GO " MACSTR
 			   " freq=%u MHz)",

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list