From 6748c79f299f31a680411d6885627ea3d180948e Mon Sep 17 00:00:00 2001 From: Sheenam Monga Date: Tue, 29 Nov 2022 14:11:00 +0530 Subject: [PATCH] qcacmn: Update SRG and NON-SRG PD threshold Currently, SRG PD threshold is updated with addition of SR_PD_THRESHOLD_MIN which is already added in srg threshold and threshold is left shifted to 8 bits and type casted to unit8 which is causing 0 value and NON-SRG PD threshold is updated to NON-SRG PD threshold advertised by AP only in case threshold provided by user space is not within the range of connected AP but in some cases user may enable command without threshold in such cases NON-SRG threshold will be sent as 0. Fix is to update SRG PD threshold directly to the value without any addition and use QDF_SET_BIT to add SRG and NON-SRG data in value which is required by FW. Update NON-SRG PD threshold to threshold advertised by AP in case userspace doesn't provide any PD threshold. Change-Id: I162722264a566e731352f11874f310714bffe4b2 CRs-Fixed: 3340905 --- .../dispatcher/inc/wlan_vdev_mlme_api.h | 5 ++- .../dispatcher/src/wlan_vdev_mlme_api.c | 31 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h index f8a64b46f4..60905af32d 100644 --- a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h +++ b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h @@ -45,11 +45,12 @@ #define NON_SRG_SPR_ENABLE_POS 31 #define NON_SRG_SPR_ENABLE 0x80 #define NON_SR_PD_THRESHOLD_DISABLED 0x80 +#define SR_PADDING_BYTE 8 #endif /** - * wlan_mlme_peer_param_id - peer param id in mlme layer + * enum wlan_mlme_peer_param_id - peer param id in mlme layer * @WLAN_MLME_PEER_BW_PUNCTURE: update puncture 20 MHz bitmap */ enum wlan_mlme_peer_param_id { @@ -229,6 +230,7 @@ QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev); /** * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity + * vdev: Object manager VDEV object * * API to take VDEV MLME command lock * @@ -238,6 +240,7 @@ void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev); /** * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity + * vdev: Object manager VDEV object * * API to release VDEV MLME command lock * diff --git a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c index d8a1bc312b..e1969f4c7f 100644 --- a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c +++ b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c @@ -414,14 +414,14 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val, ap_non_srg_pd_threshold = wlan_vdev_mlme_get_non_srg_pd_offset(vdev) + SR_PD_THRESHOLD_MIN; - /** + /* * Update non_srg_pd_threshold with provide * non_srg_pd_threshold for non-srg, if pd threshold is * with in the range else keep the same as * advertised by AP. */ - if (non_srg_pd_threshold && - non_srg_pd_threshold > ap_non_srg_pd_threshold) + if (!non_srg_pd_threshold || + (non_srg_pd_threshold > ap_non_srg_pd_threshold)) non_srg_pd_threshold = ap_non_srg_pd_threshold; /* 31st BIT - Enable/Disable Non-SRG based spatial reuse. */ @@ -432,21 +432,18 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val, wlan_vdev_mlme_get_srg_pd_offset( vdev, &ap_srg_max_pd_threshold_offset, &ap_srg_min_pd_threshold_offset); - /** + /* * Update srg_pd_threshold with provide * srg_pd_threshold, if pd threshold is with in the * SRG range else keep the max of advertised by AP. */ - if (srg_pd_threshold && - srg_pd_threshold < (ap_srg_max_pd_threshold_offset + - SR_PD_THRESHOLD_MIN) && - srg_pd_threshold > (ap_srg_min_pd_threshold_offset + - SR_PD_THRESHOLD_MIN)) - srg_pd_threshold = srg_pd_threshold + - SR_PD_THRESHOLD_MIN; - else + if (!srg_pd_threshold || + (srg_pd_threshold > (ap_srg_max_pd_threshold_offset + + SR_PD_THRESHOLD_MIN) || + srg_pd_threshold < (ap_srg_min_pd_threshold_offset + + SR_PD_THRESHOLD_MIN))) srg_pd_threshold = ap_srg_max_pd_threshold_offset + - SR_PD_THRESHOLD_MIN; + SR_PD_THRESHOLD_MIN; /* 30th BIT - Enable/Disable SRG based spatial reuse. */ *val |= is_sr_enable << SRG_SPR_ENABLE_POS; @@ -457,10 +454,10 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val, * 8 - 15| Param value for SRG based Spatial Reuse * 29 | Param value is in dBm units rather than dB units */ - *val |= - (uint8_t)(non_srg_pd_threshold << NON_SRG_MAX_PD_OFFSET_POS); - *val |= - (uint8_t)(srg_pd_threshold << SRG_THRESHOLD_MAX_PD_POS); + QDF_SET_BITS(*val, NON_SRG_MAX_PD_OFFSET_POS, SR_PADDING_BYTE, + (uint8_t)non_srg_pd_threshold); + QDF_SET_BITS(*val, SRG_THRESHOLD_MAX_PD_POS, SR_PADDING_BYTE, + (uint8_t)srg_pd_threshold); *val |= SR_PARAM_VAL_DBM_UNIT << SR_PARAM_VAL_DBM_POS; wlan_vdev_mlme_set_current_non_srg_pd_threshold(vdev, non_srg_pd_threshold);