Pārlūkot izejas kodu

qcacmn: Add the hang event infrastructure

As part of the new requirement to understand the reason for the
wifi hang the data need to be collected from the required modules
which will help in root-causing the reason for the hang.

Add the infrastructure so that the required modules can register for
this hang event notifier chain.

Change-Id: I32f1365eec1ad7d6e19be95e8faf9a980d054b76
CRs-Fixed: 2648304
Arun Kumar Khandavalli 5 gadi atpakaļ
vecāks
revīzija
2bfa222e36

+ 93 - 0
qdf/inc/qdf_hang_event_notifier.h

@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2020, 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: qdf_hang_event_notifier
+  * This file provides OS dependent QDF notifier call for hang event
+  */
+
+#ifndef QDF_HANG_EVENT_NOTIFIER_H
+#define QDF_HANG_EVENT_NOTIFIER_H
+
+#include <qdf_notifier.h>
+
+#define QDF_HANG_EVENT_VERSION "1.0"
+#define QDF_HANG_EVENT_DATA_SIZE 784
+
+/**
+ * qdf_notifier_data - Private data for notifier data
+ * @hang_data: Data filled by notifier
+ * @offset: Current offset of the hang data buffer
+ */
+struct qdf_notifer_data {
+	uint8_t *hang_data;
+	unsigned int offset;
+};
+
+#ifdef WLAN_HANG_EVENT
+/**
+ * qdf_hang_event_register_notifier() - Hang data notifier register
+ * @nb: Notifier block
+ *
+ * This function registers notifier block for the hang data notifier chain
+ * the registered function will be invoked when the hang data notifier call
+ * is invoked.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb);
+
+/**
+ * qdf_hang_event_unregister_notifier() - Hang data notifier unregister
+ * @nb: Notifier block
+ *
+ * This function unregisters notifier block for the hang data notifier chain.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb);
+
+/**
+ * qdf_hang_event_notifier_call() - Hang data notifier register
+ * @v: state
+ * @data: Private data for this notifier chain
+ *
+ * This function when invoked will call the functions registered with this
+ * notifier chain.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data);
+#else
+static inline
+QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+#endif

+ 44 - 0
qdf/src/qdf_hang_event_notifier.c

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2020, 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: qdf_hang_event_notifier
+  * This file provides OS dependent QDF notifier call for hang event
+  */
+
+#include <i_qdf_notifier.h>
+#include <qdf_notifier.h>
+#include <qdf_hang_event_notifier.h>
+
+static qdf_atomic_notifier_init(qdf_hang_event_notif_head)
+
+QDF_STATUS qdf_hang_event_register_notifier(qdf_notif_block *nb)
+{
+	return qdf_register_atomic_notifier_chain(&qdf_hang_event_notif_head,
+						  nb);
+}
+
+QDF_STATUS qdf_hang_event_unregister_notifier(qdf_notif_block *nb)
+{
+	return qdf_unregister_atomic_notifier_chain(&qdf_hang_event_notif_head,
+						    nb);
+}
+
+QDF_STATUS qdf_hang_event_notifier_call(unsigned long v, void *data)
+{
+	return qdf_atomic_notfier_call(&qdf_hang_event_notif_head,
+					 v, data);
+}

+ 2 - 2
qdf/src/qdf_notifier.c

@@ -39,11 +39,11 @@ QDF_STATUS qdf_unregister_blocking_notifier_chain(qdf_blocking_notif_head *head,
 }
 
 QDF_STATUS qdf_blocking_notfier_call(qdf_blocking_notif_head *head,
-				     unsigned long v, void *data)
+				     unsigned long state, void *data)
 {
 	int ret;
 
-	ret = __qdf_blocking_notfier_call(head, v, data);
+	ret = __qdf_blocking_notfier_call(head, state, data);
 
 	return qdf_status_from_os_return(ret);
 }