From patchwork Wed Mar 20 14:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willem de Bruijn X-Patchwork-Id: 1059276 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BWh/mO/l"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44PXrx5TGWz9sPF for ; Thu, 21 Mar 2019 01:50:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728280AbfCTOuJ (ORCPT ); Wed, 20 Mar 2019 10:50:09 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:45878 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728261AbfCTOuH (ORCPT ); Wed, 20 Mar 2019 10:50:07 -0400 Received: by mail-qk1-f195.google.com with SMTP id z76so14257447qkb.12 for ; Wed, 20 Mar 2019 07:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ECidLr/mxYR9rTAsLyJ9Zj+CEqL9uK5QSiZGe/vZXvk=; b=BWh/mO/lkhakw0HGilqERi2aEBf0kCbPxDKJ3lhlBSq6F2kb3Ji92UCL/9NTLZ0Qnj N/EqOM76kPyhSY0CqoHSHjK7kwUogx37hoH3FEHr7BimHp0g8zYK4ATlybrdkCXxxLu6 EUUcKRE/ed1BJ6+S9mN+dX6kyIRoVItdVhvMjsx/iR1JdBJ/8KGpRX7PJ5MrnsNGjD0s iYZhycEnWHD+8NDMsZDMO0xD9UguBsQlSmNlER2TirFA52ZNpnSGlN1n15oT4J9D29DJ QlJpLzNmDbfvx0bvVHly/30bwycItSJIMWWakK7n8evorufxY8belUrlJh5TWqUCRGRM xs8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ECidLr/mxYR9rTAsLyJ9Zj+CEqL9uK5QSiZGe/vZXvk=; b=tSRnjw93cS7Y/Gf5vDgleSGzUobsrfuC9X8LfD3CEu8qDKz7iNEEfTY7u/38QvLd4U HNkp9zgAyIcvz9ntQqXZoCM0NZ9LWMp1WGVYYGnOLbAj/i9gmMLWLUcp6gTRAIWel7gf 949qKpnv5EavDsg2eo75UlD30uOT74Ijbf3Z5J6XQ08nGv8K3tH99PqppdKf0P6OgMQ5 mqUNUqH9wIPA/0MN7a2OheBoToBe8G/9sT094sIBj3bC0Pl0vJLk5J33qc39WFPLh1Oj Y2Xh5Rv0hkI+OcWrcmc6+r+KOWeCdsSA+0BPbQXhhm4BMkPmwHeu4rOhOz+9rsaKGyeo 6D0A== X-Gm-Message-State: APjAAAUROX/eQW1fr4I7gBlv87E78WXK/4hTvE9Tykrl9Zh1B9a60g/g tc8IoluJRagTxzThgOF+rFDTCOAo X-Google-Smtp-Source: APXvYqzl7vkhnXMyeCy/1duHSZEAtOsAtk1cBdPFjxblnnF8qQ6S1O9lqfctp9MDQDyaXQbD7WTsuw== X-Received: by 2002:a37:9304:: with SMTP id v4mr21223663qkd.266.1553093406667; Wed, 20 Mar 2019 07:50:06 -0700 (PDT) Received: from willemb1.nyc.corp.google.com ([2620:0:1003:315:3fa1:a34c:1128:1d39]) by smtp.gmail.com with ESMTPSA id x201sm1142257qkb.92.2019.03.20.07.50.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 07:50:05 -0700 (PDT) From: Willem de Bruijn To: netdev@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, sdf@google.com, posk@google.com, Willem de Bruijn Subject: [PATCH bpf-next 13/13] selftests/bpf: convert bpf tunnel test to encap modes Date: Wed, 20 Mar 2019 10:49:44 -0400 Message-Id: <20190320144944.147862-14-willemdebruijn.kernel@gmail.com> X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog In-Reply-To: <20190320144944.147862-1-willemdebruijn.kernel@gmail.com> References: <20190320144944.147862-1-willemdebruijn.kernel@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Willem de Bruijn Make the tests correctly annotate skbs with tunnel metadata. This makes the gso tests succeed. Enable them. Signed-off-by: Willem de Bruijn --- .../selftests/bpf/progs/test_tc_tunnel.c | 19 +++++++++++++++---- tools/testing/selftests/bpf/test_tc_tunnel.sh | 10 ++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c index 3b79dffb81037..f541c2de947d2 100644 --- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c +++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c @@ -70,8 +70,13 @@ static __always_inline int encap_ipv4(struct __sk_buff *skb, bool with_gre) if (tcph.dest != __bpf_constant_htons(cfg_port)) return TC_ACT_OK; - flags = BPF_F_ADJ_ROOM_FIXED_GSO; - olen = with_gre ? sizeof(h_outer) : sizeof(h_outer.ip); + flags = BPF_F_ADJ_ROOM_FIXED_GSO | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4; + if (with_gre) { + flags |= BPF_F_ADJ_ROOM_ENCAP_L4_GRE; + olen = sizeof(h_outer); + } else { + olen = sizeof(h_outer.ip); + } /* add room between mac and network header */ if (bpf_skb_adjust_room(skb, olen, BPF_ADJ_ROOM_MAC, flags)) @@ -119,8 +124,14 @@ static __always_inline int encap_ipv6(struct __sk_buff *skb, bool with_gre) if (tcph.dest != __bpf_constant_htons(cfg_port)) return TC_ACT_OK; - flags = BPF_F_ADJ_ROOM_FIXED_GSO; - olen = with_gre ? sizeof(h_outer) : sizeof(h_outer.ip); + flags = BPF_F_ADJ_ROOM_FIXED_GSO | BPF_F_ADJ_ROOM_ENCAP_L3_IPV6; + if (with_gre) { + flags |= BPF_F_ADJ_ROOM_ENCAP_L4_GRE; + olen = sizeof(h_outer); + } else { + olen = sizeof(h_outer.ip); + } + /* add room between mac and network header */ if (bpf_skb_adjust_room(skb, olen, BPF_ADJ_ROOM_MAC, flags)) diff --git a/tools/testing/selftests/bpf/test_tc_tunnel.sh b/tools/testing/selftests/bpf/test_tc_tunnel.sh index 3d2111d89315c..4e66c45ec465f 100755 --- a/tools/testing/selftests/bpf/test_tc_tunnel.sh +++ b/tools/testing/selftests/bpf/test_tc_tunnel.sh @@ -97,13 +97,11 @@ if [[ "$#" -eq "0" ]]; then echo "ip6 gre" $0 ipv6 ip6gre 100 - # disabled until passes SKB_GSO_DODGY checks - # echo "ip gre gso" - # $0 ipv4 gre 2000 + echo "ip gre gso" + $0 ipv4 gre 2000 - # disabled until passes SKB_GSO_DODGY checks - # echo "ip6 gre gso" - # $0 ipv6 ip6gre 2000 + echo "ip6 gre gso" + $0 ipv6 ip6gre 2000 echo "OK. All tests passed" exit 0