🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10330

[PATCH net-next v4 4/5] netconsole: allow configuring the rate limit burst through configfs

#10330
From: Breno Leitao
Date: Tue, 03 Nov 2026 10:37
86 lines
12594 bytes
A target that sets ratelimit_interval_ms runs with the ratelimit default
of 10 messages per interval, which is either too coarse or too generous
depending on how chatty the target is.

Expose it as ratelimit_burst through configfs.

Restart the interval on write, as ratelimit_interval_ms_store() does.
Raising the burst of a target that has already drained the bucket
otherwise buys nothing until the interval in flight ends.

Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/netconsole.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 69acf2c5c6b063..2adf09adb9688c 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -978,6 +978,13 @@ static ssize_t ratelimit_interval_ms_show(struct config_item *item, char *buf)
 			  jiffies_to_msecs(READ_ONCE(nt->ratelimit.interval)));
 }
 
+static ssize_t ratelimit_burst_show(struct config_item *item, char *buf)
+{
+	struct netconsole_target *nt = to_target(item);
+
+	return sysfs_emit(buf, "%d\n", READ_ONCE(nt->ratelimit.burst));
+}
+
 /* configfs helper to display if cpu_nr sysdata feature is enabled */
 static ssize_t sysdata_cpu_nr_enabled_show(struct config_item *item, char *buf)
 {
@@ -1396,6 +1403,31 @@ static ssize_t ratelimit_interval_ms_store(struct config_item *item,
 	return count;
 }
 
+static ssize_t ratelimit_burst_store(struct config_item *item, const char *buf,
+				     size_t count)
+{
+	struct netconsole_target *nt = to_target(item);
+	unsigned int burst;
+	ssize_t ret;
+
+	ret = kstrtouint(buf, 10, &burst);
+	if (ret)
+		return ret;
+
+	if (burst > INT_MAX)
+		return -ERANGE;
+
+	/* Restart the interval as ratelimit_interval_ms_store() does, so the
+	 * new burst is spendable right away.
+	 */
+	dynamic_netconsole_mutex_lock();
+	WRITE_ONCE(nt->ratelimit.burst, burst);
+	ratelimit_state_reset_interval(&nt->ratelimit, nt->ratelimit.interval);
+	dynamic_netconsole_mutex_unlock();
+
+	return count;
+}
+
 struct userdatum {
 	struct config_item item;
 	char value[MAX_EXTRADATA_VALUE_LEN];
@@ -1761,6 +1793,7 @@ CONFIGFS_ATTR(, remote_mac);
 CONFIGFS_ATTR(, release);
 CONFIGFS_ATTR_RO(, transmit_errors);
 CONFIGFS_ATTR(, ratelimit_interval_ms);
+CONFIGFS_ATTR(, ratelimit_burst);
 
 static struct configfs_attribute *netconsole_target_attrs[] = {
 	&attr_enabled,
@@ -1775,6 +1808,7 @@ static struct configfs_attribute *netconsole_target_attrs[] = {
 	&attr_remote_mac,
 	&attr_transmit_errors,
 	&attr_ratelimit_interval_ms,
+	&attr_ratelimit_burst,
 	NULL,
 };
 

-- 
2.53.0-Meta
Technical Details
Message-ID: <20261103-netcons_ratelimit-v4-4-b554c27ba27a@debian.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355477-linux-kernel-netdev=dewy.ru
References: <20261103-netcons_ratelimit-v4-0-b554c27ba27a@debian.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355477-linux-kernel-netdev=dewy.ru
From: leitao@debian.org (Breno Leitao)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v4 4/5] netconsole: allow configuring the rate
 limit burst through configfs
Date: Tue, 03 Nov 2026 02:37:49 -0800
Organization: Usenet Network
Message-ID: <20261103-netcons_ratelimit-v4-4-b554c27ba27a@debian.org>
References: <20261103-netcons_ratelimit-v4-0-b554c27ba27a@debian.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3163358"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CzEz4SX4mWgGJObPIHn44ZrifiE= sha256:NrOB7gre21FZhpUwQa254zM3M+NKE4J2sXyyHDY6A5k=
	sha1:xg8mpa42KC1F7+geK0ov3xo0/Is= sha256:2z7yce7dUZMyl2QSW7Bl0Ue9pml6VTJpd1KchvFWYVs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 79BED11286C; Tue,  3 Nov 2026 15:18:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.052
X-Spam-Status: No, score=-3.052 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=debian.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id dKvwIHtUIUsa;
	Tue,  3 Nov 2026 15:18:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355477-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=debian.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A286511286D; Tue,  3 Nov 2026 15:18:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 990A9C227C; Tue,  3 Nov 2026 10:54:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793702547;
	b=DP/xQuGJQr1WWXZnOMWv4U/jgLCvXk4ZuqfiAMqcRsSAKz9D6nEAt98BzVkZHDKR4U6i
	 PIguhIDc/VZ4nOXiD24YF5mSSQUNvrUV4XCwHciZQau+Zf4n7gcCA4wNNM3VvQ09hEB9q
	 t+WwcKf6EIipkRA+UX/py3KBptuq12lhLChHPzMVJn8Fyeu7LdZ6vU8qEQNgOx+fM69wW
	 LfkEqYa75zy/obLfe4r2m95NoTSTsymcfN4EfmS9jzWUQH7ZTfd1EbTPVQhYzrlQ3nFZj
	 emofO9/8yQNFLk6WF5yvTnNCxjhwx174nNQhJBIIT1+SWtu5RyK15sk7dPRHgD4aIGw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793702547;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:
	 Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:
	 X-Debian-User;
	bh=Wk8y5lyddSNqISmOsoUMorH6jePtOzGwLZbSsd0cfgs=;
	b=CHLlb45GAQLUzJ+pKRgVZ1ng2TT3wcxNlg5Lw2Pv9RIphoFo6UApHGgu0vrASzIZCUQZ
	 rajygtHykG11/wAtuoiH3f9AW+C7WOtu4bzOYS/5XliBJrPOY05ShtMnurZ1HKmMBJCcV
	 l8kgbyKHZLscd/VpJrVhLchiWRzd58+3qL8SPCzx0CwQ0HJilF4jDFttMqDJWrzpEedYq
	 xKwCk0FMSo5qQz+sEZGxGdX6HlYsfEwDRvNJXl5OHyuuMaZJ2d9560CxxShnB+cHyitaA
	 7qQFE8h66x+XAsGL0Tcb6eLy1vcv2Bhoch1R+4/61dj0XF23bvfYBPrb+ka1lgceRGA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=PMLzXqRw;
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D32E606ED94;
	Tue,  3 Nov 2026 10:42:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=PMLzXqRw
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793702536;
	b=YzD6PT9c9xzUtoKXK/rAqRo4mI/9MnR042rraSoqftHwlVdXGJGbD/oiQyczHMjFqMWW
	 wQKF5b2/5UpALL08B/QRAWOsvwBAj0tlP3rD53qBeemZZK5KX5nPElGlEiZ/ds7WhronF
	 el5R1XMtAun6YYV6fhDtG4vVQVIcURUjXZUyt2/FFj7p7fBQGDrzAH2VFYg2XLEzGx6EL
	 nJkETNZFtPixIsTjskUxPn6l5uXwXKae0fKexTEZiUXOSFlwlsJlr7ZFRhwnEH5fjD2dx
	 fD4QAxppaf82JnT+ehiT9hpszTW2bfUNlQdFlsDYWnNhVVh5SHY4qBKGhXTvkl395TQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793702536;
	h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:
	 X-Debian-User;
	bh=Wk8y5lyddSNqISmOsoUMorH6jePtOzGwLZbSsd0cfgs=;
	b=XRbDkcEV4bPC1upbg3D148xiJU+HWnKxOKORaHsrZrg4hqAyDDpQHBloQTwX7G8+oUE5
	 nbFGOc4fTsnhGKSjew+fw0nVTamfcRRXqAjE8PbPJpdr+HenifHh3xafW4u/yn4wjOZe9
	 rGAYmlR7/wGALFMhMISjl5e775nc86O3NxTYRUcocBYboiZTkee+vpjd/RTfSvsX1zCIC
	 iEGE8yzoTIpWpvEtnYm0/1VfKIcOUWfU854S0A3g+L/m+bZGIMAgfrPs1RIigO5A9OqNP
	 RlxCLfRdKltaEig8uSmk4X/Rmbv74FbeAdiKzB7cl/TUr7toKOiOgI2TOkfGpXWYbPw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=PMLzXqRw;
	arc=none smtp.remote-ip=82.195.75.108
X-Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 299C2606D815;
	Tue,  3 Nov 2026 10:42:16 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 299C2606D815
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org;
	s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References:
	Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:
	From:Reply-To:Content-ID:Content-Description;
	bh=Wk8y5lyddSNqISmOsoUMorH6jePtOzGwLZbSsd0cfgs=; b=PMLzXqRwCaEeV2bAPqh2aCVPKl
	YTgOUwFaobiwBqlsHVeSiKDr1jBSe/WqiwfBy18B9tM1d4yEe+rI28D68J/IAhUBefUmDeYRWtWj5
	+fXGdgt22YhQVbkscjnQVfEmmbJe7mt4rx+qjZitektvbFqx9rGKP886j/q7tIs8kHKEt+qwOHChL
	AuJoebr4gZRXTPUVfMZNPfV6I6+D6ytuhtQyQVRXt7Yk0tFRw+B6y2/RnbrPUxpfdGoD4WfT5SJcE
	0xBo+CRi4Io4yc7pJZ8j/wvvg2HZ07TY78D+1Qngjt9hFhxvlQDJTuTB3/erD0rgz2aOsH1xqjvEn
	dM7cUDNA==;
X-Received: from authenticated-user
	by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
	(Exim 4.96)
	(envelope-from <leitao@debian.org>)
	id 1xOBy2-006sNw-1G;
	Tue, 03 Nov 2026 10:42:14 +0000
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261103-netcons_ratelimit-v4-0-b554c27ba27a@debian.org>
X-Cc: Randy Dunlap <rdunlap@infradead.org>, paulmck@kernel.org, 
 gustavold@gmail.com, asantostc@gmail.com, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, 
 linux-kselftest@vger.kernel.org, Breno Leitao <leitao@debian.org>, 
 kernel-team@meta.com
X-Mailer: b4 0.17-dev-ce4c1
X-Developer-Signature: v=1; a=openpgp-sha256; l=2740; i=leitao@debian.org;
 h=from:subject:message-id; bh=ivuyYyxed+3cACuB3kGUwV+T4acdnEPo772SlTJgVtA=;
 b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBq6bpq/4WTNBvEVdLC+6EHAIjWDIwLnLHqfnnTw
 mNqK+HVIn6JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaum6agAKCRA1o5Of/Hh3
 bQd7D/wL0pe9dcE49s4VF9+tOlY2Ef9HP6I6pdP0NOly9SuE03ashVUUYOThGDfow64SjSnc7X+
 OS0wWEfNYPHkrIgUw6u9x/kTZd+f9GEQ2mhmoYe29JNnj40WJMPgEG3oAnFg9j2NDw7s5Wuk1cP
 LBt+CC4UhplLVggcu+F5ThylDu0skDFxiELw4Kz3C+Am/og8P8/Nw5AZ1j+Hbrmx/eTRs7Djpxr
 sAxc1dOYudtLx/6jT61hUG3LbgZTbBuPUtcd8Ujl8KOIfAeFCUV1inPl19T/DtkMNjZWFcE6DLy
 DCrRIkjmGs0DtmkSKGxXPzrM8IOH13L5/nenViuLjsWpvu8M5quGAQgfIvFoo+SCKl+0vxDNZJ7
 5FznpvQa5XGOByi+64yyn07FOraemCDP7nNhdJ3qU3auPcV+cLYZWp0UMLoLCTzPjCyq52gdHtI
 Po2uF80RsU9YViSgCRg3bsLJ4l2q+3xg4RcpfvdnCmPpST1fC9sr/blFI4vpQ4h30pJndUgQ0Ka
 d7k28aeGmVHdEyGb2Le9QkOS/HgVJ1Wp/sfJ6DNKr0M26S8ugl8lkb5X/MNOImWCymUy6HKWVYW
 AysQAh6MK8VW7A13zUreI+O7TqMYragAHv1p71cehHIcDOONlCQr5Dadge0WhoM71fxk/EYcAz2
 +NZhUTyiKsM4wWw==
X-Developer-Key: i=leitao@debian.org; a=openpgp;
 fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D
X-Debian-User: leitao