瀏覽代碼

qcacmn: Add API to populate parameter for connecting event logging

Introduce API to populate parameter for connecting event
logging in order to be printed after STA INFO
event.

Add wlan_cm_is_first_attempt() api in order to
restrict the logging of STA INFO and connecting
event to first connection attempt.

Change-Id: Ica4253eea71ba72ea5176f733402d0758797463b
CRs-Fixed: 3599759
Vijay Raj 1 年之前
父節點
當前提交
cabdbfa0c8

+ 29 - 0
os_if/linux/mlme/src/osif_cm_req.c

@@ -160,6 +160,33 @@ uint8_t osif_cm_get_rsn_cap_mfp(enum nl80211_mfp mfp_state)
 	}
 }
 
+#ifdef CONNECTIVITY_DIAG_EVENT
+/**
+ * osif_cm_populate_user_crypto_param() - API to cache crypto param
+ * received from the userspace.
+ * @connect_req: Connect request buffer to cache parameter
+ * @req: Connection request parameter received from userspace.
+ *
+ * Return: None
+ */
+static void
+osif_cm_populate_user_crypto_param(struct wlan_cm_connect_req *connect_req,
+				   const struct cfg80211_connect_params *req)
+{
+	connect_req->crypto.user_cipher_pairwise =
+					req->crypto.ciphers_pairwise[0];
+	connect_req->crypto.user_akm_suite = req->crypto.akm_suites[0];
+	connect_req->crypto.user_auth_type = req->auth_type;
+	connect_req->crypto.user_grp_cipher = req->crypto.cipher_group;
+}
+#else
+static void
+osif_cm_populate_user_crypto_param(struct wlan_cm_connect_req *connect_req,
+				   const struct cfg80211_connect_params *req)
+{
+}
+#endif
+
 static
 QDF_STATUS osif_cm_set_crypto_params(struct wlan_cm_connect_req *connect_req,
 				     const struct cfg80211_connect_params *req)
@@ -203,6 +230,8 @@ QDF_STATUS osif_cm_set_crypto_params(struct wlan_cm_connect_req *connect_req,
 	/* Copy user configured MFP capability */
 	connect_req->crypto.user_mfp = osif_cm_get_rsn_cap_mfp(req->mfp);
 
+	osif_cm_populate_user_crypto_param(connect_req, req);
+
 	return status;
 }
 

+ 21 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_main_api.h

@@ -1326,6 +1326,27 @@ void cm_set_candidate_custom_sort_cb(
  */
 bool cm_is_connect_req_reassoc(struct wlan_cm_connect_req *req);
 
+/**
+ * cm_is_first_candidate_connect_attempt() - Is it a first attempt to
+ * connect to a candidate after receiving connect request
+ * @vdev: vdev pointer
+ *
+ * Return: True if it is the first connect attempt to a candidate
+ * after receiving the connect request from the userspace
+ */
+bool cm_is_first_candidate_connect_attempt(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * cm_get_active_connect_req_param() - Get Connect request parameter
+ * @vdev: vdev pointer
+ * @req: Connection request buffer to be filled
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_get_active_connect_req_param(struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_req *req);
+
 /**
  * cm_get_rnr() - get rnr
  * @vdev:vdev

+ 66 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_util.c

@@ -1567,6 +1567,72 @@ bool cm_is_connect_req_reassoc(struct wlan_cm_connect_req *req)
 	return false;
 }
 
+bool cm_is_first_candidate_connect_attempt(struct wlan_objmgr_vdev *vdev)
+{
+	struct cnx_mgr *cm_ctx;
+	struct cm_req *cm_req;
+	bool status = false;
+
+	cm_ctx = cm_get_cm_ctx(vdev);
+	if (!cm_ctx)
+		return status;
+
+	cm_req_lock_acquire(cm_ctx);
+	cm_req = cm_get_req_by_cm_id(cm_ctx, cm_ctx->active_cm_id);
+	if (!cm_req)
+		goto out;
+
+	if (cm_req->connect_req.cur_candidate_retries ||
+	    cm_req->connect_req.connect_attempts > 1)
+		goto out;
+
+	status = true;
+
+out:
+	cm_req_lock_release(cm_ctx);
+	return status;
+}
+
+QDF_STATUS
+cm_get_active_connect_req_param(struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_req *req)
+{
+	struct cnx_mgr *cm_ctx;
+	qdf_list_node_t *cur_node = NULL, *next_node = NULL;
+	struct cm_req *cm_req = NULL;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	uint32_t cm_id_prefix;
+
+	cm_ctx = cm_get_cm_ctx(vdev);
+	if (!cm_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	cm_req_lock_acquire(cm_ctx);
+	qdf_list_peek_front(&cm_ctx->req_list, &cur_node);
+	while (cur_node) {
+		qdf_list_peek_next(&cm_ctx->req_list, cur_node, &next_node);
+
+		cm_req = qdf_container_of(cur_node, struct cm_req, node);
+		cm_id_prefix = CM_ID_GET_PREFIX((cm_req->cm_id));
+
+		if (cm_req->cm_id != cm_ctx->active_cm_id ||
+		    cm_id_prefix != CONNECT_REQ_PREFIX) {
+			cur_node = next_node;
+			next_node = NULL;
+			continue;
+		}
+
+		*req = cm_req->connect_req.req;
+		qdf_mem_zero(&req->assoc_ie, sizeof(struct element_info));
+		qdf_mem_zero(&req->scan_ie, sizeof(struct element_info));
+		status = QDF_STATUS_SUCCESS;
+		break;
+	}
+
+	cm_req_lock_release(cm_ctx);
+	return status;
+}
+
 bool cm_get_active_connect_req(struct wlan_objmgr_vdev *vdev,
 			       struct wlan_cm_vdev_connect_req *req)
 {

+ 22 - 0
umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h

@@ -350,6 +350,28 @@ wlan_cm_connect_resp_fill_mld_addr_from_vdev_id(struct wlan_objmgr_psoc *psoc,
 bool wlan_cm_get_active_connect_req(struct wlan_objmgr_vdev *vdev,
 				    struct wlan_cm_vdev_connect_req *req);
 
+/**
+ * wlan_cm_is_first_candidate_connect_attempt() - Check whether it is
+ * the first attempt for the current AP after receiving connect request
+ * @vdev: vdev pointer
+ *
+ * Return: True if it is the first connecting attempt on a candidate.
+ * Otherwise return false
+ */
+bool wlan_cm_is_first_candidate_connect_attempt(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_cm_get_active_connect_req_param() - API to fetch connect request
+ * parameter.
+ * @vdev: vdev pointer
+ * @req: Connection request parameter buffer to be filled
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_cm_get_active_connect_req_param(struct wlan_objmgr_vdev *vdev,
+				     struct wlan_cm_connect_req *req);
+
 #ifdef WLAN_FEATURE_HOST_ROAM
 /**
  * wlan_cm_get_active_reassoc_req() - Get copy of active reassoc request

+ 12 - 0
umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h

@@ -79,6 +79,12 @@ struct wlan_cm_wep_key_params {
  * @rsn_caps: rsn caps
  * @mgmt_ciphers: mgmt cipher bitmask
  * @user_mfp: Management frame protection state configured by user
+ * @user_auth_type: user provided auth type
+ * @user_grp_cipher: user provided  group cipher
+ * @user_akm_suite: user provided AKM suite. First akm suite value
+ * is populated from akm suites array received from userspace
+ * @user_cipher_pairwise: user provided pairwise cipher. First pairwise
+ * cipher values populated from pairwise cipher array received from userspace
  */
 struct wlan_cm_connect_crypto_info {
 	uint32_t wpa_versions;
@@ -90,6 +96,12 @@ struct wlan_cm_connect_crypto_info {
 	uint16_t rsn_caps;
 	uint32_t mgmt_ciphers;
 	uint8_t user_mfp;
+#ifdef CONNECTIVITY_DIAG_EVENT
+	uint32_t user_auth_type;
+	uint32_t user_grp_cipher;
+	uint32_t user_akm_suite;
+	uint32_t user_cipher_pairwise;
+#endif
 };
 
 #ifdef WLAN_FEATURE_FILS_SK

+ 12 - 0
umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c

@@ -233,11 +233,23 @@ bool wlan_cm_get_active_connect_req(struct wlan_objmgr_vdev *vdev,
 	return cm_get_active_connect_req(vdev, req);
 }
 
+QDF_STATUS
+wlan_cm_get_active_connect_req_param(struct wlan_objmgr_vdev *vdev,
+				     struct wlan_cm_connect_req *req)
+{
+	return cm_get_active_connect_req_param(vdev, req);
+}
+
 cm_ext_t *wlan_cm_get_ext_hdl(struct wlan_objmgr_vdev *vdev)
 {
 	return cm_get_ext_hdl(vdev);
 }
 
+bool wlan_cm_is_first_candidate_connect_attempt(struct wlan_objmgr_vdev *vdev)
+{
+	return cm_is_first_candidate_connect_attempt(vdev);
+}
+
 #ifdef WLAN_FEATURE_HOST_ROAM
 bool wlan_cm_get_active_reassoc_req(struct wlan_objmgr_vdev *vdev,
 				    struct wlan_cm_vdev_reassoc_req *req)