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=ac6M57LM Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mail.toke.dk (Postfix) with ESMTPS id 0D28EA2CB42 for ; Wed, 27 Sep 2023 09:58:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695801501; x=1727337501; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=03LkefjeBenrPX6vZKJMBeEVffbM4VKuslv0KH2qVIM=; b=ac6M57LM0FSd9cm6SyeD0fMravgHHnYUA48h/PibFC1sTuMS1SwM1JF+ uVQ3gATCMVd3ZsyN+y4yIheDjTozsvLdzRbwyTfxvPmHi5BDBJqANTVRc MNFicoj0AC7iWmo3w6U+u634WcL0e3vU0HjjJEIGL38RCeJbJ+VUSvNwu FSQSwoJXmGu0FkT6i7LI+EfpNv6O7R+3J6PL8XyYm+BtCmjxIjRZ1g0jo /iMugHnRi2r4muObljGD8LuGoiwWphbH2p8PpFblJPjAncJDyU4uuC5sb 2nLyupHNROdt1qu1RfDc3Yiwj6AcLl9I4CQp+mfwZwpuJ/zuxhH348AF6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="366818093" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="366818093" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 00:58:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="725714048" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="725714048" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga006.jf.intel.com with ESMTP; 27 Sep 2023 00:58:13 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 965B97EAC1; Wed, 27 Sep 2023 08:58:11 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Wed, 27 Sep 2023 09:51:13 +0200 Message-ID: <20230927075124.23941-14-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230927075124.23941-1-larysa.zaremba@intel.com> References: <20230927075124.23941-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: C6BD2CEJXNIJCMJ32HL2FXGVCSRNLECF X-Message-ID-Hash: C6BD2CEJXNIJCMJ32HL2FXGVCSRNLECF 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 , Tariq Toukan , Saeed Mahameed , Maciej Fijalkowski X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] [RFC bpf-next v2 13/24] 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 cc4ba7e995b7..5f12f67af85f 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -647,8 +647,34 @@ static int ice_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto, 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