aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/dynamic_debug.h17
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--lib/dynamic_debug.c25
-rw-r--r--net/core/dev.c3
4 files changed, 48 insertions, 3 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 843cb9eb4226..feaac1ee3001 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -47,6 +47,13 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
47 const char *fmt, ...) 47 const char *fmt, ...)
48 __attribute__ ((format (printf, 3, 4))); 48 __attribute__ ((format (printf, 3, 4)));
49 49
50struct net_device;
51
52extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
53 const struct net_device *dev,
54 const char *fmt, ...)
55 __attribute__ ((format (printf, 3, 4)));
56
50#define dynamic_pr_debug(fmt, ...) do { \ 57#define dynamic_pr_debug(fmt, ...) do { \
51 static struct _ddebug descriptor \ 58 static struct _ddebug descriptor \
52 __used \ 59 __used \
@@ -67,6 +74,16 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
67 __dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \ 74 __dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \
68 } while (0) 75 } while (0)
69 76
77#define dynamic_netdev_dbg(dev, fmt, ...) do { \
78 static struct _ddebug descriptor \
79 __used \
80 __attribute__((section("__verbose"), aligned(8))) = \
81 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
82 _DPRINTK_FLAGS_DEFAULT }; \
83 if (unlikely(descriptor.enabled)) \
84 __dynamic_netdev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);\
85 } while (0)
86
70#else 87#else
71 88
72static inline int ddebug_remove_module(const char *mod) 89static inline int ddebug_remove_module(const char *mod)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ddee79bb8f15..9333a0300c5e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2617,6 +2617,9 @@ static inline const char *netdev_name(const struct net_device *dev)
2617 return dev->name; 2617 return dev->name;
2618} 2618}
2619 2619
2620extern int __netdev_printk(const char *level, const struct net_device *dev,
2621 struct va_format *vaf);
2622
2620extern int netdev_printk(const char *level, const struct net_device *dev, 2623extern int netdev_printk(const char *level, const struct net_device *dev,
2621 const char *format, ...) 2624 const char *format, ...)
2622 __attribute__ ((format (printf, 3, 4))); 2625 __attribute__ ((format (printf, 3, 4)));
@@ -2644,8 +2647,7 @@ extern int netdev_info(const struct net_device *dev, const char *format, ...)
2644#elif defined(CONFIG_DYNAMIC_DEBUG) 2647#elif defined(CONFIG_DYNAMIC_DEBUG)
2645#define netdev_dbg(__dev, format, args...) \ 2648#define netdev_dbg(__dev, format, args...) \
2646do { \ 2649do { \
2647 dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ 2650 dynamic_netdev_dbg(__dev, format, ##args); \
2648 netdev_name(__dev), ##args); \
2649} while (0) 2651} while (0)
2650#else 2652#else
2651#define netdev_dbg(__dev, format, args...) \ 2653#define netdev_dbg(__dev, format, args...) \
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 4fc03ddb05f2..ee3b9ba625c5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -33,6 +33,7 @@
33#include <linux/hardirq.h> 33#include <linux/hardirq.h>
34#include <linux/sched.h> 34#include <linux/sched.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/netdevice.h>
36 37
37extern struct _ddebug __start___verbose[]; 38extern struct _ddebug __start___verbose[];
38extern struct _ddebug __stop___verbose[]; 39extern struct _ddebug __stop___verbose[];
@@ -503,6 +504,30 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
503} 504}
504EXPORT_SYMBOL(__dynamic_dev_dbg); 505EXPORT_SYMBOL(__dynamic_dev_dbg);
505 506
507int __dynamic_netdev_dbg(struct _ddebug *descriptor,
508 const struct net_device *dev, const char *fmt, ...)
509{
510 struct va_format vaf;
511 va_list args;
512 int res;
513
514 BUG_ON(!descriptor);
515 BUG_ON(!fmt);
516
517 va_start(args, fmt);
518
519 vaf.fmt = fmt;
520 vaf.va = &args;
521
522 res = dynamic_emit_prefix(descriptor);
523 res += __netdev_printk(KERN_CONT, dev, &vaf);
524
525 va_end(args);
526
527 return res;
528}
529EXPORT_SYMBOL(__dynamic_netdev_dbg);
530
506static __initdata char ddebug_setup_string[1024]; 531static __initdata char ddebug_setup_string[1024];
507static __init int ddebug_setup_query(char *str) 532static __init int ddebug_setup_query(char *str)
508{ 533{
diff --git a/net/core/dev.c b/net/core/dev.c
index 17d67b579beb..c47a7bcf3c64 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6290,7 +6290,7 @@ const char *netdev_drivername(const struct net_device *dev)
6290 return empty; 6290 return empty;
6291} 6291}
6292 6292
6293static int __netdev_printk(const char *level, const struct net_device *dev, 6293int __netdev_printk(const char *level, const struct net_device *dev,
6294 struct va_format *vaf) 6294 struct va_format *vaf)
6295{ 6295{
6296 int r; 6296 int r;
@@ -6305,6 +6305,7 @@ static int __netdev_printk(const char *level, const struct net_device *dev,
6305 6305
6306 return r; 6306 return r;
6307} 6307}
6308EXPORT_SYMBOL(__netdev_printk);
6308 6309
6309int netdev_printk(const char *level, const struct net_device *dev, 6310int netdev_printk(const char *level, const struct net_device *dev,
6310 const char *format, ...) 6311 const char *format, ...)