From nobody Wed May 7 19:00:25 2025 X-Original-To: dev-commits-src-main@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 4Zt4Mt03xXz5v7ql; Wed, 07 May 2025 19:00:26 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zt4Ms6SSxz3sHn; Wed, 07 May 2025 19:00:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746644425; 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=sGFFBbNy3b99UscIJ81WPXi7Txe1T5Luog4iFqpi7EI=; b=GpZ4HFXMlDBDcscAKLeKL0eviXsBmO71ed6t3qLefAfnTyPSEnC1LHAe0b2DS3lz4p7Mgd h633P/xGBLd6jOK0MzZBC0uVn5oUNWLJGTTWvAyXt9GFWxkj0BQRBMTWNFX2f7HrZEZOUF tx7i+OGN+d4QjNFd5WI0L4gyec4/Td56Qce9ahxy3Y/ds8F63LvjaGlEEcVKXL8LPNs4YZ ju3hiyzgq27quSgT/RYFFP3NtbKwvwL4sn+DFXnHiT5RxptUt5QoaszT06aI1lHR4XXv/I I1bn4D+NNibjYrZRe8RJkwuKdb0mu+3Y2aWmOCiyVytz7ewNJ3f3GSeQ+XMzmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746644425; 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=sGFFBbNy3b99UscIJ81WPXi7Txe1T5Luog4iFqpi7EI=; b=N4Hv/oHk3MCg/FVky+Ikey65rfQq8wYjjO+reMlKVcICm0FLsycXhGdYSuesPl74N4yPqF YURUzbA9V9h7C7I8saya7YVWk8fGwUXW/J+KP+9/OI4rHCXgZQNFtxyxRxNwbXCTdLuIMO 1i4DerEEIDFGOe8tlHfFJTbxsavUDjiQZMWlajpplxkRAc8kXcKcLlz0szdcUpi3ODQcdm LUbxzzLPzN5v+dZdixHu+7qkQe2nmNwrFeReIlqQOH5mysgm+F9vUsrj+KarwXr7Ghskue ddBAAnMKFJowb5d7hefDqn2/i6iyhowvkdjP3rI4ldGW5UC5h6aov/h7NcSlWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746644425; a=rsa-sha256; cv=none; b=LO3+6SV1KqYClG6LhO/EaWmWAyKvSxrkjovYdxDtWgK1ECwIdhFXWvbbt0wA+vrF0uiWeJ tB6rMumSnM1wDW7yY1O+E4+xAs9IRUrHQ4XUPBqQcF63jx8xO9KZW8iN3R52yDFiWY2XWJ JBoPAS+QE5e3ZTevdh7F2HzXfPMxkSTKMC8Tfq66XTGIpVr7nStYm6QX1HZd6AVUNNLRkK U4dY/QlPzmuqzu3TqbtJxGGt/XYOq1DRXGc8z3oA/nakcpkhf/UGNWRxj2jom2m9mI2Zmm 0gAMA2zlNxy3ysZCPDaDXnzzB3M19SPq9Fm8/l6izcUVqQ/R6VUtzLgrTKkM8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Zt4Ms5thwzhRJ; Wed, 07 May 2025 19:00:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 547J0Pdh000392; Wed, 7 May 2025 19:00:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 547J0PiT000389; Wed, 7 May 2025 19:00:25 GMT (envelope-from git) Date: Wed, 7 May 2025 19:00:25 GMT Message-Id: <202505071900.547J0PiT000389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 271128b06986 - main - mbuf: Allow clusters to fill an entire jumbo page. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 271128b0698653294acf0ed3457d5871af5b3ef1 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=271128b0698653294acf0ed3457d5871af5b3ef1 commit 271128b0698653294acf0ed3457d5871af5b3ef1 Author: Dag-Erling Smørgrav AuthorDate: 2025-05-07 18:58:48 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-05-07 18:59:09 +0000 mbuf: Allow clusters to fill an entire jumbo page. The assumption that MCLBYTES == MJUMPAGESIZE can only happen if pages are small is incorrect: it can also happen if MCLSHIFT is adjusted to increase the size of clusters. Restore the ability to have clusters fill a jumbo page, while still disallowing them from exceeding them. MFC after: 1 week Fixes: 840327e5ddf3, 9c3ad5ba932b Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Reviewed by: siderop1_netapp.com, kevans, brooks Differential Revision: https://reviews.freebsd.org/D50242 --- sys/conf/NOTES | 3 ++- sys/dev/cxgbe/adapter.h | 4 ++++ sys/dev/cxgbe/t4_sge.c | 8 ++++++++ sys/kern/kern_mbuf.c | 4 ++-- sys/sys/mbuf.h | 6 ++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index d85980e4e122..e84fdcb30220 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2057,7 +2057,8 @@ device rtwnfw # mismatch between the mbuf size assumed by the kernel and the mbuf size # assumed by a module. The only driver that currently has the ability to # detect a mismatch is ti(4). -options MCLSHIFT=11 # mbuf cluster shift in bits, 11 == 2KB +options MCLSHIFT=12 # mbuf cluster shift in bits, 12 == 4 kB + # default is 11 == 2 kB options MSIZE=256 # mbuf size in bytes # diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 3bf4f666ce7d..d3820245837a 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -107,7 +107,11 @@ enum { CTRL_EQ_QSIZE = 1024, TX_EQ_QSIZE = 1024, +#if MJUMPAGESIZE != MCLBYTES SW_ZONE_SIZES = 4, /* cluster, jumbop, jumbo9k, jumbo16k */ +#else + SW_ZONE_SIZES = 3, /* cluster, jumbo9k, jumbo16k */ +#endif CL_METADATA_SIZE = CACHE_LINE_SIZE, SGE_MAX_WR_NDESC = SGE_MAX_WR_LEN / EQ_ESIZE, /* max WR size in desc */ diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index bc81a0251deb..86454bc4fe10 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -570,7 +570,9 @@ t4_sge_modload(void) } if (largest_rx_cluster != MCLBYTES && +#if MJUMPAGESIZE != MCLBYTES largest_rx_cluster != MJUMPAGESIZE && +#endif largest_rx_cluster != MJUM9BYTES && largest_rx_cluster != MJUM16BYTES) { printf("Invalid hw.cxgbe.largest_rx_cluster value (%d)," @@ -579,7 +581,9 @@ t4_sge_modload(void) } if (safest_rx_cluster != MCLBYTES && +#if MJUMPAGESIZE != MCLBYTES safest_rx_cluster != MJUMPAGESIZE && +#endif safest_rx_cluster != MJUM9BYTES && safest_rx_cluster != MJUM16BYTES) { printf("Invalid hw.cxgbe.safest_rx_cluster value (%d)," @@ -718,7 +722,9 @@ t4_tweak_chip_settings(struct adapter *sc) uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); static int sw_buf_sizes[] = { MCLBYTES, +#if MJUMPAGESIZE != MCLBYTES MJUMPAGESIZE, +#endif MJUM9BYTES, MJUM16BYTES }; @@ -855,7 +861,9 @@ t4_init_rx_buf_info(struct adapter *sc) int i, j, n; static int sw_buf_sizes[] = { /* Sorted by size */ MCLBYTES, +#if MJUMPAGESIZE != MCLBYTES MJUMPAGESIZE, +#endif MJUM9BYTES, MJUM16BYTES }; diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 48886c1e5b0c..90af03e29dfb 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -61,8 +61,8 @@ #include #include -_Static_assert(MJUMPAGESIZE > MCLBYTES, - "Cluster must be smaller than a jumbo page"); +_Static_assert(MCLBYTES <= MJUMPAGESIZE, + "Cluster must not be larger than a jumbo page"); /* * In FreeBSD, Mbufs and Mbuf Clusters are allocated from UMA diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 58b7585303bb..c75094aea450 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -885,9 +885,11 @@ m_gettype(int size) case MCLBYTES: type = EXT_CLUSTER; break; +#if MJUMPAGESIZE != MCLBYTES case MJUMPAGESIZE: type = EXT_JUMBOP; break; +#endif case MJUM9BYTES: type = EXT_JUMBO9; break; @@ -933,9 +935,11 @@ m_getzone(int size) case MCLBYTES: zone = zone_clust; break; +#if MJUMPAGESIZE != MCLBYTES case MJUMPAGESIZE: zone = zone_jumbop; break; +#endif case MJUM9BYTES: zone = zone_jumbo9; break; @@ -1055,9 +1059,11 @@ m_cljset(struct mbuf *m, void *cl, int type) case EXT_CLUSTER: size = MCLBYTES; break; +#if MJUMPAGESIZE != MCLBYTES case EXT_JUMBOP: size = MJUMPAGESIZE; break; +#endif case EXT_JUMBO9: size = MJUM9BYTES; break;