From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mail.toke.dk (Postfix) with ESMTPS id C494FA062E9 for ; Fri, 12 May 2023 17:20:58 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=EsooMe8k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683904859; x=1715440859; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ca3C3CN5XD0jYqPpaEXrBQ6QBGcOSKPhdaJMaphgwXU=; b=EsooMe8kEkveS7N3dVNtHa4wzmPAPsy4RVOqeYKStYguVw63zH6chJSO 93v/c4ylTw8dw4/8hy35Wv26qOWkpDfXHd/DcY9iGZKijh2rPV5vuzZ3I EOmkOe4dLsUaDENUkt3Qz7JuUVlDlFvVnJn8gM2fqnzHIpjlHjsoF0FF5 YwAU39FIzv66z4k7Jlp/AxktBdKzAdQheOSWa26xCOGMEyUvlZHzsjNvb DIbF22injioEiKMYneAEB88XkrN5unS6Goo2OcBWuhFOxA0CdzHL29j21 V9u7lk6PqkH8TYGzgQzURIBfvWNnm41BYys3f+WJ77Lb/0Q/AQrWkBO5s A==; X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="353061190" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="353061190" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 08:20:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="812114413" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="812114413" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmsmga002.fm.intel.com with ESMTP; 12 May 2023 08:20:39 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id AD00735FB7; Fri, 12 May 2023 16:20:35 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Fri, 12 May 2023 17:16:34 +0200 Message-Id: <20230512151639.992033-11-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230512151639.992033-1-larysa.zaremba@intel.com> References: <20230512151639.992033-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: UTKQDXOYBT7SBHJGFN76X33NKDJY3Y4B X-Message-ID-Hash: UTKQDXOYBT7SBHJGFN76X33NKDJY3Y4B X-MailFrom: larysa.zaremba@intel.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: Larysa Zaremba , Stanislav Fomichev , 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] [PATCH 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: 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; + + *vlan_tag = ice_get_vlan_tag_from_rx_desc(xdp_ext->eop_desc); + 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