From mboxrd@z Thu Jan 1 00:00:00 1970 From: William Tu Subject: [PATCH net-next] bpf: move bpf csum flag check Date: Mon, 4 Dec 2017 14:18:29 -0800 Message-ID: <1512425909-105242-1-git-send-email-u9012063@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:37432 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751428AbdLDWSo (ORCPT ); Mon, 4 Dec 2017 17:18:44 -0500 Received: by mail-pf0-f194.google.com with SMTP id n6so9623531pfa.4 for ; Mon, 04 Dec 2017 14:18:43 -0800 (PST) Received: from sc9-mailhost1.vmware.com ([208.91.2.1]) by smtp.gmail.com with ESMTPSA id h81sm27489909pfh.119.2017.12.04.14.18.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 14:18:37 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: 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. Signed-off-by: William Tu Acked-by: Daniel Borkmann --- net/core/filter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 8ec5a504eb28..4d644ad17457 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -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; } -- 2.7.4