Explorar el Código

qcacmn: Fix Green AP reference count ID mismatch

Green AP incorrectly uses object manager ID for reference
counting, and it causes inconsistency in the system.
Create a unique reference count ID for green AP
and use it.

Change-Id: Ia7d9545e95add01d209b11f1b000e38bc1591a47
CRs-Fixed: 2220280
Kabilan Kannan hace 7 años
padre
commit
6c3cb57806

+ 3 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h

@@ -216,6 +216,7 @@ typedef void (*wlan_objmgr_peer_status_handler)(
  * @WLAN_INIT_DEINIT_ID:        Init deinit module
  * @WLAN_IPA_ID:                IPA operations
  * @WLAN_CP_STATS_ID:           Control Plane Statistics Module
+ * @WLAN_GREEN_AP_ID:           Green AP operations
  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
  */
  /* New value added to the enum must also be reflected in function
@@ -261,6 +262,7 @@ typedef enum {
 	WLAN_INIT_DEINIT_ID   = 36,
 	WLAN_IPA_ID           = 37,
 	WLAN_CP_STATS_ID      = 38,
+	WLAN_GREEN_AP_ID      = 39,
 	WLAN_REF_ID_MAX,
 } wlan_objmgr_ref_dbgid;
 
@@ -313,6 +315,7 @@ static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
 					"WLAN_INIT_DEINIT_ID",
 					"WLAN_IPA_ID",
 					"WLAN_CP_STATS_ID",
+					"WLAN_GREEN_AP_ID",
 					"WLAN_REF_ID_MAX" };
 
 	return (char *)strings[id];

+ 3 - 2
umac/cmn_services/utils/inc/wlan_utility.h

@@ -177,9 +177,10 @@ uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev);
 /*
  * wlan_util_is_vap_active() - Check for vap active
  * @pdev: pdev pointer
+ * @dbg_id: debug id for ref counting
  *
  * @Return: QDF_STATUS_SUCCESS in case of vap active
  */
-QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev);
-
+QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev,
+				   wlan_objmgr_ref_dbgid dbg_id);
 #endif /* _WLAN_UTILITY_H_ */

+ 3 - 2
umac/cmn_services/utils/src/wlan_utility.c

@@ -281,7 +281,8 @@ static void wlan_vap_active(struct wlan_objmgr_pdev *pdev,
 	wlan_vdev_obj_unlock(vdev);
 }
 
-QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev)
+QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev,
+				   wlan_objmgr_ref_dbgid dbg_id)
 {
 	uint8_t flag = 0;
 
@@ -291,7 +292,7 @@ QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev)
 	wlan_objmgr_pdev_iterate_obj_list(pdev,
 				WLAN_VDEV_OP,
 				wlan_vap_active,
-				&flag, 0, WLAN_OBJMGR_ID);
+				&flag, 0, dbg_id);
 
 	if (flag == 1)
 		return QDF_STATUS_SUCCESS;

+ 1 - 1
umac/green_ap/core/src/wlan_green_ap_main.c

@@ -56,7 +56,7 @@ static QDF_STATUS wlan_green_ap_ant_ps_reset
 	 * Add protection against green AP enabling interrupts
 	 * when not valid or no VAPs exist
 	 */
-	if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS)
+	if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) == QDF_STATUS_SUCCESS)
 		green_ap_tx_ops->reset_dev(pdev);
 	else
 		green_ap_err("Green AP tried to enable IRQs when invalid");

+ 5 - 3
umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c

@@ -216,11 +216,12 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val)
 	}
 
 	if (val) {
-	struct wlan_pdev_green_ap_ctx *green_ap_ctx;
+		struct wlan_pdev_green_ap_ctx *green_ap_ctx;
+
 		wlan_objmgr_pdev_iterate_obj_list(pdev,
 					WLAN_VDEV_OP,
 					wlan_green_ap_check_mode,
-					&flag, 0, WLAN_OBJMGR_ID);
+					&flag, 0, WLAN_GREEN_AP_ID);
 		if (flag == 1) {
 			green_ap_err("Radio not in AP mode."
 					"Feature not supported");
@@ -237,7 +238,8 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val)
 
 		ucfg_green_ap_set_ps_config(pdev, val);
 
-		if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS)
+		if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) ==
+					    QDF_STATUS_SUCCESS)
 			wlan_green_ap_start(pdev);
 	} else {
 		wlan_green_ap_stop(pdev);