From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by mail.toke.dk (Postfix) with ESMTPS id EA108A1B267 for ; Thu, 20 Jul 2023 23:59:01 +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=bWs4BZZ3 Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-5634dbfb8b1so658339a12.1 for ; Thu, 20 Jul 2023 14:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689890340; x=1690495140; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Ivp1TBnd1/v0oKmUsvkQtIucEL7zSFDmhW7hv5CZdSE=; b=bWs4BZZ3m4K2zmKM84WnDVPczXKXUyoQbP6+eskzSCyz31t95wHTQt147Fw7Ywrdpe rrc7zoE0IYfuSfDaye8tZ3HzdexMisi8gE0f+TjpB6YS0wT5IlyQkFA/Vn2y3YyBfmY/ n/v+WKlwa30egyzHT6JoDsBWt6iIWzVDpOqr2giYATPamecQvOA4O/6mYt/v1ktFEvQo t6JSLaZ2ZMXPLY3b3j7OJdUHSw44b9JpgoHwZyL7V9xqmm14VK1gnKnq8npUZTJMxg5j AoMiYQ6zzuscmxRQ6DAoxqmvGw/NncACnK7EsiAwNxu3C9RcD6C0vebGv/ibtGOX/Teo MIGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689890340; x=1690495140; 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=Ivp1TBnd1/v0oKmUsvkQtIucEL7zSFDmhW7hv5CZdSE=; b=kERgH0f19ant2mgWnPnKAZ3Pao+rV13UPJdnuAcCdQBiE7bfcW8J9CRlvPsaEXV7Cv UC9rNjFE4b8SzQ0wJWTtbvzNNvkK2RoCxkQ3n3Lki2oLsnWnITptFKlPDB4rNe+1aGil cJZgCDlb/3k/jE1Ecnfq8vcIUSi7yLJK0fDL4/xT5IcG390C6R9Lo99pAhD4QyFZiw6Q f8oTaqJZ2IPBpQh02gRvbnB8rIKic9PUFfSkPnSI2paJ1z8/OPo8/u7l0q4HJTMHdalL QygbZAGeLTcjXsAyqN7LdRg4udFW41lrfvunrTjuaNyTg9z/X3/9B+VlglmEY/8iAO+7 7eMw== X-Gm-Message-State: ABy/qLbZUbwRlPGGAWseHtKbtiSChvFiB7YbMszTnqrJv4uqrNLwUzgS dN4VLvs9rgzO26qshjKeg4GoE8A= X-Google-Smtp-Source: APBJJlG/BmoDsdKv6D4hJ7EFRM2hqK7fNtNz1zIBvbPMMkks4eL22Y9O2fOri4s57vaA8eh50zWuKNE= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a63:7942:0:b0:542:c9ed:b with SMTP id u63-20020a637942000000b00542c9ed000bmr35418pgc.7.1689890339748; Thu, 20 Jul 2023 14:58:59 -0700 (PDT) Date: Thu, 20 Jul 2023 14:58:58 -0700 In-Reply-To: <20230719183734.21681-15-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230719183734.21681-1-larysa.zaremba@intel.com> <20230719183734.21681-15-larysa.zaremba@intel.com> Message-ID: From: Stanislav Fomichev To: Larysa Zaremba Content-Type: text/plain; charset="utf-8" Message-ID-Hash: QSUAEVZ7XSAIIWLVNHCMXAMX6WXWV7HX X-Message-ID-Hash: QSUAEVZ7XSAIIWLVNHCMXAMX6WXWV7HX X-MailFrom: 3I665ZAMKCZIEz12AA270.yA8JzB-349FEJzB-BDA50yF.90F@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 v3 14/21] 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/19, 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 >