qcacmn: Process rx_mgmt_pkt based on frequency

As a part of 802.11ax amendment, 6GHz band operation is added.
Since the 6 GHz channel numbers are overlapping with existing 2.4GHz
and 5GHz channel numbers, use frequency to identify unique channel
operation instead of channel number. Channel frequency is unique across
bands.

As part of above requirement add logic to process rx mgmt
packets based on the frequencies instead of channel numbers.

Change-Id: I33e31fa124cedfab31dd1827721a420ad6cdba07
CRs-Fixed: 2519512
diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
index fbeec75..e2550a9 100644
--- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c
+++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
@@ -141,8 +141,8 @@
 		    util_scan_is_null_ssid(&entry2->ssid))
 			return true;
 	} else if (entry1->cap_info.wlan_caps.ibss &&
-	   (entry1->channel.chan_idx ==
-	   entry2->channel.chan_idx)) {
+	   (entry1->channel.chan_freq ==
+	   entry2->channel.chan_freq)) {
 		/*
 		 * Same channel cannot have same SSID for
 		 * different IBSS, so no need to check BSSID
@@ -499,7 +499,8 @@
 }
 
 static QDF_STATUS
-util_scan_populate_bcn_ie_list(struct scan_cache_entry *scan_params)
+util_scan_populate_bcn_ie_list(struct scan_cache_entry *scan_params,
+			       uint8_t *chan_idx)
 {
 	struct ie_header *ie, *sub_ie;
 	uint32_t ie_len, sub_ie_len;
@@ -539,7 +540,7 @@
 			if (ie->ie_len != WLAN_DS_PARAM_IE_MAX_LEN)
 				return QDF_STATUS_E_INVAL;
 			scan_params->ie_list.ds_param = (uint8_t *)ie;
-			scan_params->channel.chan_idx =
+			*chan_idx =
 				((struct ds_ie *)ie)->cur_chan;
 			break;
 		case WLAN_ELEMID_TIM:
@@ -617,8 +618,8 @@
 				goto err;
 			scan_params->ie_list.htinfo =
 			  (uint8_t *)&(((struct wlan_ie_htinfo *) ie)->hi_ie);
-			scan_params->channel.chan_idx =
-			  ((struct wlan_ie_htinfo_cmn *)
+			*chan_idx =
+				((struct wlan_ie_htinfo_cmn *)
 			  (scan_params->ie_list.htinfo))->hi_ctrlchannel;
 			break;
 		case WLAN_ELEMID_WAPI:
@@ -1045,7 +1046,7 @@
 	struct scan_cache_entry *scan_entry;
 	struct qbss_load_ie *qbss_load;
 	struct scan_cache_node *scan_node;
-	uint8_t i;
+	uint8_t i, chan_idx = 0;
 
 	scan_entry = qdf_mem_malloc_atomic(sizeof(*scan_entry));
 	if (!scan_entry) {
@@ -1079,6 +1080,7 @@
 	scan_entry->rssi_raw = rx_param->rssi;
 	scan_entry->avg_rssi = WLAN_RSSI_IN(scan_entry->rssi_raw);
 	scan_entry->tsf_delta = rx_param->tsf_delta;
+	scan_entry->pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
 
 	/* Copy per chain rssi to scan entry */
 	qdf_mem_copy(scan_entry->per_chain_rssi, rx_param->rssi_ctl,
@@ -1119,7 +1121,7 @@
 	scan_entry->raw_frame.len = frame_len;
 	qdf_mem_copy(scan_entry->raw_frame.ptr,
 		frame, frame_len);
-	status = util_scan_populate_bcn_ie_list(scan_entry);
+	status = util_scan_populate_bcn_ie_list(scan_entry, &chan_idx);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		scm_debug("failed to parse beacon IE");
 		qdf_mem_free(scan_entry->raw_frame.ptr);
@@ -1139,13 +1141,21 @@
 	if (scan_entry->ie_list.p2p)
 		scan_entry->is_p2p = true;
 
+	if (chan_idx) {
+		uint8_t band_mask = BIT(wlan_reg_freq_to_band(
+							rx_param->chan_freq));
+
+		scan_entry->channel.chan_freq =
+			wlan_reg_chan_band_to_freq(
+				pdev, chan_idx,
+				band_mask);
+	}
 	/* If no channel info is present in beacon use meta channel */
-	if (!scan_entry->channel.chan_idx) {
-		scan_entry->channel.chan_idx =
-				rx_param->channel;
-	} else if (rx_param->channel !=
-	   scan_entry->channel.chan_idx) {
-		if (!wlan_reg_chan_is_49ghz(pdev, scan_entry->channel.chan_idx))
+	if (!scan_entry->channel.chan_freq) {
+		scan_entry->channel.chan_freq = rx_param->chan_freq;
+	} else if (rx_param->chan_freq !=
+	   scan_entry->channel.chan_freq) {
+		if (!wlan_reg_is_49ghz_freq(scan_entry->channel.chan_freq))
 			scan_entry->channel_mismatch = true;
 	}
 
@@ -1161,7 +1171,7 @@
 	}
 	qdf_mem_copy(&scan_entry->mbssid_info, mbssid_info,
 		     sizeof(scan_entry->mbssid_info));
-	if (WLAN_CHAN_IS_5GHZ(scan_entry->channel.chan_idx))
+	if (WLAN_REG_IS_5GHZ_CH_FREQ(scan_entry->channel.chan_freq))
 		scan_entry->phy_mode = util_scan_get_phymode_5g(scan_entry);
 	else
 		scan_entry->phy_mode = util_scan_get_phymode_2g(scan_entry);