Patchwork [RFC,1/4] P2P: Handling single channel concurrency

login
register
mail settings
Submitter Jithu Jance
Date March 6, 2012, 5:03 a.m.
Message ID <CAGCGobBTbuZ+4-PfQfravi5SFRw9+L4cSBOuc=6RbBentsbqug@mail.gmail.com>
Download mbox | patch
Permalink /patch/144839/
State Superseded
Headers show

Comments

Jithu Jance - March 6, 2012, 5:03 a.m.
Sorry for a delayed reply. Please find my comments inline.

> No, this is different case. I was thinking of a case that does not have
> any concurrency at all, i.e., just a single P2P client interface that is
> associated with a GO that decides to change channels. Though, maybe I
> missed the part of shared_freq>0 not hitting in this particular
> sequence.

You are right. The shared_freq won't be returning a greater than zero in
this case.


>>     e) If the priority is not set, the default behavior is to notify the
>> upper application or framework. The supplicant
>>         won't do any policing.

> Hmm.. How is this different from (d) ?
Both d and e are handled in the same way. But just i had put mentioned
it separately to indicate that both are handled.

I have took your set of patches and did the below additions and generated 4
patches.
1. Moved the prioritize setting to wpa_global
2. Applied the below two changes.
+++++++++++++++++++++
> Two more changes from my side which are not in the current set of patches.
> a) I later felt that providing network_id would be better than providing
> ssid and bssid during WPA_EVENT_FREQ_CONFLICT.
> +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT
> +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅" ssid=%s bssid=" MACSTR,
> +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
> +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅MAC2STR(wpa_s->pending_bssid));
>
> changed to
>
> +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT
> " id=%d", ssid->id);.

> b) I have added a new reason code to P2P_GROUP_REMOVE
> reason=FREQ_CONFLICT. This is useful when a p2p group gets removed when
STA
> connection has more priority.

+++++++++++++++++++++ Till here ++++++++++++++

3. Still some things are left behind. I will work on these once the attached
patches are frozen.
 a) supplicant gets the STA connected event while we already have a p2p
 connection on some other channel
    (roaming handled by driver/firmware).

 b) The concurrent-3.patch expansion [go_switch_channel].

I am splitting the reply into 4 RFC patches.

First one:

 [PATCH] Add an additional param to prioritize either sta or p2p
 connection to resolve conflicts arising during single
 channel concurrency
 Signed-hostap: Jithu Jance <jithu@broadcom.com>

---
 wpa_supplicant/ctrl_iface.c       |   14 ++++++++++++++
 wpa_supplicant/wpa_supplicant.c   |   12 +++++++++++-
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 3 files changed, 27 insertions(+), 1 deletions(-)

 void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 11f4674..2e12845 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3418,6 +3418,20 @@  static int p2p_ctrl_set(struct wpa_supplicant
*wpa_s, char *cmd)
  return 0;
  }

+ if (os_strcmp(cmd, "conc_priority") == 0) {
+ if(os_strncmp(cmd+strlen("conc_priority")+1, "sta", 3) == 0)
+ os_strncpy(wpa_s->global->conc_priority, "sta", 3);
+ else if(os_strncmp(cmd+strlen("conc_priority")+1, "p2p", 3) == 0)
+ os_strncpy(wpa_s->global->conc_priority, "p2p", 3);
+ else {
+ wpa_printf(MSG_ERROR, " conc_priority arg should be either sta or p2p");
+ return -1;
+ }
+ wpa_printf(MSG_DEBUG, "Single Channel Concurrency: Prioritize %s",
+   wpa_s->global->conc_priority);
+ return 0;
+ }
+
  if (os_strcmp(cmd, "force_long_sd") == 0) {
  wpa_s->force_long_sd = atoi(param);
  return 0;
diff --git a/wpa_supplicant/wpa_supplicant.c
b/wpa_supplicant/wpa_supplicant.c
index fdee407..1004746 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3152,9 +3152,19 @@  void wpas_connection_failed(struct wpa_supplicant
*wpa_s, const u8 *bssid)
  1000 * (timeout % 1000));
 }

-
 int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s)
 {
  return wpa_s->conf->ap_scan == 2 ||
  (wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION);
 }
+
+int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s)
+{
+ if(os_strncmp(wpa_s->global->conc_priority, "p2p", 3) == 0)
+ return 1;
+ else if(os_strncmp(wpa_s->global->conc_priority, "sta", 3) == 0)
+ return 0;
+
+ /* IF conc_priority is not set, return -1 */
+ return -1;
+}
diff --git a/wpa_supplicant/wpa_supplicant_i.h
b/wpa_supplicant/wpa_supplicant_i.h
index 0ba1935..2ffefde 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -228,6 +228,7 @@  struct wpa_global {
  int cross_connection;
  struct wpa_freq_range *p2p_disallow_freq;
  unsigned int num_p2p_disallow_freq;
+ char conc_priority[5]; /* "sta" or "p2p" */
 };


@@ -612,6 +613,7 @@  void wpa_supplicant_update_config(struct wpa_supplicant
*wpa_s);
 void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
 void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
 int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s);
+int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s);

 /* events.c */