Skip to contentSkip to conversation

bpf: move bpf csum flag check

PATCH Applied William Tu 2 participants 2 messages Dec 4, 2017

Subsystems (4)
lore
Share & tools
lore

William Tu

author
#0 lore raw

PATCH 1/1 bpf: move bpf csum flag check

trivial move the BPF_F_ZERO_CSUM_TX check right below the 'flags & BPF_F_DONT_FRAGMENT', so common tun_flags handling is logically together.

---
 net/core/filter.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
net/core/filter.c +2 -3
index 8ec5a504eb28..4d644ad17457 100644
@@ -3013,6 +3013,8 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
 	info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE;
 	if (flags & BPF_F_DONT_FRAGMENT)
 		info->key.tun_flags |= TUNNEL_DONT_FRAGMENT;
+	if (flags & BPF_F_ZERO_CSUM_TX)
+		info->key.tun_flags &= ~TUNNEL_CSUM;
 
 	info->key.tun_id = cpu_to_be64(from->tunnel_id);
 	info->key.tos = from->tunnel_tos;
@@ -3028,9 +3030,6 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
 		info->key.u.ipv4.dst = cpu_to_be32(from->remote_ipv4);
 	}
 
-	if (flags & BPF_F_ZERO_CSUM_TX)
-		info->key.tun_flags &= ~TUNNEL_CSUM;
-
 	return 0;
 }
 
Signature · 1 line
2.7.4