From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFB7123D40 for ; Fri, 12 May 2023 18:34:08 +0000 (UTC) Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8FE7695 for ; Fri, 12 May 2023 11:33:39 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-643fdfb437aso36935394b3a.0 for ; Fri, 12 May 2023 11:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683916416; x=1686508416; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5+exEN8RF1B40fPaxoi0k2T6E5J3rfhVEZNB9EwpzSM=; b=2ytWwJWpT3Nf+cnrsDcHH5KcIuij7GP+ouRdzIMCILh4WRZNrgSQNN19FSJ6vu+wm/ g0+G/4bQvlOFdtBGD5dHnfuOdk5TdxYByrmDF/2aFlZR2UBLds/mJtqx7rVI/xdWNV8a A1sQZ3OALNJkgExEqH3hNisJlOeCU6VF+0abfQro0LL+7l/tUtTnsvTbjzSn/CFfEHbY JftijlPqjlutp/AJ42j6ITeno9LWWA0lSoxJy/tp7dLa+Ew/jHMGV8EWdRRN483nrDsw 9YTIf9wrfY8U9jS72O3GInOWIoyv2ASsoGVZklk/M7us4MtfGa8fvueuzWf/66l5Ffps ZvDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683916416; x=1686508416; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5+exEN8RF1B40fPaxoi0k2T6E5J3rfhVEZNB9EwpzSM=; b=Pyg3HH8qnyesDZhY+aNwshKhwl8S4xew0mLzdrC4jmv9bndX2OnUKueXyfWbXoDNrz jsVbtm5JJjtzuSnEaiSp++aJV9JZK/MyUSp8HmpOSQshEoBewICGSNQgYVM2sHbvaKXk 4Y+q9FRp6Y/BK0z8k327EvqOYYoNMFbbJm/JcZFDmMdkXRLU1VA8uD+jo4OAmuOBvtBF TOQXulup3kVzwBXAGLhXg4qlYq5N82tYn9fC+ZQHjti8dOfZNex6AGoGfn2v98c9xB3S DUxRAvjhHZorRtvyTWwqTjPRn689bL0+pBXacZ0zlGW3JKusiycN7L3TftuidANVn3dz 5S9w== X-Gm-Message-State: AC+VfDzR1sB9h4L1FDnbR59D0lL0iCEl88UpIj4YA9MVbQ4MHQTWPas4 bBngDgjwDJRGcRQXJ3i9aszEMe4= X-Google-Smtp-Source: ACHHUZ6izS/sXksepkikL2WJhUgl6hDj55lJDgbldJSMaJRr8WAp/vT3O0/iHqJ2+q6vfS70QyzAspA= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90b:23c8:b0:250:2099:783 with SMTP id md8-20020a17090b23c800b0025020990783mr8403658pjb.2.1683916415913; Fri, 12 May 2023 11:33:35 -0700 (PDT) Date: Fri, 12 May 2023 11:33:34 -0700 In-Reply-To: <20230512152607.992209-14-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20230512152607.992209-1-larysa.zaremba@intel.com> <20230512152607.992209-14-larysa.zaremba@intel.com> Message-ID: Subject: Re: [PATCH RESEND bpf-next 13/15] selftests/bpf: Allow VLAN packets in xdp_hw_metadata From: Stanislav Fomichev To: Larysa Zaremba Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jakub Kicinski , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jiri Olsa , Jesse Brandeburg , Tony Nguyen , Anatoly Burakov , Jesper Dangaard Brouer , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On 05/12, Larysa Zaremba wrote: > Make VLAN c-tag and s-tag XDP hint testing more convenient > by not skipping VLAN-ed packets. > > Allow both 802.1ad and 802.1Q headers. Can we also extend non-hw test? That should require adding metadata handlers to veth to extract relevant parts from skb + update ip link commands to add vlan id. Should be relatively easy to do? > > Signed-off-by: Larysa Zaremba > --- > tools/testing/selftests/bpf/progs/xdp_hw_metadata.c | 9 ++++++++- > tools/testing/selftests/bpf/xdp_metadata.h | 8 ++++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > index b2dfd7066c6e..f95f82a8b449 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > @@ -26,15 +26,22 @@ int rx(struct xdp_md *ctx) > { > void *data, *data_meta, *data_end; > struct ipv6hdr *ip6h = NULL; > - struct ethhdr *eth = NULL; > struct udphdr *udp = NULL; > struct iphdr *iph = NULL; > struct xdp_meta *meta; > + struct ethhdr *eth; > int err; > > data = (void *)(long)ctx->data; > data_end = (void *)(long)ctx->data_end; > eth = data; > + > + if (eth + 1 < data_end && eth->h_proto == bpf_htons(ETH_P_8021AD)) > + eth = (void *)eth + sizeof(struct vlan_hdr); > + > + if (eth + 1 < data_end && eth->h_proto == bpf_htons(ETH_P_8021Q)) > + eth = (void *)eth + sizeof(struct vlan_hdr); > + > if (eth + 1 < data_end) { > if (eth->h_proto == bpf_htons(ETH_P_IP)) { > iph = (void *)(eth + 1); > diff --git a/tools/testing/selftests/bpf/xdp_metadata.h b/tools/testing/selftests/bpf/xdp_metadata.h > index 938a729bd307..6664893c2c77 100644 > --- a/tools/testing/selftests/bpf/xdp_metadata.h > +++ b/tools/testing/selftests/bpf/xdp_metadata.h > @@ -9,6 +9,14 @@ > #define ETH_P_IPV6 0x86DD > #endif > > +#ifndef ETH_P_8021Q > +#define ETH_P_8021Q 0x8100 > +#endif > + > +#ifndef ETH_P_8021AD > +#define ETH_P_8021AD 0x88A8 > +#endif > + > struct xdp_meta { > __u64 rx_timestamp; > __u64 xdp_timestamp; > -- > 2.35.3 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0600C77B7F for ; Fri, 12 May 2023 18:33:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6A8B3404C1; Fri, 12 May 2023 18:33:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6A8B3404C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1683916421; bh=tou+ZzRtlcOxH44Jgn2liuV2JA4s7bJRDoQImBVX6bQ=; h=Date:In-Reply-To:References:From:To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=l1o+cRdC24L9TV5is9e2gO2ozdFgoWRVLF1tMX8FOw4Qi6FCNyoPpCzI/zyki0f6K WuWTB91Py78DYjDVAIa/YTaH5eI7GyrKTm9LEUJs4LDjcnqmJNXJo5NkwNNFnc5cbt jSG/Zk+AwmGmGlPCws+AtFbjI1Qtpp9n+pMybV4HHTCXizFRWFYaUbsA6AFpmME+g0 aO5klw2KsXNVrzArZnk3M7nRIZB7xLqt8DdyeX7vsLHoY+5yhQasW4IyV2meKWiDKy xISE6/T4p+Gf8XJOwIydjDrIqSbn2psOc3yiRlMOwTSFewMb/rvWIx/EuSPb6ThqTd iieARCgr+WPJw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GgGa2lZ9Zgvx; Fri, 12 May 2023 18:33:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 5A25A40525; Fri, 12 May 2023 18:33:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5A25A40525 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 89A1C1BF836 for ; Fri, 12 May 2023 18:33:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6160460BFF for ; Fri, 12 May 2023 18:33:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6160460BFF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rGly8dkOQW65 for ; Fri, 12 May 2023 18:33:36 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 763E760AEE Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by smtp3.osuosl.org (Postfix) with ESMTPS id 763E760AEE for ; Fri, 12 May 2023 18:33:36 +0000 (UTC) Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-645538f6101so35151598b3a.1 for ; Fri, 12 May 2023 11:33:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683916416; x=1686508416; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5+exEN8RF1B40fPaxoi0k2T6E5J3rfhVEZNB9EwpzSM=; b=Xmv2VvUzlC16MeUi5Cz+WXeZwPEb2uV34Fyh1sxzOxEa4oCQyMUeoKHReNh7FCE1XT Q5RERS8OuBDaNzPEmHRDQLJGspTe7BKmbhfvNwc/SnUrPQPtEVCrhCx/Eux76BSEkJlP 1WY+PN9Hg8VEd4hS0AkpdypGXzPfzhh5WQpJkBwBg9M6VkZXwHG8NzLX8afEwlyHGBir nJZpRzOGzNzkusdBlVhgd2ZFFiGCksAe9XFy+3uLIthFPx60zbWA5Yacy4nFzKEyzEEx jh7+fkjOW9GYEJeMgo3USxhyHW3ovyUPxanMbKFbfd6tlY4RRcmclWwTA1fPaAWHwdpj EDDg== X-Gm-Message-State: AC+VfDyszhy7GQINB1HyWCo5VSqhoJsMMrt6kaQ9SGsOaQdE1E3j5C6h i13xrReTdQXWWaXJP2Km5zsZTM0= X-Google-Smtp-Source: ACHHUZ6izS/sXksepkikL2WJhUgl6hDj55lJDgbldJSMaJRr8WAp/vT3O0/iHqJ2+q6vfS70QyzAspA= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90b:23c8:b0:250:2099:783 with SMTP id md8-20020a17090b23c800b0025020990783mr8403658pjb.2.1683916415913; Fri, 12 May 2023 11:33:35 -0700 (PDT) Date: Fri, 12 May 2023 11:33:34 -0700 In-Reply-To: <20230512152607.992209-14-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230512152607.992209-1-larysa.zaremba@intel.com> <20230512152607.992209-14-larysa.zaremba@intel.com> Message-ID: From: Stanislav Fomichev To: Larysa Zaremba X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683916416; x=1686508416; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5+exEN8RF1B40fPaxoi0k2T6E5J3rfhVEZNB9EwpzSM=; b=2ytWwJWpT3Nf+cnrsDcHH5KcIuij7GP+ouRdzIMCILh4WRZNrgSQNN19FSJ6vu+wm/ g0+G/4bQvlOFdtBGD5dHnfuOdk5TdxYByrmDF/2aFlZR2UBLds/mJtqx7rVI/xdWNV8a A1sQZ3OALNJkgExEqH3hNisJlOeCU6VF+0abfQro0LL+7l/tUtTnsvTbjzSn/CFfEHbY JftijlPqjlutp/AJ42j6ITeno9LWWA0lSoxJy/tp7dLa+Ew/jHMGV8EWdRRN483nrDsw 9YTIf9wrfY8U9jS72O3GInOWIoyv2ASsoGVZklk/M7us4MtfGa8fvueuzWf/66l5Ffps ZvDQ== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=2ytWwJWp Subject: Re: [Intel-wired-lan] [PATCH RESEND bpf-next 13/15] selftests/bpf: Allow VLAN packets in xdp_hw_metadata X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anatoly Burakov , Alexei Starovoitov , Andrii Nakryiko , Song Liu , Tony Nguyen , Maryam Tahhan , xdp-hints@xdp-project.net, Daniel Borkmann , John Fastabend , Jesse Brandeburg , intel-wired-lan@lists.osuosl.org, Jesper Dangaard Brouer , Yonghong Song , KP Singh , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Olsa , bpf@vger.kernel.org, Martin KaFai Lau Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On 05/12, Larysa Zaremba wrote: > Make VLAN c-tag and s-tag XDP hint testing more convenient > by not skipping VLAN-ed packets. > > Allow both 802.1ad and 802.1Q headers. Can we also extend non-hw test? That should require adding metadata handlers to veth to extract relevant parts from skb + update ip link commands to add vlan id. Should be relatively easy to do? > > Signed-off-by: Larysa Zaremba > --- > tools/testing/selftests/bpf/progs/xdp_hw_metadata.c | 9 ++++++++- > tools/testing/selftests/bpf/xdp_metadata.h | 8 ++++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > index b2dfd7066c6e..f95f82a8b449 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > @@ -26,15 +26,22 @@ int rx(struct xdp_md *ctx) > { > void *data, *data_meta, *data_end; > struct ipv6hdr *ip6h = NULL; > - struct ethhdr *eth = NULL; > struct udphdr *udp = NULL; > struct iphdr *iph = NULL; > struct xdp_meta *meta; > + struct ethhdr *eth; > int err; > > data = (void *)(long)ctx->data; > data_end = (void *)(long)ctx->data_end; > eth = data; > + > + if (eth + 1 < data_end && eth->h_proto == bpf_htons(ETH_P_8021AD)) > + eth = (void *)eth + sizeof(struct vlan_hdr); > + > + if (eth + 1 < data_end && eth->h_proto == bpf_htons(ETH_P_8021Q)) > + eth = (void *)eth + sizeof(struct vlan_hdr); > + > if (eth + 1 < data_end) { > if (eth->h_proto == bpf_htons(ETH_P_IP)) { > iph = (void *)(eth + 1); > diff --git a/tools/testing/selftests/bpf/xdp_metadata.h b/tools/testing/selftests/bpf/xdp_metadata.h > index 938a729bd307..6664893c2c77 100644 > --- a/tools/testing/selftests/bpf/xdp_metadata.h > +++ b/tools/testing/selftests/bpf/xdp_metadata.h > @@ -9,6 +9,14 @@ > #define ETH_P_IPV6 0x86DD > #endif > > +#ifndef ETH_P_8021Q > +#define ETH_P_8021Q 0x8100 > +#endif > + > +#ifndef ETH_P_8021AD > +#define ETH_P_8021AD 0x88A8 > +#endif > + > struct xdp_meta { > __u64 rx_timestamp; > __u64 xdp_timestamp; > -- > 2.35.3 > _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan