aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunil Dutt <usdutt@qti.qualcomm.com>2014-10-30 10:50:22 (GMT)
committerJouni Malinen <j@w1.fi>2014-10-30 22:05:25 (GMT)
commitb951a97454309a5078ee24a5796829a92f1df5f9 (patch)
tree8096c94c774a1667b66bfe3a59f26a1155b43db8 /src
parent43d859271894f83c5de6294685b5919889541bab (diff)
downloadhostap-b951a97454309a5078ee24a5796829a92f1df5f9.zip
hostap-b951a97454309a5078ee24a5796829a92f1df5f9.tar.gz
hostap-b951a97454309a5078ee24a5796829a92f1df5f9.tar.bz2
P2P: Set p2p_scan_running based on driver scan request result
With the radio work interface, the actual request to start p2p_scan operation is scheduled from a radio work and hence the initial return value cannot provide the real result of the driver operation to trigger a scan. Introduce a new notification API to indicate the scan trigger status based on which the p2p_scan_running instance can be set using the real return value from the driver operation. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src')
-rw-r--r--src/p2p/p2p.c34
-rw-r--r--src/p2p/p2p.h7
2 files changed, 26 insertions, 15 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 82def55..d17f70d 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -978,14 +978,8 @@ static void p2p_search(struct p2p_data *p2p)
p2p->num_req_dev_types, p2p->req_dev_types,
p2p->find_dev_id, pw_id);
if (res < 0) {
- p2p_dbg(p2p, "Scan request failed");
+ p2p_dbg(p2p, "Scan request schedule failed");
p2p_continue_find(p2p);
- } else {
- p2p_dbg(p2p, "Running p2p_scan");
- p2p->p2p_scan_running = 1;
- eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
- eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
- p2p, NULL);
}
}
@@ -998,6 +992,22 @@ static void p2p_find_timeout(void *eloop_ctx, void *timeout_ctx)
}
+void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status)
+{
+ if (status != 0) {
+ p2p_dbg(p2p, "Scan request failed");
+ /* Do continue find even for the first p2p_find_scan */
+ p2p_continue_find(p2p);
+ } else {
+ p2p_dbg(p2p, "Running p2p_scan");
+ p2p->p2p_scan_running = 1;
+ eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
+ eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
+ p2p, NULL);
+ }
+}
+
+
static int p2p_run_after_scan(struct p2p_data *p2p)
{
struct p2p_device *dev;
@@ -1128,17 +1138,11 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
return -1;
}
- if (res == 0) {
- p2p_dbg(p2p, "Running p2p_scan");
- p2p->p2p_scan_running = 1;
- eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
- eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
- p2p, NULL);
- } else if (p2p->p2p_scan_running) {
+ if (res != 0 && p2p->p2p_scan_running) {
p2p_dbg(p2p, "Failed to start p2p_scan - another p2p_scan was already running");
/* wait for the previous p2p_scan to complete */
res = 0; /* do not report failure */
- } else {
+ } else if (res != 0) {
p2p_dbg(p2p, "Failed to start p2p_scan");
p2p_set_state(p2p, P2P_IDLE);
eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 9201d19..b1bc3d4 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -949,6 +949,13 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
const u8 *dev_id, unsigned int search_delay);
/**
+ * p2p_notify_scan_trigger_status - Indicate scan trigger status
+ * @p2p: P2P module context from p2p_init()
+ * @status: 0 on success, -1 on failure
+ */
+void p2p_notify_scan_trigger_status(struct p2p_data *p2p, int status);
+
+/**
* p2p_stop_find - Stop P2P Find (Device Discovery)
* @p2p: P2P module context from p2p_init()
*/