summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler-gcc.h4
-rw-r--r--include/linux/netdevice.h7
-rw-r--r--include/linux/overflow-arith.h18
3 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index dfaa7b3e9ae9..82c159e0532a 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -237,6 +237,10 @@
237#define KASAN_ABI_VERSION 3 237#define KASAN_ABI_VERSION 3
238#endif 238#endif
239 239
240#if GCC_VERSION >= 50000
241#define CC_HAVE_BUILTIN_OVERFLOW
242#endif
243
240#endif /* gcc version >= 40000 specific checks */ 244#endif /* gcc version >= 40000 specific checks */
241 245
242#if !defined(__noclone) 246#if !defined(__noclone)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 773383859bd9..4ac653b7b8ac 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1055,6 +1055,10 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1055 * This function is used to pass protocol port error state information 1055 * This function is used to pass protocol port error state information
1056 * to the switch driver. The switch driver can react to the proto_down 1056 * to the switch driver. The switch driver can react to the proto_down
1057 * by doing a phys down on the associated switch port. 1057 * by doing a phys down on the associated switch port.
1058 * int (*ndo_fill_metadata_dst)(struct net_device *dev, struct sk_buff *skb);
1059 * This function is used to get egress tunnel information for given skb.
1060 * This is useful for retrieving outer tunnel header parameters while
1061 * sampling packet.
1058 * 1062 *
1059 */ 1063 */
1060struct net_device_ops { 1064struct net_device_ops {
@@ -1230,6 +1234,8 @@ struct net_device_ops {
1230 int (*ndo_get_iflink)(const struct net_device *dev); 1234 int (*ndo_get_iflink)(const struct net_device *dev);
1231 int (*ndo_change_proto_down)(struct net_device *dev, 1235 int (*ndo_change_proto_down)(struct net_device *dev,
1232 bool proto_down); 1236 bool proto_down);
1237 int (*ndo_fill_metadata_dst)(struct net_device *dev,
1238 struct sk_buff *skb);
1233}; 1239};
1234 1240
1235/** 1241/**
@@ -2210,6 +2216,7 @@ void dev_add_offload(struct packet_offload *po);
2210void dev_remove_offload(struct packet_offload *po); 2216void dev_remove_offload(struct packet_offload *po);
2211 2217
2212int dev_get_iflink(const struct net_device *dev); 2218int dev_get_iflink(const struct net_device *dev);
2219int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
2213struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags, 2220struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2214 unsigned short mask); 2221 unsigned short mask);
2215struct net_device *dev_get_by_name(struct net *net, const char *name); 2222struct net_device *dev_get_by_name(struct net *net, const char *name);
diff --git a/include/linux/overflow-arith.h b/include/linux/overflow-arith.h
new file mode 100644
index 000000000000..e12ccf854a70
--- /dev/null
+++ b/include/linux/overflow-arith.h
@@ -0,0 +1,18 @@
1#pragma once
2
3#include <linux/kernel.h>
4
5#ifdef CC_HAVE_BUILTIN_OVERFLOW
6
7#define overflow_usub __builtin_usub_overflow
8
9#else
10
11static inline bool overflow_usub(unsigned int a, unsigned int b,
12 unsigned int *res)
13{
14 *res = a - b;
15 return *res > a ? true : false;
16}
17
18#endif