[openib-general] [PATCH][RFC] Turn on mthca debug unless EMBEDDED is selected
Roland Dreier
rdreier at cisco.com
Wed Mar 29 22:15:12 PST 2006
And here's a patch to make mthca debugging configurable at runtime via
a module option, and get rid of the Kconfig choice unless EMBEDDED is set.
Thoughts on this one?
--- infiniband/hw/mthca/Kconfig (revision 6101)
+++ infiniband/hw/mthca/Kconfig (working copy)
@@ -7,10 +7,11 @@ config INFINIBAND_MTHCA
("Tavor") and the MT25208 PCI Express HCA ("Arbel").
config INFINIBAND_MTHCA_DEBUG
- bool "Verbose debugging output"
+ bool "Verbose debugging output" if EMBEDDED
depends on INFINIBAND_MTHCA
- default n
+ default y
---help---
- This option causes the mthca driver produce a bunch of debug
- messages. Select this is you are developing the driver or
- trying to diagnose a problem.
+ This option causes debugging code to be compiled into the
+ mthca driver. The output can be turned on via the
+ debug_level module parameter (which can also be set after
+ the driver is loaded through sysfs).
--- infiniband/hw/mthca/Makefile (revision 6101)
+++ infiniband/hw/mthca/Makefile (working copy)
@@ -1,9 +1,5 @@
EXTRA_CFLAGS += -Idrivers/infiniband/include
-ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
-EXTRA_CFLAGS += -DDEBUG
-endif
-
obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o
ib_mthca-y := mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
--- infiniband/hw/mthca/mthca_dev.h (revision 6101)
+++ infiniband/hw/mthca/mthca_dev.h (working copy)
@@ -355,8 +355,21 @@ struct mthca_dev {
spinlock_t sm_lock;
};
-#define mthca_dbg(mdev, format, arg...) \
- dev_dbg(&mdev->pdev->dev, format, ## arg)
+#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
+extern int mthca_debug_level;
+
+#define mthca_dbg(mdev, format, arg...) \
+ do { \
+ if (mthca_debug_level) \
+ dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \
+ } while (0)
+
+#else /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
+#define mthca_dbg(mdev, format, arg...) do { (void) mdev; } while (0)
+
+#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
#define mthca_err(mdev, format, arg...) \
dev_err(&mdev->pdev->dev, format, ## arg)
#define mthca_info(mdev, format, arg...) \
--- infiniband/hw/mthca/mthca_main.c (revision 6101)
+++ infiniband/hw/mthca/mthca_main.c (working copy)
@@ -52,6 +52,14 @@ MODULE_DESCRIPTION("Mellanox InfiniBand
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(DRV_VERSION);
+#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
+
+int mthca_debug_level = 0;
+module_param_named(debug_level, mthca_debug_level, int, 0644);
+MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
+
+#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
#ifdef CONFIG_PCI_MSI
static int msi_x = 0;
More information about the general
mailing list