Przeglądaj źródła

qcacmn: Add SRG pd offset in OBSS_PD_THRESHOLD

Currently, SRG pd offset is not sent to fw as part
of WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD. Add
support to send SRG pd offset provided by userspace,
if provided offset is with in the range of min and max
SRG PD offset advertised by AP.

Change-Id: I8b70dedbabcc6c3a296b8d378b9317924dd5c581
CRs-Fixed: 3304747
Sheenam Monga 2 lat temu
rodzic
commit
7d1a7719b8
1 zmienionych plików z 43 dodań i 29 usunięć
  1. 43 29
      umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c

+ 43 - 29
umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c

@@ -404,47 +404,61 @@ void
 wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
 			 int32_t pd_threshold, bool is_sr_enable)
 {
-	uint8_t non_srg_pd_threshold;
-	/*To do initialization removal*/
-	uint8_t srg_pd_threshold = 0;
-
-	non_srg_pd_threshold =
+	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 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 =
 		wlan_vdev_mlme_get_pd_offset(vdev) + NON_SR_PD_THRESHOLD_MIN;
-	/*
-	 * To do
-	 * set srg_pd_min and max offset in lim_update_vdev_sr_elements
-	 * srp_ie->srg_info.info.srg_pd_min_offset.
-	 * Get here and chcek provided threshold is in range or not
-	 */
+		/**
+		 * 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.
+		 */
+		if (pd_threshold && non_srg_pd_threshold > pd_threshold)
+			non_srg_pd_threshold = 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);
+		/**
+		 * Update rg_pd_threshold with provide
+		 * 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 +
+				    NON_SR_PD_THRESHOLD_MIN) &&
+		    pd_threshold > (srg_min_pd_threshold_offset +
+				    NON_SR_PD_THRESHOLD_MIN))
+			srg_pd_threshold = pd_threshold +
+				NON_SR_PD_THRESHOLD_MIN;
+		else
+			srg_pd_threshold = srg_max_pd_threshold_offset +
+				NON_SR_PD_THRESHOLD_MIN;
+
+		/* 30th BIT - Enable/Disable SRG based spatial reuse. */
+		*val |= is_sr_enable << SRG_SPR_ENABLE_POS;
+	}
 
-	/**
-	 * 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.
-	 */
-	if (pd_threshold && non_srg_pd_threshold > pd_threshold)
-		non_srg_pd_threshold = pd_threshold;
 	/* bit    | purpose
 	 * -----------------
 	 * 0  - 7 | Param Value for non-SRG based Spatial Reuse
 	 * 8  - 15| Param value for SRG based Spatial Reuse
-	 * 16 - 28| Reserved
-	 * 29     | Param value is in dBm units rather than dB units
-	 * 30     | Enable/Disable SRG based spatial reuse.
-	 *        | If set to 0, ignore bits 8-15.
-	 * 16 - 28| Reserved
 	 * 29     | Param value is in dBm units rather than dB units
-	 * 30     | Enable/Disable SRG based spatial reuse.
-	 *        | If set to 0, ignore bits 8-15.
-	 * 31     | Enable/Disable Non-SRG based spatial reuse.
-	 *        | If set to 0, ignore bits 0-7.
 	 */
 	*val |=
 		(uint8_t)(non_srg_pd_threshold << NON_SRG_MAX_PD_OFFSET_POS);
 	*val |=
 		(uint8_t)(srg_pd_threshold << SRG_THRESHOLD_MAX_PD_POS);
 	*val |= SR_PARAM_VAL_DBM_UNIT << SR_PARAM_VAL_DBM_POS;
-	*val |= is_sr_enable << NON_SRG_SPR_ENABLE_POS;
-	*val |= is_sr_enable << SRG_SPR_ENABLE_POS;
 }
 #endif