From nobody Mon Jan 5 20:09:27 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 4dlQPN0Nm6z6N034 for ; Mon, 05 Jan 2026 20:09:28 +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 4dlQPM4xBQz3R07 for ; Mon, 05 Jan 2026 20:09:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767643767; 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=CNPDp/GVKD/XgoJW2FE3Oxfxmi8/gGyEgPOntN6u00s=; b=MYwDw8dSSdWaAEMKUARAFeMBmxXFrY/Tjead4MLFX41z461QfU5eXdcbvdEgCOoMuJmk6Z oibfV3Itzg8+4jviPrAog4WtYEtcf1IYw9aBBsVNfYCJlH7If04RMDF3cUoNe7zXOFq/JK sWXBXS7pLdcsMsDcXXDHVW9Y8bohq1/v9kGUJI7gmhL4QCe0Sx/7cd68hJPJi5dMDtvaKc ceNBjJ8DBJ9Q3TdyCOu1BB/ehT4G35ypBl3NmaVJSljuPvx9rjwFRokB3NTQo3lKd8xPgr I6ytYdNmAsK0anmjRghGcUJ97MY81AExN8VnQWETBEssNII/OrVmfTcL+zn8Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767643767; 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=CNPDp/GVKD/XgoJW2FE3Oxfxmi8/gGyEgPOntN6u00s=; b=Rg7/8PxENU2MZ+DWhNSTwpKENgg38jg8cQuNJVoyNU3U1vn4vJZpspKTDYISINnMPgd93r Nr5odOZDuM/AlKGwjulf1/evTziSjqAToJSXt1VqK8V1CLzOD/LlgvAM46oSzp/HuBt5sB kkP5VUX5Yw9TfWDfX6DNTsULMQDkN2FPpY0DHRaE06FQ49NsfTSyc4Se5Hdo8O0o1FCBdG 4NqlW+IGIgnANyKttR2zBpinikmbPGb0bn6w1xiF8pMr9gX82lB6axZStgVdazI5zRHymG /De4NzTHItlVRu7byLJq6T8xMXJ+8Jaa+Qyeu6qzwFwBRHvGKgCRnfxp+VbDHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767643767; a=rsa-sha256; cv=none; b=W1QF14Q6FgUr6ca5YuzGrZKJR7yyqIgW7gQJVY+dSLqugg/d0ntv3r13H4XNHo9trXCnNG Sm1CJeg2X6K1RZGdAL1vItT8VixoM5klHehPBpeyMlJQh/wnYhuptLyknXqHrX/BhzsJjQ vJLFB2ouhYkFaIjIlv36xb+z015XVv9ip39nrxMs4VeYMG3R1hrwhPqL+1Fz0dVVbXzv+8 8ADPlvXdnklmqn2m8wf7aj4j6FUBzFicyGOHJY4LxjEnx2OE99IOez1QFw740xdO0iybbv go5e8q8yf6+8v7zsARTNlNopm+YJ5FmQcyfKXiHaRQEnfTKvIqF5CG0BjT0/Kg== 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 4dlQPM43Qkzbwp for ; Mon, 05 Jan 2026 20:09:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 800f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 05 Jan 2026 20:09:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron Subject: git: 55bd09ae0fc4 - main - linuxkpi: Add support for statically-allocated kfifo 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: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55bd09ae0fc437c9eb135952ac278540b7388add Auto-Submitted: auto-generated Date: Mon, 05 Jan 2026 20:09:27 +0000 Message-Id: <695c1a77.800f.5db6f26e@gitrepo.freebsd.org> The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=55bd09ae0fc437c9eb135952ac278540b7388add commit 55bd09ae0fc437c9eb135952ac278540b7388add Author: Jean-Sébastien Pédron AuthorDate: 2025-09-07 08:37:27 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2026-01-05 19:32:49 +0000 linuxkpi: Add support for statically-allocated kfifo The main difference with the dynamically allocated version is that the structure is initialized with `DECLARE_KFIFO()` which takes the number of items as an additional argument compared to `DECLARE_KFIFO_PTR()`. The declared structure is then initialized with `INIT_KFIFO()` which sets all fields to 0, except `total` which is computed from the size of the array passed to `DECLARE_KFIFO()`. The amdgpu DRM driver started to used this in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54497 --- sys/compat/linuxkpi/common/include/linux/kfifo.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kfifo.h b/sys/compat/linuxkpi/common/include/linux/kfifo.h index d2f570781661..fbe16e22683e 100644 --- a/sys/compat/linuxkpi/common/include/linux/kfifo.h +++ b/sys/compat/linuxkpi/common/include/linux/kfifo.h @@ -33,8 +33,26 @@ #include #include -#define INIT_KFIFO(x) 0 -#define DECLARE_KFIFO(x, y, z) +/* + * INIT_KFIFO() is used to initialize the structure declared with + * DECLARE_KFIFO(). It doesn't work with DECLARE_KFIFO_PTR(). + */ +#define INIT_KFIFO(_kf) \ + ({ \ + (_kf).total = nitems((_kf).head); \ + (_kf).count = 0; \ + (_kf).first = 0; \ + (_kf).last = 0; \ + }) + +#define DECLARE_KFIFO(_name, _type, _size) \ + struct kfifo_ ## _name { \ + size_t total; \ + size_t count; \ + size_t first; \ + size_t last; \ + _type head[_size]; \ + } _name #define DECLARE_KFIFO_PTR(_name, _type) \ struct kfifo_ ## _name { \