diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 230d51e536..a2ac015815 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1876,17 +1876,42 @@ cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle) dp_handle); } +/** + * cdp_soc_handle_mode_change() - Update pdev_id to lmac_id mapping + * @soc: opaque soc handle + * @pdev_id: id of data path pdev handle + * @lmac_id: lmac id + * Return: QDF_STATUS + */ +static inline QDF_STATUS +cdp_soc_handle_mode_change(ol_txrx_soc_handle soc, uint8_t pdev_id, + uint32_t lmac_id) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return QDF_STATUS_E_FAILURE; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->map_pdev_to_lmac) + return QDF_STATUS_E_FAILURE; + + return soc->ops->cmn_drv_ops->handle_mode_change(soc, pdev_id, + lmac_id); +} + /** * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping * @soc: opaque soc handle * @pdev_id: id of data path pdev handle * @lmac_id: lmac id - * @mode_change: flag to indicate mode change (true) or init (false) * Return: QDF_STATUS */ static inline QDF_STATUS cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id, - uint32_t lmac_id, bool mode_change) + uint32_t lmac_id) { if (!soc || !soc->ops) { QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, @@ -1900,7 +1925,7 @@ cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id, return QDF_STATUS_E_FAILURE; return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id, - lmac_id, mode_change); + lmac_id); } /** diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 273dd192eb..774205408d 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -429,7 +429,10 @@ struct cdp_cmn_ops { void *dp_txrx_handle); QDF_STATUS (*map_pdev_to_lmac)(ol_txrx_soc_handle soc, uint8_t pdev_id, - uint32_t lmac_id, bool mode_change); + uint32_t lmac_id); + + QDF_STATUS (*handle_mode_change)(ol_txrx_soc_handle soc, + uint8_t pdev_id, uint32_t lmac_id); QDF_STATUS (*set_pdev_status_down)(struct cdp_soc_t *soc_handle, uint8_t pdev_id, bool is_pdev_down); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index d3971c3ad5..8f5a659076 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -9419,20 +9419,48 @@ dp_soc_set_dp_txrx_handle(struct cdp_soc *soc_handle, void *txrx_handle) * @soc_hdl: datapath soc handle * @pdev_id: id of the datapath pdev handle * @lmac_id: lmac id - * @mode_change: flag to indicate a mode change * * Return: QDF_STATUS */ static QDF_STATUS dp_soc_map_pdev_to_lmac (struct cdp_soc_t *soc_hdl, uint8_t pdev_id, - uint32_t lmac_id, bool mode_change) + uint32_t lmac_id) +{ + struct dp_soc *soc = (struct dp_soc *)soc_hdl; + + wlan_cfg_set_hw_mac_idx(soc->wlan_cfg_ctx, + pdev_id, + lmac_id); + + /*Set host PDEV ID for lmac_id*/ + wlan_cfg_set_pdev_idx(soc->wlan_cfg_ctx, + pdev_id, + lmac_id); + + return QDF_STATUS_SUCCESS; +} + +/** + * dp_soc_handle_pdev_mode_change() - Update pdev to lmac mapping + * @soc_hdl: datapath soc handle + * @pdev_id: id of the datapath pdev handle + * @lmac_id: lmac id + * + * In the event of a dynamic mode change, update the pdev to lmac mapping + * + * Return: QDF_STATUS + */ +static QDF_STATUS +dp_soc_handle_pdev_mode_change + (struct cdp_soc_t *soc_hdl, uint8_t pdev_id, + uint32_t lmac_id) { struct dp_soc *soc = (struct dp_soc *)soc_hdl; - struct dp_pdev *pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, - pdev_id); struct dp_vdev *vdev = NULL; uint8_t hw_pdev_id, mac_id; + struct dp_pdev *pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, + pdev_id); int nss_config = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); if (qdf_unlikely(!pdev)) @@ -9441,12 +9469,6 @@ dp_soc_map_pdev_to_lmac pdev->lmac_id = lmac_id; dp_info(" mode change %d %d\n", pdev->pdev_id, pdev->lmac_id); - if (!mode_change) { - wlan_cfg_set_hw_mac_idx(soc->wlan_cfg_ctx, - pdev->pdev_id, - lmac_id); - } - /*Set host PDEV ID for lmac_id*/ wlan_cfg_set_pdev_idx(soc->wlan_cfg_ctx, pdev->pdev_id, @@ -9456,19 +9478,17 @@ dp_soc_map_pdev_to_lmac dp_get_target_pdev_id_for_host_pdev_id(soc, pdev->pdev_id); - if (mode_change) { - /* - * When NSS offload is enabled, send pdev_id->lmac_id - * and pdev_id to hw_pdev_id to NSS FW - */ - if (nss_config) { - mac_id = pdev->lmac_id; - if (soc->cdp_soc.ol_ops->pdev_update_lmac_n_target_pdev_id) - soc->cdp_soc.ol_ops-> - pdev_update_lmac_n_target_pdev_id( - soc->ctrl_psoc, - &pdev_id, &mac_id, &hw_pdev_id); - } + /* + * When NSS offload is enabled, send pdev_id->lmac_id + * and pdev_id to hw_pdev_id to NSS FW + */ + if (nss_config) { + mac_id = pdev->lmac_id; + if (soc->cdp_soc.ol_ops->pdev_update_lmac_n_target_pdev_id) + soc->cdp_soc.ol_ops-> + pdev_update_lmac_n_target_pdev_id( + soc->ctrl_psoc, + &pdev_id, &mac_id, &hw_pdev_id); } qdf_spin_lock_bh(&pdev->vdev_list_lock); @@ -10079,6 +10099,7 @@ static struct cdp_cmn_ops dp_ops_cmn = { .get_soc_dp_txrx_handle = dp_soc_get_dp_txrx_handle, .set_soc_dp_txrx_handle = dp_soc_set_dp_txrx_handle, .map_pdev_to_lmac = dp_soc_map_pdev_to_lmac, + .handle_mode_change = dp_soc_handle_pdev_mode_change, .set_pdev_status_down = dp_soc_set_pdev_status_down, .txrx_set_ba_aging_timeout = dp_set_ba_aging_timeout, .txrx_get_ba_aging_timeout = dp_get_ba_aging_timeout,