Просмотр исходного кода

qcacld-3.0: Update Roaming AP BSSID to user space

Currently, roam stats don't cache Roam AP BSSID and don't update
to user space.
If roam successful, save R_AP and P_AP, if roam failed, save P_AP
and save C_AP if exist, then update to user space.

CRs-Fixed: 3580957
Change-Id: Ib0048c34701a7750f9261ba5cbd1bc65eb41582c
Chunquan Luo 1 год назад
Родитель
Сommit
f1aabdebab

+ 19 - 0
components/mlme/core/inc/wlan_mlme_main.h

@@ -698,11 +698,30 @@ struct roam_scan_chn {
  * @num_channels: total number of channels scanned during roam scan
  * @roam_chn: each roam scan channel information
  * @total_scan_time: total scan time of all roam channel
+ * @original_bssid: connected AP before roam happens, regardless of
+ *  the roam resulting in success or failure.
+ *  For non-MLO scenario, it indicates the original connected AP BSSID.
+ *  For MLO scenario, it indicates the original BSSID of the link
+ *  for which the reassociation occurred during the roam.
+ * @candidate_bssid: roam candidate AP BSSID when roam failed.
+ *  If the firmware updates more than one candidate AP BSSID
+ *  to the driver, the driver only fills the last candidate AP BSSID.
+ *  For non-MLO scenario, it indicates the last candidate AP BSSID.
+ *  For MLO scenario, it indicates the AP BSSID which may be the primary
+ *  link BSSID or a nonprimary link BSSID.
+ * @roamed_bssid: roamed AP BSSID when roam succeeds.
+ *  For non-MLO case, it indicates new AP BSSID which has been
+ *  successfully roamed.
+ *  For MLO case, it indicates the new AP BSSID of the link on
+ *  which the reassociation occurred during the roam.
  */
 struct eroam_scan_info {
 	uint8_t num_channels;
 	struct roam_scan_chn roam_chn[MAX_ROAM_SCAN_CHAN];
 	uint32_t total_scan_time;
+	struct qdf_mac_addr original_bssid;
+	struct qdf_mac_addr candidate_bssid;
+	struct qdf_mac_addr roamed_bssid;
 };
 
 /**

+ 54 - 0
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -4075,6 +4075,57 @@ wlan_cm_clear_current_roam_stats_info(struct mlme_legacy_priv *mlme_priv)
 		    sizeof(struct enhance_roam_info), 0);
 }
 
+/**
+ * wlan_cm_update_roam_bssid() - API to get roam stats AP BSSID
+ * @mlme_priv: Pointer to Pointer to vdev mlme legacy priv struct
+ * @scan: Scan data from target_if wmi event
+ *
+ * get AP BSSID from roam stats info which keep in scan data.
+ *
+ * Return: void
+ */
+static void
+wlan_cm_update_roam_bssid(struct mlme_legacy_priv *mlme_priv,
+			  struct wmi_roam_scan_data *scan)
+{
+	struct enhance_roam_info *info;
+	int16_t i;
+	uint16_t index, scan_ap_idx;
+	struct wmi_roam_candidate_info *ap = NULL;
+
+	if (scan->num_ap == 0)
+		return;
+
+	scan_ap_idx = scan->num_ap - 1;
+	ap = &scan->ap[scan_ap_idx];
+
+	index = mlme_priv->roam_write_index;
+	info = &mlme_priv->roam_info[index];
+
+	/* For roam failed, we may get candidate ap list, and only
+	 * fetch the last candidate AP bssid.
+	 */
+
+	for (i = scan_ap_idx; i >= 0; i--) {
+		if (ap->type == WLAN_ROAM_SCAN_CURRENT_AP)
+			qdf_mem_copy(info->scan.original_bssid.bytes,
+				     ap->bssid.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		else if (ap->type == WLAN_ROAM_SCAN_CANDIDATE_AP &&
+			 qdf_is_macaddr_zero(&info->scan.candidate_bssid))
+			qdf_mem_copy(info->scan.candidate_bssid.bytes,
+				     ap->bssid.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		else if (ap->type == WLAN_ROAM_SCAN_ROAMED_AP)
+			qdf_mem_copy(info->scan.roamed_bssid.bytes,
+				     ap->bssid.bytes,
+				     QDF_MAC_ADDR_SIZE);
+		else
+			mlme_debug("unknown type:%u of AP", ap->type);
+		ap--;
+	}
+}
+
 /**
  * wlan_cm_update_roam_stats_info() - API to update roam stats info
  * @psoc:    Pointer to psoc
@@ -4131,6 +4182,9 @@ wlan_cm_update_roam_stats_info(struct wlan_objmgr_psoc *psoc,
 		if (stats_info->frame_stats[index].num_frame)
 			wlan_cm_update_roam_frame_info(mlme_priv,
 						       &stats_info->frame_stats[index]);
+		if (stats_info->scan[index].present)
+			wlan_cm_update_roam_bssid(mlme_priv,
+						  &stats_info->scan[index]);
 
 		mlme_priv->roam_write_index += 1;
 		if (mlme_priv->roam_write_index == mlme_priv->roam_cache_num)

+ 20 - 0
core/hdd/src/wlan_hdd_stats.c

@@ -10349,6 +10349,26 @@ static int hdd_nla_put_roam_stats_info(struct sk_buff *skb,
 	}
 	nla_nest_end(skb, roam_frame_info);
 
+	if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ROAM_STATS_ORIGINAL_BSSID,
+		    QDF_MAC_ADDR_SIZE, info->scan.original_bssid.bytes)) {
+		hdd_err("roam original AP bssid put fail");
+		return -EINVAL;
+	}
+	if (info->trigger.roam_status) {
+		if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ROAM_STATS_CANDIDATE_BSSID,
+			    QDF_MAC_ADDR_SIZE,
+			    info->scan.candidate_bssid.bytes)) {
+			hdd_err("roam candidate AP bssid put fail");
+			return -EINVAL;
+		}
+	} else {
+		if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ROAM_STATS_ROAMED_BSSID,
+			    QDF_MAC_ADDR_SIZE, info->scan.roamed_bssid.bytes)) {
+			hdd_err("roam roamed AP bssid put fail");
+			return -EINVAL;
+		}
+	}
+
 	return 0;
 }