Wifi-3463. Fix for scan timeout with scan on same interface

Successive scan requests on same interface cause scan timeout.
Scan requests are enqueued at the Opensync layer and is designed
to handle the requests sequentially. If there are successive
scan requests for the same interface, then we end up deleteling
an on-going scan context. This is due to the interface name being
used as key for the AVL entries, and we were trying to reuse the
AVL entry if one already exist.
Solution is to always allocate a new entry without any reuse.

Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
This commit is contained in:
ravi vaishnav
2021-08-12 18:21:52 -04:00
committed by Rick Sommerville
parent 3531b884c1
commit 4beda3ab66
2 changed files with 57 additions and 11 deletions

View File

@@ -0,0 +1,44 @@
Index: opensync-2.0.5.0/src/sm/src/sm_scan_schedule.c
===================================================================
--- opensync-2.0.5.0.orig/src/sm/src/sm_scan_schedule.c
+++ opensync-2.0.5.0/src/sm/src/sm_scan_schedule.c
@@ -155,6 +155,12 @@ clean:
/* Remove processed context */
ds_dlist_remove_head(&g_scan_ctx_list);
+ LOG(DEBUG, "sm_scan_schedule_cb. Scan done. Deleting scan_ctx. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
sm_scan_ctx_free(scan_ctx);
scan_ctx = NULL;
@@ -163,6 +169,13 @@ clean:
if (scan_ctx)
{
scan_status = true;
+
+ LOG(DEBUG, "sm_scan_schedule_cb. Schedule next scan request. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
rc =
sm_scan_schedule_process (
scan_ctx);
@@ -303,6 +316,12 @@ bool sm_scan_schedule(
if (NULL == scan_in_progress) {
/* Trigger the scan and wait for results */
+ LOG(DEBUG, "sm_scan_schedule. Schedule scan request. %p. %s %s %d\n",
+ scan_ctx,
+ radio_get_name_from_type(scan_ctx->scan_request.radio_cfg->type),
+ radio_get_scan_name_from_type(scan_ctx->scan_request.scan_type),
+ scan_ctx->scan_request.chan_list[0]);
+
rc =
sm_scan_schedule_process(
scan_ctx);

View File

@@ -54,6 +54,8 @@ struct nl80211_scan {
static struct avl_tree nl80211_scan_tree = AVL_TREE_INIT(nl80211_scan_tree, avl_strcmp, false, NULL);
static void nl80211_scan_del(struct nl80211_scan *nl80211_scan);
static int nl80211_chainmask_recv(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
@@ -383,16 +385,17 @@ static int nl80211_scan_add(char *name, target_scan_cb_t *scan_cb, void *scan_ct
{
struct nl80211_scan *nl80211_scan = avl_find_element(&nl80211_scan_tree, name, nl80211_scan, avl);
if (!nl80211_scan) {
nl80211_scan = malloc(sizeof(*nl80211_scan));
if (!nl80211_scan)
return -1;
memset(nl80211_scan, 0, sizeof(*nl80211_scan));
strncpy(nl80211_scan->name, name, IF_NAMESIZE);
nl80211_scan->avl.key = nl80211_scan->name;
avl_insert(&nl80211_scan_tree, &nl80211_scan->avl);
LOGD("%s: added scan context", name);
}
if (nl80211_scan)
nl80211_scan_del(nl80211_scan);
nl80211_scan = malloc(sizeof(*nl80211_scan));
if (!nl80211_scan)
return -1;
memset(nl80211_scan, 0, sizeof(*nl80211_scan));
strncpy(nl80211_scan->name, name, IF_NAMESIZE);
nl80211_scan->avl.key = nl80211_scan->name;
avl_insert(&nl80211_scan_tree, &nl80211_scan->avl);
LOGD("%s: added scan context", name);
nl80211_scan->scan_cb = scan_cb;
nl80211_scan->scan_ctx = scan_ctx;
@@ -414,7 +417,6 @@ static void nl80211_scan_finish(char *name, bool state)
if (nl80211_scan) {
LOGD("%s: calling context cb", nl80211_scan->name);
(*nl80211_scan->scan_cb)(nl80211_scan->scan_ctx, state);
nl80211_scan_del(nl80211_scan);
}
}