Browse Source

qcacld-3.0: Set SMM if all new/existing conns are in same band

When the device is in DBS mode, and STA session gets
disconnected, then the dbs_opportunistic_timer is started
to wait for 10s and then sets back to SMM (Single MAC
mode) after timeout if DBS mode is not required.

The enhancement is to check the if the device is in DBS mode
and the STA session disconnects and new STA session starts in
the band in which existing connection are there, then stop the
dbs_opportunistic_timer and set hw_mode to SMM.

Change-Id: I16bfbb5135e36f2ab87bd09244d5eb6932846c72
CRs-Fixed: 1077488
Nitesh Shah 8 năm trước cách đây
mục cha
commit
044fd675f5

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

@@ -852,6 +852,7 @@ QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight);
 QDF_STATUS cds_set_hw_mode_on_channel_switch(uint8_t session_id);
 void cds_set_do_hw_mode_change_flag(bool flag);
 bool cds_is_hw_mode_change_after_vdev_up(void);
+void cds_checkn_update_hw_mode_single_mac_mode(uint8_t channel);
 void cds_dump_connection_status_info(void);
 uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode,
 						uint32_t *list);

+ 39 - 0
core/cds/src/cds_concurrency.c

@@ -9116,6 +9116,45 @@ uint8_t cds_get_mcc_operating_channel(uint8_t session_id)
 	return chan;
 }
 
+/**
+ * cds_checkn_update_hw_mode_single_mac_mode() - Set hw_mode to SMM
+ * if required
+ * @channel: channel number for the new STA connection
+ *
+ * After the STA disconnection, if the hw_mode is in DBS and the new STA
+ * connection is coming in the band in which existing connections are
+ * present, then this function stops the dbs opportunistic timer and sets
+ * the hw_mode to Single MAC mode (SMM).
+ *
+ * Return: None
+ */
+void cds_checkn_update_hw_mode_single_mac_mode(uint8_t channel)
+{
+	uint8_t i;
+	cds_context_type *cds_ctx;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
+	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
+		if (conc_connection_list[i].in_use)
+			if (!CDS_IS_SAME_BAND_CHANNELS(channel,
+				conc_connection_list[i].chan)) {
+				cds_info("DBS required");
+				return;
+			}
+	}
+
+	if (QDF_TIMER_STATE_RUNNING ==
+		cds_ctx->dbs_opportunistic_timer.state)
+		qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer);
+
+	cds_dbs_opportunistic_timer_handler((void *)cds_ctx);
+}
+
 /**
  * cds_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change
  * @flag: Indicate if hw mode change is required or not

+ 17 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -11166,6 +11166,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 	tCsrRoamProfile *pRoamProfile;
 	eCsrAuthType RSNAuthType;
 	tSmeConfigParams *sme_config;
+	uint8_t channel = 0;
+	struct sir_hw_mode_params hw_mode;
 
 	ENTER();
 
@@ -11458,6 +11460,21 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 		pRoamProfile->ChannelInfo.ChannelList = NULL;
 		pRoamProfile->ChannelInfo.numOfChannels = 0;
 
+		if (!QDF_IS_STATUS_SUCCESS(
+				wma_get_current_hw_mode(&hw_mode))) {
+			hdd_err("wma_get_current_hw_mode failed");
+			return status;
+		}
+
+		if ((QDF_STA_MODE == pAdapter->device_mode)
+		    && hw_mode.dbs_cap) {
+			cds_get_channel_from_scan_result(pAdapter,
+					pRoamProfile, &channel);
+			if (channel)
+				cds_checkn_update_hw_mode_single_mac_mode
+					(channel);
+		}
+
 	} else {
 		hdd_err("No valid Roam profile");
 		return -EINVAL;