Browse Source

qcacld-3.0: Get SAP best channel bandwidth for multi-SAP

For multi-SAP case, after get pcl channel list, also call
wlansap_select_chan_with_best_bandwidth() to get best bandwidth
channel so that don't shrink bandwidth after COEX happen.

For concurrency with STA/P2P mode, don't invoke above function and
take pcl channel as first priority.

Change-Id: Ie211f87728d445aad8d806a1025fb76b4c6dccf0
CRs-Fixed: 3491478
Will Huang 1 year ago
parent
commit
c7ececd18f
1 changed files with 41 additions and 1 deletions
  1. 41 1
      core/sap/src/sap_module.c

+ 41 - 1
core/sap/src/sap_module.c

@@ -3348,8 +3348,18 @@ wlansap_select_chan_with_best_bandwidth(struct sap_context *sap_ctx,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	if (policy_mgr_get_connection_count(mac->psoc) != 1)
+	if (policy_mgr_mode_specific_connection_count(mac->psoc,
+						      PM_STA_MODE,
+						      NULL) ||
+	    policy_mgr_mode_specific_connection_count(mac->psoc,
+						      PM_P2P_CLIENT_MODE,
+						      NULL) ||
+	    policy_mgr_mode_specific_connection_count(mac->psoc,
+						      PM_P2P_GO_MODE,
+						      NULL)) {
+		sap_debug("sta/p2p mode active, skip!");
 		return QDF_STATUS_E_INVAL;
+	}
 
 	pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan,
 				    &unsafe_chan_cnt,
@@ -3509,6 +3519,27 @@ wlansap_get_safe_channel(struct sap_context *sap_ctx,
 	return INVALID_CHANNEL_ID;
 }
 #else
+/**
+ * wlansap_select_chan_with_best_bandwidth() - Select channel with
+ * max possible band width
+ * @sap_ctx: sap context
+ * @ch_freq_list: candidate channel frequency list
+ * @ch_cnt: count of channel frequency in list
+ * @selected_freq: selected channel frequency
+ * @selected_ch_width: selected channel width
+ *
+ * Return: QDF_STATUS_SUCCESS if better channel selected
+ */
+static inline QDF_STATUS
+wlansap_select_chan_with_best_bandwidth(struct sap_context *sap_ctx,
+					uint32_t *ch_freq_list,
+					uint32_t ch_cnt,
+					uint32_t *selected_freq,
+					enum phy_ch_width *selected_ch_width)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 /**
  * wlansap_get_safe_channel() - Get safe channel from current regulatory
  * @sap_ctx: Pointer to SAP context
@@ -3535,6 +3566,7 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx,
 	struct mac_context *mac;
 	struct sir_pcl_list pcl = {0};
 	uint32_t pcl_freqs[NUM_CHANNELS] = {0};
+	uint32_t select_freq;
 	QDF_STATUS status;
 	mac_handle_t mac_handle;
 	uint32_t pcl_len = 0;
@@ -3576,6 +3608,14 @@ wlansap_get_safe_channel_from_pcl_and_acs_range(struct sap_context *sap_ctx,
 			return INVALID_CHANNEL_ID;
 		}
 
+		if (wlansap_select_chan_with_best_bandwidth(sap_ctx,
+							    pcl_freqs,
+							    pcl_len,
+							    &select_freq,
+							    ch_width) ==
+		    QDF_STATUS_SUCCESS)
+			return select_freq;
+
 		if (pcl_len) {
 			sap_debug("select %d from valid ch freq list",
 				  pcl_freqs[0]);