Эх сурвалжийг харах

qcacmn: Add logs in wmi_buf_alloc()

In wmi_buf_alloc() function, pass function name and
line number of caller and log the same in case of failure,
this approach helps to remove error logs in caller function
there by reducing text segment.

Also add wmi_nofl_* macros.

Change-Id: Ib1ac8bf2bbcefa7f0015aff2733d3dc4773b185d
CRs-Fixed: 2281983
Arif Hussain 6 жил өмнө
parent
commit
58189eb0bd

+ 12 - 1
wmi/inc/wmi_unified_api.h

@@ -201,7 +201,18 @@ wmi_buf_t
 wmi_buf_alloc_debug(wmi_unified_t wmi_handle, uint32_t len,
 		    uint8_t *file_name, uint32_t line_num);
 #else
-wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint32_t len);
+/**
+ * wmi_buf_alloc() - generic function to allocate WMI buffer
+ * @wmi_handle: handle to WMI.
+ * @len: length of the buffer
+ *
+ * Return: return wmi_buf_t or null if memory alloc fails
+ */
+#define wmi_buf_alloc(wmi_handle, len) \
+	wmi_buf_alloc_fl(wmi_handle, len, __func__, __LINE__)
+
+wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
+			   const char *func, uint32_t line);
 #endif
 
 /**

+ 17 - 0
wmi/inc/wmi_unified_priv.h

@@ -66,6 +66,23 @@
 #define WMI_MGMT_EVENT_DEBUG_MAX_ENTRY (256)
 #endif
 
+#define wmi_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_WMI, ## params)
+#define wmi_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_WMI, ## params)
+#define wmi_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_WMI, ## params)
+#define wmi_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_WMI, ## params)
+#define wmi_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_WMI, ## params)
+
+#define wmi_nofl_alert(params...) \
+	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_WMI, ## params)
+#define wmi_nofl_err(params...) \
+	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_WMI, ## params)
+#define wmi_nofl_warn(params...) \
+	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_WMI, ## params)
+#define wmi_nofl_info(params...) \
+	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_WMI, ## params)
+#define wmi_nofl_debug(params...) \
+	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_WMI, ## params)
+
 /**
  * struct wmi_command_debug - WMI command log buffer data type
  * @ command - Store WMI Command id

+ 5 - 3
wmi/src/wmi_unified.c

@@ -1220,12 +1220,14 @@ void wmi_buf_free(wmi_buf_t net_buf)
 }
 qdf_export_symbol(wmi_buf_free);
 #else
-wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint32_t len)
+wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
+			   const char *func, uint32_t line)
 {
 	wmi_buf_t wmi_buf;
 
 	if (roundup(len + WMI_MIN_HEAD_ROOM, 4) > wmi_handle->max_msg_len) {
-		QDF_ASSERT(0);
+		wmi_nofl_err("%s:%d, Invalid len:%d", func, line, len);
+		QDF_DEBUG_PANIC();
 		return NULL;
 	}
 
@@ -1243,7 +1245,7 @@ wmi_buf_t wmi_buf_alloc(wmi_unified_t wmi_handle, uint32_t len)
 	qdf_nbuf_set_pktlen(wmi_buf, len);
 	return wmi_buf;
 }
-qdf_export_symbol(wmi_buf_alloc);
+qdf_export_symbol(wmi_buf_alloc_fl);
 
 void wmi_buf_free(wmi_buf_t net_buf)
 {