qcacmn: Handle SRG and NON-SRG pd threshold

Currently, only single pd_threshold is fetched and
treated as SRG and NON-SRG pd threshold instead of
handling both threshold separately.

Fix is to get SRG and NON-SRG pd threshold from
userspace instead of single pd threshold.

Change-Id: I414843dfd08068c81531d0e96d71fb68d8bfccd1
CRs-Fixed: 3328201
This commit is contained in:
Sheenam Monga
2022-11-03 19:51:14 +05:30
committed by Madan Koyyalamudi
parent 58ee0d8e0b
commit fee16fbe5a
4 changed files with 35 additions and 27 deletions

View File

@@ -174,18 +174,19 @@ spatial_reuse_send_pd_threshold(struct wlan_objmgr_pdev *pdev,
/**
* spatial_reuse_set_sr_enable_disable: To send wmi command to enable/disable SR
*
* @vdev: object manager vdev
* @pdev: object manager pdev
* @is_sr_enable: sr enable/disable
* @pd_threshold: pd threshold
* @srg_pd_threshold: SRG pd threshold
* @non_srg_pd_threshold: NON-SRG pd threshold
*
* Return: Success/Failure
*/
static QDF_STATUS
spatial_reuse_set_sr_enable_disable(struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_pdev *pdev,
bool is_sr_enable, int32_t pd_threshold)
bool is_sr_enable, int32_t srg_pd_threshold,
int32_t non_srg_pd_threshold)
{
uint32_t val = 0;
uint8_t sr_ctrl;
@@ -201,7 +202,8 @@ spatial_reuse_set_sr_enable_disable(struct wlan_objmgr_vdev *vdev,
(sr_ctrl & NON_SRG_OFFSET_PRESENT)) ||
(sr_ctrl & SRG_INFO_PRESENT)) {
if (is_sr_enable) {
wlan_mlme_update_sr_data(vdev, &val, pd_threshold,
wlan_mlme_update_sr_data(vdev, &val, srg_pd_threshold,
non_srg_pd_threshold,
is_sr_enable);
wlan_vdev_obj_lock(vdev);
wlan_vdev_mlme_set_he_spr_enabled(vdev, true);

View File

@@ -1490,7 +1490,8 @@ struct wlan_lmac_if_spatial_reuse_tx_ops {
QDF_STATUS(*target_if_set_sr_enable_disable)(
struct wlan_objmgr_vdev *vdev,
struct wlan_objmgr_pdev *pdev,
bool is_sr_enable, int32_t pd_threshold);
bool is_sr_enable, int32_t srg_pd_threshold,
int32_t non_srg_pd_threshold);
};
#endif

View File

@@ -318,10 +318,10 @@ wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc,
#ifdef WLAN_FEATURE_SR
/**
* wlan_mlme_update_sr_data() - Updates SR values
*
* @vdev: Object manager VDEV object
* @val: SR value
* @pd_threshold: pd threshold sent by userspace
* @srg_pd_threshold: SRG PD threshold sent by userspace
* @non_srg_pd_threshold: NON SRG PD threshold sent by userspace
* @is_sr_enable: SR enable/disable from userspace
*
* API to Update SR value based on AP advertisement and provided by userspace
@@ -330,11 +330,13 @@ wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc,
*/
void
wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
int32_t pd_threshold, bool is_sr_enable);
int32_t srg_pd_threshold, int32_t non_srg_pd_threshold,
bool is_sr_enable);
#else
static inline void
wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
int32_t pd_threshold, bool is_sr_enable)
int32_t srg_pd_threshold, int32_t non_srg_pd_threshold,
bool is_sr_enable)
{}
#endif
#endif

View File

@@ -400,47 +400,50 @@ wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc,
#ifdef WLAN_FEATURE_SR
void
wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
int32_t pd_threshold, bool is_sr_enable)
int32_t srg_pd_threshold, int32_t non_srg_pd_threshold,
bool is_sr_enable)
{
uint8_t non_srg_pd_threshold = 0, srg_pd_threshold = 0;
uint8_t srg_min_pd_threshold_offset, srg_max_pd_threshold_offset;
uint8_t ap_non_srg_pd_threshold = 0;
uint8_t ap_srg_min_pd_threshold_offset, ap_srg_max_pd_threshold_offset;
uint8_t sr_ctrl;
sr_ctrl = wlan_vdev_mlme_get_sr_ctrl(vdev);
if (!(sr_ctrl & NON_SRG_PD_SR_DISALLOWED) &&
(sr_ctrl & NON_SRG_OFFSET_PRESENT)) {
non_srg_pd_threshold =
ap_non_srg_pd_threshold =
wlan_vdev_mlme_get_pd_offset(vdev) + NON_SR_PD_THRESHOLD_MIN;
/**
* Update non_srg_pd_threshold with provide
* pd_threshold, if pd threshold is with in the
* range else keep the same as advertised by AP.
* non_srg_pd_threshold for non-srg, if pd threshold is
* with in the range else keep the same as
* advertised by AP.
*/
if (pd_threshold && non_srg_pd_threshold > pd_threshold)
non_srg_pd_threshold = 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. */
*val |= is_sr_enable << NON_SRG_SPR_ENABLE_POS;
}
if (sr_ctrl & SRG_INFO_PRESENT) {
wlan_vdev_mlme_get_srg_pd_offset(vdev,
&srg_max_pd_threshold_offset,
&srg_min_pd_threshold_offset);
wlan_vdev_mlme_get_srg_pd_offset(
vdev, &ap_srg_max_pd_threshold_offset,
&ap_srg_min_pd_threshold_offset);
/**
* Update rg_pd_threshold with provide
* pd_threshold, if pd threshold is with in the
* 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 (pd_threshold &&
pd_threshold < (srg_max_pd_threshold_offset +
if (srg_pd_threshold &&
srg_pd_threshold < (ap_srg_max_pd_threshold_offset +
NON_SR_PD_THRESHOLD_MIN) &&
pd_threshold > (srg_min_pd_threshold_offset +
srg_pd_threshold > (ap_srg_min_pd_threshold_offset +
NON_SR_PD_THRESHOLD_MIN))
srg_pd_threshold = pd_threshold +
srg_pd_threshold = srg_pd_threshold +
NON_SR_PD_THRESHOLD_MIN;
else
srg_pd_threshold = srg_max_pd_threshold_offset +
srg_pd_threshold = ap_srg_max_pd_threshold_offset +
NON_SR_PD_THRESHOLD_MIN;
/* 30th BIT - Enable/Disable SRG based spatial reuse. */