aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
authorGal Pressman <galpress@amazon.com>2019-05-01 06:48:13 -0400
committerDoug Ledford <dledford@redhat.com>2019-05-01 12:29:28 -0400
commit923abb9d797ba078f4e9eb3734dd71be5f567a2a (patch)
tree31db9356a4c325ce3e1e106bb64b436b639a2e53 /lib/dynamic_debug.c
parentb9b0f34531e0f8ff7fd0b78adfbc0e8209900f83 (diff)
RDMA/core: Introduce RDMA subsystem ibdev_* print functions
Similarly to dev/netdev/etc printk helpers, add standard printk helpers for the RDMA subsystem. Example output: efa 0000:00:06.0 efa_0: Hello World! efa_0: Hello World! (no parent device set) (NULL ib_device): Hello World! (ibdev is NULL) Cc: Jason Baron <jbaron@akamai.com> Suggested-by: Jason Gunthorpe <jgg@ziepe.ca> Suggested-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Gal Pressman <galpress@amazon.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 7bdf98c37e91..8a16c2d498e9 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -37,6 +37,8 @@
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/netdevice.h> 38#include <linux/netdevice.h>
39 39
40#include <rdma/ib_verbs.h>
41
40extern struct _ddebug __start___verbose[]; 42extern struct _ddebug __start___verbose[];
41extern struct _ddebug __stop___verbose[]; 43extern struct _ddebug __stop___verbose[];
42 44
@@ -636,6 +638,41 @@ EXPORT_SYMBOL(__dynamic_netdev_dbg);
636 638
637#endif 639#endif
638 640
641#if IS_ENABLED(CONFIG_INFINIBAND)
642
643void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
644 const struct ib_device *ibdev, const char *fmt, ...)
645{
646 struct va_format vaf;
647 va_list args;
648
649 va_start(args, fmt);
650
651 vaf.fmt = fmt;
652 vaf.va = &args;
653
654 if (ibdev && ibdev->dev.parent) {
655 char buf[PREFIX_SIZE];
656
657 dev_printk_emit(LOGLEVEL_DEBUG, ibdev->dev.parent,
658 "%s%s %s %s: %pV",
659 dynamic_emit_prefix(descriptor, buf),
660 dev_driver_string(ibdev->dev.parent),
661 dev_name(ibdev->dev.parent),
662 dev_name(&ibdev->dev),
663 &vaf);
664 } else if (ibdev) {
665 printk(KERN_DEBUG "%s: %pV", dev_name(&ibdev->dev), &vaf);
666 } else {
667 printk(KERN_DEBUG "(NULL ib_device): %pV", &vaf);
668 }
669
670 va_end(args);
671}
672EXPORT_SYMBOL(__dynamic_ibdev_dbg);
673
674#endif
675
639#define DDEBUG_STRING_SIZE 1024 676#define DDEBUG_STRING_SIZE 1024
640static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE]; 677static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE];
641 678