From nobody Wed Nov 27 00:44:38 2024 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA0531AF0BB; Tue, 15 Oct 2024 13:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999468; cv=none; b=OCjCzLqSr9vJLdiD25TK3KOgmhH4/LoZntVFXcklALav0HCclrur0woWg4mK3DxfPt/zBToFhk3JV7MhNeCEn0+hT6ofblvyIgZTjlYXjnBdsX6mU3J94Dxx3YGHIHwStFFk5roYUnGujdy11lS68fb91OumJzXw67VUyRCSWik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999468; c=relaxed/simple; bh=bc5yl74zdn98bGrzflzZJhT8dVZ1ucUyhLi6xxRM+Rg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y23DOypGNm9aZIAgZifyU5myEfWBK2QE3amZu1eOE7coYugjT0sp8YcwY0IZfOAbnSmA9/vK5UWb4Z+9wQfpzPEcb7vd6WyOsPAws6mPHyAcQoMny+N2gU72zhICepd1m+aBqc3ik3OjSQk+h9DuBzCDSFr1jEoh2Sz0DKYUe2M= 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.171 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.11,205,1725289200"; d="scan'208";a="221998714" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 15 Oct 2024 22:37:45 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.93.176]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id ADE22400755A; Tue, 15 Oct 2024 22:37:28 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Biju Das , Claudiu Beznea , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH v2 09/10] net: ravb: Enable IPv6 TX checksum offload for GbEth Date: Tue, 15 Oct 2024 14:36:33 +0100 Message-Id: <20241015133634.193-10-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241015133634.193-1-paul.barker.ct@bp.renesas.com> References: <20241015133634.193-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The GbEth IP supports offloading IPv6 TCP, UDP & ICMPv6 checksums in the TX path. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb.h | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/ren= esas/ravb.h index e1e55e677215..d7b3810ce21b 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -998,7 +998,7 @@ enum CSR1_BIT { CSR1_TDHD =3D 0x08000000, }; =20 -#define CSR1_CSUM_ENABLE (CSR1_TTCP4 | CSR1_TUDP4) +#define CSR1_CSUM_ENABLE (CSR1_TTCP4 | CSR1_TUDP4 | CSR1_TTCP6 | CSR1_TUDP= 6) =20 enum CSR2_BIT { CSR2_RIP4 =3D 0x00000001, diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/etherne= t/renesas/ravb_main.c index 80c0d36bffcb..14b4462331b0 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2063,17 +2063,24 @@ static void ravb_tx_timeout_work(struct work_struct= *work) =20 static bool ravb_can_tx_csum_gbeth(struct sk_buff *skb) { - struct iphdr *ip =3D ip_hdr(skb); + u8 inner_protocol; =20 /* TODO: Need to add support for VLAN tag 802.1Q */ if (skb_vlan_tag_present(skb)) return false; =20 - /* TODO: Need to add hardware checksum for IPv6 */ - if (skb->protocol !=3D htons(ETH_P_IP)) + switch (ntohs(skb->protocol)) { + case ETH_P_IP: + inner_protocol =3D ip_hdr(skb)->protocol; + break; + case ETH_P_IPV6: + inner_protocol =3D ipv6_hdr(skb)->nexthdr; + break; + default: return false; + } =20 - switch (ip->protocol) { + switch (inner_protocol) { case IPPROTO_TCP: case IPPROTO_UDP: return true; --=20 2.43.0