From nobody Thu Jan 29 15:39:59 2026 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 4f23HN2nLRz6Qrdg for ; Thu, 29 Jan 2026 15:40:00 +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 4f23HN0Qslz3y0Z for ; Thu, 29 Jan 2026 15:40:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769701200; 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=hTHIAlud1pCgkz2Flm/OHtN45CEqt75fn87vAOuiAnA=; b=QSIaNmYwUIjLyYzj3Zc2oDWPUW0UUrHFksvfJUaIUa8R20luRGLMhlLHbU5SFgGzFdlNZz C6hJGbi/g8RDcxryZweQoWBnMXxiWuOIPmn397ktnf5oBXqs2nvYYn8GTFy0ZP0x6eoQNy OdlOmru3y4NIuoidL9P9TQptJEJuWEMdeSkDQx8gAv2o09cw5iIzIyh7Q/4du56Vh3pQPz PcWSm7PBc9jmBLPGE/rbdPwn5LL9SrDQAMBg7v/r+6KrXZ1h/uS59tGHPM5evlXUkBhheh ZhcMlyRb+7Kr68/g/8VMDQsCIwAvwG+s2LJBXAXxGKGDVac3CQqnw5k7hr3QzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1769701200; a=rsa-sha256; cv=none; b=RngCTSXtWI1laMRYgScwa27Rq9b5pevyNZCLIsWBtuHaiGN7e3GcLhbUObXAKklFsygJ2f Bg/HlD6m8ygKxpUHtXeoUfJDTCuc5n+i3JQUbyq8nUcTQexX5xz5Vl2TCyInlJW9Xn5oG+ SaLZxCt6sbcH7x6QXJw1DAdoFyghYZVniDIyPxxtWAawjGzYV/8Ppt984MiKfXTynMPYQZ +8H826BAiMIX7SKUB/ty0YsusJi8jzH+TCdu12Rt5AxVVTxBsaQ/vcvN8PJR6pwMM0fD35 okAvArDjxChwoMDtVHHqvV8l7D05vc8rqYGa0q+ILZQnt/4knVGFIFXH/1qs0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769701200; 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=hTHIAlud1pCgkz2Flm/OHtN45CEqt75fn87vAOuiAnA=; b=QDpIpyfk+4iZXysSQyHPVMvsLtwvDquFfdZgYRcVdRiRzUBTxtZ1Vu1uBb9ukCcPJMmWbM F1udosiBtGxGHSWTWsirpaK8YzbSikRwKjbJ7GjxYmwGUsCsVoYmgomMXFSHoWOMJc85jl FDtGIRoBV9U7RtbFxYzlYXtW9Os7qCbM8PnE1zuVvWfI6H/xRAHeMYrffVE7x6dv67gfpD a4ozFal9n7E9nvL2M6x/287msOtevKd1jwc4a49GHWNfXwBXRBYtihR8w3gSEYg1nEJypL ndj1NrmcZ6rtGvozApJzal17kffmr7aDsyDVr4OsuS6BEvrhdncT63ftoSI2Eg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f23HM75Nbzl8n for ; Thu, 29 Jan 2026 15:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39f73 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 29 Jan 2026 15:39:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4df8a30e54b6 - stable/14 - cxgbe tom: Halve the size of offload transmit software descriptors 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4df8a30e54b6a0c5b27f3119429d2bb044cd3e27 Auto-Submitted: auto-generated Date: Thu, 29 Jan 2026 15:39:59 +0000 Message-Id: <697b7f4f.39f73.58df748f@gitrepo.freebsd.org> The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4df8a30e54b6a0c5b27f3119429d2bb044cd3e27 commit 4df8a30e54b6a0c5b27f3119429d2bb044cd3e27 Author: John Baldwin AuthorDate: 2025-09-11 21:10:39 +0000 Commit: John Baldwin CommitDate: 2026-01-29 15:27:29 +0000 cxgbe tom: Halve the size of offload transmit software descriptors Use bitfields to pack tx_credits and plen into a single 32-bit word. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D47759 (cherry picked from commit 5a38857684907c52982787dbac2c5e5c8abfd4f8) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 2 ++ sys/dev/cxgbe/iw_cxgbe/qp.c | 2 ++ sys/dev/cxgbe/tom/t4_cpl_io.c | 16 ++++++++++++++++ sys/dev/cxgbe/tom/t4_tls.c | 4 ++++ sys/dev/cxgbe/tom/t4_tom.c | 2 ++ sys/dev/cxgbe/tom/t4_tom.h | 7 +++++-- 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index ab1428c06d87..89b3628bae6d 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1053,6 +1053,8 @@ send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX; flowc->mnemval[0].val = htobe32(maxlen); + KASSERT(howmany(flowclen, 16) <= MAX_OFLD_TX_SDESC_CREDITS, + ("%s: tx_credits %u too large", __func__, howmany(flowclen, 16))); txsd->tx_credits = howmany(flowclen, 16); txsd->plen = 0; KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0, diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index 0e374bc961c4..cbf4bae00a60 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -1326,6 +1326,8 @@ creds(struct toepcb *toep, struct inpcb *inp, size_t wrsize) return (EINVAL); } txsd = &toep->txsd[toep->txsd_pidx]; + KASSERT(howmany(wrsize, 16) <= MAX_OFLD_TX_SDESC_CREDITS, + ("%s: tx_credits %zu too large", __func__, howmany(wrsize, 16))); txsd->tx_credits = howmany(wrsize, 16); txsd->plen = 0; KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0, diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 836d32360b1e..9aaa243ba9e1 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -148,6 +148,8 @@ send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) KASSERT(paramidx == nparams, ("nparams mismatch")); + KASSERT(howmany(flowclen, 16) <= MAX_OFLD_TX_SDESC_CREDITS, + ("%s: tx_credits %u too large", __func__, howmany(flowclen, 16))); txsd->tx_credits = howmany(flowclen, 16); txsd->plen = 0; KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0, @@ -215,6 +217,8 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb *toep, u_int Bps) else flowc->mnemval[0].val = htobe32(tc_idx); + KASSERT(flowclen16 <= MAX_OFLD_TX_SDESC_CREDITS, + ("%s: tx_credits %u too large", __func__, flowclen16)); txsd->tx_credits = flowclen16; txsd->plen = 0; toep->tx_credits -= txsd->tx_credits; @@ -491,6 +495,9 @@ t4_close_conn(struct adapter *sc, struct toepcb *toep) #define MIN_TX_CREDITS(iso) \ (MIN_OFLD_TX_CREDITS + ((iso) ? MIN_ISO_TX_CREDITS : 0)) +_Static_assert(MAX_OFLD_TX_CREDITS <= MAX_OFLD_TX_SDESC_CREDITS, + "MAX_OFLD_TX_SDESC_CREDITS too small"); + /* Maximum amount of immediate data we could stuff in a WR */ static inline int max_imm_payload(int tx_credits, int iso) @@ -705,6 +712,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) if ((m->m_flags & M_NOTAVAIL) != 0) break; + if (plen + m->m_len > MAX_OFLD_TX_SDESC_PLEN) + break; if (m->m_flags & M_EXTPG) { #ifdef KERN_TLS if (m->m_epg_tls != NULL) { @@ -870,6 +879,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) toep->flags |= TPF_TX_SUSPENDED; KASSERT(toep->txsd_avail > 0, ("%s: no txsd", __func__)); + KASSERT(plen <= MAX_OFLD_TX_SDESC_PLEN, + ("%s: plen %u too large", __func__, plen)); txsd->plen = plen; txsd->tx_credits = credits; txsd++; @@ -1211,6 +1222,8 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) toep->flags |= TPF_TX_SUSPENDED; KASSERT(toep->txsd_avail > 0, ("%s: no txsd", __func__)); + KASSERT(plen <= MAX_OFLD_TX_SDESC_PLEN, + ("%s: plen %u too large", __func__, plen)); txsd->plen = plen; txsd->tx_credits = credits; txsd++; @@ -1969,6 +1982,9 @@ t4_set_tcb_field(struct adapter *sc, struct sge_wrq *wrq, struct toepcb *toep, req->val = htobe64(val); if (wrq->eq.type == EQ_OFLD) { txsd = &toep->txsd[toep->txsd_pidx]; + _Static_assert(howmany(sizeof(*req), 16) <= + MAX_OFLD_TX_SDESC_CREDITS, + "MAX_OFLD_TX_SDESC_CREDITS too small"); txsd->tx_credits = howmany(sizeof(*req), 16); txsd->plen = 0; KASSERT(toep->tx_credits >= txsd->tx_credits && diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c index c6377980fca9..e3937737d7e2 100644 --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -191,6 +191,8 @@ tls_program_key_id(struct toepcb *toep, struct ktls_session *tls, t4_tls_key_ctx(tls, direction, kctx); txsd = &toep->txsd[toep->txsd_pidx]; + _Static_assert(DIV_ROUND_UP(TLS_KEY_WR_SZ, 16) <= + MAX_OFLD_TX_SDESC_CREDITS, "MAX_OFLD_TX_SDESC_CREDITS too small"); txsd->tx_credits = DIV_ROUND_UP(TLS_KEY_WR_SZ, 16); txsd->plen = 0; toep->tx_credits -= txsd->tx_credits; @@ -694,6 +696,8 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, int drop) toep->flags |= TPF_TX_SUSPENDED; KASSERT(toep->txsd_avail > 0, ("%s: no txsd", __func__)); + KASSERT(m->m_len <= MAX_OFLD_TX_SDESC_PLEN, + ("%s: plen %u too large", __func__, m->m_len)); txsd->plen = m->m_len; txsd->tx_credits = credits; txsd++; diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 97cb380d0e71..134b02f15959 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -882,6 +882,8 @@ send_mss_flowc_wr(struct adapter *sc, struct toepcb *toep) flowc->mnemval[0].val = htobe32(toep->params.emss); txsd = &toep->txsd[toep->txsd_pidx]; + _Static_assert(flowclen16 <= MAX_OFLD_TX_SDESC_CREDITS, + "MAX_OFLD_TX_SDESC_CREDITS too small"); txsd->tx_credits = flowclen16; txsd->plen = 0; toep->tx_credits -= txsd->tx_credits; diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 6295a3484b9f..3b2243aeb69f 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -122,10 +122,13 @@ struct conn_params { }; struct ofld_tx_sdesc { - uint32_t plen; /* payload length */ - uint8_t tx_credits; /* firmware tx credits (unit is 16B) */ + uint32_t plen : 26; /* payload length */ + uint32_t tx_credits : 6; /* firmware tx credits (unit is 16B) */ }; +#define MAX_OFLD_TX_SDESC_PLEN ((1u << 26) - 1) +#define MAX_OFLD_TX_SDESC_CREDITS ((1u << 6) - 1) + struct ppod_region { u_int pr_start; u_int pr_len;