Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Apr 2026 12:30:23 +0000
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b9446b22bcf6 - stable/15 - dpnaa2: announce transmit checksum support
Message-ID:  <69eb625f.1a65a.77ff964e@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=b9446b22bcf61500a628f42bf04a7a4d6fcbee76

commit b9446b22bcf61500a628f42bf04a7a4d6fcbee76
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-01-23 07:59:57 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-04-24 12:29:06 +0000

    dpnaa2: announce transmit checksum support
    
    Let the network stack know that the NIC supports checksum offloading
    for the IPv4 header checksum and the TCP and UDP transport checksum.
    This avoids the computation in software and therefore provides the
    expected performance gain.
    
    PR:                     292006
    Reviewed by:            dsl, Timo Völker
    Differential Revision:  https://reviews.freebsd.org/D54809
    
    (cherry picked from commit f31336b3e3146fed9cc517fef8e877c17496f9e0)
---
 sys/dev/dpaa2/dpaa2_ni.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c
index d94770b3c3ec..460e2a02a9a7 100644
--- a/sys/dev/dpaa2/dpaa2_ni.c
+++ b/sys/dev/dpaa2/dpaa2_ni.c
@@ -210,6 +210,9 @@ MALLOC_DEFINE(M_DPAA2_TXB, "dpaa2_txb", "DPAA2 DMA-mapped buffer (Tx)");
 #define	RXH_L4_B_2_3		(1 << 7) /* dst port in case of TCP/UDP/SCTP */
 #define	RXH_DISCARD		(1 << 31)
 
+/* Transmit checksum offload */
+#define DPAA2_CSUM_TX_OFFLOAD	(CSUM_IP | CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6)
+
 /* Default Rx hash options, set during attaching. */
 #define DPAA2_RXH_DEFAULT	(RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3)
 
@@ -567,6 +570,7 @@ dpaa2_ni_attach(device_t dev)
 	if_settransmitfn(ifp, dpaa2_ni_transmit);
 	if_setqflushfn(ifp, dpaa2_ni_qflush);
 
+	if_sethwassist(sc->ifp, DPAA2_CSUM_TX_OFFLOAD);
 	if_setcapabilities(ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM |
 	    IFCAP_HWCSUM_IPV6 | IFCAP_JUMBO_MTU);
 	if_setcapenable(ifp, if_getcapabilities(ifp));
@@ -2617,8 +2621,10 @@ dpaa2_ni_ioctl(if_t ifp, u_long c, caddr_t data)
 		changed = if_getcapenable(ifp) ^ ifr->ifr_reqcap;
 		if ((changed & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) != 0)
 			if_togglecapenable(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
-		if ((changed & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0)
-                        if_togglecapenable(ifp, IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6);
+		if ((changed & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) {
+			if_togglecapenable(ifp, IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6);
+			if_togglehwassist(ifp, DPAA2_CSUM_TX_OFFLOAD);
+		}
 
 		rc = dpaa2_ni_setup_if_caps(sc);
 		if (rc) {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69eb625f.1a65a.77ff964e>