From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mail.toke.dk (Postfix) with ESMTPS id B3D63A1AD63 for ; Wed, 19 Jul 2023 20:42:12 +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=XmVjd7bA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689792132; x=1721328132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rw5nz9sCTfQBM+hv9Hl09jY0OCRRTTTu6FBR9DxJTlA=; b=XmVjd7bAYswhQc7NeZqQCD7wODffeOOHU++8gX4wDprovW3C/S7ogNZ8 Ebtyl+xGWp+VnlpPX1hN6hdAxIUM5rH5GGRL7b3yD1D3A3doS4Xrv3Xh6 rQUejPPopik34Zz+FV+mCcUorQk+VR/r3LRDH8YkGjEJLE3McRBwk7JpA VG26yoPQTyCcQMjvbxdj08a+tWFi4zHAWJTGUV0NqWCTQ3cmpgC9qZpDk WiUyCjBfSA+WNTTzKi9hkyMVM3R1G7Y8FFlg74c0My2uqPXVFTnWfDdL4 ujg0/RynEUoOHE50JBsxpWk4x6GrbuQinPf5hBuidEFyBylnpALH83moe g==; X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="370111275" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="370111275" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 11:42:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="794146688" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="794146688" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmsmga004.fm.intel.com with ESMTP; 19 Jul 2023 11:42:07 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 574223583D; Wed, 19 Jul 2023 19:42:06 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Wed, 19 Jul 2023 20:37:26 +0200 Message-ID: <20230719183734.21681-14-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719183734.21681-1-larysa.zaremba@intel.com> References: <20230719183734.21681-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6EDMMVG4FUCUVELBSPGAKKCBAOUNAMVZ X-Message-ID-Hash: 6EDMMVG4FUCUVELBSPGAKKCBAOUNAMVZ 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 , 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, sdf@google.com, 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] [PATCH bpf-next v3 13/21] ice: Implement checksum 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_csum callback to allow XDP code to determine, whether HW has validated any checksums. Signed-off-by: Larysa Zaremba --- drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 54685d0747aa..6647a7e55ac8 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -660,8 +660,37 @@ static int ice_xdp_rx_vlan_tag(const struct xdp_md *ctx, u16 *vlan_tci, return 0; } +/** + * ice_xdp_rx_csum_lvl - Get level, at which HW has checked the checksum + * @ctx: XDP buff pointer + * @csum_status: destination address + * @csum_info: destination address + * + * Copy HW checksum level (if was checked) to the destination address. + */ +static int ice_xdp_rx_csum(const struct xdp_md *ctx, + enum xdp_csum_status *csum_status, + union xdp_csum_info *csum_info) +{ + const struct ice_xdp_buff *xdp_ext = (void *)ctx; + const union ice_32b_rx_flex_desc *eop_desc; + enum ice_rx_csum_status status; + u16 ptype; + + eop_desc = xdp_ext->pkt_ctx.eop_desc; + ptype = ice_get_ptype(eop_desc); + + status = ice_get_rx_csum_status(eop_desc, ptype); + if (status & ICE_RX_CSUM_NONE) + return -ENODATA; + + *csum_status = ice_rx_csum_lvl(status) + 1; + 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_vlan_tag = ice_xdp_rx_vlan_tag, + .xmo_rx_csum = ice_xdp_rx_csum, }; -- 2.41.0