Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
4d4626f1
Unverified
Commit
4d4626f1
authored
7 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
batman-adv: add fixes for packet checksum handling
Fixes "hw csum failure" log spam in batman-adv.
parent
c89d4f5b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
patches/packages/routing/0002-batman-adv-add-fixes-for-packet-checksum-handling.patch
+102
-0
102 additions, 0 deletions
...2-batman-adv-add-fixes-for-packet-checksum-handling.patch
with
102 additions
and
0 deletions
patches/packages/routing/0002-batman-adv-add-fixes-for-packet-checksum-handling.patch
0 → 100644
+
102
−
0
View file @
4d4626f1
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 22 Jan 2018 20:41:41 +0100
Subject: batman-adv: add fixes for packet checksum handling
diff --git a/batman-adv/patches/0001-batman-adv-fix-packet-checksum-in-receive-path.patch b/batman-adv/patches/0001-batman-adv-fix-packet-checksum-in-receive-path.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ce1a5345be1405ccf034ab948b2061be46cda090
--- /dev/null
+++ b/batman-adv/patches/0001-batman-adv-fix-packet-checksum-in-receive-path.patch
@@ -0,0 +1,44 @@
+From 05cee97344804ffb2a8df87603663a098fd0cb36 Mon Sep 17 00:00:00 2001
+Message-Id: <05cee97344804ffb2a8df87603663a098fd0cb36.1516705934.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 22 Jan 2018 20:06:51 +0100
+Subject: [PATCH 1/2] batman-adv: fix packet checksum in receive path
+
+eth_type_trans() internally calls skb_pull(), which does not adjust the
+skb checksum; skb_postpull_rcsum() is necessary to avoid log spam of the
+form "bat0: hw csum failure" when packets with CHECKSUM_COMPLETE are
+received.
+
+Note that in usual setups, packets don't reach batman-adv with
+CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see
+batadv's ethtype?), which is why the log messages do nor occur on every
+system using batman-adv. I could reproduce this issue by stacking
+batman-adv on top of a VXLAN interface.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ net/batman-adv/soft-interface.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
+index 9f673cdf..6f7ce7a6 100644
+--- a/net/batman-adv/soft-interface.c
++++ b/net/batman-adv/soft-interface.c
+@@ -451,13 +451,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
+
+ /* skb->dev & skb->pkt_type are set here */
+ skb->protocol = eth_type_trans(skb, soft_iface);
+-
+- /* should not be necessary anymore as we use skb_pull_rcsum()
+- * TODO: please verify this and remove this TODO
+- * -- Dec 21st 2009, Simon Wunderlich
+- */
+-
+- /* skb->ip_summed = CHECKSUM_UNNECESSARY; */
++ skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
+
+ batadv_inc_counter(bat_priv, BATADV_CNT_RX);
+ batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
+--
+2.16.1
+
diff --git a/batman-adv/patches/0002-batman-adv-invalidate-checksum-on-fragment-reassembl.patch b/batman-adv/patches/0002-batman-adv-invalidate-checksum-on-fragment-reassembl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..957fc345846acde05345963bcd66eed47b167358
--- /dev/null
+++ b/batman-adv/patches/0002-batman-adv-invalidate-checksum-on-fragment-reassembl.patch
@@ -0,0 +1,42 @@
+From 3f5713999a5f61ed7221944276393b4ff40a9416 Mon Sep 17 00:00:00 2001
+Message-Id: <3f5713999a5f61ed7221944276393b4ff40a9416.1516705934.git.mschiffer@universe-factory.net>
+In-Reply-To: <05cee97344804ffb2a8df87603663a098fd0cb36.1516705934.git.mschiffer@universe-factory.net>
+References: <05cee97344804ffb2a8df87603663a098fd0cb36.1516705934.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Tue, 23 Jan 2018 10:24:45 +0100
+Subject: [PATCH 2/2] batman-adv: invalidate checksum on fragment reassembly
+
+A more sophisticated implementation could try to combine fragment checksums
+when all fragments have CHECKSUM_COMPLETE and are split at even offsets.
+For now, we just set ip_summed to CHECKSUM_NONE to avoid "hw csum failure"
+warnings in the kernel log when fragmented frames are received. In
+consequence, skb_pull_rcsum() can be replaced with skb_pull().
+
+Note that in usual setups, packets don't reach batman-adv with
+CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see
+batadv's ethtype?), which is why the log messages do nor occur on every
+system using batman-adv. I could reproduce this issue by stacking
+batman-adv on top of a VXLAN interface.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ net/batman-adv/fragmentation.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
+index ebe6e389..1bb2b43f 100644
+--- a/net/batman-adv/fragmentation.c
++++ b/net/batman-adv/fragmentation.c
+@@ -287,7 +287,8 @@ batadv_frag_merge_packets(struct hlist_head *chain)
+ /* Move the existing MAC header to just before the payload. (Override
+ * the fragment header.)
+ */
+- skb_pull_rcsum(skb_out, hdr_size);
++ skb_pull(skb_out, hdr_size);
++ skb_out->ip_summed = CHECKSUM_NONE;
+ memmove(skb_out->data - ETH_HLEN, skb_mac_header(skb_out), ETH_HLEN);
+ skb_set_mac_header(skb_out, -ETH_HLEN);
+ skb_reset_network_header(skb_out);
+--
+2.16.1
+
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment