qcacld-3.0: Disable NAN in stop_adapter
Framework might not disable NAN discovery explicitly in some cases like driver unload. So disable NAN from stop_adapter to terminate NDPs and NAN discovery properly. Cleanup the API os_if_process_nan_disable_req() by using the new API ucfg_disable_nan_discovery(). Change-Id: Ic2c834db44c42a44db902c93f67a887de1b6c2fb CRs-Fixed: 2594318
This commit is contained in:

committed by
nshrivas

parent
baff7dc092
commit
ee454da9db
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -368,6 +368,21 @@ bool ucfg_nan_is_sta_ndp_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
|
||||
* Return: True if NAN vdev creation is allowed else false
|
||||
*/
|
||||
bool ucfg_nan_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* ucfg_disable_nan_discovery() - Disable NAN discovery
|
||||
* @psoc: pointer to psoc object
|
||||
* @data: Data to be sent to NAN discovery engine, which runs in firmware
|
||||
* @data_len: Length of the data
|
||||
*
|
||||
* Send NAN disable request to firmware by setting the mandatory
|
||||
* params(disable_2g_discovery, disable_5g_discovery) along
|
||||
* with the data, if provided.
|
||||
*
|
||||
* Return: status of operation
|
||||
*/
|
||||
QDF_STATUS ucfg_disable_nan_discovery(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *data, uint32_t data_len);
|
||||
#else /* WLAN_FEATURE_NAN */
|
||||
|
||||
static inline
|
||||
@@ -425,5 +440,12 @@ bool ucfg_nan_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline
|
||||
QDF_STATUS ucfg_disable_nan_discovery(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *data, uint32_t data_len)
|
||||
{
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif /* WLAN_FEATURE_NAN */
|
||||
#endif /* _NAN_UCFG_API_H_ */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -1045,3 +1045,33 @@ bool ucfg_nan_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc)
|
||||
|
||||
return psoc_nan_obj->nan_caps.nan_vdev_allowed;
|
||||
}
|
||||
|
||||
QDF_STATUS ucfg_disable_nan_discovery(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *data, uint32_t data_len)
|
||||
{
|
||||
struct nan_disable_req *nan_req;
|
||||
QDF_STATUS status;
|
||||
|
||||
nan_req = qdf_mem_malloc(sizeof(*nan_req) + data_len);
|
||||
if (!nan_req)
|
||||
return -ENOMEM;
|
||||
|
||||
nan_req->psoc = psoc;
|
||||
nan_req->disable_2g_discovery = true;
|
||||
nan_req->disable_5g_discovery = true;
|
||||
if (data_len && data) {
|
||||
nan_req->params.request_data_len = data_len;
|
||||
qdf_mem_copy(nan_req->params.request_data, data, data_len);
|
||||
}
|
||||
|
||||
nan_debug("sending NAN Disable Req");
|
||||
status = ucfg_nan_discovery_req(nan_req, NAN_DISABLE_REQ);
|
||||
|
||||
if (QDF_IS_STATUS_SUCCESS(status))
|
||||
nan_debug("Successfully sent NAN Disable request");
|
||||
else
|
||||
nan_err("Unable to send NAN Disable request: %u", status);
|
||||
|
||||
qdf_mem_free(nan_req);
|
||||
return status;
|
||||
}
|
||||
|
@@ -5948,7 +5948,9 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
|
||||
memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
|
||||
wireless_send_event(adapter->dev, SIOCGIWAP, &wrqu,
|
||||
NULL);
|
||||
}
|
||||
} else if (adapter->device_mode == QDF_NAN_DISC_MODE &&
|
||||
ucfg_is_nan_disc_active(hdd_ctx->psoc))
|
||||
ucfg_disable_nan_discovery(hdd_ctx->psoc, NULL, 0);
|
||||
|
||||
wlan_hdd_scan_abort(adapter);
|
||||
wlan_hdd_cleanup_actionframe(adapter);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -2610,34 +2610,15 @@ int os_if_nan_legacy_req(struct wlan_objmgr_psoc *psoc, const void *data,
|
||||
static int os_if_process_nan_disable_req(struct wlan_objmgr_psoc *psoc,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
struct nan_disable_req *nan_req;
|
||||
uint32_t buf_len;
|
||||
uint8_t *data;
|
||||
uint32_t data_len;
|
||||
QDF_STATUS status;
|
||||
|
||||
buf_len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA]);
|
||||
data = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA]);
|
||||
data_len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA]);
|
||||
|
||||
nan_req = qdf_mem_malloc(sizeof(*nan_req) + buf_len);
|
||||
if (!nan_req) {
|
||||
osif_err("Request allocation failure");
|
||||
return -ENOMEM;
|
||||
}
|
||||
status = ucfg_disable_nan_discovery(psoc, data, data_len);
|
||||
|
||||
nan_req->psoc = psoc;
|
||||
nan_req->disable_2g_discovery = true;
|
||||
nan_req->disable_5g_discovery = true;
|
||||
nan_req->params.request_data_len = buf_len;
|
||||
nla_memcpy(nan_req->params.request_data,
|
||||
tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA], buf_len);
|
||||
|
||||
osif_debug("sending NAN Disable Req");
|
||||
status = ucfg_nan_discovery_req(nan_req, NAN_DISABLE_REQ);
|
||||
|
||||
if (QDF_IS_STATUS_SUCCESS(status))
|
||||
osif_debug("Successfully sent NAN Disable request");
|
||||
else
|
||||
osif_err("Unable to send NAN Disable request");
|
||||
|
||||
qdf_mem_free(nan_req);
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user