From patchwork Sat Feb 3 14:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13544273 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 931B55CDC7; Sat, 3 Feb 2024 14:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706970378; cv=none; b=K+ADgp+fdOaG8SI4fJiCc5NXYsewjwLEb2fNuInJ2TVSkjukgnFum/lJV04IdhhVDF65kpzqBeFBg7W3g358pOtx7GSqm+ET9JZjipl9yQhTOfnhIjRH5q6qPSS93HDgk6qPZB0MujdQey4DwJwMCTVBCxXQPlCSfMaQWxNRv9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706970378; c=relaxed/simple; bh=zN1tPZap7/+TyGBIkdGFkeLcWiAAupUznoYoKeEJAig=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GK6O9K9N/DUK7Ga6qXQEJbVb4Db2tCIPK0Lu6T+KXLEhrhUT8VZ4Xyu5Z1DpuzsZCfqT17XwLCVSQbIs8A2/LTfH7uex1sJw841ys7NbaN94x/nPmVqsW3Yr/cLtke3Qi9yXX0vjkYSr3ncNRh6USCEDpVJGdu5D28+77EnLLJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,240,1701097200"; d="scan'208";a="196644563" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 03 Feb 2024 23:26:08 +0900 Received: from localhost.localdomain (unknown [10.226.92.48]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F3BF541F8490; Sat, 3 Feb 2024 23:26:01 +0900 (JST) From: Biju Das To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Biju Das , Sergey Shtylyov , Vincent Guittot , peterz@infradead.org, Claudiu Beznea , Yoshihiro Shimoda , Wolfram Sang , Nikita Yushchenko , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v4 net-next 0/2] Add HW checksum offload support for RZ/G2L GbEthernet IP Date: Sat, 3 Feb 2024 14:25:57 +0000 Message-Id: <20240203142559.130466-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch series aims to add HW checksum offload supported by TOE module found on the RZ/G2L Gb ethernet IP. TOE has hardware support for calculating IP header and TCP/UDP/ICMP checksum for both IPv4 and IPv6. For Rx, the 4-byte result of checksum calculation is attached to the Ethernet frames.First 2-bytes is result of IPv4 header checksum and next 2-bytes is TCP/UDP/ICMP checksum. If a frame does not have checksum error, 0x0000 is attached as checksum calculation result. For unsupported frames 0xFFFF is attached as checksum calculation result. In case of an IPv6 packet, IPv4 checksum is always set to 0xFFFF. For Tx, the result of checksum calculation is set to the checksum field of each IPv4 Header/TCP/UDP/ICMP of ethernet frames. For the unsupported frames, those fields are not changed. If a transmission frame is an UDPv4 frame and its checksum value in the UDP header field is 0x0000, TOE does not calculate checksum for UDP part of this frame as it is optional function as per standards. Add Tx/Rx checksum offload supported by TOE for IPv4 and TCP/UDP protocols. Results of iperf3 in Mbps RZ/V2L: TCP(Tx/Rx) results with checksum offload Enabled: {921,932} TCP(Tx/Rx) results with checksum offload Disabled: {867,612} UDP(Tx/Rx) results with checksum offload Enabled: {950,946} UDP(Tx/Rx) results with checksum offload Disabled: {952,920} RZ/G2L: TCP(Tx/Rx) results with checksum offload Enabled: {920,936} TCP(Tx/Rx) results with checksum offload Disabled: {871,626} UDP(Tx/Rx) results with checksum offload Enabled: {953,950} UDP(Tx/Rx) results with checksum offload Disabled: {954,920} RZ/G2LC: TCP(Tx/Rx) results with checksum offload Enabled: {927,936} TCP(Tx/Rx) results with checksum offload Disabled: {889,626} UDP(Tx/Rx) results with checksum offload Enabled: {950,946} UDP(Tx/Rx) results with checksum offload Disabled: {949,944} v3->v4: * Add separate section for RZ/G2L TOE registers in enum ravb_reg. * Dropped enabling IPv6 specific bits in CSR2. * The comment "csum" expanded to "checksum" in ravb_rx_csum_gbeth(). * Dropped unnecessary comment "Hardware validated our checksum". * Dropped reading CSR0 register in ravb_endisable_csum_gbeth(). * Restored NETIF_F_HW_CSUM and associated changes. * Dropped enabling IPv6 specific bits in CSR1. * Dropped enabling ICMPv4 specific bit and associated handling as linux does not support it. v2->v3: * Updated commit header and description as suggested by Sergey for cover letter, * patch#1 and patch#2. * Dropped TOE_RX_CSUM_OK macro. * Renamed ravb_csum_offload_init_gbeth()->ravb_csum_init_gbeth(). * Moved enabling {RPE,TPE} in ravb_csum_init_gbeth(). * Updated the error message in ravb_csum_init_gbeth() as "Timeout enabling hardware checksum" * Introduced ravb_endisable_csum_gbeth() for enabling/disabling CSR{1,2} registers. * Replaced NETIF_F_IP_CSUM->NETIF_F_HW_CSUM as we are supporting only IPv4. * Updated the comment related to UDP header field. * Renamed ravb_is_tx_checksum_offload_gbeth_possible()->ravb_is_tx_csum_gbeth(). v1->v2: * Updated covering letter and results * Fixed the sparse warnings for patch#1 by replacing __sum16->__wsum. Biju Das (2): ravb: Add Rx checksum offload support for GbEth ravb: Add Tx checksum offload support for GbEth drivers/net/ethernet/renesas/ravb.h | 36 +++++- drivers/net/ethernet/renesas/ravb_main.c | 151 ++++++++++++++++++++++- 2 files changed, 183 insertions(+), 4 deletions(-)