Skip to content

Commit f617f27

Browse files
ecree-solarflaredavem330
authored andcommitted
net: implement netif_cond_dbg macro
For reporting things that may or may not be serious, depending on some condition, netif_cond_dbg will check the condition and print the report at either dbg (if the condition is true) or the specified level. Suggested-by: Jon Cooper <[email protected]> Signed-off-by: Edward Cree <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d3d4ec commit f617f27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/linux/netdevice.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4347,6 +4347,15 @@ do { \
43474347
})
43484348
#endif
43494349

4350+
/* if @cond then downgrade to debug, else print at @level */
4351+
#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...) \
4352+
do { \
4353+
if (cond) \
4354+
netif_dbg(priv, type, netdev, fmt, ##args); \
4355+
else \
4356+
netif_ ## level(priv, type, netdev, fmt, ##args); \
4357+
} while (0)
4358+
43504359
#if defined(VERBOSE_DEBUG)
43514360
#define netif_vdbg netif_dbg
43524361
#else

0 commit comments

Comments
 (0)