Patchwork P2P: Stop p2p listen when listen duration is over.

login
register
mail settings
Submitter Syed Asifful Dayyan Rafiuddeen
Date July 3, 2013, 11:05 a.m.
Message ID <2F87FC9B7C2FB34287BB37749ED494361C060F1A@SJEXCHMB12.corp.ad.broadcom.com>
Download mbox | patch
Permalink /patch/256598/
State Superseded
Headers show

Comments

Syed Asifful Dayyan Rafiuddeen - July 3, 2013, 11:05 a.m.
Even after listen duration is over, supplicant stays in
 p2p_listen_only state, which is blocking the STA scan. This
 patch will stop p2p listen and update p2p_state to idle
 when listen duration expires.

Signed-hostap: Syed Asifful Dayyan <syedd@broadcom.com>
---
 src/p2p/p2p.c                   |    7 +++++++
 src/p2p/p2p.h                   |    8 ++++++++
 wpa_supplicant/p2p_supplicant.c |    4 ++++
 3 files changed, 19 insertions(+), 0 deletions(-)
Arend van Spriel - July 3, 2013, 11:36 a.m.
On 07/03/2013 01:05 PM, Syed Asifful Dayyan Rafiuddeen wrote:
> Even after listen duration is over, supplicant stays in
>   p2p_listen_only state, which is blocking the STA scan. This
>   patch will stop p2p listen and update p2p_state to idle
>   when listen duration expires.
>
> Signed-hostap: Syed Asifful Dayyan <syedd@broadcom.com>
> ---
>   src/p2p/p2p.c                   |    7 +++++++
>   src/p2p/p2p.h                   |    8 ++++++++
>   wpa_supplicant/p2p_supplicant.c |    4 ++++
>   3 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> index 54f5ee8..fec4af7 100644
> --- a/src/p2p/p2p.c
> +++ b/src/p2p/p2p.c
> @@ -1113,6 +1113,13 @@ void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq)
>   	p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
>   }
>
> +#ifdef ANDROID_P2P

Any reason to assume this is Android specific? Maybe it is better to fix 
it in p2p_state_timeout().

Regards,
Arend

> +void p2p_stop_listen(struct p2p_data *p2p)
> +{
> +	p2p_stop_listen_for_freq(p2p, 0);
> +	p2p_set_state(p2p, P2P_IDLE);
> +}
> +#endif /* ANDROID_P2P */

Patch

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 54f5ee8..fec4af7 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1113,6 +1113,13 @@  void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq)
 	p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
 }
 
+#ifdef ANDROID_P2P
+void p2p_stop_listen(struct p2p_data *p2p)
+{
+	p2p_stop_listen_for_freq(p2p, 0);
+	p2p_set_state(p2p, P2P_IDLE);
+}
+#endif /* ANDROID_P2P */
 
 void p2p_stop_find(struct p2p_data *p2p)
 {
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index e911474..e4eed3c 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -903,6 +903,14 @@  void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
  */
 int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
 
+#ifdef ANDROID_P2P
+/**
+ * p2p_stop_listen - Stop P2P Listen
+ * @p2p: P2P module context from p2p_init()
+ */
+void p2p_stop_listen(struct p2p_data *p2p);
+#endif /* ANDROID_P2P */
+
 /**
  * p2p_connect - Start P2P group formation (GO negotiation)
  * @p2p: P2P module context from p2p_init()
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cbc0a38..9b9d353 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4055,6 +4055,10 @@  void wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
 		wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
 		wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
 	}
+#ifdef ANDROID_P2P
+	else /* When listen duration is over, stop listen & update p2p_state to IDLE. */
+		p2p_stop_listen(wpa_s->global->p2p);
+#endif /* ANDROID_P2P */
 }