Przeglądaj źródła

qcacld-3.0: Trim scan channel list

As requirement, concurrent mode, station 5G/2G scan need stop when
AP connected by peer station.

Condition:
STA + AP 5G (connected) + AP 2.4G	skip 5G scan
STA + AP 5G (connected)			skip 5G scan
STA + AP 2.4G (connected && 2.4G only)	skip 2.4G scan
Others concurrency			skip none

Add API policy_mgr_scan_trim_chnls_for_connected_ap() to check if
need trim scan channel list. Which channel list need be trimmed.

Change-Id: I21da69fad617a6f342b9d902bf5b9d326ee1e11c
CRs-Fixed: 3075065
Yu Ouyang 3 lat temu
rodzic
commit
bcffed6ac2

+ 26 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -173,6 +173,18 @@ static inline const char *device_mode_to_string(uint32_t idx)
 	}
 };
 
+/**
+ * trim_chan_info - trim channel info
+ * @band_capability: band capability
+ * @sap_count: sap count
+ * @trim: enum trim channel list
+ */
+struct trim_chan_info {
+	uint32_t band_capability;
+	uint32_t sap_count;
+	uint16_t trim;
+};
+
 /**
  * policy_mgr_get_allow_mcc_go_diff_bi() - to get information on whether GO
  *						can have diff BI than STA in MCC
@@ -3580,6 +3592,20 @@ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc);
  */
 bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * policy_mgr_scan_trim_chnls_for_connected_ap() - check if sta scan
+ * should skip 5g or 2.4g channel when AP/GO connected by clients.
+ * STA + AP 5G (connected) + AP 2.4G		skip 5G scan
+ * STA + AP 5G (connected)			skip 5G scan
+ * STA + AP 2.4G (connected && 2.4G only)	skip 2.4G scan
+ *
+ * @pdev: pointer to pdev
+ *
+ * Return: trim_channel_list
+ */
+uint16_t
+policy_mgr_scan_trim_chnls_for_connected_ap(struct wlan_objmgr_pdev *pdev);
+
 /**
  * policy_mgr_is_hwmode_set_for_given_chnl() - to check for given channel
  * if the hw mode is properly set.

+ 74 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -4755,6 +4755,80 @@ bool policy_mgr_scan_trim_5g_chnls_for_dfs_ap(struct wlan_objmgr_psoc *psoc)
 	return true;
 }
 
+static void
+policy_mgr_fill_trim_chan(struct wlan_objmgr_pdev *pdev,
+			  void *object, void *arg)
+{
+	struct wlan_objmgr_vdev *vdev = object;
+	struct trim_chan_info *trim_info = arg;
+	uint16_t sap_peer_count = 0;
+	qdf_freq_t chan_freq;
+
+	if (wlan_vdev_mlme_get_opmode(vdev) != QDF_SAP_MODE)
+		return;
+
+	if (wlan_vdev_is_up(vdev) != QDF_STATUS_SUCCESS)
+		return;
+
+	sap_peer_count = wlan_vdev_get_peer_count(vdev);
+	policy_mgr_debug("vdev %d - peer count %d",
+			 wlan_vdev_get_id(vdev), sap_peer_count);
+	if (sap_peer_count <= 1)
+		return;
+
+	chan_freq = wlan_get_operation_chan_freq(vdev);
+	if (!chan_freq)
+		return;
+
+	if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq)) {
+		trim_info->trim |= TRIM_CHANNEL_LIST_5G;
+	} else if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq)) {
+		if (trim_info->sap_count != 1)
+			return;
+
+		if ((trim_info->band_capability & BIT(REG_BAND_5G)) ==
+		     BIT(REG_BAND_5G))
+			return;
+
+		trim_info->trim |= TRIM_CHANNEL_LIST_24G;
+	}
+}
+
+uint16_t
+policy_mgr_scan_trim_chnls_for_connected_ap(struct wlan_objmgr_pdev *pdev)
+{
+	struct trim_chan_info trim_info;
+	struct wlan_objmgr_psoc *psoc;
+	QDF_STATUS status;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc)
+		return TRIM_CHANNEL_LIST_NONE;
+
+	status = wlan_mlme_get_band_capability(psoc,
+					       &trim_info.band_capability);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		policy_mgr_err("Could not get band capability");
+		return TRIM_CHANNEL_LIST_NONE;
+	}
+
+	trim_info.sap_count = policy_mgr_mode_specific_connection_count(psoc,
+							PM_SAP_MODE, NULL);
+	if (!trim_info.sap_count)
+		return TRIM_CHANNEL_LIST_NONE;
+
+	trim_info.trim = TRIM_CHANNEL_LIST_NONE;
+
+	wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP,
+					  policy_mgr_fill_trim_chan, &trim_info,
+					  0, WLAN_POLICY_MGR_ID);
+	policy_mgr_debug("band_capability %d, sap_count %d, trim %d",
+			 trim_info.band_capability, trim_info.sap_count,
+			 trim_info.trim);
+
+	return trim_info.trim;
+}
+
 QDF_STATUS policy_mgr_get_nss_for_vdev(struct wlan_objmgr_psoc *psoc,
 				enum policy_mgr_con_mode mode,
 				uint8_t *nss_2g, uint8_t *nss_5g)