Przeglądaj źródła

qcacld-3.0: Add logic to force SCC in SAP+STA concurrency

If SAP is up & STA comes up or moves to a DFS or passive or LTE
unsafe channel that causes MCC, move SAP to the other band if DBS
is supported. This logic is enabled only if gWlanMccToSccSwitchMode
is non zero.

Change-Id: I56f78dfaedec31c4c41aea6ac8c66261c9ad4c91
CRs-Fixed: 2063060
Tushnim Bhattacharyya 7 lat temu
rodzic
commit
ed678f97ae
2 zmienionych plików z 44 dodań i 4 usunięć
  1. 1 0
      core/cds/inc/cds_utils.h
  2. 43 4
      core/hdd/src/wlan_hdd_hostapd.c

+ 1 - 0
core/cds/inc/cds_utils.h

@@ -56,6 +56,7 @@
 #define CDS_24_GHZ_BASE_FREQ   (2407)
 #define CDS_5_GHZ_BASE_FREQ    (5000)
 #define CDS_24_GHZ_CHANNEL_6   (6)
+#define CDS_5_GHZ_CHANNEL_36   (36)
 #define CDS_24_GHZ_CHANNEL_14  (14)
 #define CDS_24_GHZ_CHANNEL_15  (15)
 #define CDS_24_GHZ_CHANNEL_27  (27)

+ 43 - 4
core/hdd/src/wlan_hdd_hostapd.c

@@ -2701,7 +2701,8 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 	hdd_ap_ctx_t *hdd_ap_ctx;
 	uint16_t intf_ch = 0;
 	struct hdd_context *hdd_ctx;
-
+	hdd_station_ctx_t *hdd_sta_ctx;
+	hdd_adapter_t *sta_adapter;
 	hdd_adapter_t *ap_adapter = wlan_hdd_get_adapter_from_vdev(
 					psoc, vdev_id);
 	if (!ap_adapter) {
@@ -2709,6 +2710,19 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/* TODO: need work for 3 port case with sta+sta */
+	sta_adapter = hdd_get_adapter(hdd_ctx, QDF_STA_MODE);
+	if (!sta_adapter) {
+		hdd_err("Adapter is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (NULL == channel || NULL == sec_ch) {
 		hdd_err("Null parameters");
 	}
@@ -2718,19 +2732,44 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter);
 	hal_handle = WLAN_HDD_GET_HAL_CTX(ap_adapter);
+	hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter);
 
 	if (!hal_handle)
 		return QDF_STATUS_E_FAILURE;
 
-	intf_ch = wlansap_check_cc_intf(hdd_ap_ctx->sapContext);
-	hdd_info("intf_ch: %d", intf_ch);
+	/*
+	 * Check if STA's channel is DFS or passive or part of LTE avoided
+	 * channel list. In that case move SAP to other band if DBS is
+	 * supported, return from here if DBS is not supported.
+	 * Need to take care of 3 port cases with 2 STA iface in future.
+	 */
+	if (wlan_reg_is_dfs_ch(hdd_ctx->hdd_pdev,
+		hdd_sta_ctx->conn_info.operationChannel) ||
+		wlan_reg_is_passive_or_disable_ch(hdd_ctx->hdd_pdev,
+			hdd_sta_ctx->conn_info.operationChannel) ||
+		!policy_mgr_is_safe_channel(psoc,
+			hdd_sta_ctx->conn_info.operationChannel)) {
+		if (policy_mgr_is_hw_dbs_capable(psoc)) {
+			if (WLAN_REG_IS_5GHZ_CH(
+				hdd_sta_ctx->conn_info.operationChannel))
+				intf_ch = CDS_24_GHZ_CHANNEL_6;
+			else
+				intf_ch = CDS_5_GHZ_CHANNEL_36;
+		} else {
+			hdd_debug("can't move sap to %d",
+				hdd_sta_ctx->conn_info.operationChannel);
+			return QDF_STATUS_E_FAILURE;
+		}
+	} else {
+		intf_ch = wlansap_check_cc_intf(hdd_ap_ctx->sapContext);
+		hdd_info("intf_ch: %d", intf_ch);
+	}
 
 	if (intf_ch == 0) {
 		hdd_err("interface channel is 0");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
 	hdd_info("SAP restart orig chan: %d, new chan: %d",
 		 hdd_ap_ctx->sapConfig.channel, intf_ch);
 	hdd_ap_ctx->sapConfig.channel = intf_ch;