Pārlūkot izejas kodu

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
Sheenam Monga 2 gadi atpakaļ
vecāks
revīzija
6748c79f29

+ 4 - 1
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
  *

+ 14 - 17
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);