From nobody Wed Apr 22 21:08:07 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 4g1Bdh4pg0z6bKk8 for ; Wed, 22 Apr 2026 21:08:08 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g1Bdh0Cvdz3jkw for ; Wed, 22 Apr 2026 21:08:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776892088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TkKw6h0DVWKSIWsjcqCM2NOXUJS6IuiPG9ADlzq6UZc=; b=OU8ROratce/GQZAY/M4L8nw1iVwmcISOWjb292viyfOaUGO3hvxmJNttfWMKUcfeK26Pu+ TmwyAi5XXmIDC4I+dyg5HHNGRNUaVOppxEFWKeygZkPy69mKNUNWKQOMtgP2cWhclcWHmg Q0ObRv86RRZtGKJ+y6NOm2E3bCoSDTN+wENT77+NOIsMN0PtpYKeMm5wi8yAe5ywAp+eeA GfIGiMznZwWLzvAG/9AjnB3k6aiagE0IFsRhZvAsPFM6JQPSF70yCGU4ExieJSQxgvCVsl Pm+zrdx4SI5GAHYoPee4OnYL7CIKcJnzSQDR45UQfJs5G0AVdDuw5kStYbpssA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776892088; a=rsa-sha256; cv=none; b=UQr+8ffqELbBxas0sxlsCmYiIpu13si+73w6Zt2x39OycLraaD9IWWoIIYk5hp3omUeCGq aDpLC95GgyeXpE2xTVLgKb3eAPF2b258Ao3cXsCL87qUXUMSgTdDV27JHq2YmhY8/4i65k QhuqYpPjTmuQF53ANmfWOt/lEOMJfvdypwRclamUd8eH0s5dv+QFKTS+g+nLU1VOGTSewu gsEZyu7C/GVoxmsu5W0WUAZoHZpULMb0cbmBb2O4vlnK7x5GrCoUDt6g8nT8BcM0d/Vxgb NcWSDWDjxFrOG3v0zdYtLNLOoAJiusjKOum/gGz2YtzMvyv3q0r7jW/Q+6uJDQ== 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=1776892088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TkKw6h0DVWKSIWsjcqCM2NOXUJS6IuiPG9ADlzq6UZc=; b=cMNFdrXcCeI8XhZW2qMlB0C9kKHl+QgC+SZAmTl2sTBjx+ZZ2mt1/g/kyXaTgnmQNsGF6F /hp54eZ4UQFv5YMTiCZsOx0PqOJNPGwNeV9/sKL4guXnC8wor1bHXsCurAcpcE2si9gBF9 fvf6hcBjix6OF4IpMoXgrXL/fNi+T4HZ5Mj/3emOyg722ZrLBJEWsdDMNKPcse6Q9oQMQf EOX9gnWelNG8ALbnpP1GV28VWWmnZsGWpi8fJeBsCdH/5zm3QKS+xVMYYi5mq3YIAcFTbP qmY5lo8uzj2df68IrUcVmxN3MM/i9ozzWdP1u5XMdwEd3tbgEjf/LJktOy6KAw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g1Bdg6f6yzncL for ; Wed, 22 Apr 2026 21:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26dc5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 22 Apr 2026 21:08:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron From: Bjoern A. Zeeb Subject: git: b510eedf7e51 - stable/15 - 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: b510eedf7e512019ccac0f5f79e0cb7738dad40b Auto-Submitted: auto-generated Date: Wed, 22 Apr 2026 21:08:07 +0000 Message-Id: <69e938b7.26dc5.7c2155b3@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b510eedf7e512019ccac0f5f79e0cb7738dad40b commit b510eedf7e512019ccac0f5f79e0cb7738dad40b Author: Jean-Sébastien Pédron AuthorDate: 2025-09-07 08:37:27 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-04-22 20:56:54 +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 (cherry picked from commit 55bd09ae0fc437c9eb135952ac278540b7388add) --- 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 b9f6ecacd3d1..b0d0c17f07e4 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 { \