Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03e089df authored by Andrei Danaila's avatar Andrei Danaila
Browse files

mhi: Enable logging based on defconfig options



MHI driver stack logging to the private IPC log buffer can be quite
expensive from a MIPS perspective. Enable such MHI logging
if and only if such logging is desired in defconfig.

Change-Id: I4a16eedc2424d250129b1b44a91d1fa32be399f5
Signed-off-by: default avatarAndrei Danaila <adanaila@codeaurora.org>
parent 50e0173f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
# Makefile for the msm networking support.
#

ccflags-$(CONFIG_MSM_MHI_DEBUG) := -DDEBUG
obj-$(CONFIG_MSM_RMNET_MHI) += msm_rmnet_mhi.o
obj-$(CONFIG_ECM_IPA) += ecm_ipa.o
obj-$(CONFIG_RNDIS_IPA) += rndis_ipa.o
+14 −5
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/msm_mhi.h>
#include <linux/debugfs.h>
#include <linux/ipc_logging.h>
#include <linux/device.h>

#define RMNET_MHI_DRIVER_NAME "rmnet_mhi"
#define RMNET_MHI_DEV_NAME    "rmnet_mhi%d"
@@ -54,11 +55,14 @@ struct __packed mhi_skb_priv {

enum DBG_LVL rmnet_ipc_log_lvl = MSG_VERBOSE;
enum DBG_LVL rmnet_msg_lvl = MSG_CRITICAL;
static unsigned int rmnet_log_override;

module_param(rmnet_msg_lvl , uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(rmnet_msg_lvl, "dbg lvl");
module_param(rmnet_ipc_log_lvl, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(rmnet_ipc_log_lvl, "dbg lvl");
module_param(rmnet_log_override , uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(rmnet_log_override, "dbg class");

unsigned int mru = MHI_DEFAULT_MRU;
module_param(mru, uint, S_IRUGO | S_IWUSR);
@@ -67,9 +71,14 @@ MODULE_PARM_DESC(mru, "MRU interface setting");
void *rmnet_ipc_log;

#define rmnet_log(_msg_lvl, _msg, ...) do { \
		if ((_msg_lvl) >= rmnet_msg_lvl) \
		DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, _msg);	 \
		if ((rmnet_log_override ||				 \
		    unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) &&\
		    (_msg_lvl) >= rmnet_msg_lvl)			 \
			pr_alert("[%s] " _msg, __func__, ##__VA_ARGS__); \
		if (rmnet_ipc_log && ((_msg_lvl) >= rmnet_ipc_log_lvl))	\
		if ((rmnet_log_override ||				      \
			unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) && \
			rmnet_ipc_log && ((_msg_lvl) >= rmnet_ipc_log_lvl))   \
			ipc_log_string(rmnet_ipc_log,			 \
			       "[%s] " _msg, __func__, ##__VA_ARGS__);	 \
} while (0)
+9 −0
Original line number Diff line number Diff line
@@ -211,6 +211,15 @@ config MSM_MHI_UCI
	  read, write and ioctl operations to communicate with the
	  attached device.

config MSM_MHI_DEBUG
	 bool "MHI debug support"
	 depends on MSM_MHI
	 help
	   Say yes here to enable debugging support in the MHI transport
	   and individual MHI client drivers. This option may impact
	   throughput as individual MHI packets and state transitions
	   will be logged.

config MSM_MHI_DEV
        tristate "Modem Device Interface Driver"
	depends on EP_PCIE && IPA
+1 −0
Original line number Diff line number Diff line
# Makefile for MHI driver
ccflags-$(CONFIG_MSM_MHI_DEBUG) := -DDEBUG
obj-y += mhi_main.o
obj-y += mhi_iface.o
obj-y += mhi_init.o
+9 −12
Original line number Diff line number Diff line
@@ -25,22 +25,19 @@
#include <linux/msm_pcie.h>
#include <linux/sched.h>
#include <linux/irqreturn.h>
#include <linux/list.h>
#include <linux/dma-mapping.h>

extern struct mhi_pcie_devices mhi_devices;

enum MHI_DEBUG_CLASS {
	MHI_DBG_DATA = 0x1000,
	MHI_DBG_POWER = 0x2000,
	MHI_DBG_reserved = 0x80000000
};

enum MHI_DEBUG_LEVEL {
	MHI_MSG_VERBOSE = 0x1,
	MHI_MSG_INFO = 0x2,
	MHI_MSG_DBG = 0x4,
	MHI_MSG_WARNING = 0x8,
	MHI_MSG_ERROR = 0x10,
	MHI_MSG_CRITICAL = 0x20,
	MHI_MSG_RAW = 0x1,
	MHI_MSG_VERBOSE = 0x2,
	MHI_MSG_INFO = 0x4,
	MHI_MSG_DBG = 0x8,
	MHI_MSG_WARNING = 0x10,
	MHI_MSG_ERROR = 0x20,
	MHI_MSG_CRITICAL = 0x40,
	MHI_MSG_reserved = 0x80000000
};

Loading