From 6cdc4ce277c0a7836c369928a6a191760080272f Mon Sep 17 00:00:00 2001 From: Rachit Kankane Date: Thu, 1 Sep 2022 14:24:25 +0530 Subject: [PATCH] qcacld-3.0: Send PDEV Param command for SR Send WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD during PDEV init with disabled PD-Threshold value to initialize SR related registers in HW. Change-Id: I49e73c76974e098b6dfbf647a898b53abf8ea2ba CRs-Fixed: 3306179 --- .../mlme/dispatcher/src/wlan_mlme_ucfg_api.c | 4 ++ .../dispatcher/inc/spatial_reuse_api.h | 16 ++++++++ .../dispatcher/src/spatial_reuse_api.c | 37 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c index 514db0c7d2..4926a6664b 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c @@ -31,6 +31,7 @@ #include "wlan_pdev_mlme_api.h" #include "wlan_vdev_mgr_tgt_if_tx_api.h" #include "wlan_policy_mgr_public_struct.h" +#include "spatial_reuse_api.h" QDF_STATUS ucfg_mlme_global_init(void) { @@ -119,6 +120,9 @@ QDF_STATUS ucfg_mlme_pdev_open(struct wlan_objmgr_pdev *pdev) } pdev_mlme->mlme_register_ops = mlme_register_vdev_mgr_ops; + /* Initialize MAC0/1 SR registers */ + wlan_spatial_reuse_pdev_init(pdev); + return QDF_STATUS_SUCCESS; } diff --git a/components/spatial_reuse/dispatcher/inc/spatial_reuse_api.h b/components/spatial_reuse/dispatcher/inc/spatial_reuse_api.h index 1b016e33ea..3f920f65ef 100644 --- a/components/spatial_reuse/dispatcher/inc/spatial_reuse_api.h +++ b/components/spatial_reuse/dispatcher/inc/spatial_reuse_api.h @@ -37,6 +37,16 @@ QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev, uint8_t sr_ctrl, uint8_t non_srg_max_pd_offset); + +/** + * wlan_spatial_reuse_pdev_init() - Send PDEV command with disabled + * PD threshold value to initialize HW + * registers + * @pdev: objmgr manager pdev + * + * Return: QDF_STATUS + */ +QDF_STATUS wlan_spatial_reuse_pdev_init(struct wlan_objmgr_pdev *pdev); #else static inline QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev, @@ -45,6 +55,12 @@ QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev, { return QDF_STATUS_SUCCESS; } + +static inline +QDF_STATUS wlan_spatial_reuse_pdev_init(struct wlan_objmgr_pdev *pdev) +{ + return QDF_STATUS_SUCCESS; +} #endif /** diff --git a/components/spatial_reuse/dispatcher/src/spatial_reuse_api.c b/components/spatial_reuse/dispatcher/src/spatial_reuse_api.c index ce7dd52f3c..93f86d051f 100644 --- a/components/spatial_reuse/dispatcher/src/spatial_reuse_api.c +++ b/components/spatial_reuse/dispatcher/src/spatial_reuse_api.c @@ -18,6 +18,7 @@ * DOC : contains interface prototypes for spatial_reuse api */ #include +#include QDF_STATUS wlan_spatial_reuse_config_set(struct wlan_objmgr_vdev *vdev, uint8_t sr_ctrl, @@ -77,3 +78,39 @@ wlan_sr_setup_req(struct wlan_objmgr_vdev *vdev, struct wlan_objmgr_pdev *pdev, } return status; } + +QDF_STATUS wlan_spatial_reuse_pdev_init(struct wlan_objmgr_pdev *pdev) +{ + struct pdev_params pparam; + wmi_unified_t wmi_handle; + bool sr_supported; + bool sr_per_ppdu_supported; + + wmi_handle = GET_WMI_HDL_FROM_PDEV(pdev); + if (!wmi_handle) { + mlme_err("Failed to get WMI handle!"); + return QDF_STATUS_E_INVAL; + } + sr_supported = + wmi_service_enabled(wmi_handle, + wmi_service_srg_srp_spatial_reuse_support); + sr_per_ppdu_supported = + wmi_service_enabled(wmi_handle, + wmi_service_obss_per_packet_sr_support); + if (!sr_per_ppdu_supported && !sr_supported) { + mlme_err("FW doesn't support"); + return QDF_STATUS_E_NOSUPPORT; + } + + qdf_mem_zero(&pparam, sizeof(pparam)); + pparam.param_id = WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD; + QDF_SET_BITS(pparam.param_value, NON_SRG_SPR_ENABLE_POS, + NON_SRG_SPR_ENABLE_SIZE, NON_SRG_SPR_ENABLE); + QDF_SET_BITS(pparam.param_value, SR_PARAM_VAL_DBM_POS, + NON_SRG_PARAM_VAL_DBM_SIZE, SR_PARAM_VAL_DBM_UNIT); + QDF_SET_BITS(pparam.param_value, NON_SRG_MAX_PD_OFFSET_POS, + NON_SRG_MAX_PD_OFFSET_SIZE, NON_SR_PD_THRESHOLD_DISABLED); + + return wmi_unified_pdev_param_send(wmi_handle, &pparam, + WILDCARD_PDEV_ID); +}