From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mail.toke.dk (Postfix) with ESMTPS id 1088CA15821 for ; Mon, 3 Jul 2023 20:17: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=MuS9i0ND DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688408233; x=1719944233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sHqdvBvHsNSPyHC4M445WTPfz0TpuEcQFCdK7bBdueQ=; b=MuS9i0NDGVMPml7cU19hl9PZegpG2Cvr9qQkI0Bnu+X1MQjrQgolmIuP asZAY2kTS5pnv32U9TRv30nKMKjA1uf9H0Stz6+VXe53w1A2uu0sTNkQp uPlBhPxyPvbZWDNGY88GTC/jdzOSO2EIkuFHtvoK+akLO4sCz6MZNrQ/j dcWVanphM4q5QhevnHKbCpilYXpDTLcuGHXIlw9NWI0upQ2yo1XIbep1z RpaUmdmtP+Ir8xydwcMIpu5GrnfjQUkuH733F/doAVXRWr+6KkgsKh7rS bSLukZc6BxdQarcNr+sovnpcYJT6kAwoVAE0DalR87aF5lirNZ47b7W2Z g==; X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="393682690" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="393682690" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2023 11:17:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10760"; a="892615146" X-IronPort-AV: E=Sophos;i="6.01,178,1684825200"; d="scan'208";a="892615146" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga005.jf.intel.com with ESMTP; 03 Jul 2023 11:17: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 B7E4C35803; Mon, 3 Jul 2023 19:17:05 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Date: Mon, 3 Jul 2023 20:12:19 +0200 Message-ID: <20230703181226.19380-14-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703181226.19380-1-larysa.zaremba@intel.com> References: <20230703181226.19380-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: OWCAC6ZHN26BLQZ32QPE4VXYK67BG3MV X-Message-ID-Hash: OWCAC6ZHN26BLQZ32QPE4VXYK67BG3MV 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 v2 13/20] ice: Implement checksum level 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_lvl callback to allow XDP code to determine, whether checksum was checked by hardware and on what level. 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 e9f334fecdf1..41ab52b6990d 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_tag, return 0; } +/** + * ice_xdp_rx_csum_lvl - Get level, at which HW has checked the checksum + * @ctx: XDP buff pointer + * @csum_lvl: destination address + * + * Copy HW checksum level (if was checked) to the destination address. + */ +static int ice_xdp_rx_csum_lvl(const struct xdp_md *ctx, u8 *csum_lvl) +{ + 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_lvl = 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_lvl = ice_xdp_rx_csum_lvl, }; -- 2.41.0