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 493741EA6E for ; Fri, 12 May 2023 18:32:03 +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 6BC792729 for ; Fri, 12 May 2023 11:31:27 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-643bb9cdd3cso8038960b3a.1 for ; Fri, 12 May 2023 11:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683916283; x=1686508283; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wq2By9mZuUQ7p1oM5SkoXHJiUzdgw169iTgadwLtfnQ=; b=JWT1FrK7ck7EpDsQRE4pCSwDvUGJ63OfyV6gRQBf3N6utX08/U1OHXmvomU3P6Z3G6 N5Tvx3vxz4Y6ynHYvG8gsQs85MZ7VK/EoDwOcb9T7Vuf16vwygdYAzo/UNwe5EPtiLD8 HAQ764S9LE4N6qXozvAtzgduNz/lnpvl878hU17TpCFsRDDOzxM/9/Y7iSQQ3Zx2WZpj I4fJF+J/zB+k1AZUcc8RBSXW1+T9EWoDEQpcvOtBknUhsuo/Cja32EUu70hGOaWdrDKH 6PzSqv0XmVdYlay6qmzlhnjOFde/W19FX57pttk9HvCy1ixM/Fgu/A/6SlTmkdEkZhVw NRng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683916283; x=1686508283; 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=wq2By9mZuUQ7p1oM5SkoXHJiUzdgw169iTgadwLtfnQ=; b=diFV+zvfMKRqNZNdJnDpcno5IseXyC982E0IMg2a1R0bDSTzt6ctF2+j+sxO2G7b/m EQK0srP44XbILDZkC3LC58B2zLRD8khDQHRPmvzf3r3jx/bKsD/fRqdK/JyeqPBu/jHr 37S5Mn2aAwwNiYym3bleKzJ+OI/wSV3mnM5efRAktmmNdtLfWPyZdnqvAdRSuc97G6hL rWDTnuUhEgQ1vr7LJb6EnhcnjDY9wUVucTq2wfZOO95GGn4F6ymJScrRC957+Y+JPmf2 9ZKt58un7O3pV3xpNjIVyAZvPQ8eN5yZxDJQyM/jMnsWcsKzCuBt4rKgfoieC7c2We/B NOgg== X-Gm-Message-State: AC+VfDxyGlb4z44TSRvxKFHqFu2/yexqbBmLg32ckwnl/FdKqhid9NpD R/B83Ax8xLXjQnVeVm0jD1Dz3nk= X-Google-Smtp-Source: ACHHUZ5yguYzBo0raBvnnA2xkJTrHlxk1B/ym21H6OwVm5I5+i5m5lU08ouAnUGmmP635rdcxpsTQfI= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a05:6a00:7c6:b0:643:599b:4db4 with SMTP id n6-20020a056a0007c600b00643599b4db4mr6882664pfu.1.1683916282830; Fri, 12 May 2023 11:31:22 -0700 (PDT) Date: Fri, 12 May 2023 11:31:21 -0700 In-Reply-To: <20230512152607.992209-11-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-11-larysa.zaremba@intel.com> Message-ID: Subject: Re: [PATCH RESEND bpf-next 10/15] ice: Implement VLAN tag hint 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: > Implement .xmo_rx_vlan_tag callback to allow XDP code to read > packet's VLAN tag. > > Signed-off-by: Larysa Zaremba > --- > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 44 +++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index 1caa73644e7b..39547feb6106 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -627,7 +627,51 @@ static int ice_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, > return 0; > } > > +/** > + * ice_xdp_rx_ctag - VLAN tag XDP hint handler > + * @ctx: XDP buff pointer > + * @vlan_tag: destination address > + * > + * Copy VLAN tag (if was stripped) to the destination address. > + */ > +static int ice_xdp_rx_ctag(const struct xdp_md *ctx, u16 *vlan_tag) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + netdev_features_t features; > + [..] > + features = xdp_ext->rx_ring->netdev->features; > + > + if (!(features & NETIF_F_HW_VLAN_CTAG_RX)) > + return -EINVAL; Passing-by comment: why do we need to check features? ice_get_vlan_tag_from_rx_desc seems to be checking a bunch of fields in the descriptors, so that should be enough? > + > + *vlan_tag = ice_get_vlan_tag_from_rx_desc(xdp_ext->eop_desc); Should we also do the following: if (!*vlan_tag) return -ENODATA; ? > + return 0; > +} > + > +/** > + * ice_xdp_rx_stag - VLAN s-tag XDP hint handler > + * @ctx: XDP buff pointer > + * @vlan_tag: destination address > + * > + * Copy VLAN s-tag (if was stripped) to the destination address. > + */ > +static int ice_xdp_rx_stag(const struct xdp_md *ctx, u16 *vlan_tag) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + netdev_features_t features; > + > + features = xdp_ext->rx_ring->netdev->features; > + > + if (!(features & NETIF_F_HW_VLAN_STAG_RX)) > + return -EINVAL; > + > + *vlan_tag = ice_get_vlan_tag_from_rx_desc(xdp_ext->eop_desc); > + return 0; > +} > + > const struct xdp_metadata_ops ice_xdp_md_ops = { > .xmo_rx_timestamp = ice_xdp_rx_hw_ts, > .xmo_rx_hash = ice_xdp_rx_hash, > + .xmo_rx_ctag = ice_xdp_rx_ctag, > + .xmo_rx_stag = ice_xdp_rx_stag, > }; > -- > 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 83727C77B7C for ; Fri, 12 May 2023 18:31:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2A20B403BF; Fri, 12 May 2023 18:31:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2A20B403BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1683916287; bh=GYtcEtB7eivw2BFqK9rI1b2GwKRK45rx7jsGGeGXOY4=; h=Date:In-Reply-To:References:From:To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=D2jPAzUh94iT+YaKX9LimDf+Z+1Owf6P3XOIbrgGjBiEjx9tBIFCW2EJkU7F11x6I kG/jm27PIzbWkPPR2qA64XVgh02OXyGd1ukeYSWnhaLsTF695hZDlljGUEjb1dQsSB zCWyr6uonPtILssuGjcmKMs1GedNaEOGKCWysTQ3VBdFifWJzYuFROwpfL36Z1nYj4 qjT4jf8Jz3bd78+XFyIPg+/EThX/v99HRIGgdK204Xxi9Zsfju/6PbEwT7bujcq+CE 1XYwSeEaTF1KPu1EsoKlti27YpMec+rICT5OWxLcUSxUtzAkWbDq2E1bfJCo6JcUNB eY8FdWIL9Dhyg== 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 EBngV6uHbU4w; Fri, 12 May 2023 18:31:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 24551404C1; Fri, 12 May 2023 18:31:26 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 24551404C1 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 168051BF836 for ; Fri, 12 May 2023 18:31:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id F031584872 for ; Fri, 12 May 2023 18:31:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F031584872 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QOwxmEetK-Yh for ; Fri, 12 May 2023 18:31:23 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5DBFA8485B Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5DBFA8485B for ; Fri, 12 May 2023 18:31:23 +0000 (UTC) Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-6434307a64bso10398580b3a.2 for ; Fri, 12 May 2023 11:31:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683916283; x=1686508283; 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=wq2By9mZuUQ7p1oM5SkoXHJiUzdgw169iTgadwLtfnQ=; b=hDeNNv+BOA033Jjyz/Rz7nboXZgM8s3prYouI2L3IzJp/3cYMH9yucPtRMEuK2a0bU 06LIjLZOqqCV47DIxDWLOSNoL2+OFeyoveMem6B5pnetUs9XPkQHMwVYVkWdtJWOw1az wCIvMfnZVEarAZ1oNG17eyJ6ZwPU8rifyVMw6IczMCK0PoyRKYGi6uGDPsoefwT3Z3oY 25kzXN/yPGhK8EbaiSuxKQRgp+LW6XEZ7/tIcnxMjolrF5//zedf5AzFYH2NyIuyoDbt WNY1SpmdsGkCqxBNfivCSyvSN0wVw69E3F0wxuEmmXBAuq9LghTL0XpY3ec8LeQrBoJL 6i6g== X-Gm-Message-State: AC+VfDxTsmXq/EFrzHuLlMAkGUyWZflOoqmNXLC8gHVoPjbBoPPmXe5D T2V6ebfoCRU9qvX5PfzxE14+iNQ= X-Google-Smtp-Source: ACHHUZ5yguYzBo0raBvnnA2xkJTrHlxk1B/ym21H6OwVm5I5+i5m5lU08ouAnUGmmP635rdcxpsTQfI= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a05:6a00:7c6:b0:643:599b:4db4 with SMTP id n6-20020a056a0007c600b00643599b4db4mr6882664pfu.1.1683916282830; Fri, 12 May 2023 11:31:22 -0700 (PDT) Date: Fri, 12 May 2023 11:31:21 -0700 In-Reply-To: <20230512152607.992209-11-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230512152607.992209-1-larysa.zaremba@intel.com> <20230512152607.992209-11-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=1683916283; x=1686508283; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wq2By9mZuUQ7p1oM5SkoXHJiUzdgw169iTgadwLtfnQ=; b=JWT1FrK7ck7EpDsQRE4pCSwDvUGJ63OfyV6gRQBf3N6utX08/U1OHXmvomU3P6Z3G6 N5Tvx3vxz4Y6ynHYvG8gsQs85MZ7VK/EoDwOcb9T7Vuf16vwygdYAzo/UNwe5EPtiLD8 HAQ764S9LE4N6qXozvAtzgduNz/lnpvl878hU17TpCFsRDDOzxM/9/Y7iSQQ3Zx2WZpj I4fJF+J/zB+k1AZUcc8RBSXW1+T9EWoDEQpcvOtBknUhsuo/Cja32EUu70hGOaWdrDKH 6PzSqv0XmVdYlay6qmzlhnjOFde/W19FX57pttk9HvCy1ixM/Fgu/A/6SlTmkdEkZhVw NRng== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=JWT1FrK7 Subject: Re: [Intel-wired-lan] [PATCH RESEND bpf-next 10/15] ice: Implement VLAN tag hint 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: > Implement .xmo_rx_vlan_tag callback to allow XDP code to read > packet's VLAN tag. > > Signed-off-by: Larysa Zaremba > --- > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 44 +++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index 1caa73644e7b..39547feb6106 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -627,7 +627,51 @@ static int ice_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, > return 0; > } > > +/** > + * ice_xdp_rx_ctag - VLAN tag XDP hint handler > + * @ctx: XDP buff pointer > + * @vlan_tag: destination address > + * > + * Copy VLAN tag (if was stripped) to the destination address. > + */ > +static int ice_xdp_rx_ctag(const struct xdp_md *ctx, u16 *vlan_tag) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + netdev_features_t features; > + [..] > + features = xdp_ext->rx_ring->netdev->features; > + > + if (!(features & NETIF_F_HW_VLAN_CTAG_RX)) > + return -EINVAL; Passing-by comment: why do we need to check features? ice_get_vlan_tag_from_rx_desc seems to be checking a bunch of fields in the descriptors, so that should be enough? > + > + *vlan_tag = ice_get_vlan_tag_from_rx_desc(xdp_ext->eop_desc); Should we also do the following: if (!*vlan_tag) return -ENODATA; ? > + return 0; > +} > + > +/** > + * ice_xdp_rx_stag - VLAN s-tag XDP hint handler > + * @ctx: XDP buff pointer > + * @vlan_tag: destination address > + * > + * Copy VLAN s-tag (if was stripped) to the destination address. > + */ > +static int ice_xdp_rx_stag(const struct xdp_md *ctx, u16 *vlan_tag) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + netdev_features_t features; > + > + features = xdp_ext->rx_ring->netdev->features; > + > + if (!(features & NETIF_F_HW_VLAN_STAG_RX)) > + return -EINVAL; > + > + *vlan_tag = ice_get_vlan_tag_from_rx_desc(xdp_ext->eop_desc); > + return 0; > +} > + > const struct xdp_metadata_ops ice_xdp_md_ops = { > .xmo_rx_timestamp = ice_xdp_rx_hw_ts, > .xmo_rx_hash = ice_xdp_rx_hash, > + .xmo_rx_ctag = ice_xdp_rx_ctag, > + .xmo_rx_stag = ice_xdp_rx_stag, > }; > -- > 2.35.3 > _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan