gluon-core: allow zero VXLAN UDP checksum on RX

Also disabling TX checksums and not only allowing incoming packets without
checksum will provide another small speedup. As doing so would break wired
meshing with VXLAN-enabled nodes that require non-zero checksums, we will
wait a few days before this step.
This commit is contained in:
Matthias Schiffer 2018-01-24 20:56:20 +01:00
parent e54b37d835
commit 7ae8a51126
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
3 changed files with 119 additions and 0 deletions

View File

@ -45,6 +45,7 @@ proto_gluon_wired_setup() {
json_add_string ip6addr "$(interface_linklocal "$ifname")"
json_add_string peer6addr 'ff02::15c'
json_add_int vid "$(lua -lgluon.util -e 'print(tonumber(gluon.util.domain_seed_bytes("gluon-mesh-vxlan", 3), 16))')"
json_add_boolean rxcsum '0'
json_close_object
ubus call network add_dynamic "$(json_dump)"
fi

View File

@ -0,0 +1,75 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 24 Jan 2018 20:53:32 +0100
Subject: netifd: system-linux: VXLAN: add options to enable and disable UDP checksums
diff --git a/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch b/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch
new file mode 100644
index 0000000000000000000000000000000000000000..67a8bb864be37fa97dfcce4dd841bacafefcd0fc
--- /dev/null
+++ b/package/network/config/netifd/patches/0002-system-linux-VXLAN-add-options-to-enable-and-disable.patch
@@ -0,0 +1,65 @@
+From af3cadb6a46ba93e8a729e71d82b176275931e62 Mon Sep 17 00:00:00 2001
+Message-Id: <af3cadb6a46ba93e8a729e71d82b176275931e62.1516821520.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Wed, 24 Jan 2018 13:21:44 +0100
+Subject: [PATCH] system-linux: VXLAN: add options to enable and disable UDP
+ checksums
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ system-linux.c | 11 +++++++++++
+ system.c | 2 ++
+ system.h | 2 ++
+ 3 files changed, 15 insertions(+)
+
+diff --git a/system-linux.c b/system-linux.c
+index 32d6ffc..0277886 100644
+--- a/system-linux.c
++++ b/system-linux.c
+@@ -2841,6 +2841,17 @@ static int system_add_vxlan(const char *name, const unsigned int link, struct bl
+ }
+ nla_put_u16(msg, IFLA_VXLAN_PORT, htons(port));
+
++ if ((cur = tb_data[VXLAN_DATA_ATTR_RXCSUM])) {
++ bool rxcsum = blobmsg_get_bool(cur);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, !rxcsum);
++ }
++
++ if ((cur = tb_data[VXLAN_DATA_ATTR_TXCSUM])) {
++ bool txcsum = blobmsg_get_bool(cur);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_CSUM, txcsum);
++ nla_put_u8(msg, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, !txcsum);
++ }
++
+ if ((cur = tb[TUNNEL_ATTR_TOS])) {
+ char *str = blobmsg_get_string(cur);
+ unsigned tos = 1;
+diff --git a/system.c b/system.c
+index 5555272..e236e96 100644
+--- a/system.c
++++ b/system.c
+@@ -36,6 +36,8 @@ static const struct blobmsg_policy vxlan_data_attrs[__VXLAN_DATA_ATTR_MAX] = {
+ [VXLAN_DATA_ATTR_ID] = { .name = "id", .type = BLOBMSG_TYPE_INT32 },
+ [VXLAN_DATA_ATTR_PORT] = { .name = "port", .type = BLOBMSG_TYPE_INT32 },
+ [VXLAN_DATA_ATTR_MACADDR] = { .name = "macaddr", .type = BLOBMSG_TYPE_STRING },
++ [VXLAN_DATA_ATTR_RXCSUM] = { .name = "rxcsum", .type = BLOBMSG_TYPE_BOOL },
++ [VXLAN_DATA_ATTR_TXCSUM] = { .name = "txcsum", .type = BLOBMSG_TYPE_BOOL },
+ };
+
+ const struct uci_blob_param_list vxlan_data_attr_list = {
+diff --git a/system.h b/system.h
+index 61c72c2..371a524 100644
+--- a/system.h
++++ b/system.h
+@@ -41,6 +41,8 @@ enum vxlan_data {
+ VXLAN_DATA_ATTR_ID,
+ VXLAN_DATA_ATTR_PORT,
+ VXLAN_DATA_ATTR_MACADDR,
++ VXLAN_DATA_ATTR_RXCSUM,
++ VXLAN_DATA_ATTR_TXCSUM,
+ __VXLAN_DATA_ATTR_MAX
+ };
+
+--
+2.16.1
+

View File

@ -0,0 +1,43 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 24 Jan 2018 13:51:45 +0100
Subject: vxlan: add options to enable and disable UDP checksums
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
diff --git a/package/network/config/vxlan/Makefile b/package/network/config/vxlan/Makefile
index a471d4e90cbe30c1d1dd01dbf7553995d8c0485e..aeceb9cd884e517b2f274925637b62a538bfa70e 100644
--- a/package/network/config/vxlan/Makefile
+++ b/package/network/config/vxlan/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=vxlan
-PKG_VERSION:=1
+PKG_VERSION:=2
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/config/vxlan/files/vxlan.sh b/package/network/config/vxlan/files/vxlan.sh
index 27ccd8f12759f69c7c226cac0c923335b8ccc6a8..d055d41edc59f50c0c132849bbcd0235edeef5b9 100755
--- a/package/network/config/vxlan/files/vxlan.sh
+++ b/package/network/config/vxlan/files/vxlan.sh
@@ -15,8 +15,8 @@ vxlan_generic_setup() {
local link="$cfg"
- local port vid ttl tos mtu macaddr zone
- json_get_vars port vid ttl tos mtu macaddr zone
+ local port vid ttl tos mtu macaddr zone rxcsum txcsum
+ json_get_vars port vid ttl tos mtu macaddr zone rxcsum txcsum
proto_init_update "$link" 1
@@ -36,6 +36,8 @@ vxlan_generic_setup() {
[ -n "$port" ] && json_add_int port "$port"
[ -n "$vid" ] && json_add_int id "$vid"
[ -n "$macaddr" ] && json_add_string macaddr "$macaddr"
+ [ -n "$rxcsum" ] && json_add_boolean rxcsum "$rxcsum"
+ [ -n "$txcsum" ] && json_add_boolean txcsum "$txcsum"
json_close_object
proto_close_tunnel