mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-31 23:42:52 +01:00
scan: Move triggered variable to scan_request
This commit is contained in:
parent
6051a14952
commit
c125d2b003
36
src/scan.c
36
src/scan.c
@ -83,6 +83,16 @@ struct scan_request {
|
|||||||
bool passive:1; /* Active or Passive scan? */
|
bool passive:1; /* Active or Passive scan? */
|
||||||
bool started : 1; /* Has TRIGGER_SCAN succeeded at least once? */
|
bool started : 1; /* Has TRIGGER_SCAN succeeded at least once? */
|
||||||
bool periodic : 1; /* Started as a periodic scan? */
|
bool periodic : 1; /* Started as a periodic scan? */
|
||||||
|
/*
|
||||||
|
* Set to true if the TRIGGER_SCAN command at the head of the 'cmds'
|
||||||
|
* queue was acked by the kernel indicating that the scan request was
|
||||||
|
* successful. May be set and cleared multiple times during a
|
||||||
|
* the scan_request lifetime (as each command in the 'cmds' queue is
|
||||||
|
* issued to the kernel). Will be false if the current request
|
||||||
|
* was not started due to an -EBUSY error from the kernel. Also will
|
||||||
|
* be false when the scan is complete and GET_SCAN is pending.
|
||||||
|
*/
|
||||||
|
bool triggered : 1;
|
||||||
struct l_queue *cmds;
|
struct l_queue *cmds;
|
||||||
/* The time the current scan was started. Reported in TRIGGER_SCAN */
|
/* The time the current scan was started. Reported in TRIGGER_SCAN */
|
||||||
uint64_t start_time_tsf;
|
uint64_t start_time_tsf;
|
||||||
@ -108,15 +118,6 @@ struct scan_context {
|
|||||||
* roamed automatically.
|
* roamed automatically.
|
||||||
*/
|
*/
|
||||||
unsigned int get_fw_scan_cmd_id;
|
unsigned int get_fw_scan_cmd_id;
|
||||||
/*
|
|
||||||
* Whether the top request in the queue has triggered the current
|
|
||||||
* scan. May be set and cleared multiple times during a single
|
|
||||||
* request. May be false when the current request is waiting due
|
|
||||||
* to an EBUSY or an external scan (sr->cmds non-empty), when
|
|
||||||
* start_cmd_id is non-zero and for a brief moment when GET_SCAN
|
|
||||||
* is running.
|
|
||||||
*/
|
|
||||||
bool triggered:1;
|
|
||||||
struct wiphy *wiphy;
|
struct wiphy *wiphy;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -249,7 +250,7 @@ static void scan_request_triggered(struct l_genl_msg *msg, void *userdata)
|
|||||||
l_debug("%s scan triggered for wdev %" PRIx64,
|
l_debug("%s scan triggered for wdev %" PRIx64,
|
||||||
sr->passive ? "Passive" : "Active", sc->wdev_id);
|
sr->passive ? "Passive" : "Active", sc->wdev_id);
|
||||||
|
|
||||||
sc->triggered = true;
|
sr->triggered = true;
|
||||||
sr->started = true;
|
sr->started = true;
|
||||||
l_genl_msg_unref(l_queue_pop_head(sr->cmds));
|
l_genl_msg_unref(l_queue_pop_head(sr->cmds));
|
||||||
|
|
||||||
@ -817,7 +818,7 @@ bool scan_cancel(uint64_t wdev_id, uint32_t id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* If already triggered, just zero out the callback */
|
/* If already triggered, just zero out the callback */
|
||||||
if (sr == l_queue_peek_head(sc->requests) && sc->triggered) {
|
if (sr == l_queue_peek_head(sc->requests) && sr->triggered) {
|
||||||
l_debug("Scan is at the top of the queue and triggered");
|
l_debug("Scan is at the top of the queue and triggered");
|
||||||
|
|
||||||
sr->callback = NULL;
|
sr->callback = NULL;
|
||||||
@ -1000,11 +1001,8 @@ uint64_t scan_get_triggered_time(uint64_t wdev_id, uint32_t id)
|
|||||||
if (!sc)
|
if (!sc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!sc->triggered)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sr = l_queue_find(sc->requests, scan_request_match, L_UINT_TO_PTR(id));
|
sr = l_queue_find(sc->requests, scan_request_match, L_UINT_TO_PTR(id));
|
||||||
if (!sr)
|
if (!sr || !sr->triggered)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return sr->start_time_tsf;
|
return sr->start_time_tsf;
|
||||||
@ -1855,8 +1853,8 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
|
|||||||
sc->state = SCAN_STATE_NOT_RUNNING;
|
sc->state = SCAN_STATE_NOT_RUNNING;
|
||||||
|
|
||||||
/* Was this our own scan or an external scan */
|
/* Was this our own scan or an external scan */
|
||||||
if (sc->triggered) {
|
if (sr && sr->triggered) {
|
||||||
sc->triggered = false;
|
sr->triggered = false;
|
||||||
|
|
||||||
if (!sr->callback) {
|
if (!sr->callback) {
|
||||||
scan_finished(sc, -ECANCELED, NULL, NULL, sr);
|
scan_finished(sc, -ECANCELED, NULL, NULL, sr);
|
||||||
@ -1950,8 +1948,8 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
|
|||||||
if (!sr)
|
if (!sr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (sc->triggered) {
|
if (sr->triggered) {
|
||||||
sc->triggered = false;
|
sr->triggered = false;
|
||||||
|
|
||||||
/* If periodic scan, don't report the abort */
|
/* If periodic scan, don't report the abort */
|
||||||
if (sr->periodic)
|
if (sr->periodic)
|
||||||
|
Loading…
Reference in New Issue
Block a user