qcacld-3.0: Add DISA Component changes into the skeleton

Add final changes of DISA component into the skeleton. Fill up all the
code in core, dispatcher and target_if of the DISA component. Use new
wmi API to extract cmd response from event buffer.

Change-Id: I55f7170efa1055f1449dd95d9f1a911dfa6b54ce
CRs-Fixed: 2161979
Este commit está contenido en:
Nachiket Kukade
2017-12-20 17:34:46 +05:30
cometido por snandini
padre ba2253d2af
commit 09acaf85a9
Se han modificado 8 ficheros con 221 adiciones y 36 borrados

Ver fichero

@@ -84,13 +84,4 @@ QDF_STATUS disa_core_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
encrypt_decrypt_resp_callback cb,
void *cookie);
/**
* disa_core_encrypt_decrypt_resp() - Collect encrypt/decrypt request resp
* @psoc: objmgr psoc object
* @resp: DISA encrypt/decrypt request response parameters
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_core_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp);
#endif /* end of _WLAN_DISA_MAIN_H_ */

Ver fichero

@@ -51,6 +51,7 @@ struct disa_psoc_priv_obj {
struct wlan_disa_ctx {
encrypt_decrypt_resp_callback callback;
void *callback_context;
bool request_active;
qdf_spinlock_t lock;
};

Ver fichero

@@ -28,11 +28,34 @@ static struct wlan_disa_ctx *gp_disa_ctx;
QDF_STATUS disa_allocate_ctx(void)
{
/* If it is already created, ignore */
if (gp_disa_ctx != NULL) {
disa_debug("already allocated disa_ctx");
return QDF_STATUS_SUCCESS;
}
/* allocate DISA ctx */
gp_disa_ctx = qdf_mem_malloc(sizeof(*gp_disa_ctx));
if (!gp_disa_ctx) {
disa_err("unable to allocate disa_ctx");
QDF_ASSERT(0);
return QDF_STATUS_E_NOMEM;
}
qdf_spinlock_create(&gp_disa_ctx->lock);
return QDF_STATUS_SUCCESS;
}
void disa_free_ctx(void)
{
if (!gp_disa_ctx) {
disa_err("disa ctx is already freed");
QDF_ASSERT(0);
return;
}
qdf_spinlock_destroy(&gp_disa_ctx->lock);
qdf_mem_free(gp_disa_ctx);
gp_disa_ctx = NULL;
}
struct wlan_disa_ctx *disa_get_context(void)
@@ -45,11 +68,40 @@ QDF_STATUS disa_core_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
encrypt_decrypt_resp_callback cb,
void *cookie)
{
return tgt_disa_encrypt_decrypt_req(psoc, req);
}
struct wlan_disa_ctx *disa_ctx;
QDF_STATUS status = QDF_STATUS_SUCCESS;
QDF_STATUS disa_core_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp)
{
return QDF_STATUS_SUCCESS;
DISA_ENTER();
disa_ctx = disa_get_context();
if (!disa_ctx) {
disa_err("DISA context is NULL!");
return QDF_STATUS_E_INVAL;
}
qdf_spin_lock_bh(&disa_ctx->lock);
if (!disa_ctx->request_active) {
disa_ctx->callback = cb;
disa_ctx->callback_context = cookie;
disa_ctx->request_active = true;
} else {
status = QDF_STATUS_E_INVAL;
}
qdf_spin_unlock_bh(&disa_ctx->lock);
if (status != QDF_STATUS_SUCCESS) {
disa_err("A request is already active!");
return status;
}
status = disa_psoc_get_ref(psoc);
if (status != QDF_STATUS_SUCCESS) {
disa_err("DISA cannot get the reference out of psoc");
return status;
}
status = tgt_disa_encrypt_decrypt_req(psoc, req);
disa_psoc_put_ref(psoc);
DISA_EXIT();
return status;
}

Ver fichero

@@ -32,7 +32,14 @@
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_init(void);
#else
static inline QDF_STATUS disa_init(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_deinit() - unregister disa notification handlers.
@@ -41,7 +48,44 @@ QDF_STATUS disa_init(void);
*
* Return: QDF_STATUS_SUCCESS - in case of success else return error
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_deinit(void);
#else
static inline QDF_STATUS disa_deinit(void)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_enable() - Trigger psoc enable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc);
#else
static inline QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_disable() - Trigger psoc disable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
#ifdef WLAN_FEATURE_DISA
QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc);
#else
static inline QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
#endif
/**
* disa_psoc_object_created_notification(): disa psoc create handler
@@ -67,19 +111,4 @@ QDF_STATUS disa_psoc_object_created_notification(
QDF_STATUS disa_psoc_object_destroyed_notification(
struct wlan_objmgr_psoc *psoc, void *arg);
/**
* disa_psoc_enable() - Trigger psoc enable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc);
/**
* disa_psoc_disable() - Trigger psoc disable for DISA
* @psoc: objmgr psoc object
*
* Return: QDF status success or failure
*/
QDF_STATUS disa_psoc_disable(struct wlan_objmgr_psoc *psoc);
#endif /* end of _WLAN_DISA_OBJ_MGMT_API_H_ */

Ver fichero

@@ -26,7 +26,7 @@
#include "wlan_disa_public_struct.h"
#define GET_DISA_TX_OPS_FROM_VDEV(vedv) \
(disa_psoc_get_priv(psoc)->disa_tx_ops)
(&disa_psoc_get_priv(psoc)->disa_tx_ops)
/**
* tgt_disa_encrypt_decrypt_req() - send encrypt/decrypt request to target if

Ver fichero

@@ -193,7 +193,6 @@ QDF_STATUS disa_psoc_object_destroyed_notification(
QDF_STATUS disa_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
return tgt_disa_register_ev_handlers(psoc);
}
/**

Ver fichero

@@ -33,7 +33,19 @@
QDF_STATUS tgt_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req)
{
return QDF_STATUS_SUCCESS;
struct wlan_disa_tx_ops *disa_tx_ops;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
DISA_ENTER();
disa_tx_ops = GET_DISA_TX_OPS_FROM_VDEV(psoc);
QDF_ASSERT(disa_tx_ops->disa_encrypt_decrypt_req);
if (disa_tx_ops->disa_encrypt_decrypt_req)
status = disa_tx_ops->disa_encrypt_decrypt_req(psoc, req);
DISA_EXIT();
return status;
}
/**
@@ -47,6 +59,35 @@ QDF_STATUS tgt_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
QDF_STATUS tgt_disa_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_resp_params *resp)
{
struct wlan_disa_ctx *disa_ctx;
encrypt_decrypt_resp_callback cb;
void *cookie;
DISA_ENTER();
if (!resp) {
disa_err("encrypt/decrypt resp is null");
return QDF_STATUS_E_NULL_VALUE;
}
disa_ctx = disa_get_context();
if (!disa_ctx) {
disa_err("DISA context is NULL!");
return QDF_STATUS_E_INVAL;
}
qdf_spin_lock_bh(&disa_ctx->lock);
cb = disa_ctx->callback;
disa_ctx->callback = NULL;
cookie = disa_ctx->callback_context;
disa_ctx->callback_context = NULL;
disa_ctx->request_active = false;
qdf_spin_unlock_bh(&disa_ctx->lock);
if (cb)
cb(cookie, resp);
DISA_EXIT();
return QDF_STATUS_SUCCESS;
}
@@ -58,6 +99,15 @@ QDF_STATUS tgt_disa_encrypt_decrypt_resp(struct wlan_objmgr_psoc *psoc,
*/
QDF_STATUS tgt_disa_register_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
struct wlan_disa_tx_ops *disa_tx_ops;
disa_tx_ops = GET_DISA_TX_OPS_FROM_VDEV(psoc);
QDF_ASSERT(disa_tx_ops->disa_register_ev_handlers);
if (disa_tx_ops->disa_register_ev_handlers)
return disa_tx_ops->disa_register_ev_handlers(psoc);
return QDF_STATUS_SUCCESS;
}
@@ -69,6 +119,15 @@ QDF_STATUS tgt_disa_register_ev_handlers(struct wlan_objmgr_psoc *psoc)
*/
QDF_STATUS tgt_disa_unregister_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
struct wlan_disa_tx_ops *disa_tx_ops;
disa_tx_ops = GET_DISA_TX_OPS_FROM_VDEV(psoc);
QDF_ASSERT(disa_tx_ops->disa_unregister_ev_handlers);
if (disa_tx_ops->disa_unregister_ev_handlers)
return disa_tx_ops->disa_unregister_ev_handlers(psoc);
return QDF_STATUS_SUCCESS;
}

Ver fichero

@@ -29,29 +29,83 @@ int
target_if_encrypt_decrypt_event_handler(ol_scn_t scn_handle, uint8_t *data,
uint32_t data_len)
{
struct disa_encrypt_decrypt_resp_params resp;
struct wlan_objmgr_psoc *psoc;
if (data == NULL) {
target_if_err("%s: invalid pointer", __func__);
return -EINVAL;
}
psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
if (!psoc) {
target_if_err("psoc ptr is NULL");
return -EINVAL;
}
if (wmi_extract_encrypt_decrypt_resp_params(
GET_WMI_HDL_FROM_PSOC(psoc),
data, &resp) != QDF_STATUS_SUCCESS) {
target_if_err("Extraction of encrypt decrypt resp params failed");
return -EINVAL;
}
tgt_disa_encrypt_decrypt_resp(psoc, &resp);
return 0;
}
QDF_STATUS
target_if_disa_register_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
QDF_STATUS status;
status = wmi_unified_register_event(GET_WMI_HDL_FROM_PSOC(psoc),
wmi_vdev_encrypt_decrypt_data_rsp_event_id,
target_if_encrypt_decrypt_event_handler);
if (status) {
target_if_err("Failed to register Scan match event cb");
return QDF_STATUS_E_FAILURE;
}
return status;
}
QDF_STATUS
target_if_disa_unregister_ev_handlers(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
QDF_STATUS status;
status = wmi_unified_unregister_event(GET_WMI_HDL_FROM_PSOC(psoc),
wmi_vdev_encrypt_decrypt_data_rsp_event_id);
if (status) {
target_if_err("Failed to unregister Scan match event cb");
return QDF_STATUS_E_FAILURE;
}
return status;
}
QDF_STATUS
target_if_disa_encrypt_decrypt_req(struct wlan_objmgr_psoc *psoc,
struct disa_encrypt_decrypt_req_params *req)
{
return QDF_STATUS_SUCCESS;
return wmi_unified_encrypt_decrypt_send_cmd(GET_WMI_HDL_FROM_PSOC(psoc),
req);
}
void target_if_disa_register_tx_ops(struct wlan_disa_tx_ops *disa_tx_ops)
{
if (!disa_tx_ops) {
target_if_err("disa_tx_ops is null");
return;
}
disa_tx_ops->disa_encrypt_decrypt_req =
target_if_disa_encrypt_decrypt_req;
disa_tx_ops->disa_register_ev_handlers =
target_if_disa_register_ev_handlers;
disa_tx_ops->disa_unregister_ev_handlers =
target_if_disa_unregister_ev_handlers;
}