aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/net.h')
-rw-r--r--include/linux/net.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/net.h b/include/linux/net.h
index be60c7f5e145..e9ac2df079ba 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -250,6 +250,29 @@ extern struct socket *sockfd_lookup(int fd, int *err);
250#define sockfd_put(sock) fput(sock->file) 250#define sockfd_put(sock) fput(sock->file)
251extern int net_ratelimit(void); 251extern int net_ratelimit(void);
252 252
253#define net_ratelimited_function(function, ...) \
254do { \
255 if (net_ratelimit()) \
256 function(__VA_ARGS__); \
257} while (0)
258
259#define net_emerg_ratelimited(fmt, ...) \
260 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
261#define net_alert_ratelimited(fmt, ...) \
262 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
263#define net_crit_ratelimited(fmt, ...) \
264 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
265#define net_err_ratelimited(fmt, ...) \
266 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
267#define net_notice_ratelimited(fmt, ...) \
268 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
269#define net_warn_ratelimited(fmt, ...) \
270 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
271#define net_info_ratelimited(fmt, ...) \
272 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
273#define net_dbg_ratelimited(fmt, ...) \
274 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
275
253#define net_random() random32() 276#define net_random() random32()
254#define net_srandom(seed) srandom32((__force u32)seed) 277#define net_srandom(seed) srandom32((__force u32)seed)
255 278
@@ -290,5 +313,8 @@ extern int kernel_sock_shutdown(struct socket *sock,
290 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \ 313 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
291 "-type-" __stringify(type)) 314 "-type-" __stringify(type))
292 315
316#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \
317 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
318 name)
293#endif /* __KERNEL__ */ 319#endif /* __KERNEL__ */
294#endif /* _LINUX_NET_H */ 320#endif /* _LINUX_NET_H */