diff options
author | Vlad Yasevich <vyasevic@redhat.com> | 2012-11-15 03:49:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-15 17:36:17 -0500 |
commit | 8ca896cfdd17f32f5aa2747644733ebf3725360d (patch) | |
tree | 64a6ad61af635285a26a039f42bdc78ae8855979 /net/ipv6/protocol.c | |
parent | de27d001d187721de775ed9e0c485aa6f517c745 (diff) |
ipv6: Add new offload registration infrastructure.
Create a new data structure for IPv6 protocols that holds GRO/GSO
callbacks and a new array to track the protocols that register GRO/GSO.
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/protocol.c')
-rw-r--r-- | net/ipv6/protocol.c | 21 |
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 | ||
28 | const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS] __read_mostly; | 28 | const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS] __read_mostly; |
29 | const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS] __read_mostly; | ||
29 | 30 | ||
30 | int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol) | 31 | int 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 | } |
35 | EXPORT_SYMBOL(inet6_add_protocol); | 36 | EXPORT_SYMBOL(inet6_add_protocol); |
36 | 37 | ||
38 | int 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 | } | ||
43 | EXPORT_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 | } |
52 | EXPORT_SYMBOL(inet6_del_protocol); | 60 | EXPORT_SYMBOL(inet6_del_protocol); |
61 | |||
62 | int 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 | } | ||
73 | EXPORT_SYMBOL(inet6_del_offload); | ||