]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/ipv6/ip6_offload.c
drm/ttm: Delete an unnecessary check before the function call "ttm_tt_destroy"
[karo-tx-linux.git] / net / ipv6 / ip6_offload.c
index 787e55f4796cf5a8772b18dd8338692fa82bee21..22e90e56b5a9ff8d5f645b481fae8756e7246777 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <net/protocol.h>
 #include <net/ipv6.h>
+#include <net/inet_common.h>
 
 #include "ip6_offload.h"
 
@@ -253,9 +254,11 @@ out:
        return pp;
 }
 
-static struct sk_buff **sit_gro_receive(struct sk_buff **head,
-                                       struct sk_buff *skb)
+static struct sk_buff **sit_ip6ip6_gro_receive(struct sk_buff **head,
+                                              struct sk_buff *skb)
 {
+       /* Common GRO receive for SIT and IP6IP6 */
+
        if (NAPI_GRO_CB(skb)->encap_mark) {
                NAPI_GRO_CB(skb)->flush = 1;
                return NULL;
@@ -266,6 +269,21 @@ static struct sk_buff **sit_gro_receive(struct sk_buff **head,
        return ipv6_gro_receive(head, skb);
 }
 
+static struct sk_buff **ip4ip6_gro_receive(struct sk_buff **head,
+                                          struct sk_buff *skb)
+{
+       /* Common GRO receive for SIT and IP6IP6 */
+
+       if (NAPI_GRO_CB(skb)->encap_mark) {
+               NAPI_GRO_CB(skb)->flush = 1;
+               return NULL;
+       }
+
+       NAPI_GRO_CB(skb)->encap_mark = 1;
+
+       return inet_gro_receive(head, skb);
+}
+
 static int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
 {
        const struct net_offload *ops;
@@ -298,6 +316,20 @@ static int sit_gro_complete(struct sk_buff *skb, int nhoff)
        return ipv6_gro_complete(skb, nhoff);
 }
 
+static int ip6ip6_gro_complete(struct sk_buff *skb, int nhoff)
+{
+       skb->encapsulation = 1;
+       skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP6;
+       return ipv6_gro_complete(skb, nhoff);
+}
+
+static int ip4ip6_gro_complete(struct sk_buff *skb, int nhoff)
+{
+       skb->encapsulation = 1;
+       skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP6;
+       return inet_gro_complete(skb, nhoff);
+}
+
 static struct packet_offload ipv6_packet_offload __read_mostly = {
        .type = cpu_to_be16(ETH_P_IPV6),
        .callbacks = {
@@ -310,11 +342,26 @@ static struct packet_offload ipv6_packet_offload __read_mostly = {
 static const struct net_offload sit_offload = {
        .callbacks = {
                .gso_segment    = ipv6_gso_segment,
-               .gro_receive    = sit_gro_receive,
+               .gro_receive    = sit_ip6ip6_gro_receive,
                .gro_complete   = sit_gro_complete,
        },
 };
 
+static const struct net_offload ip4ip6_offload = {
+       .callbacks = {
+               .gso_segment    = inet_gso_segment,
+               .gro_receive    = ip4ip6_gro_receive,
+               .gro_complete   = ip4ip6_gro_complete,
+       },
+};
+
+static const struct net_offload ip6ip6_offload = {
+       .callbacks = {
+               .gso_segment    = ipv6_gso_segment,
+               .gro_receive    = sit_ip6ip6_gro_receive,
+               .gro_complete   = ip6ip6_gro_complete,
+       },
+};
 static int __init ipv6_offload_init(void)
 {
 
@@ -326,6 +373,8 @@ static int __init ipv6_offload_init(void)
        dev_add_offload(&ipv6_packet_offload);
 
        inet_add_offload(&sit_offload, IPPROTO_IPV6);
+       inet6_add_offload(&ip6ip6_offload, IPPROTO_IPV6);
+       inet6_add_offload(&ip4ip6_offload, IPPROTO_IPIP);
 
        return 0;
 }