]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip link: Add support for remote checksum offload to IP tunnels
authorTom Herbert <therbert@google.com>
Thu, 29 Jan 2015 16:51:58 +0000 (08:51 -0800)
committerStephen Hemminger <shemming@brocade.com>
Thu, 5 Feb 2015 18:50:02 +0000 (10:50 -0800)
This patch adds support to remote checksum checksum offload
confinguration for IPIP, SIT, and GRE tunnels. This patch
adds a [no]encap-remcsum to ip link command which applicable
when configured tunnels that use GUE.

http://tools.ietf.org/html/draft-herbert-remotecsumoffload-00

Example:

ip link add name tun1 type gre remote 192.168.1.1 local 192.168.1.2 \
   ttl 225 encap fou encap-sport auto encap-dport 7777 encap-csum \
   encap-remcsum

This would create an GRE tunnel in GUE encapsulation where the source
port is automatically selected (based on hash of inner packet),
checksums in the encapsulating UDP header are enabled (needed.for
remote checksum offload), and remote checksum ffload is configured to
be used on the tunnel (affects TX side).

Signed-off-by: Tom Herbert <therbert@google.com>
ip/link_gre.c
ip/link_iptnl.c

index 47b64cb806e4b777e75bd8eb61a16e999dbfea4d..1d78387683ad362a0572bd2ac14983138efdbb63 100644 (file)
@@ -31,7 +31,7 @@ static void print_usage(FILE *f)
        fprintf(f, "          [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n");
        fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
        fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-       fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ]\n");
+       fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
        fprintf(f, "\n");
        fprintf(f, "Where: NAME := STRING\n");
        fprintf(f, "       ADDR := { IP_ADDRESS | any }\n");
@@ -287,6 +287,10 @@ get_failed:
                        encapflags |= TUNNEL_ENCAP_FLAG_CSUM6;
                } else if (strcmp(*argv, "noencap-udp6-csum") == 0) {
                        encapflags |= ~TUNNEL_ENCAP_FLAG_CSUM6;
+               } else if (strcmp(*argv, "encap-remcsum") == 0) {
+                       encapflags |= TUNNEL_ENCAP_FLAG_REMCSUM;
+               } else if (strcmp(*argv, "noencap-remcsum") == 0) {
+                       encapflags |= ~TUNNEL_ENCAP_FLAG_REMCSUM;
                } else
                        usage();
                argc--; argv++;
@@ -445,6 +449,11 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
                        fputs("encap-csum6 ", f);
                else
                        fputs("noencap-csum6 ", f);
+
+               if (flags & TUNNEL_ENCAP_FLAG_REMCSUM)
+                       fputs("encap-remcsum ", f);
+               else
+                       fputs("noencap-remcsum ", f);
        }
 }
 
index 948711782cca8e44e712064ca291688ae01bc627..cab174f9973bfddd61f2d5a30c7b9dd8edbadd83 100644 (file)
@@ -31,7 +31,7 @@ static void print_usage(FILE *f, int sit)
        fprintf(f, "          [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]\n");
        fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
        fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-       fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ]\n");
+       fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
        if (sit) {
                fprintf(f, "          [ mode { ip6ip | ipip | any } ]\n");
                fprintf(f, "          [ isatap ]\n");
@@ -256,6 +256,10 @@ get_failed:
                        encapflags |= TUNNEL_ENCAP_FLAG_CSUM6;
                } else if (strcmp(*argv, "noencap-udp6-csum") == 0) {
                        encapflags &= ~TUNNEL_ENCAP_FLAG_CSUM6;
+               } else if (strcmp(*argv, "encap-remcsum") == 0) {
+                       encapflags |= TUNNEL_ENCAP_FLAG_REMCSUM;
+               } else if (strcmp(*argv, "noencap-remcsum") == 0) {
+                       encapflags &= ~TUNNEL_ENCAP_FLAG_REMCSUM;
                } else if (strcmp(*argv, "6rd-prefix") == 0) {
                        inet_prefix prefix;
                        NEXT_ARG();
@@ -438,6 +442,11 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
                        fputs("encap-csum6 ", f);
                else
                        fputs("noencap-csum6 ", f);
+
+               if (flags & TUNNEL_ENCAP_FLAG_REMCSUM)
+                       fputs("encap-remcsum ", f);
+               else
+                       fputs("noencap-remcsum ", f);
        }
 }