aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/protocol.c')
-rw-r--r--net/ipv6/protocol.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
index 053082dfc93e..f7c53a7d5cb0 100644
--- a/net/ipv6/protocol.c
+++ b/net/ipv6/protocol.c
@@ -26,6 +26,7 @@
26#include <net/protocol.h> 26#include <net/protocol.h>
27 27
28const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS] __read_mostly; 28const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS] __read_mostly;
29const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS] __read_mostly;
29 30
30int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol) 31int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol)
31{ 32{
@@ -34,6 +35,13 @@ int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol
34} 35}
35EXPORT_SYMBOL(inet6_add_protocol); 36EXPORT_SYMBOL(inet6_add_protocol);
36 37
38int inet6_add_offload(const struct net_offload *prot, unsigned char protocol)
39{
40 return !cmpxchg((const struct net_offload **)&inet6_offloads[protocol],
41 NULL, prot) ? 0 : -1;
42}
43EXPORT_SYMBOL(inet6_add_offload);
44
37/* 45/*
38 * Remove a protocol from the hash tables. 46 * Remove a protocol from the hash tables.
39 */ 47 */
@@ -50,3 +58,16 @@ int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol
50 return ret; 58 return ret;
51} 59}
52EXPORT_SYMBOL(inet6_del_protocol); 60EXPORT_SYMBOL(inet6_del_protocol);
61
62int inet6_del_offload(const struct net_offload *prot, unsigned char protocol)
63{
64 int ret;
65
66 ret = (cmpxchg((const struct net_offload **)&inet6_offloads[protocol],
67 prot, NULL) == prot) ? 0 : -1;
68
69 synchronize_net();
70
71 return ret;
72}
73EXPORT_SYMBOL(inet6_del_offload);