diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 19fdab259a..33594885d1 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1060,4 +1060,52 @@ QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc, return soc->ops->cmn_drv_ops->update_config_parameters(psoc, cfg); } + +/** + * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev + * @soc: opaque soc handle + * @pdev: data path pdev handle + * + * Return: opaque dp handle + */ +static inline void * +cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return 0; + } + + if (soc->ops->cmn_drv_ops->get_dp_txrx_handle) + return soc->ops->cmn_drv_ops->get_dp_txrx_handle(pdev); + + return 0; +} + +/** + * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev + * @soc: opaque soc handle + * @pdev: data path pdev handle + * @dp_hdl: opaque pointer for dp_txrx_handle + * + * Return: void + */ +static inline void +cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev, void *dp_hdl) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->set_dp_txrx_handle) + return; + + soc->ops->cmn_drv_ops->set_dp_txrx_handle(pdev, dp_hdl); +} #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 69b41765a0..ed8152d602 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -228,6 +228,9 @@ struct cdp_cmn_ops { uint32_t *rx_pn); QDF_STATUS (*update_config_parameters)(struct cdp_soc *psoc, struct cdp_config_params *params); + + void *(*get_dp_txrx_handle)(struct cdp_pdev *pdev_hdl); + void (*set_dp_txrx_handle)(struct cdp_pdev *pdev_hdl, void *dp_txrx_hdl); }; struct cdp_ctrl_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 05fb56e639..c4c81b6fc2 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -2541,6 +2541,7 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force) soc->pdev_list[pdev->pdev_id] = NULL; soc->pdev_count--; wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx); + qdf_mem_free(pdev->dp_txrx_handle); qdf_mem_free(pdev); } @@ -5872,6 +5873,34 @@ dp_txrx_data_tx_cb_set(struct cdp_vdev *vdev_handle, vdev->tx_non_std_data_callback.ctxt = ctxt; } +/** + * dp_pdev_get_dp_txrx_handle() - get dp handle from pdev + * @pdev_hdl: datapath pdev handle + * + * Return: opaque pointer to dp txrx handle + */ +static void *dp_pdev_get_dp_txrx_handle(struct cdp_pdev *pdev_hdl) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; + + return pdev->dp_txrx_handle; +} + +/** + * dp_pdev_set_dp_txrx_handle() - set dp handle in pdev + * @pdev_hdl: datapath pdev handle + * @dp_txrx_hdl: opaque pointer for dp_txrx_handle + * + * Return: void + */ +static void +dp_pdev_set_dp_txrx_handle(struct cdp_pdev *pdev_hdl, void *dp_txrx_hdl) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; + + pdev->dp_txrx_handle = dp_txrx_hdl; +} + #ifdef CONFIG_WIN static void dp_peer_teardown_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) { @@ -5926,7 +5955,9 @@ static struct cdp_cmn_ops dp_ops_cmn = { .set_pn_check = dp_set_pn_check_wifi3, .update_config_parameters = dp_update_config_parameters, /* TODO: Add other functions */ - .txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set + .txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set, + .get_dp_txrx_handle = dp_pdev_get_dp_txrx_handle, + .set_dp_txrx_handle = dp_pdev_set_dp_txrx_handle, }; static struct cdp_ctrl_ops dp_ops_ctrl = { diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index f10a68afa5..cc88040ba4 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1103,6 +1103,8 @@ struct dp_pdev { uint16_t tx_peer_id; uint16_t rx_ppdu_id; } am_copy_id; + + void *dp_txrx_handle; /* Advanced data path handle */ }; struct dp_peer;