Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10738656rwr; Fri, 12 May 2023 12:12:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oKYW9iTX0lch0eDGJg1+hVGNzsZZGbOzgn9eSgRQhzkem7c/2cP9X+/bjqqURHWsdrNht X-Received: by 2002:a05:6a20:7488:b0:104:8e5d:4f14 with SMTP id p8-20020a056a20748800b001048e5d4f14mr3577258pzd.46.1683918752533; Fri, 12 May 2023 12:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683918752; cv=none; d=google.com; s=arc-20160816; b=IR1Y0fmoPekD7Jq5p29LEfNJmj7PiNTBZv5NGHidsBbMD1Wlkwg6aoQGIgBGsoRxpL yoTy3Jr9OHD6DCmiZFZj9ByElPccv1YiFLbGQqstPkYBGXoCjBIwLyeVSBCsgcTCaCVI DIt3mUQih2X66XoMlbWflOcdXkTQuGyWo8vw2sYYqSpRtBoUMO4dlQzLQKuoyuba1wbB loO2Kdyzj0NLYHmWbl89YjtGsJMEoZGXMf26SsODb7EichNYK+N+AYEVjHghZzDTdzVu gfd/D7vQifbTmMm75XJakIG0InGVGFcKrhnESQ2aWJJVaJCpCsNbiwAuF3cPCtiLVC+S sO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=wq2By9mZuUQ7p1oM5SkoXHJiUzdgw169iTgadwLtfnQ=; b=HnH138HxWCas4Balj2areTpVb7jPz1IY/zU3v8SrWqmpYX604ONWZQ4uC+SFHwvpew BehKc8rrDvO28EoLQzpnypG9TrlxvoyT1NIXT9GAqrTW953C4xJy8b7605UgW/UKSq1+ Y2uItFPa6jeHsLJgTWWFXHwXfEPPa58oxqrGJ/yKKWCEj0HPAtRd2lGWCSBInzeS3JQf /WWo9SqNkseodNnDsCIinZ8RtAz6o0PIpkc26wsh0FWqNb6eX2MayaIwnQHtLFFgaM8W KidZDiF3ZZPXpQ3DxeQ3F2X/LQWEXL01D9pxAOkXFUKeM+j1yxns9JUAC2dQJUTRRdhp lynQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=JWT1FrK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020aa79a46000000b006478fe28452si8528211pfj.27.2023.05.12.12.12.17; Fri, 12 May 2023 12:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=JWT1FrK7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238945AbjELScE (ORCPT + 99 others); Fri, 12 May 2023 14:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238343AbjELScD (ORCPT ); Fri, 12 May 2023 14:32:03 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BF0093ED for ; Fri, 12 May 2023 11:31:28 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id d2e1a72fcca58-6436b503faeso10387693b3a.3 for ; Fri, 12 May 2023 11:31:28 -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=f1/kAxKJtnDMfGLlPt3m732l29YzOHN9h8GN7NLlgm+d2o1D6l354IY52ZMQKivt/Q cgPWKJLyVSdf0ZNzPyQJraRqhyHoHZsQc3NrHHbACFdcDR5ePW3Fe2PFtFre4rHNi4RX /WSsxdiN7PJhpnfxjie+AOnnsR0Zq75yCOv8+ALr+zwrRlOwjcqHBWtTtL/JzeHUSxt/ uVlcbmX0U7cESS5Wj5Uy27+rJA9VLl/w0j6rUKJdiM4Re+8Qzw/GLnzJkEMsN/YIC1Lt tJYblIy1oRHsluPCsDiQYJ+pkrI/fZni5USiCkiqCFJoJGsk28hHka5TAKvhI8/QWlEC 9LgA== X-Gm-Message-State: AC+VfDwzuCi6yDyQ389YqBP5GygwAv5GXHaSQYXMPzw4MDw8fFJQBnPd ZYDR23LNhusfZLmHf1V/PhVIXIY= 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: 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >