浏览代码

qcacld-3.0: Define ext_vdev_ptr and ext_pdev_ptr with specific type

Define ext_vdev_ptr and ext_pdev_ptr with specific type, remove void
pointer usage for part of mlme code.

Change-Id: Ie71d59386224e4671bdae071aa7425a998d5e242
CRs-Fixed: 2488192
hqu 5 年之前
父节点
当前提交
7f10f558c4

+ 31 - 59
components/mlme/core/src/wlan_mlme_main.c

@@ -47,65 +47,55 @@ struct wlan_mlme_psoc_obj *mlme_get_psoc_obj_fl(struct wlan_objmgr_psoc *psoc,
 struct wlan_mlme_nss_chains *mlme_get_dynamic_vdev_config(
 				struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	return &mlme_priv->dynamic_cfg;
 }
 
 struct wlan_mlme_nss_chains *mlme_get_ini_vdev_config(
 				struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	return &mlme_priv->ini_cfg;
 }
 
 struct mlme_roam_after_data_stall *
 mlme_get_roam_invoke_params(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme)
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
-
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
+	}
 
 	return &mlme_priv->roam_invoke_params;
 }
 
 uint8_t *mlme_get_dynamic_oce_flags(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	return &mlme_priv->sta_dynamic_oce_value;
 }
 
@@ -2366,7 +2356,6 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 void mlme_set_self_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 				  struct wlan_ies *ie)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
 	if (!ie || !ie->len || !ie->data) {
@@ -2374,14 +2363,12 @@ void mlme_set_self_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	if (mlme_priv->self_disconnect_ies.data) {
 		qdf_mem_free(mlme_priv->self_disconnect_ies.data);
 		mlme_priv->self_disconnect_ies.len = 0;
@@ -2402,17 +2389,14 @@ void mlme_set_self_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 
 void mlme_free_self_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	if (mlme_priv->self_disconnect_ies.data) {
 		qdf_mem_free(mlme_priv->self_disconnect_ies.data);
 		mlme_priv->self_disconnect_ies.data = NULL;
@@ -2422,24 +2406,20 @@ void mlme_free_self_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 
 struct wlan_ies *mlme_get_self_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	return &mlme_priv->self_disconnect_ies;
 }
 
 void mlme_set_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 				  struct wlan_ies *ie)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
 	if (!ie || !ie->len || !ie->data) {
@@ -2447,14 +2427,12 @@ void mlme_set_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	if (mlme_priv->peer_disconnect_ies.data) {
 		qdf_mem_free(mlme_priv->peer_disconnect_ies.data);
 		mlme_priv->peer_disconnect_ies.len = 0;
@@ -2475,17 +2453,14 @@ void mlme_set_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev,
 
 void mlme_free_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	if (mlme_priv->peer_disconnect_ies.data) {
 		qdf_mem_free(mlme_priv->peer_disconnect_ies.data);
 		mlme_priv->peer_disconnect_ies.data = NULL;
@@ -2495,16 +2470,13 @@ void mlme_free_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 
 struct wlan_ies *mlme_get_peer_disconnect_ies(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return NULL;
 	}
 
-	mlme_priv = vdev_mlme->ext_vdev_ptr;
-
 	return &mlme_priv->peer_disconnect_ies;
 }

+ 36 - 72
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -550,17 +550,14 @@ static QDF_STATUS ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
 QDF_STATUS mlme_set_chan_switch_in_progress(struct wlan_objmgr_vdev *vdev,
 					       bool val)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->chan_switch_in_progress = val;
 
 	return QDF_STATUS_SUCCESS;
@@ -568,17 +565,14 @@ QDF_STATUS mlme_set_chan_switch_in_progress(struct wlan_objmgr_vdev *vdev,
 
 bool mlme_is_chan_switch_in_progress(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->chan_switch_in_progress;
 }
 
@@ -586,17 +580,14 @@ QDF_STATUS
 ap_mlme_set_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev *vdev,
 					    bool val)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->hidden_ssid_restart_in_progress = val;
 
 	return QDF_STATUS_SUCCESS;
@@ -604,33 +595,27 @@ ap_mlme_set_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev *vdev,
 
 bool ap_mlme_is_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->hidden_ssid_restart_in_progress;
 }
 
 QDF_STATUS mlme_set_connection_fail(struct wlan_objmgr_vdev *vdev, bool val)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->connection_fail = val;
 
 	return QDF_STATUS_SUCCESS;
@@ -638,34 +623,28 @@ QDF_STATUS mlme_set_connection_fail(struct wlan_objmgr_vdev *vdev, bool val)
 
 bool mlme_is_connection_fail(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->connection_fail;
 }
 
 QDF_STATUS mlme_set_assoc_type(struct wlan_objmgr_vdev *vdev,
 			       enum vdev_assoc_type assoc_type)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->assoc_type = assoc_type;
 
 	return QDF_STATUS_SUCCESS;
@@ -673,34 +652,28 @@ QDF_STATUS mlme_set_assoc_type(struct wlan_objmgr_vdev *vdev,
 
 enum vdev_assoc_type  mlme_get_assoc_type(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->assoc_type;
 }
 
 QDF_STATUS
 mlme_set_vdev_start_failed(struct wlan_objmgr_vdev *vdev, bool val)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->vdev_start_failed = val;
 
 	return QDF_STATUS_SUCCESS;
@@ -708,33 +681,27 @@ mlme_set_vdev_start_failed(struct wlan_objmgr_vdev *vdev, bool val)
 
 bool mlme_get_vdev_start_failed(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->vdev_start_failed;
 }
 
 QDF_STATUS mlme_set_cac_required(struct wlan_objmgr_vdev *vdev, bool val)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	mlme_priv->cac_required_for_new_channel = val;
 
 	return QDF_STATUS_SUCCESS;
@@ -742,17 +709,14 @@ QDF_STATUS mlme_set_cac_required(struct wlan_objmgr_vdev *vdev, bool val)
 
 bool mlme_get_cac_required(struct wlan_objmgr_vdev *vdev)
 {
-	struct vdev_mlme_obj *vdev_mlme;
 	struct mlme_legacy_priv *mlme_priv;
 
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		mlme_legacy_err("vdev component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return false;
 	}
 
-	mlme_priv = (struct mlme_legacy_priv *)vdev_mlme->ext_vdev_ptr;
-
 	return mlme_priv->cac_required_for_new_channel;
 }
 

+ 43 - 0
components/mlme/dispatcher/inc/wlan_ext_mlme_obj_types.h

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: wlan_ext_mlme_obj_types.h
+ *
+ * This header file is included by the converged control path mlme
+ * component to map legacy private structures to the external
+ * (ext)typedefs used by the converged code. This mechanism allows the
+ * legacy structs to be included as part of the global objmgr objects.
+ */
+
+#ifndef __WLAN_EXT_MLME_OBJ_TYPE_H__
+#define __WLAN_EXT_MLME_OBJ_TYPE_H__
+
+/**
+ * typedef mlme_pdev_ext_t - Opaque definition of pdev mlme pointer
+ * Define ext_pdev_ptr from external umac/mlme component point to this type
+ */
+struct opaque_mlme_pdev_ext;
+typedef struct opaque_mlme_pdev_ext mlme_pdev_ext_t;
+
+/**
+ * typedef mlme_vdev_ext_t - Definition of vdev mlme pointer
+ * Define ext_vdev_ptr from external umac/mlme component point to this type
+ */
+typedef struct mlme_legacy_priv mlme_vdev_ext_t;
+
+#endif