[PATCH 1/1] P2P: Prevent pending_action_tx from truncating extended listen
Jithu Jance
jithu
Thu Aug 7 04:03:46 PDT 2014
On receiving the cancel remain on channel event, the pending_tx
is scheduled immediately and returned. This was preventing
the wpas_p2p_listen_start function from execution thereby resulting
in termination of the extended listen.
Please see whether the patch is fine.
Signed-off-by: Jithu Jance <jithu at broadcom.com>
---
wpa_supplicant/p2p_supplicant.c | 38 +++++++++++++++++++++++++++++---------
1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index f1269ad..6d901c5 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4929,6 +4929,18 @@ static int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s,
return p2p_listen(wpa_s->global->p2p, timeout);
}
+static void wpas_p2p_continue_listen(void *eloop_ctx,
+ void *data)
+{
+ struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)eloop_ctx;
+
+ wpa_printf(MSG_DEBUG, "P2P: execute listen end tasks ");
+
+ if (wpa_s->p2p_long_listen > 0) {
+ wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
+ wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
+ }
+}
/**
* wpas_p2p_cancel_remain_on_channel_cb - Remain-on-channel timeout
@@ -4943,27 +4955,35 @@ void wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
unsigned int freq)
{
wpa_printf(MSG_DEBUG, "P2P: Cancel remain-on-channel callback "
- "(p2p_long_listen=%d ms pending_action_tx=%p)",
- wpa_s->p2p_long_listen, offchannel_pending_action_tx(wpa_s));
+ "(p2p_long_listen=%d ms pending_action_tx=%p freq=%d)",
+ wpa_s->p2p_long_listen, offchannel_pending_action_tx(wpa_s), freq);
wpas_p2p_listen_work_done(wpa_s);
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return;
- if (p2p_listen_end(wpa_s->global->p2p, freq) > 0)
+ if (p2p_listen_end(wpa_s->global->p2p, freq) > 0) {
+ wpa_printf(MSG_DEBUG, "P2P: p2p module started a new operation");
return; /* P2P module started a new operation */
- if (offchannel_pending_action_tx(wpa_s))
- return;
+ }
if (wpa_s->p2p_long_listen > 0)
wpa_s->p2p_long_listen -= wpa_s->max_remain_on_chan;
- if (wpa_s->p2p_long_listen > 0) {
- wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
- wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
- } else {
+ else {
/*
* When listen duration is over, stop listen & update p2p_state
* to IDLE.
*/
p2p_stop_listen(wpa_s->global->p2p);
}
+
+ if (offchannel_pending_action_tx(wpa_s)) {
+ /*
+ * Allow the pending tx to happen before we
+ * resume the listen or SEARCH operation
+ */
+ if (wpa_s->p2p_long_listen > 0)
+ eloop_register_timeout(0, 100,
+ wpas_p2p_continue_listen, wpa_s, NULL);
+ return;
+ }
}
--
1.7.9.5
- Jithu Jance
More information about the Hostap
mailing list