From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by mail.toke.dk (Postfix) with ESMTPS id 58402A16366 for ; Wed, 5 Jul 2023 19:31:50 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=BMkvre6u Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-53ba38cf091so1150389a12.1 for ; Wed, 05 Jul 2023 10:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688578309; x=1691170309; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uAllegANh0wecO8quStfyUYqqh/4wE1uob2jJG1C+pU=; b=BMkvre6ubBI7GfbFOLTTKaMAOWH+AoIIm/6LH7VNPMHkSCZcsj8jEu0w4Lr9kH5UTl olKlyXJndJOsMqDUYROFQxkhD7FxgY6VcV/JXUqSne7nJMbPZYxcWHrl0qV+mJfIdKRC jsltyhmsAzyOAuEXjYVamop6Q1Kj03piJGE4UqNeOdbGudOnNFWt+UIaxyxRbR6gEZp7 uxa5nPZELHNWOJgQhuDdgsZv0bwdxo4BTLyLrDnmBrOHmMnN34miIb+HMBOH6FWmv4SX KMrgkTELrVb9bqijP8X+hl00QinirpNFtWPUISkkl/dp0Pt2B/08wJeTI06XA4Mv3/ni Upzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688578309; x=1691170309; 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=uAllegANh0wecO8quStfyUYqqh/4wE1uob2jJG1C+pU=; b=cRHiE3f62y6TNNUN95rBBqKVt28kF+kbcUcw9NZ5ME6lFpirkQ767Lf8cvy3KXK4HZ scXiEdeEvwgp1T9yHsXMq8xS6Zid8HT3cNXyv00W3P7yqo9DRWe6vVdqwX2TPxHpFHud R0mx3hF1BtxDUCn4RKQPYKpjoWsuNe99alEKUZ0uPEHOMQLm/G7f/sdTjEj5/HX96fFe OeEdx+zixWyEL7A5fWScO5oNfwqfKSLG85Z23MDdtbJ2kfppXH8dL1Ea9g9qjitjMsK4 BmM6fuDYdpk5MR5x0nRL23BvK8xg8fXQhCiaQNAtyrT2H3/Fa1atNsLSooSsiPxU3mfB V0BQ== X-Gm-Message-State: ABy/qLZKKHZZPJXscRSxfrcGkG3Jr04Bj/F4rf3rTdiEzh1YEMJErmvo YRNAxfPc+gC0ybRO+UGOsfZLk+c= X-Google-Smtp-Source: APBJJlFxtH8vPv9ha+Sonx0ulVsAGnHbzZ8OIby+hQXM1P4BTVj0mKPOsyjnwy8v/GMkZo+sb4gWKe8= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90a:f696:b0:263:3727:6045 with SMTP id cl22-20020a17090af69600b0026337276045mr2142917pjb.4.1688578308779; Wed, 05 Jul 2023 10:31:48 -0700 (PDT) Date: Wed, 5 Jul 2023 10:31:47 -0700 In-Reply-To: <20230703181226.19380-15-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230703181226.19380-1-larysa.zaremba@intel.com> <20230703181226.19380-15-larysa.zaremba@intel.com> Message-ID: From: Stanislav Fomichev To: Larysa Zaremba Content-Type: text/plain; charset="utf-8" Message-ID-Hash: HL2HRVZK3FW53RINRLRJLU7YKB6VXB3I X-Message-ID-Hash: HL2HRVZK3FW53RINRLRJLU7YKB6VXB3I X-MailFrom: 3BKmlZAMKCRkH245DD5A3.1DBM2E-67CIHM2E-EGD831I.C3I@flex--sdf.bounces.google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 14/20] selftests/bpf: Allow VLAN packets in xdp_hw_metadata List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 07/03, 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. > > Signed-off-by: Larysa Zaremba Acked-by: Stanislav Fomichev > --- > tools/testing/selftests/bpf/progs/xdp_hw_metadata.c | 10 +++++++++- > tools/testing/selftests/bpf/xdp_metadata.h | 8 ++++++++ > 2 files changed, 17 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..63d7de6c6bbb 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c > @@ -26,15 +26,23 @@ 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->h_proto == bpf_htons(ETH_P_8021Q))) > + 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.41.0 >