From nobody Wed May 14 09:09:17 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 4Zy6wZ2TMNz5wPCq; Wed, 14 May 2025 09:09:18 +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 4Zy6wZ1cv3z3S37; Wed, 14 May 2025 09:09:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747213758; 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=o/d1HVvaPDL7PKrm2hFeZEju5iIBLKtjkBNilsZoIQE=; b=LT7WGBeidfTGEIFe/5W6Ix8FWI7Efpp821BlMQ3e/bKAXKgtxXuKQwKAnFsp9DlN1zrc/i zcQ/FpvWz1qHtlOEwMGfXTQLP5auwL/TZm3JhRiG/7TvnNAEWnLJ6rfIKgRN6PhKa8e17m tpPcM2M3Ifn2CMNlHsGh+mrgJa64aojpBMtvxcwyzOWrqy46N70p1G7lxLJBZhYm9u3ag3 /Hmk+0PqPFv4vlp0y/PW7d+ji/1tj3VLFvsD/FJ9pg3okDMc7yjPSNmp0ZTniuk8m1iuLV 9Pmh65PDGdHTMpX1GvqhZ15zkMcrWXNy7HzCcfy28PpNomRD1lcOy4gRyu4JIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747213758; 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=o/d1HVvaPDL7PKrm2hFeZEju5iIBLKtjkBNilsZoIQE=; b=ol7lOybB+H2iJrDGbEYSSX0FMBIIgRo7nxk+o1eFXtsc72deOH+VkiRC+gnUefek7sGYKF JCSrEtP3puvX9S7uJTvtrZwtfTBlbA6GER9903hUNRO53EPIRzW3JCM+MNPakGi7zSZJuF JiohaIoIrs25pcR55BwPayIqHhJpTJ655oIkST5tSa2wfnr73llQbKNmEaia450KpqGV6R DGx+ZXw3sWJThqeP8srlLgPoiJjrFg5iSlEKwfo3FrSTlQucZEZ5IXdlkvt+o6ftqX8t09 uifQzz6lOQ8eMNXExf8sVrS6i1HxcX4M9a7GvE9KRs9Arx5/oQAiAC9aUrsZ6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747213758; a=rsa-sha256; cv=none; b=q8XFfby6GOlDbYDNzxNChaYLNKuIfLQRdeXbqPF+WaaWIY1CGn+sVjXv/E9SFqUp4kFS8n /JdCS2hBzJ7Pgg9QgCoL8UrJKpPi2u3alYdrEriKp29HIkBE+cr/Jd+sISAWKJyZ5WEC+q Yrv6RDjqWLyIr33mUZsZbaUtRIr0GsqPMJRuYuK2l8uaZWOKIXywTSKvMrYDlgNl2bx9hK 8fDImqZVuKSrnF4C2LiUSnWZsizrufnbmbj5YBIuzfoZ51HKyWARctdXm+TqYWIK9e1nCj UmINb1m/jq2iJYwf6GFH+CvPsokmCVmR71jDd4yK9tqPebEX+rga3QrwcnSMYQ== 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 4Zy6wZ0JhRz9w2; Wed, 14 May 2025 09:09:18 +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 54E99HQD062843; Wed, 14 May 2025 09:09:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54E99HGa062840; Wed, 14 May 2025 09:09:17 GMT (envelope-from git) Date: Wed, 14 May 2025 09:09:17 GMT Message-Id: <202505140909.54E99HGa062840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: cbc3efab49aa - stable/14 - mbuf: Allow clusters to fill an entire jumbo page. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cbc3efab49aaa69acd3ac1701bc11095a4373d0a Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=cbc3efab49aaa69acd3ac1701bc11095a4373d0a commit cbc3efab49aaa69acd3ac1701bc11095a4373d0a Author: Dag-Erling Smørgrav AuthorDate: 2025-05-07 18:58:48 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-05-14 09:08:41 +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 (cherry picked from commit 271128b0698653294acf0ed3457d5871af5b3ef1) --- 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 6de8eab73027..55c1798bbffc 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2047,7 +2047,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 cc927f27d318..7591db6cd833 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 a740c31789a1..69d82086c7a5 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 c17fc9dec9a4..65a328cb52a1 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -886,9 +886,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; @@ -934,9 +936,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; @@ -1056,9 +1060,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;