Prechádzať zdrojové kódy

qcacmn: Print vdev, pdev and psoc info before being destroyed

Add debug code to print the vdev, pdev and psoc info before getting
destroyed. This will help in cases where we dont get crash dumps
for panics and we need to look up few important data, which
can be done by enable object manager debug.

Change-Id: Iab1895d348ccf225ee6390abef26b76936fbe560
CRs-Fixed: 2528290
Vivek 5 rokov pred
rodič
commit
4ad877f928

+ 12 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h

@@ -1016,4 +1016,16 @@ static inline void *wlan_pdev_get_dp_handle(struct wlan_objmgr_pdev *pdev)
 	return pdev->dp_handle;
 }
 
+/**
+ * wlan_print_pdev_info() - print pdev members
+ * @pdev: pdev object pointer
+ *
+ * Return: void
+ */
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev);
+#else
+static inline void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev) {}
+#endif
+
 #endif /* _WLAN_OBJMGR_PDEV_H_*/

+ 14 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h

@@ -1558,4 +1558,18 @@ static inline uint8_t wlan_psoc_get_id(
 
 	return psoc->soc_objmgr.psoc_id;
 }
+
+/**
+ * wlan_print_psoc_info() - print psoc members
+ * @psoc: psoc object pointer
+ *
+ * Return: void
+ */
+
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc);
+#else
+static inline void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc) {}
+#endif
+
 #endif /* _WLAN_OBJMGR_PSOC_OBJ_H_*/

+ 12 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_vdev_obj.h

@@ -1340,4 +1340,16 @@ static inline void *wlan_vdev_get_dp_handle(struct wlan_objmgr_vdev *vdev)
 	return vdev->dp_handle;
 }
 
+/**
+ * wlan_print_vdev_info() - print vdev members
+ * @vdev: vdev object pointer
+ *
+ * Return: void
+ */
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_vdev_info(struct wlan_objmgr_vdev *vdev);
+#else
+static inline void wlan_print_vdev_info(struct wlan_objmgr_vdev *vdev) {}
+#endif
+
 #endif /* _WLAN_OBJMGR_VDEV_OBJ_H_*/

+ 41 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c

@@ -194,6 +194,7 @@ static QDF_STATUS wlan_objmgr_pdev_obj_destroy(struct wlan_objmgr_pdev *pdev)
 
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
 
+	wlan_print_pdev_info(pdev);
 	obj_mgr_info("Physically deleting pdev %d", pdev_id);
 
 	if (pdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
@@ -904,3 +905,43 @@ struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev(
 }
 
 qdf_export_symbol(wlan_objmgr_pdev_get_first_vdev);
+
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_objmgr_pdev_objmgr *pdev_objmgr;
+	struct wlan_objmgr_vdev *vdev;
+	struct wlan_objmgr_vdev *vdev_next;
+	qdf_list_t *vdev_list;
+	uint16_t index = 0;
+
+	pdev_objmgr = &pdev->pdev_objmgr;
+
+	obj_mgr_debug("pdev: %pK", pdev);
+	obj_mgr_debug("wlan_pdev_id: %d", pdev_objmgr->wlan_pdev_id);
+	obj_mgr_debug("wlan_vdev_count: %d", pdev_objmgr->wlan_vdev_count);
+	obj_mgr_debug("max_vdev_count: %d", pdev_objmgr->max_vdev_count);
+	obj_mgr_debug("wlan_peer_count: %d", pdev_objmgr->wlan_peer_count);
+	obj_mgr_debug("max_peer_count: %d", pdev_objmgr->max_peer_count);
+	obj_mgr_debug("temp_peer_count: %d", pdev_objmgr->temp_peer_count);
+	obj_mgr_debug("wlan_psoc: %pK", pdev_objmgr->wlan_psoc);
+	obj_mgr_debug("ref_cnt: %d", qdf_atomic_read(&pdev_objmgr->ref_cnt));
+
+	wlan_pdev_obj_lock(pdev);
+	vdev_list = &pdev_objmgr->wlan_vdev_list;
+	/* Get first vdev */
+	vdev = wlan_pdev_vdev_list_peek_head(vdev_list);
+
+	while (vdev) {
+		obj_mgr_debug("wlan_vdev_list[%d]: %pK", index, vdev);
+		wlan_print_vdev_info(vdev);
+		index++;
+		/* get next vdev */
+		vdev_next = wlan_vdev_get_next_vdev_of_pdev(vdev_list, vdev);
+		vdev = vdev_next;
+	}
+	wlan_pdev_obj_unlock(pdev);
+}
+
+qdf_export_symbol(wlan_print_pdev_info);
+#endif

+ 43 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -202,6 +202,7 @@ static QDF_STATUS wlan_objmgr_psoc_obj_destroy(struct wlan_objmgr_psoc *psoc)
 	}
 	wlan_objmgr_notify_destroy(psoc, WLAN_PSOC_OP);
 
+	wlan_print_psoc_info(psoc);
 	obj_mgr_info("Physically deleting psoc %d", psoc->soc_objmgr.psoc_id);
 
 	if (psoc->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
@@ -2170,3 +2171,45 @@ void wlan_objmgr_psoc_check_for_peer_leaks(struct wlan_objmgr_psoc *psoc)
 	wlan_psoc_obj_unlock(psoc);
 }
 qdf_export_symbol(wlan_objmgr_psoc_check_for_peer_leaks);
+
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_objmgr_psoc_objmgr *psoc_objmgr;
+	struct wlan_objmgr_pdev *pdev;
+	struct wlan_objmgr_vdev *vdev;
+	uint16_t index = 0;
+
+	psoc_objmgr = &psoc->soc_objmgr;
+
+	obj_mgr_debug("psoc: %pK", psoc);
+	obj_mgr_debug("psoc_id: %d", psoc_objmgr->psoc_id);
+	obj_mgr_debug("wlan_pdev_count: %d", psoc_objmgr->wlan_pdev_count);
+	obj_mgr_debug("wlan_pdev_id_map: 0x%x", psoc_objmgr->wlan_pdev_id_map);
+	obj_mgr_debug("wlan_vdev_count: %d", psoc_objmgr->wlan_vdev_count);
+	obj_mgr_debug("max_vdev_count: %d", psoc_objmgr->max_vdev_count);
+	obj_mgr_debug("wlan_peer_count: %d", psoc_objmgr->wlan_peer_count);
+	obj_mgr_debug("max_peer_count: %d", psoc_objmgr->max_peer_count);
+	obj_mgr_debug("temp_peer_count: %d", psoc_objmgr->temp_peer_count);
+	obj_mgr_debug("ref_cnt: %d", qdf_atomic_read(&psoc_objmgr->ref_cnt));
+	obj_mgr_debug("qdf_dev: %pK", psoc_objmgr->qdf_dev);
+
+	obj_mgr_debug("wlan_vdev_id_map[%d]: 0x%x",
+		      index, psoc_objmgr->wlan_vdev_id_map[index]);
+	index++;
+	obj_mgr_debug("wlan_vdev_id_map[%d]: 0x%x",
+		      index, psoc_objmgr->wlan_vdev_id_map[index]);
+
+	wlan_objmgr_for_each_psoc_pdev(psoc, index, pdev) {
+		obj_mgr_debug("wlan_pdev_list[%d]: %pK", index, pdev);
+		wlan_print_pdev_info(pdev);
+	}
+
+	wlan_objmgr_for_each_psoc_vdev(psoc, index, vdev) {
+		obj_mgr_debug("wlan_vdev_list[%d]: %pK", index, vdev);
+		wlan_print_vdev_info(vdev);
+	}
+}
+
+qdf_export_symbol(wlan_print_psoc_info);
+#endif

+ 21 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -279,6 +279,7 @@ static QDF_STATUS wlan_objmgr_vdev_obj_destroy(struct wlan_objmgr_vdev *vdev)
 
 	vdev_id = wlan_vdev_get_id(vdev);
 
+	wlan_print_vdev_info(vdev);
 	obj_mgr_debug("Physically deleting vdev %d", vdev_id);
 
 	if (vdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
@@ -1080,3 +1081,23 @@ struct wlan_objmgr_vdev *wlan_vdev_get_next_active_vdev_of_pdev(
 	return NULL;
 }
 
+#ifdef WLAN_OBJMGR_DEBUG
+void wlan_print_vdev_info(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_vdev_objmgr *vdev_objmgr;
+	uint32_t ref_cnt;
+
+	vdev_objmgr = &vdev->vdev_objmgr;
+
+	ref_cnt = qdf_atomic_read(&vdev_objmgr->ref_cnt);
+
+	obj_mgr_debug("vdev: %pK", vdev);
+	obj_mgr_debug("vdev_id: %d", vdev_objmgr->vdev_id);
+	obj_mgr_debug("print_cnt: %d", vdev_objmgr->print_cnt);
+	obj_mgr_debug("wlan_pdev: %pK", vdev_objmgr->wlan_pdev);
+	obj_mgr_debug("ref_cnt: %d", ref_cnt);
+}
+
+qdf_export_symbol(wlan_print_vdev_info);
+#endif
+