Pārlūkot izejas kodu

qcacmn: Handle Spatial Reuse on Roaming

Currently, if SR (Spatial Reuse) is supported by AP and then
STA roams to another AP then host needs to parse SR IE and
send events to userspace and commands to Fw based on below
scenarios:

i.) Roamed AP doesn't support SR: If roamed AP doesn't support
SR then async event with SR disable is required to be sent to
userspace.

ii.) Roamed AP supports SR: If roamed AP supports SR then below
validations are required.

a.) existing thresholds are in range of roamed AP: Send SR enable
command to FW with previous thresholds , as FW disables SR during
roaming.

b.) existing thresholds are not in range of roamed AP: then decision
will be based on whether threshold is provided during SR enable command
or not. If threshold is provided along with SR enable command then send
disable to userspace and in other case update thresholds as per roamed
AP , send async event to userspace with new configured values and send
enable command to fw with new thresholds.

Change-Id: I7eeebddbaa5075f0ba5d823f946b0cfa9d78c1c6
CRs-Fixed: 3331049
Sheenam Monga 2 gadi atpakaļ
vecāks
revīzija
6b53d5f9bb

+ 161 - 32
umac/mlme/include/wlan_vdev_mlme.h

@@ -364,10 +364,12 @@ struct vdev_mlme_proto {
  * @he_spr_srg_max_pd_offset: SRG PD max offset
  * @he_spr_srg_min_pd_offset: SRG PD min offset
  * @he_spr_enabled:     Spatial reuse enabled or not
- * @pd_threshold: pd threshold sent by userspace
  * @he_spr_disabled_due_conc: spr disabled due to concurrency
  * @srg_bss_color: srg bss color
  * @srg_partial_bssid: srg partial bssid
+ * @he_curr_non_srg_pd_threshold: current configured NON-SRG PD threshold
+ * @he_curr_srg_pd_threshold: current configured SRG PD threshold
+ * @is_pd_threshold_present: PD threshold is present in SR enable command or not
  */
 struct vdev_mlme_mgmt_generic {
 	uint32_t rts_threshold;
@@ -402,9 +404,11 @@ struct vdev_mlme_mgmt_generic {
 	bool he_spr_enabled;
 	bool he_spr_disabled_due_conc;
 	bool sr_prohibit_enabled;
-	int32_t pd_threshold;
 	uint64_t srg_bss_color;
 	uint64_t srg_partial_bssid;
+	int32_t he_curr_non_srg_pd_threshold;
+	int32_t he_curr_srg_pd_threshold;
+	bool is_pd_threshold_present;
 #endif
 };
 
@@ -1226,17 +1230,15 @@ static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
 }
 
 /**
- * wlan_vdev_mlme_get_pd_offset() - get spatial reuse pd offset
+ * wlan_vdev_mlme_get_non_srg_pd_offset() - get spatial reuse non srg pd offset
  * @vdev: VDEV object
  *
  * API to retrieve the spatial reuse pd offset from VDEV
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return:
- * @he_spr_non_srg_pd_max_offset: max pd offset
+ * @he_spr_non_srg_pd_max_offset: max non srg pd offset
  */
-static inline uint8_t wlan_vdev_mlme_get_pd_offset(
+static inline uint8_t wlan_vdev_mlme_get_non_srg_pd_offset(
 						struct wlan_objmgr_vdev *vdev)
 {
 	struct vdev_mlme_obj *vdev_mlme;
@@ -1254,8 +1256,6 @@ static inline uint8_t wlan_vdev_mlme_get_pd_offset(
  *
  * API to check whether the spatial reuse enabled or not
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return:
  * @he_spr_enabled: Spatial reuse enabled or not
  */
@@ -1342,17 +1342,17 @@ static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
 }
 
 /**
- * wlan_vdev_mlme_set_pd_offset() - set spatial reuse pd max offset
+ * wlan_vdev_mlme_set_non_srg_pd_offset() - set spatial reuse non srg
+ * pd max offset
  * @vdev: VDEV object
  *
  * API to set the spatial reuse pd max offset
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
-static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
-						uint8_t pd_max_offset)
+static inline void
+wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
+				     uint8_t non_srg_pd_max_offset)
 {
 	struct vdev_mlme_obj *vdev_mlme;
 
@@ -1360,7 +1360,8 @@ static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
 	if (!vdev_mlme)
 		return;
 
-	vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset = pd_max_offset;
+	vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset =
+						non_srg_pd_max_offset;
 }
 
 /**
@@ -1369,8 +1370,6 @@ static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
  *
  * API to set the spatial reuse enabled
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline void wlan_vdev_mlme_set_he_spr_enabled(
@@ -1444,8 +1443,6 @@ void wlan_vdev_mlme_set_sr_prohibit_en(struct wlan_objmgr_vdev *vdev,
  *
  * API to set the spatial reuse SRG pd min max offset
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline
@@ -1471,8 +1468,6 @@ void wlan_vdev_mlme_set_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
  *
  * API to set the spatial reuse SRG pd min max offset
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline
@@ -1498,8 +1493,6 @@ void wlan_vdev_mlme_get_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
  *
  * API to set the spatial reuse bss color bit map
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline
@@ -1523,8 +1516,6 @@ void wlan_vdev_mlme_set_srg_bss_color_bit_map(struct wlan_objmgr_vdev *vdev,
  *
  * API to set the spatial reuse partial bssid bitmap
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline
@@ -1548,8 +1539,6 @@ void wlan_vdev_mlme_set_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev *vdev,
  *
  * API to get the spatial reuse bss color bit map
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline
@@ -1573,8 +1562,6 @@ void wlan_vdev_mlme_get_srg_bss_color_bit_map(struct wlan_objmgr_vdev *vdev,
  *
  * API to get the spatial reuse partial bssid bitmap
  *
- * Caller need to acquire lock with wlan_vdev_obj_lock()
- *
  * Return: void
  */
 static inline void
@@ -1589,13 +1576,154 @@ wlan_vdev_mlme_get_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev *vdev,
 
 	*srg_partial_bssid = vdev_mlme->mgmt.generic.srg_partial_bssid;
 }
+
+/**
+ * wlan_vdev_mlme_get_current_non_srg_pd_threshold() - get current non srg pd
+ * threshold
+ * @vdev: VDEV object
+ * @non_srg_pd_threshold: NON-SRG pd threshold
+ *
+ * API to get non srg pd threshold
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_get_current_non_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
+						int32_t *non_srg_pd_threshold)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme)
+		return;
+
+	*non_srg_pd_threshold =
+		vdev_mlme->mgmt.generic.he_curr_non_srg_pd_threshold;
+}
+
+/**
+ * wlan_vdev_mlme_get_current_srg_pd_threshold() - get current srg pd threshold
+ * @vdev: VDEV object
+ * @srg_pd_threshold: SRG pd threshold
+ *
+ * API to get srg pd threshold
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_get_current_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
+					    int32_t *srg_pd_threshold)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme)
+		return;
+
+	*srg_pd_threshold =
+		vdev_mlme->mgmt.generic.he_curr_srg_pd_threshold;
+}
+
+/**
+ * wlan_vdev_mlme_set_current_non_srg_pd_threshold() - set current non srg pd
+ * threshold
+ * @vdev: VDEV object
+ * @non_srg_pd_threshold: NON-SRG pd threshold
+ *
+ * API to set non srg pd threshold
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_set_current_non_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
+						int32_t non_srg_pd_threshold)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme)
+		return;
+
+	vdev_mlme->mgmt.generic.he_curr_non_srg_pd_threshold =
+						non_srg_pd_threshold;
+}
+
+/**
+ * wlan_vdev_mlme_set_current_srg_pd_threshold() - set current srg pd threshold
+ * @vdev: VDEV object
+ * @srg_pd_threshold: SRG pd threshold
+ *
+ * API to set srg pd threshold
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_set_current_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
+					    int32_t srg_pd_threshold)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme)
+		return;
+	vdev_mlme->mgmt.generic.he_curr_srg_pd_threshold =
+						srg_pd_threshold;
+}
+
+/**
+ * wlan_vdev_mlme_set_pd_threshold_present() - set is PD threshold
+ * present or not.
+ * @vdev: VDEV object
+ * @is_pd_threshold_present: is PD threshold present
+ *
+ * API to set pd threshold present flag
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_set_pd_threshold_present(struct wlan_objmgr_vdev *vdev,
+					bool is_pd_threshold_present)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme)
+		return;
+	vdev_mlme->mgmt.generic.is_pd_threshold_present =
+						is_pd_threshold_present;
+}
+
+/**
+ * wlan_vdev_mlme_get_pd_threshold_present() - get is PD threshold
+ * present or not.
+ * @vdev: VDEV object
+ * @is_pd_threshold_present: is PD threshold present
+ *
+ * API to get pd threshold present flag
+ *
+ * Return: void
+ */
+static inline void
+wlan_vdev_mlme_get_pd_threshold_present(struct wlan_objmgr_vdev *vdev,
+					bool *is_pd_threshold_present)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme) {
+		*is_pd_threshold_present = false;
+		return;
+	}
+	*is_pd_threshold_present =
+			vdev_mlme->mgmt.generic.is_pd_threshold_present;
+}
 #else
 static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
 {
 	return 0;
 }
 
-static inline uint8_t wlan_vdev_mlme_get_pd_offset(
+static inline uint8_t wlan_vdev_mlme_get_non_srg_pd_offset(
 						struct wlan_objmgr_vdev *vdev)
 {
 	return 0;
@@ -1624,8 +1752,9 @@ static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
 {
 }
 
-static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
-						uint8_t pd_max_offset)
+static inline void
+wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
+				     uint8_t non_srg_pd_max_offset)
 {
 }
 

+ 1 - 1
umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h

@@ -35,7 +35,7 @@
 #define NON_SRG_PARAM_VAL_DBM_SIZE 1
 #define NON_SRG_MAX_PD_OFFSET_POS 0
 #define NON_SRG_MAX_PD_OFFSET_SIZE 8
-#define NON_SR_PD_THRESHOLD_MIN -82
+#define SR_PD_THRESHOLD_MIN -82
 #define SRG_SPR_ENABLE_POS 30
 #define SRG_THRESHOLD_MAX_PD_POS 8
 #define NON_SRG_PD_SR_DISALLOWED 0x02

+ 11 - 7
umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c

@@ -404,14 +404,16 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
 			 bool is_sr_enable)
 {
 	uint8_t ap_non_srg_pd_threshold = 0;
-	uint8_t ap_srg_min_pd_threshold_offset, ap_srg_max_pd_threshold_offset;
+	uint8_t ap_srg_min_pd_threshold_offset = 0;
+	uint8_t ap_srg_max_pd_threshold_offset = 0;
 	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)) {
 		ap_non_srg_pd_threshold =
-		wlan_vdev_mlme_get_pd_offset(vdev) + NON_SR_PD_THRESHOLD_MIN;
+			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
@@ -437,19 +439,18 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
 		 */
 		if (srg_pd_threshold &&
 		    srg_pd_threshold < (ap_srg_max_pd_threshold_offset +
-				    NON_SR_PD_THRESHOLD_MIN) &&
+					SR_PD_THRESHOLD_MIN) &&
 		    srg_pd_threshold > (ap_srg_min_pd_threshold_offset +
-				    NON_SR_PD_THRESHOLD_MIN))
+					SR_PD_THRESHOLD_MIN))
 			srg_pd_threshold = srg_pd_threshold +
-				NON_SR_PD_THRESHOLD_MIN;
+					   SR_PD_THRESHOLD_MIN;
 		else
 			srg_pd_threshold = ap_srg_max_pd_threshold_offset +
-				NON_SR_PD_THRESHOLD_MIN;
+						SR_PD_THRESHOLD_MIN;
 
 		/* 30th BIT - Enable/Disable SRG based spatial reuse. */
 		*val |= is_sr_enable << SRG_SPR_ENABLE_POS;
 	}
-
 	/* bit    | purpose
 	 * -----------------
 	 * 0  - 7 | Param Value for non-SRG based Spatial Reuse
@@ -461,5 +462,8 @@ wlan_mlme_update_sr_data(struct wlan_objmgr_vdev *vdev, int *val,
 	*val |=
 		(uint8_t)(srg_pd_threshold << SRG_THRESHOLD_MAX_PD_POS);
 	*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);
+	wlan_vdev_mlme_set_current_srg_pd_threshold(vdev, srg_pd_threshold);
 }
 #endif