From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (unknown [192.55.52.93]) by mail.toke.dk (Postfix) with ESMTPS id 1D425A1CC29 for ; Fri, 28 Jul 2023 19:44:43 +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=k6A52fDk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690566284; x=1722102284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ilvtgIUqJ5hEp3FeBkpAW9MohoyE2wINrHeApnNuVy8=; b=k6A52fDkVLw6vdecD7UII2t3OwhkiE500t+Zt9qnhWulv5rahvF2FEli cvDGzXLXThJTGvdWSAYSGVO/606FdqX1PheSPMB/Mdc9EWPPmcNJDHG12 x13wGkb/CVtMmaALmUTebPieUsyHj5gLT7dgeaFDZIJgINtd01oWzua/c hKfT+E70FXiVYVpt8obD1VOnWEIIM8i3UKvyh+lepTLATRdShdRX9Rixf goh0HqkQjxTkZSc0yN69hE8SXl5wRERszoTSFa85IeVHj4r5xoD+QFoIp hVwxHsYPWA4gfSQiskN3a4hj+E0HhAyGhSqDRS9acYywpdmBSTKwVXwGS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="366117447" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="366117447" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2023 10:44:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="851294678" X-IronPort-AV: E=Sophos;i="6.01,238,1684825200"; d="scan'208";a="851294678" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga004.jf.intel.com with ESMTP; 28 Jul 2023 10:44:30 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id C0E51386B4; Fri, 28 Jul 2023 18:44:28 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Fri, 28 Jul 2023 19:39:15 +0200 Message-ID: <20230728173923.1318596-14-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230728173923.1318596-1-larysa.zaremba@intel.com> References: <20230728173923.1318596-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: AXAJB4PU5Y4RXMW5RFVGEQWA6PPR2N3B X-Message-ID-Hash: AXAJB4PU5Y4RXMW5RFVGEQWA6PPR2N3B 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, Willem de Bruijn , Alexei Starovoitov , Simon Horman X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] [PATCH bpf-next v4 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 6ae57a98a4d8..e7a7c8e536b2 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 = XDP_CHECKSUM_VALID_LVL0 + ice_rx_csum_lvl(status); + 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