qcacld-3.0: Process NAN enable/disable synchronously

In the current implementation, NAN enable and disable request are
processed asynchronously, because of which some race conditions
are seen.
	Example: If NDI is having multiple NDPs and without terminating
	NDPs if NAN disable and NDI delete are issued back to back then,
	NDP_END sequence is not initiated and causing deviation from
	NAN spec. Root-cause is firmware deleting NDP peer as a part of
	NDI delete before initiating NDP end sequence.

To fix this, process NAN enable and disable requests synchronously.

Change-Id: I467419370187b0dc8d879e1806347c9f21ebb23a
CRs-Fixed: 2528599
This commit is contained in:
Rajeev Kumar Sirasanagandla
2019-10-18 19:37:31 +05:30
committed by nshrivas
parent 91e874ef20
commit cbc6c3b8d1
4 changed files with 86 additions and 41 deletions

View File

@@ -419,13 +419,13 @@ void ucfg_nan_datapath_event_handler(struct wlan_objmgr_psoc *psoc,
psoc_obj->cb_obj.os_if_ndp_event_handler(psoc, vdev, type, msg);
}
static void ucfg_concurrency_nan_disable_callback(void *cookie)
static void ucfg_nan_request_process_cb(void *cookie)
{
struct osif_request *request;
request = osif_request_get(cookie);
if (request) {
nan_debug("request (cookie:0x%pK) completed", cookie);
osif_request_complete(request);
osif_request_put(request);
} else {
@@ -458,8 +458,8 @@ int ucfg_nan_register_hdd_callbacks(struct wlan_objmgr_psoc *psoc,
cb_obj->os_if_ndp_event_handler;
psoc_obj->cb_obj.os_if_nan_event_handler =
cb_obj->os_if_nan_event_handler;
psoc_obj->cb_obj.ucfg_explicit_disable_cb =
ucfg_concurrency_nan_disable_callback;
psoc_obj->cb_obj.ucfg_nan_request_process_cb =
ucfg_nan_request_process_cb;
return 0;
}
@@ -564,6 +564,13 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
struct scheduler_msg msg = {0};
uint32_t len;
QDF_STATUS status;
struct nan_psoc_priv_obj *psoc_priv;
struct osif_request *request = NULL;
static const struct osif_request_params params = {
.priv_size = 0,
.timeout_ms = 1000,
};
int err;
if (!in_req) {
nan_alert("NAN Discovery req is null");
@@ -575,6 +582,12 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
struct nan_enable_req *req = in_req;
psoc = req->psoc;
psoc_priv = nan_get_psoc_priv_obj(psoc);
if (!psoc_priv) {
nan_err("nan psoc priv object is NULL");
return QDF_STATUS_E_INVAL;
}
/*
* Take a psoc reference while it is being used by the
* NAN requests.
@@ -602,6 +615,12 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
struct nan_disable_req *req = in_req;
psoc = req->psoc;
psoc_priv = nan_get_psoc_priv_obj(psoc);
if (!psoc_priv) {
nan_err("nan psoc priv object is NULL");
return QDF_STATUS_E_INVAL;
}
status = wlan_objmgr_psoc_try_get_ref(psoc,
WLAN_NAN_ID);
if (QDF_IS_STATUS_ERROR(status)) {
@@ -626,6 +645,12 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
struct nan_generic_req *req = in_req;
psoc = req->psoc;
psoc_priv = nan_get_psoc_priv_obj(psoc);
if (!psoc_priv) {
nan_err("nan psoc priv object is NULL");
return QDF_STATUS_E_INVAL;
}
status = wlan_objmgr_psoc_try_get_ref(psoc,
WLAN_NAN_ID);
if (QDF_IS_STATUS_ERROR(status)) {
@@ -651,6 +676,23 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
msg.type = req_type;
msg.callback = nan_discovery_scheduled_handler;
msg.flush_callback = nan_discovery_flush_callback;
if (req_type == NAN_GENERIC_REQ)
goto post_msg;
request = osif_request_alloc(&params);
if (!request) {
nan_err("Request allocation failure");
nan_discovery_flush_callback(&msg);
return QDF_STATUS_E_NOMEM;
}
psoc_priv->request_context = osif_request_cookie(request);
if (req_type == NAN_DISABLE_REQ)
psoc_priv->is_explicit_disable = true;
post_msg:
nan_debug("posting request: %u", req_type);
status = scheduler_post_message(QDF_MODULE_ID_NAN,
QDF_MODULE_ID_NAN,
QDF_MODULE_ID_OS_IF, &msg);
@@ -660,6 +702,21 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
nan_discovery_flush_callback(&msg);
}
if (req_type != NAN_GENERIC_REQ) {
err = osif_request_wait_for_response(request);
if (err)
nan_err("NAN request: %u timed out: %d",
req_type, err);
else
nan_debug("NAN request: %u serviced successfully",
req_type);
if (req_type == NAN_DISABLE_REQ)
psoc_priv->is_explicit_disable = false;
osif_request_put(request);
}
return status;
}
@@ -668,13 +725,7 @@ void ucfg_nan_disable_concurrency(struct wlan_objmgr_psoc *psoc)
struct nan_disable_req nan_req = {0};
enum nan_disc_state curr_nan_state;
struct nan_psoc_priv_obj *psoc_priv;
struct osif_request *request;
static const struct osif_request_params params = {
.priv_size = 0,
.timeout_ms = 1000,
};
QDF_STATUS status;
int err;
if (!psoc) {
nan_err("psoc object is NULL, no action will be taken");
@@ -700,35 +751,17 @@ void ucfg_nan_disable_concurrency(struct wlan_objmgr_psoc *psoc)
}
qdf_spin_unlock_bh(&psoc_priv->lock);
request = osif_request_alloc(&params);
if (!request) {
nan_err("Request allocation failure");
return;
}
nan_req.psoc = psoc;
nan_req.disable_2g_discovery = true;
nan_req.disable_5g_discovery = true;
psoc_priv->disable_context = osif_request_cookie(request);
status = ucfg_nan_discovery_req(&nan_req, NAN_DISABLE_REQ);
if (QDF_IS_STATUS_ERROR(status)) {
nan_err("Unable to disable NAN Discovery");
osif_request_put(request);
return;
}
psoc_priv->is_explicit_disable = true;
nan_debug("Successfully sent NAN Disable request");
err = osif_request_wait_for_response(request);
if (err)
nan_err("NAN Disable timed out waiting for disable ind-%d",
err);
else
nan_debug("NAN Disabled successfully");
psoc_priv->is_explicit_disable = false;
osif_request_put(request);
nan_debug("NAN Disabled successfully");
}
static QDF_STATUS