From nobody Mon Dec 29 18:15:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dg4CN0h62z6M84B for ; Mon, 29 Dec 2025 18:15:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dg4CM4S3Kz3Khb for ; Mon, 29 Dec 2025 18:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767032143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VB6PPHWhuR1FzcjhFSAsOwhY6Wf1FEbwCxR2n3u0mb4=; b=qalxryn234jAWS89gNz/T26hDTvcwLA9GJa2egAh1PGj2d7JaLMDroD9IuNKnLxdEk1n1s a5ZQiwGGphoZSxO1n8RQhh7X5yFL1eFdcSx1i97QGYqr365k+b7PyhmAC1N2lyz8NRRmEe ty3pK/PFiJSWCyC1htTuYlQgiK9ngXOic17/22qOwvkBAta/oG3pARSa+Wi0g7M2wmncS/ DZp3LRhwAzZm8q/Temme0lsVFVClRhyHR1DXJ2HS9t1YMVmfXpI1ARZ7kFysNCtoj0tOhr YkjJZ5HHN2H8nEnrC9nFuqDqwQxco1Wlw7iF2ynfCO8ATh46T3wqz+wDCP7tLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767032143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VB6PPHWhuR1FzcjhFSAsOwhY6Wf1FEbwCxR2n3u0mb4=; b=ZqdOvYISfNGRksDMVkNOiKcQX6C0RRuRe+oEUshQv5+FsATBNeo3NqgDh/bInnfJYhoDKl 7FgoPv6PUkxQoafuV7I7OscYF5FjF6GVdlL5H5wJGpVn/yIw16Y9I5gMePWWBuwfG/4Bq9 0jnUc1vj6LXGyuKGtDv2IwobmeRr9m8TBJcgb2vKRaF6TmcSnI181kQDJIZ/4fD61JXf9k m7TwRjpQbRHpm2CZcpQQje2lj7aLrlXhc+1qxrW+zKwJ8upYchi2QsRCp1YScdIKm4Uoxb /lderzUyBKwtfZBHePzfWn8B+GOqygL8dKCBQreoMK9cXKNDbo4hL3ti/7h6uA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767032143; a=rsa-sha256; cv=none; b=W+vV5H9qpxMl1vYNt8hPQwELUiJEewvJp4FvuuoXIdnOHtYXggFkZh5WYrpvo4gBSPuBhN /tmI8Z6pYJ/z3fytJoLKghR7jOJTsVJg1QbwYxTHqHp82zqu9CU2zr70IH2jZwxzs9THAV RY6sT0eS2ounNQ7UZ4n21+TAIdYFzAfegVdO0I5E+76vnbbeb1j6eMs5UPitfjtFjM6zPc prbDPs9hydalpzDKVfJUAM7JhiD6YiQH+NWYZ9AZVvEX74VytBX9evFqdXU1Ppy9umq2th o/EBSYEa6Ziyv0LIHOMjUZ1SjKiBhx6yOyYPucvHNiQCIHOzm9A25DH3DxLnEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dg4CM28pWz9K6 for ; Mon, 29 Dec 2025 18:15:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3336c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Dec 2025 18:15:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Salychev Subject: git: 23b83bfeb767 - stable/14 - dpaa2: Setup interface caps on attach List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dsl X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 23b83bfeb767eaf04ea15bf65aaa6a47761186b9 Auto-Submitted: auto-generated Date: Mon, 29 Dec 2025 18:15:43 +0000 Message-Id: <6952c54f.3336c.33ce34a4@gitrepo.freebsd.org> The branch stable/14 has been updated by dsl: URL: https://cgit.FreeBSD.org/src/commit/?id=23b83bfeb767eaf04ea15bf65aaa6a47761186b9 commit 23b83bfeb767eaf04ea15bf65aaa6a47761186b9 Author: Dmitry Salychev AuthorDate: 2025-10-28 22:30:05 +0000 Commit: Dmitry Salychev CommitDate: 2025-12-29 18:14:52 +0000 dpaa2: Setup interface caps on attach 39d4094173f9 ("epair: add support for checksum offloading") revealed that HW checksum offloading is not enabled when the dpaa2_ni driver is attached despite being declared and enabled on the dpni interface. I modified dpaa2_ni_setup_if_caps to take into account both IPv4 and IPv6 checksum offloading capabilities and added a call to re-configure interface capabilities on attach to fix it. Reviewed by: bz Fixes: 39d4094173f9 ("epair: add support for checksum offloading") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53436 (cherry picked from commit a731cb93a66271713d6ea197946e4a307e5b0837) --- sys/dev/dpaa2/dpaa2_ni.c | 52 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c index 698b440376e3..98a6c6047188 100644 --- a/sys/dev/dpaa2/dpaa2_ni.c +++ b/sys/dev/dpaa2/dpaa2_ni.c @@ -559,7 +559,8 @@ dpaa2_ni_attach(device_t dev) if_settransmitfn(ifp, dpaa2_ni_transmit); if_setqflushfn(ifp, dpaa2_ni_qflush); - if_setcapabilities(ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_JUMBO_MTU); + if_setcapabilities(ifp, IFCAP_VLAN_MTU | IFCAP_HWCSUM | + IFCAP_HWCSUM_IPV6 | IFCAP_JUMBO_MTU); if_setcapenable(ifp, if_getcapabilities(ifp)); DPAA2_CMD_INIT(&cmd); @@ -627,6 +628,12 @@ dpaa2_ni_attach(device_t dev) __func__, error); goto close_ni; } + error = dpaa2_ni_setup_if_caps(sc); + if (error) { + device_printf(dev, "%s: failed to setup interface capabilities: " + "error=%d\n", __func__, error); + goto close_ni; + } ether_ifattach(sc->ifp, sc->mac.addr); callout_init(&sc->mii_callout, 0); @@ -1569,8 +1576,7 @@ dpaa2_ni_setup_msi(struct dpaa2_ni_softc *sc) static int dpaa2_ni_setup_if_caps(struct dpaa2_ni_softc *sc) { - const bool en_rxcsum = if_getcapenable(sc->ifp) & IFCAP_RXCSUM; - const bool en_txcsum = if_getcapenable(sc->ifp) & IFCAP_TXCSUM; + bool en_rxcsum, en_txcsum; device_t pdev = device_get_parent(sc->dev); device_t dev = sc->dev; device_t child = dev; @@ -1582,6 +1588,17 @@ dpaa2_ni_setup_if_caps(struct dpaa2_ni_softc *sc) DPAA2_CMD_INIT(&cmd); + /* + * XXX-DSL: DPAA2 allows to validate L3/L4 checksums on reception and/or + * generate L3/L4 checksums on transmission without + * differentiating between IPv4/v6, i.e. enable for both + * protocols if requested. + */ + en_rxcsum = if_getcapenable(sc->ifp) & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); + en_txcsum = if_getcapenable(sc->ifp) & + (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); + error = DPAA2_CMD_RC_OPEN(dev, child, &cmd, rcinfo->id, &rc_token); if (error) { device_printf(dev, "%s: failed to open resource container: " @@ -1627,6 +1644,13 @@ dpaa2_ni_setup_if_caps(struct dpaa2_ni_softc *sc) goto close_ni; } + if (bootverbose) { + device_printf(dev, "%s: L3/L4 checksum validation %s\n", + __func__, en_rxcsum ? "enabled" : "disabled"); + device_printf(dev, "%s: L3/L4 checksum generation %s\n", + __func__, en_txcsum ? "enabled" : "disabled"); + } + (void)DPAA2_CMD_NI_CLOSE(dev, child, &cmd); (void)DPAA2_CMD_RC_CLOSE(dev, child, DPAA2_CMD_TK(&cmd, rc_token)); return (0); @@ -2574,13 +2598,27 @@ dpaa2_ni_ioctl(if_t ifp, u_long c, caddr_t data) break; case SIOCSIFCAP: changed = if_getcapenable(ifp) ^ ifr->ifr_reqcap; - if (changed & IFCAP_HWCSUM) { - if ((ifr->ifr_reqcap & changed) & IFCAP_HWCSUM) { - if_setcapenablebit(ifp, IFCAP_HWCSUM, 0); + if (changed & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + if ((ifr->ifr_reqcap & changed) & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + if_setcapenablebit(ifp, + IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6, 0); } else { - if_setcapenablebit(ifp, 0, IFCAP_HWCSUM); + if_setcapenablebit(ifp, 0, + IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); } } + if (changed & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) { + if ((ifr->ifr_reqcap & changed) & + (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) { + if_setcapenablebit(ifp, + IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6, 0); + } else { + if_setcapenablebit(ifp, 0, + IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); + } + } + rc = dpaa2_ni_setup_if_caps(sc); if (rc) { printf("%s: failed to update iface capabilities: "