From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=intel.com (client-ip=134.134.136.126; helo=mgamail.intel.com; envelope-from=larysa.zaremba@intel.com; receiver=) 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=FTqUfPSD Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mail.toke.dk (Postfix) with ESMTPS id 4674BA208C3 for ; Fri, 11 Aug 2023 18:20:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691770853; x=1723306853; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MrzRG4al62OiD9VEbOJ+kaeSZbDEICc4yRM2zQdS+Vw=; b=FTqUfPSD81jvjzd2EEc5WLiteb/mIh1Laa3taF4TBBLSThfBHh/r3DAS zH38x7zdSHiV3H/7gPJj+GjTvMYnhJYUAmSUPmiNvJyMjeZGJ0PEijC18 GdHwiOoKRR6oO2lpCRyTgaoicaV81hONR2GGPDNLcNjAJIZkjoqabXLVp cEXfBZ1HZPZSi/eCh+aPSRjugjWmoXtGd4go+TGpYEEu9+/pE5OgOu6fw HcdgTZOAwv6FFxqrRCzy6SspChPEbzbFPIucQgGC+WA9JzbneXeLOV9dN y8THtf1YEdPyl/g2CEa7uZnmoUjzSwb7+oEeO3LeHF093kD7woGTB1hwn A==; X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="356672118" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="356672118" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 09:20:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10799"; a="1063363821" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="1063363821" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmsmga005.fm.intel.com with ESMTP; 11 Aug 2023 09:20:34 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id A824533BC2; Fri, 11 Aug 2023 17:20:32 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Fri, 11 Aug 2023 18:15:01 +0200 Message-ID: <20230811161509.19722-14-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811161509.19722-1-larysa.zaremba@intel.com> References: <20230811161509.19722-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 2MPVDJK7QFVIYWTGYHSCMOF4GRMT5Z3E X-Message-ID-Hash: 2MPVDJK7QFVIYWTGYHSCMOF4GRMT5Z3E X-MailFrom: larysa.zaremba@intel.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address 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 v5 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 | 26 +++++++++++++++++++ 1 file changed, 26 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..f11a245705bc 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -660,8 +660,34 @@ static int ice_xdp_rx_vlan_tag(const struct xdp_md *ctx, u16 *vlan_tci, return 0; } +/** + * ice_xdp_rx_csum - RX checksum XDP hint handler + * @ctx: XDP buff pointer + * @csum_status: status destination address + * @csum: not used + */ +static int ice_xdp_rx_csum(const struct xdp_md *ctx, + enum xdp_csum_status *csum_status, __wsum *csum) +{ + 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_FAIL) + return -ENODATA; + + *csum_status = XDP_CHECKSUM_VERIFIED; + 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