ソースを参照

Revert "qcacld-3.0: Use system time instead of jiffies for BSS received time"

This reverts Change-Id Ia14b84f1039dc4ffec6ad63550fed21e932f8012

It was observed that in some scenarios scan results are not showing up
in the UI in a timely manner. The speculation is that not all code was
converted that needs to be converted. So revert this change for now
with the expectation that a complete change will be forthcoming. This
means that until a revised change is supplied that the original issue
of scan result aging may again be present.

Change-Id: I38d975fd9927493e81f4008b429abcae90af4fa9
CRs-Fixed: 1083225
(cherry picked from commit f40cf74d38bf630930325c6e9b703746bee107cc)
Jeff Johnson 8 年 前
コミット
feb22898cb

+ 2 - 2
core/hdd/inc/wlan_hdd_main.h

@@ -1070,10 +1070,10 @@ struct hdd_adapter_s {
 	int temperature;
 
 	/* Time stamp for last completed RoC request */
-	uint64_t last_roc_ts;
+	unsigned long last_roc_ts;
 
 	/* Time stamp for start RoC request */
-	uint64_t start_roc_ts;
+	unsigned long start_roc_ts;
 
 	/* State for synchronous OCB requests to WMI */
 	struct sir_ocb_set_config_response ocb_set_config_resp;

+ 2 - 8
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10673,14 +10673,8 @@ struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter,
 	qie_age->oui_2 = QCOM_OUI2;
 	qie_age->oui_3 = QCOM_OUI3;
 	qie_age->type = QCOM_VENDOR_IE_AGE_TYPE;
-	/*
-	 * Lowi expects the timestamp of bss in units of 1/10 ms. In driver
-	 * all bss related timestamp is in units of ms. Due to this when scan
-	 * results are sent to lowi the scan age is high.To address this,
-	 * send age in units of 1/10 ms.
-	 */
 	qie_age->age =
-		(qdf_mc_timer_get_system_time() - bss_desc->received_time)/10;
+		qdf_mc_timer_get_system_ticks() - bss_desc->nReceivedTime;
 	qie_age->tsf_delta = bss_desc->tsf_delta;
 	memcpy(&qie_age->beacon_tsf, bss_desc->timeStamp,
 	       sizeof(qie_age->beacon_tsf));
@@ -10854,7 +10848,7 @@ int wlan_hdd_cfg80211_update_bss(struct wiphy *wiphy,
 		 */
 		if ((scan_time == 0) ||
 			(scan_time <
-				pScanResult->BssDescriptor.received_time)) {
+				pScanResult->BssDescriptor.nReceivedTime)) {
 			bss_status =
 				wlan_hdd_cfg80211_inform_bss_frame(pAdapter,
 						&pScanResult->BssDescriptor);

+ 3 - 3
core/hdd/src/wlan_hdd_ipa.c

@@ -362,7 +362,7 @@ static uint8_t vdev_to_iface[CSR_ROAM_SESSION_MAX];
  * @rx_destructor_call: IPA Rx packet destructor count
  */
 struct uc_rt_debug_info {
-	uint64_t time;
+	unsigned long time;
 	uint64_t ipa_excep_count;
 	uint64_t rx_drop_count;
 	uint64_t net_sent_count;
@@ -726,7 +726,7 @@ static void hdd_ipa_uc_rt_debug_host_fill(void *ctext)
 	dump_info = &hdd_ipa->rt_bug_buffer[
 		hdd_ipa->rt_buf_fill_index % HDD_IPA_UC_RT_DEBUG_BUF_COUNT];
 
-	dump_info->time = (uint64_t)qdf_mc_timer_get_system_time();
+	dump_info->time = qdf_mc_timer_get_system_time();
 	dump_info->ipa_excep_count = hdd_ipa->stats.num_rx_excep;
 	dump_info->rx_drop_count = hdd_ipa->ipa_rx_internel_drop_count;
 	dump_info->net_sent_count = hdd_ipa->ipa_rx_net_send_count;
@@ -779,7 +779,7 @@ void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx)
 			HDD_IPA_UC_RT_DEBUG_BUF_COUNT;
 		dump_info = &hdd_ipa->rt_bug_buffer[dump_index];
 		HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR,
-			"%12llu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu\n",
+			"%12lu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu:%10llu\n",
 			dump_info->time, dump_info->ipa_excep_count,
 			dump_info->rx_drop_count, dump_info->net_sent_count,
 			dump_info->tx_mcbc_count, dump_info->tx_fwd_count,

+ 4 - 6
core/hdd/src/wlan_hdd_p2p.c

@@ -215,8 +215,7 @@ QDF_STATUS wlan_hdd_remain_on_channel_callback(tHalHandle hHal, void *pCtx,
 			cookie,
 			&pRemainChanCtx->chan,
 			GFP_KERNEL);
-		pAdapter->last_roc_ts =
-			(uint64_t)qdf_mc_timer_get_system_time();
+		pAdapter->last_roc_ts = qdf_mc_timer_get_system_time();
 	}
 
 	/* Schedule any pending RoC: Any new roc request during this time
@@ -840,7 +839,7 @@ static int wlan_hdd_request_remain_on_channel(struct wiphy *wiphy,
 			hdd_conn_is_connected(
 				WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter))) {
 			if (pAdapter->last_roc_ts != 0 &&
-				(((uint64_t)qdf_mc_timer_get_system_time() -
+				((qdf_mc_timer_get_system_time() -
 					 pAdapter->last_roc_ts) <
 				pHddCtx->config->p2p_listen_defer_interval)) {
 			if (pRemainChanCtx->duration > HDD_P2P_MAX_ROC_DURATION)
@@ -961,7 +960,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter,
 	cfgState = WLAN_HDD_GET_CFG_STATE_PTR(pAdapter);
 	hdd_notice("Ready on chan ind %d", scan_id);
 
-	pAdapter->start_roc_ts = (uint64_t)qdf_mc_timer_get_system_time();
+	pAdapter->start_roc_ts = qdf_mc_timer_get_system_time();
 	mutex_lock(&cfgState->remain_on_chan_ctx_lock);
 	pRemainChanCtx = cfgState->remain_on_chan_ctx;
 	if (pRemainChanCtx != NULL) {
@@ -1270,8 +1269,7 @@ static int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 		mutex_lock(&cfgState->remain_on_chan_ctx_lock);
 		if (cfgState->remain_on_chan_ctx) {
 
-			uint64_t current_time =
-				(uint64_t)qdf_mc_timer_get_system_time();
+			uint32_t current_time = qdf_mc_timer_get_system_time();
 			int remaining_roc_time =
 				((int) cfgState->remain_on_chan_ctx->duration -
 				(current_time - pAdapter->start_roc_ts));

+ 3 - 3
core/hdd/src/wlan_hdd_scan.c

@@ -482,9 +482,9 @@ static int hdd_indicate_scan_result(hdd_scan_info_t *scanInfo,
 	/* AGE */
 	event.cmd = IWEVCUSTOM;
 	p = custom;
-	p += scnprintf(p, MAX_CUSTOM_LEN, " Age: %llu",
-		       qdf_mc_timer_get_system_time() -
-		       descriptor->received_time);
+	p += scnprintf(p, MAX_CUSTOM_LEN, " Age: %lu",
+		       qdf_mc_timer_get_system_ticks() -
+		       descriptor->nReceivedTime);
 	event.u.data.length = p - custom;
 	current_event = iwe_stream_add_point(scanInfo->info, current_event, end,
 					     &event, custom);

+ 2 - 2
core/mac/inc/sir_api.h

@@ -724,8 +724,8 @@ typedef struct sSirBssDescription {
 	/* used only in scan case. */
 	uint8_t channelIdSelf;
 	uint8_t sSirBssDescriptionRsvd[3];
-	/* Based on system time, not a relative time. */
-	uint64_t received_time;
+	/* base on a tick count. It is a time stamp, not a relative time. */
+	uint32_t nReceivedTime;
 	uint32_t parentTSF;
 	uint32_t startTSF[2];
 	uint8_t mdiePresent;

+ 2 - 2
core/mac/src/pe/lim/lim_api.c

@@ -1868,8 +1868,8 @@ lim_roam_fill_bss_descr(tpAniSirGlobal pMac,
 	qdf_mem_copy((uint8_t *) &bss_desc_ptr->bssId,
 			(uint8_t *) mac_hdr->bssId,
 			sizeof(tSirMacAddr));
-	bss_desc_ptr->received_time =
-		      (uint64_t)qdf_mc_timer_get_system_time();
+	bss_desc_ptr->nReceivedTime =
+		(uint32_t)qdf_mc_timer_get_system_ticks();
 	if (parsed_frm_ptr->mdiePresent) {
 		bss_desc_ptr->mdiePresent = parsed_frm_ptr->mdiePresent;
 		qdf_mem_copy((uint8_t *)bss_desc_ptr->mdie,

+ 4 - 4
core/mac/src/pe/lim/lim_p2p.c

@@ -173,11 +173,11 @@ void lim_process_insert_single_shot_noa_timeout(tpAniSirGlobal pMac)
  *------------------------------------------------------------------*/
 void lim_convert_active_channel_to_passive_channel(tpAniSirGlobal pMac)
 {
-	uint64_t currentTime;
-	uint64_t lastTime = 0;
-	uint64_t timeDiff;
+	uint32_t currentTime;
+	uint32_t lastTime = 0;
+	uint32_t timeDiff;
 	uint8_t i;
-	currentTime = (uint64_t)qdf_mc_timer_get_system_time();
+	currentTime = qdf_mc_timer_get_system_time();
 	for (i = 1; i < SIR_MAX_24G_5G_CHANNEL_RANGE; i++) {
 		if ((pMac->lim.dfschannelList.timeStamp[i]) != 0) {
 			lastTime = pMac->lim.dfschannelList.timeStamp[i];

+ 3 - 3
core/mac/src/pe/lim/lim_scan_result_utils.c

@@ -177,14 +177,14 @@ lim_collect_bss_description(tpAniSirGlobal pMac,
 		MAC_ADDR_ARRAY(pHdr->bssId), pBssDescr->rssi,
 		pBssDescr->rssi_raw);
 
-	pBssDescr->received_time = (uint64_t)qdf_mc_timer_get_system_time();
+	pBssDescr->nReceivedTime = (uint32_t) qdf_mc_timer_get_system_ticks();
 	pBssDescr->tsf_delta = WMA_GET_RX_TSF_DELTA(pRxPacketInfo);
 	pBssDescr->seq_ctrl = pHdr->seqControl;
 
 	lim_log(pMac, LOG1,
-		  FL("BSSID: "MAC_ADDRESS_STR " tsf_delta = %u ReceivedTime = %llu ssid = %s"),
+		  FL("BSSID: "MAC_ADDRESS_STR " tsf_delta = %u ReceivedTime = %u ssid = %s"),
 		  MAC_ADDR_ARRAY(pHdr->bssId), pBssDescr->tsf_delta,
-		  pBssDescr->received_time,
+		  pBssDescr->nReceivedTime,
 		  ((pBPR->ssidPresent) ? (char *)pBPR->ssId.ssId : ""));
 
 	lim_log(pMac, LOG1, FL("Seq Ctrl: Frag Num: %d, Seq Num: LO:%02x HI:%02x"),

+ 21 - 19
core/sme/src/csr/csr_api_scan.c

@@ -2851,8 +2851,8 @@ static void csr_purge_old_scan_results(tpAniSirGlobal mac_ctx)
 {
 	tListElem *pentry, *tmp_entry;
 	tCsrScanResult *presult, *oldest_bss = NULL;
-	uint64_t oldest_entry = 0;
-	uint64_t curr_time = (uint64_t)qdf_mc_timer_get_system_time();
+	uint32_t oldest_entry = 0;
+	uint32_t curr_time = qdf_mc_timer_get_system_ticks();
 
 	csr_ll_unlock(&mac_ctx->scan.scanResultList);
 	pentry = csr_ll_peek_head(&mac_ctx->scan.scanResultList,
@@ -2861,10 +2861,10 @@ static void csr_purge_old_scan_results(tpAniSirGlobal mac_ctx)
 		tmp_entry = csr_ll_next(&mac_ctx->scan.scanResultList, pentry,
 			LL_ACCESS_NOLOCK);
 		presult = GET_BASE_ADDR(pentry, tCsrScanResult, Link);
-		if ((curr_time - presult->Result.BssDescriptor.received_time) >
+		if ((curr_time - presult->Result.BssDescriptor.nReceivedTime) >
 		     oldest_entry) {
 			oldest_entry = curr_time -
-				presult->Result.BssDescriptor.received_time;
+				presult->Result.BssDescriptor.nReceivedTime;
 			oldest_bss = presult;
 		}
 		pentry = tmp_entry;
@@ -2874,9 +2874,9 @@ static void csr_purge_old_scan_results(tpAniSirGlobal mac_ctx)
 		if (csr_ll_remove_entry(&mac_ctx->scan.scanResultList,
 		    &oldest_bss->Link, LL_ACCESS_NOLOCK)) {
 			sms_log(mac_ctx, LOG1,
-				FL("Current time delta (%llu) of BSSID to be removed" MAC_ADDRESS_STR),
+				FL("Current time delta (%d) of BSSID to be removed" MAC_ADDRESS_STR),
 				(curr_time -
-				oldest_bss->Result.BssDescriptor.received_time),
+				oldest_bss->Result.BssDescriptor.nReceivedTime),
 				MAC_ADDR_ARRAY(
 				oldest_bss->Result.BssDescriptor.bssId));
 			csr_free_scan_result_entry(mac_ctx, oldest_bss);
@@ -2954,9 +2954,8 @@ csr_remove_from_tmp_list(tpAniSirGlobal mac_ctx,
 			 * hidden ssid from the profile i.e., forget the SSID
 			 * via GUI that SSID shouldn't see in the profile
 			 */
-			uint64_t time_gap =
-				(uint64_t)qdf_mc_timer_get_system_time() -
-									 timer;
+			unsigned long time_gap = qdf_mc_timer_get_system_time() -
+									timer;
 			if ((0 == bss_dscp->Result.ssId.length)
 			    && (time_gap <= HIDDEN_TIMER)
 			    && tmpSsid.length) {
@@ -3090,7 +3089,7 @@ tCsrScanResult *csr_scan_append_bss_description(tpAniSirGlobal pMac,
 			 * hidden ssid from the profile i.e., forget the SSID
 			 * via GUI that SSID shouldn't see in the profile
 			 */
-			if (((uint64_t)qdf_mc_timer_get_system_time() - timer) <=
+			if ((qdf_mc_timer_get_system_time() - timer) <=
 			    HIDDEN_TIMER) {
 				pCsrBssDescription->Result.ssId = tmpSsid;
 				pCsrBssDescription->Result.timer = timer;
@@ -4875,8 +4874,8 @@ static bool csr_scan_age_out_bss(tpAniSirGlobal pMac, tCsrScanResult *pResult)
 			FL("Connected BSS, Set Aging Count=%d for BSS "
 			   MAC_ADDRESS_STR), pResult->AgingCount,
 			MAC_ADDR_ARRAY(pResult->Result.BssDescriptor.bssId));
-		pResult->Result.BssDescriptor.received_time =
-			(uint64_t)qdf_mc_timer_get_system_time();
+		pResult->Result.BssDescriptor.nReceivedTime =
+			(uint32_t) qdf_mc_timer_get_system_ticks();
 		return fRet;
 	}
 	/*
@@ -5927,20 +5926,23 @@ static void csr_purge_scan_result_by_age(void *pv)
 	tpAniSirGlobal mac_ctx = PMAC_STRUCT(pv);
 	tListElem *entry, *tmp_entry;
 	tCsrScanResult *result;
-	uint64_t ageout_time =
-		mac_ctx->scan.scanResultCfgAgingTime * SYSTEM_TIME_SEC_TO_MSEC;
-	uint64_t cur_time = qdf_mc_timer_get_system_time();
+	unsigned long ageout_time =
+		mac_ctx->scan.scanResultCfgAgingTime * QDF_TICKS_PER_SECOND/10;
+	unsigned long cur_time =  qdf_mc_timer_get_system_ticks();
 	uint8_t *bssId;
 
 	csr_ll_lock(&mac_ctx->scan.scanResultList);
 	entry = csr_ll_peek_head(&mac_ctx->scan.scanResultList, LL_ACCESS_NOLOCK);
-	sms_log(mac_ctx, LOG1, FL(" Ageout time=%llu"), ageout_time);
+	sms_log(mac_ctx, LOG1, FL(" Ageout time=%ld"), ageout_time);
 	while (entry) {
 		tmp_entry = csr_ll_next(&mac_ctx->scan.scanResultList, entry,
 					LL_ACCESS_NOLOCK);
 		result = GET_BASE_ADDR(entry, tCsrScanResult, Link);
-
-		if ((cur_time - result->Result.BssDescriptor.received_time) >
+		/*
+		 * qdf_mc_timer_get_system_ticks() returns in 10ms interval.
+		 * so ageout time value also updated to 10ms interval value.
+		 */
+		if ((cur_time - result->Result.BssDescriptor.nReceivedTime) >
 			    ageout_time) {
 			bssId = result->Result.BssDescriptor.bssId;
 			sms_log(mac_ctx, LOGW,
@@ -7061,7 +7063,7 @@ QDF_STATUS csr_scan_save_preferred_network_found(tpAniSirGlobal pMac,
 	pBssDescr->capabilityInfo = *((uint16_t *)&parsed_frm->capabilityInfo);
 	qdf_mem_copy((uint8_t *) &pBssDescr->bssId,
 		     (uint8_t *) macHeader->bssId, sizeof(tSirMacAddr));
-	pBssDescr->received_time = (uint64_t)qdf_mc_timer_get_system_time();
+	pBssDescr->nReceivedTime = (uint32_t) qdf_mc_timer_get_system_ticks();
 	sms_log(pMac, LOG2, FL("Bssid= "MAC_ADDRESS_STR" chan= %d, rssi = %d"),
 		MAC_ADDR_ARRAY(pBssDescr->bssId), pBssDescr->channelId,
 		pBssDescr->rssi);

+ 6 - 5
core/sme/src/csr/csr_host_scan_roam.c

@@ -149,7 +149,9 @@ void csr_neighbor_roam_process_scan_results(tpAniSirGlobal mac_ctx,
 	tpCsrNeighborRoamControlInfo n_roam_info =
 		&mac_ctx->roam.neighborRoamInfo[sessionid];
 	tpCsrNeighborRoamBSSInfo bss_info;
-	uint64_t age = 0;
+	uint32_t age_ticks = 0;
+	uint32_t limit_ticks =
+		qdf_system_msecs_to_ticks(ROAM_AP_AGE_LIMIT_MS);
 	uint8_t num_candidates = 0;
 	uint8_t num_dropped = 0;
 	/*
@@ -294,10 +296,9 @@ void csr_neighbor_roam_process_scan_results(tpAniSirGlobal mac_ctx,
 			}
 
 			/* check the age of the AP */
-			age = (uint64_t) qdf_mc_timer_get_system_time() -
-					descr->received_time;
-			if (age_constraint == true &&
-				age > ROAM_AP_AGE_LIMIT_MS) {
+			age_ticks = (uint32_t) qdf_mc_timer_get_system_ticks() -
+					descr->nReceivedTime;
+			if (age_constraint == true && age_ticks > limit_ticks) {
 				num_dropped++;
 				QDF_TRACE(QDF_MODULE_ID_SME,
 					QDF_TRACE_LEVEL_WARN,

+ 0 - 1
core/sme/src/csr/csr_inside_api.h

@@ -66,7 +66,6 @@
 
 #define CSR_MAX_BSS_SUPPORT            512
 #define SYSTEM_TIME_MSEC_TO_USEC      1000
-#define SYSTEM_TIME_SEC_TO_MSEC       1000
 
 /* This number minus 1 means the number of times a channel is scanned before a BSS is remvoed from */
 /* cache scan result */

+ 6 - 6
core/sme/src/rrm/sme_rrm.c

@@ -71,7 +71,7 @@
 #define RRM_ROAM_SCORE_NEIGHBOR_IAPP_LIST                       30
 #endif
 
-uint64_t rrm_scan_timer;
+unsigned long rrm_scan_timer;
 
 /**
  * rrm_ll_purge_neighbor_cache() -Purges all the entries in the neighbor cache
@@ -529,7 +529,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 
 	while (scan_results) {
 		next_result = sme_scan_result_get_next(mac_ctx, result_handle);
-		sms_log(mac_ctx, LOG1, "Scan res timer:%lu, rrm scan timer:%llu",
+		sms_log(mac_ctx, LOG1, "Scan res timer:%lu, rrm scan timer:%lu",
 				scan_results->timer, rrm_scan_timer);
 		if (scan_results->timer >= rrm_scan_timer) {
 			roam_info->pBssDesc = &scan_results->BssDescriptor;
@@ -651,7 +651,7 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
 	tpRrmSMEContext sme_rrm_ctx = &mac_ctx->rrm.rrmSmeContext;
 	uint32_t session_id;
 	tSirScanType scan_type;
-	uint64_t current_time;
+	unsigned long current_time;
 
 	status = csr_roam_get_session_id_from_bssid(mac_ctx,
 			&sme_rrm_ctx->sessionBssId, &session_id);
@@ -720,8 +720,8 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
 		 * and hence there is a check to see if the requests are atleast
 		 * 1 second apart.
 		 */
-		current_time = (uint64_t)qdf_mc_timer_get_system_time();
-		sms_log(mac_ctx, LOG1, "prev scan triggered before %llu ms, totalchannels %d",
+		current_time = qdf_mc_timer_get_system_time();
+		sms_log(mac_ctx, LOG1, "prev scan triggered before %ld ms, totalchannels %d",
 				current_time - rrm_scan_timer,
 				sme_rrm_ctx->channelList.numOfChannels);
 		if ((abs(current_time - rrm_scan_timer) > 1000) &&
@@ -731,7 +731,7 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
 			scan_req.idle_time = 1;
 		}
 
-		rrm_scan_timer = (uint64_t)qdf_mc_timer_get_system_time();
+		rrm_scan_timer = qdf_mc_timer_get_system_time();
 
 		/* set BSSType to default type */
 		scan_req.BSSType = eCSR_BSS_TYPE_ANY;