Jelajahi Sumber

qcacld-3.0: Add new API to validate force active cmd

After 3-link association is complete, Host sends force
inactive num command between 5 GHz and 6 GHz links to
firmware. Later, if user wants to force enable 1 or 2
links, the current checks prevent it from taking effect
as a previous force active num is in place and a NO
FORCE command cannot be sent as it is a DBS RD.
So add new API in policy manager to check if the new
force active num command is valid and process accordingly.
All new force active num commands except for 5 GHz +
6 GHz links should be allowed while honoring the prior
force inactive bitmap as well.

CRs-Fixed: 3656412
Change-Id: Iecfca57d9b47acd31d191cca2632a6d1baf62174
Gururaj Pandurangi 1 tahun lalu
induk
melakukan
181340ab64

+ 50 - 4
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -8522,6 +8522,45 @@ policy_mgr_is_restart_sap_required_with_mlo_sta(struct wlan_objmgr_psoc *psoc,
 	return restart_required;
 }
 
+/**
+ * policy_mgr_is_new_force_allowed() - Check if the new force command is allowed
+ * @psoc: PSOC object information
+ * @active_link_bitmap: Active link bitmap
+ * @force_inactive_num_bitmap: Force inactive number bitmap
+ * @force_inactive_num: Number of links to be forced inactive
+ *
+ * If ML STA associates in 3-link (2.4 GHz + 5 GHz + 6 GHz), Host sends force
+ * inactive num command between 5 GHz and 6 GHz links to firmware as it's a DBS
+ * RD. This force has to be in effect at all times but any new force active num
+ * command request from the userspace (except for 5 GHz + 6 GHz links) should be
+ * honored. This API checks if the new force command can be allowed.
+ *
+ * Return: True if the new force command is allowed, else False
+ */
+static bool
+policy_mgr_is_new_force_allowed(struct wlan_objmgr_psoc *psoc,
+				uint32_t active_link_bitmap,
+				uint16_t force_inactive_num_bitmap,
+				uint8_t force_inactive_num)
+{
+	uint32_t link_bitmap = 0;
+	uint8_t link_num = 0;
+
+	link_bitmap = ~active_link_bitmap & force_inactive_num_bitmap;
+	if (force_inactive_num_bitmap) {
+		if (!link_bitmap) {
+			policy_mgr_err("New force bitmap not allowed");
+			return false;
+		}
+		link_num = convert_link_bitmap_to_link_ids(link_bitmap,
+							   0, NULL);
+		if (link_num < force_inactive_num)
+			return false;
+	}
+
+	return true;
+}
+
 void policy_mgr_activate_mlo_links_nlink(struct wlan_objmgr_psoc *psoc,
 					 uint8_t session_id, uint8_t num_links,
 					 struct qdf_mac_addr active_link_addr[2])
@@ -8604,10 +8643,17 @@ void policy_mgr_activate_mlo_links_nlink(struct wlan_objmgr_psoc *psoc,
 		}
 		ml_nlink_get_curr_force_state(psoc, vdev, &curr);
 		if (curr.force_inactive_num || curr.force_active_num) {
-			policy_mgr_debug("force num exists with act %d %d don't enter EMLSR mode",
-					 curr.force_active_num,
-					 curr.force_inactive_num);
-			goto done;
+			if (curr.force_inactive_num) {
+				if (!policy_mgr_is_new_force_allowed(
+						psoc, active_link_bitmap,
+						curr.force_inactive_num_bitmap,
+						curr.force_inactive_num)) {
+					policy_mgr_debug("force num exists with act %d %d don't enter EMLSR mode",
+							 curr.force_active_num,
+							 curr.force_inactive_num);
+				goto done;
+				}
+			}
 		}
 		/* If current force inactive bitmap exists, we have to remove
 		 * the new active bitmap from the existing inactive bitmap,

+ 13 - 0
components/umac/mlme/mlo_mgr/inc/wlan_mlo_link_force.h

@@ -190,6 +190,19 @@ ml_nlink_convert_vdev_bitmap_to_linkid_bitmap(
 				uint32_t *link_bitmap,
 				uint32_t *associated_bitmap);
 
+/**
+ * convert_link_bitmap_to_link_ids() - Convert link bitmap to link ids
+ * @link_bitmap: PSOC object information
+ * @link_id_sz: link_ids array size
+ * @link_ids: link id array
+ *
+ * Return: num of link id in link_ids array converted from link bitmap
+ */
+uint32_t
+convert_link_bitmap_to_link_ids(uint32_t link_bitmap,
+				uint8_t link_id_sz,
+				uint8_t *link_ids);
+
 /**
  * ml_nlink_convert_link_bitmap_to_ids() - convert link bitmap
  * to link ids

+ 1 - 9
components/umac/mlme/mlo_mgr/src/wlan_mlo_link_force.c

@@ -669,15 +669,7 @@ static void ml_nlink_get_link_info(struct wlan_objmgr_psoc *psoc,
 	*ml_link_bitmap = link_bitmap;
 }
 
-/**
- * convert_link_bitmap_to_link_ids() - Convert link bitmap to link ids
- * @link_bitmap: PSOC object information
- * @link_id_sz: link_ids array size
- * @link_ids: link id array
- *
- * Return: num of link id in link_ids array converted from link bitmap
- */
-static uint32_t
+uint32_t
 convert_link_bitmap_to_link_ids(uint32_t link_bitmap,
 				uint8_t link_id_sz,
 				uint8_t *link_ids)