Browse Source

qcacld-3.0: Enable roaming on both STAs in primary iface usecase

set_primary_vdev usecase in STA+STA concurrency is to use that
interface(e.g. wlan0) over the other interface(i.e. wlan1) for
data transfer.
Non-primary vdev use case is to check the quality of that link
and decide if data can be switched to it and make it primary.
It may get disabled if it's not going to become primary STA after
measuring the link quality for sometime or with few APs.

Enable roaming on non-primary vdev also to find better AP.

Change-Id: I3205f1ee1b7da4aa813955308730949ccc70941f
CRs-Fixed: 3219633
Srinivas Dasari 2 years ago
parent
commit
7c1083a4ba

+ 12 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -1106,6 +1106,18 @@ QDF_STATUS wlan_mlme_set_primary_interface(struct wlan_objmgr_psoc *psoc,
  */
 QDF_STATUS wlan_mlme_set_default_primary_iface(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * wlan_mlme_is_primary_interface_configured() - Check if primary iface is set
+ * @psoc: pointer to psoc object
+ *
+ * Check if primary iface is configured from userspace through vendor command.
+ * Return true if it's configured. If it's not configured, default value would
+ * be 0xFF and return false then.
+ *
+ * Return: True or False
+ */
+bool wlan_mlme_is_primary_interface_configured(struct wlan_objmgr_psoc *psoc);
+
 /**
  * wlan_mlme_get_mcc_duty_cycle_percentage() - Get primary STA iface duty
  * cycle percentage

+ 9 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -2651,6 +2651,15 @@ QDF_STATUS wlan_mlme_set_primary_interface(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+bool wlan_mlme_is_primary_interface_configured(struct wlan_objmgr_psoc *psoc)
+{
+	uint8_t dual_sta_config = 0xFF;
+
+	wlan_mlme_get_dual_sta_policy(psoc, &dual_sta_config);
+	return (dual_sta_config ==
+		QCA_WLAN_CONCURRENT_STA_POLICY_PREFER_PRIMARY);
+}
+
 int wlan_mlme_get_mcc_duty_cycle_percentage(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_objmgr_psoc *psoc = NULL;

+ 21 - 10
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -3644,7 +3644,6 @@ cm_roam_switch_to_init(struct wlan_objmgr_pdev *pdev,
 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
 	struct dual_sta_policy *dual_sta_policy;
 	struct wlan_objmgr_vdev *vdev;
-	bool is_vdev_primary = false;
 
 	if (!psoc)
 		return QDF_STATUS_E_FAILURE;
@@ -3679,6 +3678,23 @@ cm_roam_switch_to_init(struct wlan_objmgr_pdev *pdev,
 			mlme_info("STA + STA concurrency is in DBS");
 			break;
 		}
+
+		/*
+		 * set_primary_vdev usecase is to use that
+		 * interface(e.g. wlan0) over the other
+		 * interface(i.e. wlan1) for data transfer. Non-primary
+		 * vdev use case is to check the quality of that link
+		 * and decide if data can be switched to it and make it
+		 * primary.
+		 * Enabling roaming on non-primary vdev also in this
+		 * context would always helps to find better AP.
+		 */
+		if (wlan_mlme_is_primary_interface_configured(psoc) &&
+		    (reason != REASON_SUPPLICANT_INIT_ROAMING)) {
+			mlme_info("STA + STA concurrency with a primary iface, have roaming enabled on both interfaces");
+			break;
+		}
+
 		/*
 		 * Disable roaming on the enabled sta if supplicant wants to
 		 * enable roaming on this vdev id
@@ -3694,19 +3710,14 @@ cm_roam_switch_to_init(struct wlan_objmgr_pdev *pdev,
 			 * vdev id if it is not an explicit enable from
 			 * supplicant.
 			 */
-			mlme_debug("Interface vdev_id: %d, roaming enabled on vdev_id: %d, primary vdev_id:%d, reason:%d",
+			mlme_debug("Interface vdev_id: %d, roaming enabled on vdev_id: %d, reason:%d",
 				   vdev_id, temp_vdev_id,
-				   dual_sta_policy->primary_vdev_id, reason);
-
-			if (vdev_id == dual_sta_policy->primary_vdev_id)
-				is_vdev_primary = true;
+				   reason);
 
-			if (is_vdev_primary ||
-			    reason == REASON_SUPPLICANT_INIT_ROAMING) {
+			if (reason == REASON_SUPPLICANT_INIT_ROAMING) {
 				cm_roam_state_change(pdev, temp_vdev_id,
 						     WLAN_ROAM_DEINIT,
-						     is_vdev_primary ?
-					     REASON_ROAM_SET_PRIMARY : reason,
+						     reason,
 						     NULL, false);
 			} else {
 				mlme_info("CM_RSO: Roam module already initialized on vdev:[%d]",