qcacmn: Add support to get objmgr pdev from scn handle

Add support to get objmgr pdev from scn handle in wmi event
handler functions.

Change-Id: I9003692958bf5ae47b6054f1ef8a0d6d3e33193b
CRs-Fixed: 2178124
Esse commit está contido em:
Himanshu Agarwal
2018-01-24 17:41:05 +05:30
commit de snandini
commit 497e83eeea
2 arquivos alterados com 58 adições e 1 exclusões

Ver arquivo

@@ -64,6 +64,9 @@
typedef struct wlan_objmgr_psoc *(*get_psoc_handle_callback)(
void *scn_handle);
typedef struct wlan_objmgr_pdev *(*get_pdev_handle_callback)(
void *scn_handle);
typedef int (*wmi_legacy_service_ready_callback)(uint32_t event_id,
void *handle,
uint8_t *event_data,
@@ -72,12 +75,14 @@ typedef int (*wmi_legacy_service_ready_callback)(uint32_t event_id,
/**
* struct target_if_ctx - target_interface context
* @magic: magic for target if ctx
* @get_wmi_handle: function pointer to get wmi handle
* @get_psoc_hdl_cb: function pointer to get psoc
* @get_pdev_hdl_cb: function pointer to get pdev
* @lock: spin lock for protecting the ctx
*/
struct target_if_ctx {
uint32_t magic;
get_psoc_handle_callback get_psoc_hdl_cb;
get_pdev_handle_callback get_pdev_hdl_cb;
wmi_legacy_service_ready_callback service_ready_cb;
qdf_spinlock_t lock;
};
@@ -293,6 +298,15 @@ QDF_STATUS target_if_open(get_psoc_handle_callback psoc_hdl_cb);
*/
QDF_STATUS target_if_close(void);
/**
* target_if_store_pdev_target_if_ctx() - stores objmgr pdev in target if ctx
* @pdev_hdl_cb: function pointer to get objmgr pdev
*
* Return: QDF_STATUS_SUCCESS - in case of success
*/
QDF_STATUS target_if_store_pdev_target_if_ctx(
get_pdev_handle_callback pdev_hdl_cb);
/**
* wlan_get_tgt_if_ctx() -Get target if ctx
*
@@ -312,6 +326,18 @@ struct target_if_ctx *target_if_get_ctx(void);
*/
struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle);
/**
* target_if_get_pdev_from_scn_hdl() - get pdev from scn handle
* @scn_handle: scn handle
*
* This API is generally used while processing wmi event.
* In wmi event SCN handle will be passed by wmi hence
* using this API we can get pdev from scn handle.
*
* Return: pdev for matching scn handle
*/
struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle);
/** target_if_register_tx_ops() - register tx_ops
* @tx_ops: tx_ops structure
*

Ver arquivo

@@ -94,6 +94,20 @@ struct wlan_objmgr_psoc *target_if_get_psoc_from_scn_hdl(void *scn_handle)
return psoc;
}
struct wlan_objmgr_pdev *target_if_get_pdev_from_scn_hdl(void *scn_handle)
{
struct wlan_objmgr_pdev *pdev;
qdf_spin_lock_bh(&g_target_if_ctx->lock);
if (scn_handle && g_target_if_ctx->get_pdev_hdl_cb)
pdev = g_target_if_ctx->get_pdev_hdl_cb(scn_handle);
else
pdev = NULL;
qdf_spin_unlock_bh(&g_target_if_ctx->lock);
return pdev;
}
#ifdef DIRECT_BUF_RX_ENABLE
static QDF_STATUS target_if_direct_buf_rx_init(void)
{
@@ -148,6 +162,7 @@ QDF_STATUS target_if_close(void)
qdf_spin_lock_bh(&g_target_if_ctx->lock);
g_target_if_ctx->magic = 0;
g_target_if_ctx->get_psoc_hdl_cb = NULL;
g_target_if_ctx->get_pdev_hdl_cb = NULL;
g_target_if_ctx->service_ready_cb = NULL;
qdf_spin_unlock_bh(&g_target_if_ctx->lock);
@@ -160,6 +175,22 @@ QDF_STATUS target_if_close(void)
return QDF_STATUS_SUCCESS;
}
QDF_STATUS target_if_store_pdev_target_if_ctx(
get_pdev_handle_callback pdev_hdl_cb)
{
if (!g_target_if_ctx) {
QDF_ASSERT(0);
target_if_err("target if ctx is null");
return QDF_STATUS_E_INVAL;
}
qdf_spin_lock_bh(&g_target_if_ctx->lock);
g_target_if_ctx->get_pdev_hdl_cb = pdev_hdl_cb;
qdf_spin_unlock_bh(&g_target_if_ctx->lock);
return QDF_STATUS_SUCCESS;
}
#ifndef WLAN_OFFCHAN_TXRX_ENABLE
static void target_if_offchan_txrx_ops_register(
struct wlan_lmac_if_tx_ops *tx_ops)