P2P: Avoid truncation of long listen operation due to offchan tx

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 long listen operation.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
This commit is contained in:
Jithu Jance 2014-08-20 21:55:06 +05:30 committed by Jouni Malinen
parent 89cd4355bb
commit 49e1e9ca88
3 changed files with 13 additions and 4 deletions

View file

@ -12,6 +12,7 @@
#include "common.h" #include "common.h"
#include "utils/eloop.h" #include "utils/eloop.h"
#include "wpa_supplicant_i.h" #include "wpa_supplicant_i.h"
#include "p2p_supplicant.h"
#include "driver_i.h" #include "driver_i.h"
#include "offchannel.h" #include "offchannel.h"
@ -197,6 +198,14 @@ void offchannel_send_action_tx_status(
wpa_s->pending_action_bssid, wpa_s->pending_action_bssid,
data, data_len, result); data, data_len, result);
} }
#ifdef CONFIG_P2P
if (wpa_s->p2p_long_listen > 0) {
/* Continue the listen */
wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
}
#endif /* CONFIG_P2P */
} }

View file

@ -5090,8 +5090,7 @@ void wpas_p2p_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
} }
static int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, unsigned int timeout)
unsigned int timeout)
{ {
/* Limit maximum Listen state time based on driver limitation. */ /* Limit maximum Listen state time based on driver limitation. */
if (timeout > wpa_s->max_remain_on_chan) if (timeout > wpa_s->max_remain_on_chan)
@ -5119,12 +5118,12 @@ void wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
wpas_p2p_listen_work_done(wpa_s); wpas_p2p_listen_work_done(wpa_s);
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return; return;
if (wpa_s->p2p_long_listen > 0)
wpa_s->p2p_long_listen -= wpa_s->max_remain_on_chan;
if (p2p_listen_end(wpa_s->global->p2p, freq) > 0) if (p2p_listen_end(wpa_s->global->p2p, freq) > 0)
return; /* P2P module started a new operation */ return; /* P2P module started a new operation */
if (offchannel_pending_action_tx(wpa_s)) if (offchannel_pending_action_tx(wpa_s))
return; 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) { if (wpa_s->p2p_long_listen > 0) {
wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state"); wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen); wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);

View file

@ -58,6 +58,7 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
const u8 *dev_id, unsigned int search_delay); const u8 *dev_id, unsigned int search_delay);
void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s); void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s);
int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout); int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout);
int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, unsigned int timeout);
int wpas_p2p_assoc_req_ie(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, int wpas_p2p_assoc_req_ie(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
u8 *buf, size_t len, int p2p_group); u8 *buf, size_t len, int p2p_group);
void wpas_p2p_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ies); void wpas_p2p_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ies);