Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10474131rwr; Fri, 12 May 2023 08:34:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WTG+NkIl5Lhb57nwW8uZ6wr65SBsGH19SCxrnjSrjY3WfbISoU7la/DtyNk8jzP0SnHBk X-Received: by 2002:a17:903:249:b0:1a6:c67f:4ed with SMTP id j9-20020a170903024900b001a6c67f04edmr32076517plh.9.1683905676334; Fri, 12 May 2023 08:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683905676; cv=none; d=google.com; s=arc-20160816; b=fCWGquW2Tzzl1ErMK46Pvg/OAhA5WoI4G62XrmYJiT8CzjCU+6hLyMq9lGtGGS9xLb BB3F8nenpSAL8eURdz7PQm53Wfq8DOK1Ps9Rbb0frovzsXMdeV1UgXQxdNrhnxOSttoz w/pNuR7dbAugNdmi4UG7nNM3kCdWpHZPte3aLgcf7aO5HfN6+5tiTLjecz8bPOA3ceNx yw74VscI5VakHjzIPHa8fnPk9jyAGpMlgQVwMxRNhqWyWLZex2G88loYE99oUSktmSc+ 0TPE2FMt0HB7CIByATV19X4qGYoR9yHWB4r+qi8cWYaInBEuMjUVwFYluTWedpVw0rQO YjVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ptwcwfz1KdiW1SP88DZkx+1v15fJi1ProyBFJF+hDfQ=; b=IVQa31bATYNtIGIEF/loG6cn5n68nbwjUzIk/cl17uuOK8qnj9WHQ5amWWExmDC1Mj yOaaNzCxC5DNndgwcraDr35XgkjsgW1U6hQ1+0ShBjV0yeyNFk79w/9Tm96z+BVp2koW 5tfIIJ1qujKNJKO8rBJZ17V3K6s2jFi/h5DXvKK3SbxUoznzYBiDjZXhw/IwMFA5m7+4 HoHOiShuSrWFDhtK49TgAgQ/SmBJrhBxAzT7rUKNMlQixDKE9WgUSJaOFsji1ukSijll 1iibSUR9zs3EKOwZpQGdqOXyE3WVF0andwHn/28ldY/myekFozk2hP3dgeYJdcIk1hTR TZVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K3Fq9O+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a170902d48100b001ac9ab8539csi10048539plg.77.2023.05.12.08.34.21; Fri, 12 May 2023 08:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K3Fq9O+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241558AbjELPWQ (ORCPT + 99 others); Fri, 12 May 2023 11:22:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241870AbjELPWJ (ORCPT ); Fri, 12 May 2023 11:22:09 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33CF6E710; Fri, 12 May 2023 08:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683904902; x=1715440902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lKsK28rErg60/rNwLMPgryg9t46tucLmP+/ktIgM2XM=; b=K3Fq9O+jpuZQkL17P03ieaDtSDT7HXC3yjsJbfyxGpoTY3Q87wL3MNze zwqihvYYD2G0gXKsxNe+RJM6Putm87JCPwZdpiL24H1VCjm0veUI9JPIc J9+tmx4olu3ZPFXyfNmcEzt+Yoxwb5x9pWOou07JiQDiZaR2VMlbVHNd4 6T+yF51/QEwoBFSjpid+Gnz7Ni4+xLJ22LJ2z/VmYkJWJ488XXSQ6I7IT 9PqsUL4GpaEXdCy8JzsPdAXWw8joqzpzGD8RY7fut5bnt/0/fCtTtKmYK 6t1e9E6VyrquYNQ9I3SQBBCni4EZCR+lsRKsXpH6Jmu+qjxL1vqkrrztE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="353061234" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="353061234" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 08:20:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="812114571" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="812114571" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmsmga002.fm.intel.com with ESMTP; 12 May 2023 08:20:44 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 0B2D43636E; Fri, 12 May 2023 16:20:40 +0100 (IST) From: Larysa Zaremba To: bpf@vger.kernel.org Cc: Larysa Zaremba , Stanislav Fomichev , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jakub Kicinski , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jiri Olsa , Jesse Brandeburg , Tony Nguyen , Anatoly Burakov , Jesper Dangaard Brouer , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/15] ice: Implement checksum level hint Date: Fri, 12 May 2023 17:16:36 +0200 Message-Id: <20230512151639.992033-13-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230512151639.992033-1-larysa.zaremba@intel.com> References: <20230512151639.992033-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c index 39547feb6106..6a3ec925f20d 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c @@ -161,6 +161,8 @@ ice_rx_csum_checked(union ice_32b_rx_flex_desc *rx_desc, u16 ptype, */ if (decoded.tunnel_type >= ICE_RX_PTYPE_TUNNEL_IP_GRENAT) *csum_lvl_dst = 1; + else + *csum_lvl_dst = 0; /* Only report checksum unnecessary for TCP, UDP, or SCTP */ switch (decoded.inner_prot) { @@ -190,7 +192,7 @@ static void ice_rx_csum_into_skb(struct ice_rx_ring *ring, struct sk_buff *skb, union ice_32b_rx_flex_desc *rx_desc, u16 ptype) { - u8 csum_level = 0; + u8 csum_level; /* Start with CHECKSUM_NONE and by default csum_level = 0 */ skb->ip_summed = CHECKSUM_NONE; @@ -669,9 +671,29 @@ static int ice_xdp_rx_stag(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; + u16 ptype = ice_get_ptype(xdp_ext->eop_desc); + + if (!ice_rx_csum_checked(xdp_ext->eop_desc, ptype, csum_lvl, + xdp_ext->rx_ring)) + return -EOPNOTSUPP; + + 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_ctag = ice_xdp_rx_ctag, .xmo_rx_stag = ice_xdp_rx_stag, + .xmo_rx_csum_lvl = ice_xdp_rx_csum_lvl, }; -- 2.35.3