Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp270174rwl; Thu, 6 Apr 2023 18:59:46 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9aZ5ctX5MqxfDF7Anvk7taT6oZaTLNUjNJSL8vnZ6nt/SPPzQPIM16mwWVH3tq9yjRb0p X-Received: by 2002:aa7:cf99:0:b0:4fc:c644:6141 with SMTP id z25-20020aa7cf99000000b004fcc6446141mr1418092edx.0.1680832786188; Thu, 06 Apr 2023 18:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680832786; cv=none; d=google.com; s=arc-20160816; b=tzgj+lB1H4MxrzxYs5Tr40Vs2zQ1AbfoWDoN6KAxiG2UJKHXdgb1M1y7Z6Xo6vh++F nFySILU7mbJHdhhz77nd2l0UfM8SPBiEb4EasAFssJDB3Or/6cXQc0qlXR9lNVUREUen A6SfUb8leBCHuXxFxvnEZ/SAw/Racuv/KRgH4f3hk0rNVS/Xkdhgi07m5LDyqs9Bi5IU yPli/AsHvXkc9dwgHgUAs/1gTOZmGOwkJ5gdQcpx9/miBek9S7c3vdAGQBi0hIbcFfjy PCgg6ErdSYcVOyCWvSQx92cV/IW5gzfduR0UjGMu2+r+ssfwjNXxEjoRtTpdE73GGBfb +ZCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PepjG6ZLpeM6OfRQMKXaRAf4V5wN0coiY427k79nKUo=; b=sosvJ0MRR9QUvfvayP317WGFZpGPURsJ5S66bmkfSxMqooXSf7FXf0Uj5LUxav3tiJ Zlo1YPiJCeNOeB1wBedQ7ukhiEy/jYPhUr40DHXi0hCKmRuIEppSZ2ndfVjbfUceWvxX c9rt/uknCMIwilDyXOyZLt6coeu1ix8QOxKY1mB5R2s+cIRfV+lC4ru6Bt0njw4kOI4u fljkurRwWmJmCKpo/xikKFrqqX8zG5KbQsHm/Md4/XW8alZ5bcWKBhDuKIfvl2AFwJux oFqPHrC8qvZhb0MrK1uchjFdUSbCVxjXNpSvoR2Bxgr7jdYpBwzLZgGsdgfgpispRabM iqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q06bERKi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a05640207ce00b004bf3fa9a025si2175225edy.605.2023.04.06.18.59.19; Thu, 06 Apr 2023 18:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q06bERKi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239409AbjDGBrp (ORCPT + 99 others); Thu, 6 Apr 2023 21:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbjDGBrn (ORCPT ); Thu, 6 Apr 2023 21:47:43 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8185C658B; Thu, 6 Apr 2023 18:47:42 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id 60-20020a17090a09c200b0023fcc8ce113so254654pjo.4; Thu, 06 Apr 2023 18:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680832062; x=1683424062; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PepjG6ZLpeM6OfRQMKXaRAf4V5wN0coiY427k79nKUo=; b=q06bERKiMblIXmReR0YrSdnhJKKVUJpLuCEvAE8es1YZyb76PfR8Cs4RvrKMKDwyAU XikKG61gWv5vNn1Mjv0fdAB3+5TgDdF+gzPhbbJtA/zemoItBt7wybLGoLJsgK4f7l/k y1cU8F7AM7JHxd69HPpuCAZhVHwHuPPmiaM96G08YwawfDR/MT6vcy/mX7AK/5rztqR6 zZAIV1LkL2XycFKMnQk4w6TiIM2aSyR8BM2Q/OqflDbf48KahgCcjgjLoTpeGqqg5kl8 mEhhnnR3J+noyV6Zpl/Tb2SsgtdOwmqIQJnO5ks7BYGRjWUZe8BhTgcOD8hNXctISnNI JcrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680832062; x=1683424062; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PepjG6ZLpeM6OfRQMKXaRAf4V5wN0coiY427k79nKUo=; b=qOTgrpq28LKmo7lX6aHAfTtDrIdWAvKiyXrOg+w6DsSSlX5fU2L5WnTm6KlNCCZK/M DnKEqFXX011vRH2Z83SGP1QQvPWL3lqu8mykyLxOEpbGuM8VaG4MDwHU0mcFDDOWq1fa jN2DIEYFPQHbBMSVY7GlhHxcYmfrwWhH/r0LSgp1a8Vx5UDhdshHLNUUck18IYKkhKJe Wi5Kk4Gj92H9VE+QChpWQUOba4cjqsjaccVSdYM7sAgwPNx83p1EcLherrF5gxXS9XCe 81gbxjwuOKqF63Sab7aN+ZZAMBEoB9EJjPPLWKtO6TxPVfCg7FN6+NrBy8SJ6IBk23ev Do5w== X-Gm-Message-State: AAQBX9dzq1dtsvzI5JT4h7ougGkz+sxPrW72lBGa32BApL928tVoX1Jw WZ3fbuoc8YoREIEEJJ11ZwA= X-Received: by 2002:a17:90a:5c:b0:23f:580d:b252 with SMTP id 28-20020a17090a005c00b0023f580db252mr612049pjb.36.1680832061857; Thu, 06 Apr 2023 18:47:41 -0700 (PDT) Received: from dhcp-172-26-102-232.dhcp.thefacebook.com ([2620:10d:c090:400::5:5abd]) by smtp.gmail.com with ESMTPSA id c18-20020a170902c1d200b0019e8c3cd3f4sm1941897plc.201.2023.04.06.18.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 18:47:41 -0700 (PDT) Date: Thu, 6 Apr 2023 18:47:37 -0700 From: Alexei Starovoitov To: Christian Ehrig Cc: bpf@vger.kernel.org, kernel-team@cloudflare.com, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Kaixi Fan , Paul Chaignon , Dave Marchevsky , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v2 3/3] selftests/bpf: Test FOU kfuncs for externally controlled ipip devices Message-ID: <20230407014737.sqnq4a3g7ye2novk@dhcp-172-26-102-232.dhcp.thefacebook.com> References: <528a824713c1545839d870eaad84d87749a23371.1680520500.git.cehrig@cloudflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <528a824713c1545839d870eaad84d87749a23371.1680520500.git.cehrig@cloudflare.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 03, 2023 at 02:12:09PM +0200, Christian Ehrig wrote: > + > +SEC("tc") > +int ipip_encap_get_tunnel(struct __sk_buff *skb) > +{ > + int ret; > + struct bpf_tunnel_key key = {}; > + struct bpf_fou_encap encap = {}; > + > + ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); > + if (ret < 0) { > + log_err(ret); > + return TC_ACT_SHOT; > + } > + > + ret = bpf_skb_get_fou_encap(skb, &encap); > + if (ret < 0) { > + log_err(ret); > + return TC_ACT_SHOT; > + } > + > + if (bpf_ntohs(encap.dport) != 5555) > + return TC_ACT_SHOT; > + > + bpf_printk("%d remote ip 0x%x, sport %d, dport %d\n", ret, > + key.remote_ipv4, bpf_ntohs(encap.sport), > + bpf_ntohs(encap.dport)); > + return TC_ACT_OK; > +} > + > SEC("tc") > int ipip6_set_tunnel(struct __sk_buff *skb) > { > diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh > index 2dec7dbf29a2..f2379414a887 100755 > --- a/tools/testing/selftests/bpf/test_tunnel.sh > +++ b/tools/testing/selftests/bpf/test_tunnel.sh All looks good to me, but please integrate the selftest into test_progs. test_tunnel is obsolete. BPF CI doesn't run it and maintainers don't do either.