Skip to contentSkip to conversation

iproute: Support for remote checksum offload

PATCH Applied Tom Herbert 3 participants 10 messages Jan 29, 2015 – Feb 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iproute: Support for remote checksum offload

Also, updated man pages for remote checksum offload options, and added a section on setting FOU/GUE encapsulation with IP tunnels.

Tom Herbert (4):
ip link: Add support for remote checksum offload to IP tunnels
vxlan: Add support for remote checksum offload
iproute: Description of new options for VXLAN in ip-link man pages
iproute: Descriptions of fou and gue options in ip-link man pages

 include/linux/if_link.h |  2 ++
 ip/iplink_vxlan.c       | 21 ++++++++++++
 ip/link_gre.c           | 11 ++++++-
 ip/link_iptnl.c         | 11 ++++++-
 man/man8/ip-link.8.in   | 86 ++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 128 insertions(+), 3 deletions(-)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH 1/4 ip link: Add support for remote checksum offload to IP tunnels

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).

---
 ip/link_gre.c   | 11 ++++++++++-
 ip/link_iptnl.c | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
ip/link_gre.c +10 -1
index 47b64cb..1d78387 100644
@@ -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);
 	}
 }
 
ip/link_iptnl.c +10 -1
index 9487117..cab174f 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

Re: [PATCH iproute2 1/4] ip link: Add support for remote checksum offload to IP tunnels

Quoted 13 lines · On Thu, 29 Jan 2015 08:51:58 -0800 Tom Herbert <[email protected]> wrote:

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

Quoted 7 lines

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).

Applied to master since this does not depend on any net-next features.

#3 lore raw

PATCH 2/4 vxlan: Add support for remote checksum offload

In reply to Tom Herbert

This patch adds support to remote checksum checksum offload to VXLAN. This patch adds remcsumtx and remcsumrx to ip vxlan configuration to enable remote checksum offload for transmit and receive on the VXLAN tunnel.

https://tools.ietf.org/html/draft-herbert-vxlan-rco-00

Example:

ip link add name vxlan0 type vxlan id 42 group 239.1.1.1 dev eth0 \
udpcsum remcsumtx remcsumrx

---
 include/linux/if_link.h |  2 ++
 ip/iplink_vxlan.c       | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
include/linux/if_link.h +2 -0
index 167ec34..11df025 100644
@@ -368,6 +368,8 @@ enum {
 	IFLA_VXLAN_UDP_CSUM,
 	IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
 	IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
+	IFLA_VXLAN_REMCSUM_TX,
+	IFLA_VXLAN_REMCSUM_RX,
 	__IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1)
ip/iplink_vxlan.c +21 -0
index 9cc3ec3..8fb11df 100644
@@ -30,6 +30,7 @@ static void print_explain(FILE *f)
 	fprintf(f, "                 [ [no]l2miss ] [ [no]l3miss ]\n");
 	fprintf(f, "                 [ ageing SECONDS ] [ maxaddress NUMBER ]\n");
 	fprintf(f, "                 [ [no]udpcsum ] [ [no]udp6zerocsumtx ] [ [no]udp6zerocsumrx ]\n");
+	fprintf(f, "                 [ [no]remcsumtx ] [ [no]remcsumrx ]\n");
 	fprintf(f, "\n");
 	fprintf(f, "Where: VNI := 0-16777215\n");
 	fprintf(f, "       ADDR := { IP_ADDRESS | any }\n");
@@ -68,6 +69,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 	__u8 udpcsum = 0;
 	__u8 udp6zerocsumtx = 0;
 	__u8 udp6zerocsumrx = 0;
+	__u8 remcsumtx = 0;
+	__u8 remcsumrx = 0;
 	int dst_port_set = 0;
 	struct ifla_vxlan_port_range range = { 0, 0 };
 
@@ -197,6 +200,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 			udp6zerocsumrx = 1;
 		} else if (!matches(*argv, "noudp6zerocsumrx")) {
 			udp6zerocsumrx = 0;
+		} else if (!matches(*argv, "remcsumtx")) {
+			remcsumtx = 1;
+		} else if (!matches(*argv, "noremcsumtx")) {
+			remcsumtx = 0;
+		} else if (!matches(*argv, "remcsumrx")) {
+			remcsumrx = 1;
+		} else if (!matches(*argv, "noremcsumrx")) {
+			remcsumrx = 0;
 		} else if (matches(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -255,6 +266,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 	addattr8(n, 1024, IFLA_VXLAN_UDP_CSUM, udpcsum);
 	addattr8(n, 1024, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, udp6zerocsumtx);
 	addattr8(n, 1024, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, udp6zerocsumrx);
+	addattr8(n, 1024, IFLA_VXLAN_REMCSUM_TX, remcsumtx);
+	addattr8(n, 1024, IFLA_VXLAN_REMCSUM_RX, remcsumrx);
 
 	if (noage)
 		addattr32(n, 1024, IFLA_VXLAN_AGEING, 0);
@@ -398,6 +411,14 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 	if (tb[IFLA_VXLAN_UDP_ZERO_CSUM6_RX] &&
 	    rta_getattr_u8(tb[IFLA_VXLAN_UDP_ZERO_CSUM6_RX]))
 		fputs("udp6zerocsumrx ", f);
+
+	if (tb[IFLA_VXLAN_REMCSUM_TX] &&
+	    rta_getattr_u8(tb[IFLA_VXLAN_REMCSUM_TX]))
+		fputs("remcsumtx ", f);
+
+	if (tb[IFLA_VXLAN_REMCSUM_RX] &&
+	    rta_getattr_u8(tb[IFLA_VXLAN_REMCSUM_RX]))
+		fputs("remcsumrx ", f);
 }
 
 static void vxlan_print_help(struct link_util *lu, int argc, char **argv,
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

Re: [PATCH iproute2 2/4] vxlan: Add support for remote checksum offload

Quoted 5 lines · On Thu, 29 Jan 2015 08:51:59 -0800 Tom Herbert <[email protected]> wrote:

This patch adds support to remote checksum checksum offload to VXLAN. This patch adds remcsumtx and remcsumrx to ip vxlan configuration to enable remote checksum offload for transmit and receive on the VXLAN tunnel.

Quoted 8 lines

https://tools.ietf.org/html/draft-herbert-vxlan-rco-00

Example:

ip link add name vxlan0 type vxlan id 42 group 239.1.1.1 dev eth0 \
udpcsum remcsumtx remcsumrx

Does not apply to current iproute2 net-next branch because the vxlan group policy extensions was applied first.

Please fix conflicts and resubmit.

#5 lore raw

PATCH 3/4 iproute: Description of new options for VXLAN in ip-link man pages

In reply to Tom Herbert

Add description for UDP checksums and remote checksum offload.

---
 man/man8/ip-link.8.in | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
man/man8/ip-link.8.in +18 -0
index 1209b55..a0be895 100644
@@ -276,6 +276,12 @@ the following additional arguments are supported:
 .BI ageing " SECONDS "
 .R " ] [ "
 .BI maxaddress " NUMBER "
+.R " ] [ "
+.I "[no]udpcsum "
+.R " ] [ "
+.I "[no]remcsumtx "
+.R " ] [ "
+.I "[no]remcsumrx "
 .R " ]"
 
 .in +8
@@ -348,6 +354,18 @@ are entered into the VXLAN device forwarding database.
 .BI maxaddress " NUMBER"
 - specifies the maximum number of FDB entries.
 
+.sp
+.I [no]udpcsum
+- specifies if UDP checksum is enabled in the outer header.
+
+.sp
+.I [no]remcsumtx
+- specifies if remote checksum option is tranmitted.
+
+.sp
+.I [no]remcsumrx
+- specifies if remote checksum option is allowed to be received.
+
 .in -8
 
 .TP
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#6 lore raw

Re: [PATCH iproute2 3/4] iproute: Description of new options for VXLAN in ip-link man pages

Quoted 25 lines · Tom Herbert

Add description for UDP checksums and remote checksum offload.

---
 man/man8/ip-link.8.in | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
man/man8/ip-link.8.in +6 -0
index 1209b55..a0be895 100644
@@ -276,6 +276,12 @@ the following additional arguments are supported:
 .BI ageing " SECONDS "
 .R " ] [ "
 .BI maxaddress " NUMBER "
+.R " ] [ "
+.I "[no]udpcsum "
+.R " ] [ "
+.I "[no]remcsumtx "
+.R " ] [ "
+.I "[no]remcsumrx "
 .R " ]"
 
 .in +8

man/man8/ip-link.8.in are entered into the VXLAN device forwarding database. · line 363

Quoted 10 lines
man/man8/ip-link.8.in +7 -0
@@ -348,6 +354,18 @@ are entered into the VXLAN device forwarding database.
 .BI maxaddress " NUMBER"
 - specifies the maximum number of FDB entries.
 
+.sp
+.I [no]udpcsum
+- specifies if UDP checksum is enabled in the outer header.
+
+.sp
+.I [no]remcsumtx
+- specifies if remote checksum option is tranmitted.
                                            ^^^^^^^^^^

transmitted

Quoted 9 lines
man/man8/ip-link.8.in +5 -0
+
+.sp
+.I [no]remcsumrx
+- specifies if remote checksum option is allowed to be received.
+
 .in -8
 
 .TP
#8 lore raw

PATCH 4/4 iproute: Descriptions of fou and gue options in ip-link man pages

In reply to Tom Herbert

Add section for additional arguments to GRE, IPIP, and SIT types that are related to Foo-over-UDP and Generic UDP Encapsulation. Also, added an example GUE configuration in the examples section.

---
 man/man8/ip-link.8.in | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)
man/man8/ip-link.8.in +67 -1
index a0be895..2634590 100644
@@ -369,6 +369,63 @@ are entered into the VXLAN device forwarding database.
 .in -8
 
 .TP
+GRE, IPIP, SIT Type Support
+For a link of types
+.I GRE/IPIP/SIT
+the following additional arguments are supported:
+
+.BI "ip link add " DEVICE
+.BR type " { gre | ipip | sit } "
+.BI " remote " ADDR " local " ADDR
+.R " [ "
+.BR encap " { fou | gue | none } "
+.R " ] [ "
+.BI "encap-sport { " PORT " | auto } "
+.R " ] [ "
+.BI "encap-dport " PORT
+.R " ] [ "
+.I " [no]encap-csum "
+.R " ] [ "
+.I " [no]encap-remcsum "
+.R " ]"
+
+.in +8
+.sp
+.BI  remote " ADDR "
+- specifies the remote address of the tunnel.
+
+.sp
+.BI  local " ADDR "
+- specifies the fixed local address for tunneled packets.
+It must be an address on another interface on this host.
+
+.sp
+.BR encap " { fou | gue | none } "
+- specifies type of secondary UDP encapsulation. "fou" indicates
+Foo-Over-UDP, "gue" indicates Generic UDP Encapsulation.
+
+.sp
+.BI "encap-sport { " PORT " | auto } "
+- specifies the source port in UDP encapsulation.
+.IR PORT
+indicates the port by number, "auto"
+indicates that the port number should be chosen automatically
+(the kernel picks a flow based on the flow hash of the
+encapsulated packet).
+
+.sp
+.I [no]encap-csum
+- specifies if UDP checksums are enabled in the secondary
+encapsulation.
+
+.sp
+.I [no]encap-remcsum
+- specifies if Remote Checksum Offload is enabled. This is only
+applicable for Generic UDP Encapsulation.
+
+.in -8
+
+.TP
 IP6GRE/IP6GRETAP Type Support
 For a link of type
 .I IP6GRE/IP6GRETAP
@@ -404,7 +461,7 @@ the following additional arguments are supported:
 .sp
 .BI  local " ADDR "
 - specifies the fixed local IPv6 address for tunneled packets.
-It must be and address on another interface on this host.
+It must be an address on another interface on this host.
 
 .sp
 .BI  [i|o]seq
@@ -781,6 +838,15 @@ ip link help gre
 .RS 4
 Display help for the gre link type.
 .RE
+.PP
+ip link add name tun1 type ipip remote 192.168.1.1
+local 192.168.1.2 ttl 225 encap gue encap-sport auto
+encap-dport 5555 encap-csum encap-remcsum
+.RS 4
+Creates an IPIP that is encapsulated with Generic UDP Encapsulation,
+and the outer UDP checksum and remote checksum offload are enabled.
+
+.RE
 
 .SH SEE ALSO
 .br
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#9 lore raw

Re: [PATCH iproute2 4/4] iproute: Descriptions of fou and gue options in ip-link man pages

Quoted 5 lines · On Thu, 29 Jan 2015 08:52:01 -0800 Tom Herbert <[email protected]> wrote:

Add section for additional arguments to GRE, IPIP, and SIT types that are related to Foo-over-UDP and Generic UDP Encapsulation. Also, added an example GUE configuration in the examples section.

Applied to master branch.