From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by mail.toke.dk (Postfix) with ESMTPS id 4D39AA0654D for ; Fri, 12 May 2023 20:31:24 +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=JWT1FrK7 Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-643bb9cdd3cso8038964b3a.1 for ; Fri, 12 May 2023 11:31:24 -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=WrKM3oXenkEx0ZW7uNY2sHfu6e3Ksdr76ohf/II6Z9WXmhs+K1BxajyXFq4n+8kjjI EkhBQWEVwUteNeTPWt3AqQTfRIRYpWFKdZ8bajPQzac8ZtHP2GCNVzq0lqAQ15LAoeCN q2hgqxxA/ATYbQ4NM8xuFQN5EOklND8fepqI597QnPPdiWE3uDWBRcsjGhtJKGTOsvmB GjvmTfQzDbExV3V73A7SiwFusd7/gs4ubE1F3+L3OBDs+PcuCaBLEss9F2fq61DVDoFt TeBX37SXbhv7Dv/QIQb7TdUtK1nQuQhf3XYeqKZ9f4hAT9Kvaoas2rDRmC1N3IbFMlIp xTDA== X-Gm-Message-State: AC+VfDyxUj3707ID28aEoANwnAnbWGU1fW3WG8PP/BlBMpFNLbfX34tH fRGTGXtLrPYUY01kDBuVw3R1diU= 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 Content-Type: text/plain; charset="utf-8" Message-ID-Hash: NSNWKETANL5FHASR6CM4PT5J533IZV3N X-Message-ID-Hash: NSNWKETANL5FHASR6CM4PT5J533IZV3N X-MailFrom: 3-oVeZAMKCakbMOPXXPUN.LXVgMY-QRWcbgMY-YaXSNLc.WNc@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, 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 X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH RESEND bpf-next 10/15] ice: Implement VLAN tag hint List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 >