From patchwork Fri Oct 27 18:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Xu X-Patchwork-Id: 159130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp813788vqb; Fri, 27 Oct 2023 11:48:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtcjB0CbyRaKYjnHpBdvymiolzk1unU6gzyJnMAJCRH5poxDhcXOokzoORQbgale22O0zT X-Received: by 2002:a05:6871:5a91:b0:1ea:2c8b:e18e with SMTP id oo17-20020a0568715a9100b001ea2c8be18emr4888525oac.8.1698432485969; Fri, 27 Oct 2023 11:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698432485; cv=none; d=google.com; s=arc-20160816; b=U9XLtGgArIYLt+sV+8uIqfNOn5YnmnOpnYfZS0klLzJsML82Ul7LjHsPXUJmtisu5/ wDqk5W5YEr9t9fB5XL/2BgaHz0IV8spD+CBWzgZqUW8JCOqwXnQfxMmj9OIcyC4p/P4w 4FRc5mA4ktpf32shy30v5Ni6THN2U4h0hxq3Y3uLBaGyfOCiu3xpcLmJN0NLHgPf6QCv cX0r7G4XaKmBa/joFK70n6A8iNHiZFU3nfajILok+VdFywwtZywMHzFraqqEZLAn1Bfu g+ufO86BXCS6DpFg9L05SRxrzixFR8aG2xpoHgf4tiMeJBcqq4Ltc/v4kwZ5Tx2odClP 4Fsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=2fjiakLITSCXGyl83edKCDEBKH//aAV9purn7c7fwtY=; fh=GLuT7sPSIcITYXe9YwAKJBGXX/p90g77yx5cYa+ihpk=; b=oCtd0lLM+go/C3KCpf4tBWeLYtq3JmUf/U1G7aPiJucQiwOmnN3DS+CRQiCZFkhPpY 7i8gSE/H3YbCbVS9oXrVilotm4EDWwzxGjM2KiALRQs5fJW7bYlnsOXUmTYht1t8OXLH iCHGRfRLi+AQfdF/b+yg+C2YhpUY38eWQ/evZgV9uWCxDfrapTQfx543rD+HwDoFAnPC dyBKFy8VC9kb6tpVCyD3KGCiqkfEF1cHVFBIZH9zKikemEppR8QChWNsxoXoSSakzzpQ mCEHD56rwgp8vwYymJOUMiVlesZgu18CxWZ1F9668zROSFcDo713q4ETWXpAE9+I3fip a0/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm2 header.b=BzISbJzd; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=K9RaMJh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n145-20020a254097000000b00d9cb86ddc0dsi3311607yba.414.2023.10.27.11.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 11:48:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm2 header.b=BzISbJzd; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=K9RaMJh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C952083B6BF0; Fri, 27 Oct 2023 11:47:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346445AbjJ0SrU (ORCPT + 25 others); Fri, 27 Oct 2023 14:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346571AbjJ0Sqz (ORCPT ); Fri, 27 Oct 2023 14:46:55 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49004128; Fri, 27 Oct 2023 11:46:48 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id 8FA965C0225; Fri, 27 Oct 2023 14:46:47 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Fri, 27 Oct 2023 14:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1698432407; x= 1698518807; bh=2fjiakLITSCXGyl83edKCDEBKH//aAV9purn7c7fwtY=; b=B zISbJzdokjCVKc7AaNFqcoQ4CyM1uafVunTRXmeK/8SkZGJYHuIh3gGYjYvelhia 8FAks34jTt9U9RatVynlmEMQN/2kN1DtFeaYkmMs4Y1/TOBk03leFmd20ezAi3tf 8nsyW7UCooG0IJm3iyFsBHHbWVU+FooruSGAEskYu54TttWAT4/CMSJYK9HyoMwM o7yMgqBdnQKOXfM/7qb6c2AG3PzuvMU/DqD+zTlTKDQNTu3UQhQXYwYyafOa+/lp DYs0vYJMNPXs2eYjcdvQlFmyPoNuOxoabGjAcJYemYWsOoJW+/1YYkEvf72SLzDV KIdlHZ2p8tsIUCa/9URKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1698432407; x= 1698518807; bh=2fjiakLITSCXGyl83edKCDEBKH//aAV9purn7c7fwtY=; b=K 9RaMJh603U0B8Q69kyC5341nRwbxYA9Nybte5ysHVXdILhCt0FPX5F28sRfPTFqs ISw6GWa1I+V5Ue54wE0Kg+g+naF+LD3ROAqO3SJug/qc/bUhhl+/9EYSwZhQyxkH HIxOys7H+PY587lYNWGw3hvC3/zvNJlGajrooOzHXPNxbrrrlb4FC40vV9UV+Cgo DY/75ZBXO8MQcNHW60a0Xnpjv9tA0RP4nqCWMtNLfNoF5v73CcaB3pwqBI1Q2Aku 05Y9m9Lr8brTQvrC3zSB7SnxCT/Bc6V4unoTRbN7eJniEpW1bgoowDGjvKrF1pEh qbWqJJ3hvq5lcmLY/8DWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrleeggddufedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpefhvf evufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgvlhcuighuuceo ugiguhesugiguhhuuhdrgiihiieqnecuggftrfgrthhtvghrnhepgfefgfegjefhudeike dvueetffelieefuedvhfehjeeljeejkefgffeghfdttdetnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugiguhesugiguhhuuhdrgiihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Oct 2023 14:46:46 -0400 (EDT) From: Daniel Xu To: andrii@kernel.org, ast@kernel.org, shuah@kernel.org, daniel@iogearbox.net, steffen.klassert@secunet.com, antony.antony@secunet.com Cc: martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, devel@linux-ipsec.org Subject: [RFC bpf-next 3/6] bpf: selftests: test_tunnel: Mount bpffs if necessary Date: Fri, 27 Oct 2023 12:46:19 -0600 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 27 Oct 2023 11:48:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780935542686698163 X-GMAIL-MSGID: 1780935542686698163 Previously, if bpffs was not already mounted, then the test suite would fail during object file pinning steps. Fix by mounting bpffs if necessary. Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/test_tunnel.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh index 85ba39992461..dd3c79129e87 100755 --- a/tools/testing/selftests/bpf/test_tunnel.sh +++ b/tools/testing/selftests/bpf/test_tunnel.sh @@ -46,7 +46,8 @@ # 6) Forward the packet to the overlay tnl dev BPF_FILE="test_tunnel_kern.bpf.o" -BPF_PIN_TUNNEL_DIR="/sys/fs/bpf/tc/tunnel" +BPF_FS="/sys/fs/bpf" +BPF_PIN_TUNNEL_DIR="${BPF_FS}/tc/tunnel" PING_ARG="-c 3 -w 10 -q" ret=0 GREEN='\033[0;92m' @@ -668,10 +669,20 @@ check_err() fi } +mount_bpffs() +{ + if ! mount | grep "bpf on /sys/fs/bpf" &>/dev/null; then + mount -t bpf bpf "$BPF_FS" + fi +} + bpf_tunnel_test() { local errors=0 + echo "Mounting bpffs..." + mount_bpffs + echo "Testing GRE tunnel..." test_gre errors=$(( $errors + $? ))