[PATCH net-next RFC 3/6] netconsole: allow configuring the rate limit burst through configfs

From: Breno Leitao

Date: Tue Aug 18 2026 - 06:34:16 EST


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.

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
drivers/net/netconsole.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 6f94495d0abc3..6d60a5188bf13 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -948,6 +948,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)
{
@@ -1366,6 +1373,27 @@ 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;
+
+ dynamic_netconsole_mutex_lock();
+ WRITE_ONCE(nt->ratelimit.burst, burst);
+ dynamic_netconsole_mutex_unlock();
+
+ return count;
+}
+
struct userdatum {
struct config_item item;
char value[MAX_EXTRADATA_VALUE_LEN];
@@ -1731,6 +1759,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,
@@ -1745,6 +1774,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