From 03bb287022ce7087a0174dd131bca582f70ac707 Mon Sep 17 00:00:00 2001
From: Pedro Falcato <pfalcato@suse.de>
Date: May 27 2025 16:46:06 +0000
Subject: net: set the minimum for net_hotdata.netdev_budget_usecs

(git-fixes).

---

diff --git a/patches.suse/net-set-the-minimum-for-net_hotdata.netdev_budget_us.patch b/patches.suse/net-set-the-minimum-for-net_hotdata.netdev_budget_us.patch
new file mode 100644
index 0000000..4e47e15
--- /dev/null
+++ b/patches.suse/net-set-the-minimum-for-net_hotdata.netdev_budget_us.patch
@@ -0,0 +1,51 @@
+From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
+Date: Thu, 20 Feb 2025 12:07:52 +0100
+Subject: net: set the minimum for net_hotdata.netdev_budget_usecs
+Patch-mainline: v6.14-rc5
+Git-commit: c180188ec02281126045414e90d08422a80f75b4
+References: git-fixes
+
+Commit 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs
+to enable softirq tuning") added a possibility to set
+net_hotdata.netdev_budget_usecs, but added no lower bound checking.
+
+Commit a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
+made the *initial* value HZ-dependent, so the initial value is at least
+2 jiffies even for lower HZ values (2 ms for 1000 Hz, 8ms for 250 Hz, 20
+ms for 100 Hz).
+
+But a user still can set improper values by a sysctl. Set .extra1
+(the lower bound) for net_hotdata.netdev_budget_usecs to the same value
+as in the latter commit. That is to 2 jiffies.
+
+Fixes: a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
+Fixes: 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning")
+Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
+Cc: Dmitry Yakunin <zeil@yandex-team.ru>
+Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
+Link: https://patch.msgid.link/20250220110752.137639-1-jirislaby@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Acked-by: Pedro Falcato <pfalcato@suse.de>
+---
+ net/core/sysctl_net_core.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/core/sysctl_net_core.c
++++ b/net/core/sysctl_net_core.c
+@@ -30,6 +30,7 @@ static int int_3600 = 3600;
+ static int min_sndbuf = SOCK_MIN_SNDBUF;
+ static int min_rcvbuf = SOCK_MIN_RCVBUF;
+ static int max_skb_frags = MAX_SKB_FRAGS;
++static int netdev_budget_usecs_min = 2 * USEC_PER_SEC / HZ;
+ 
+ static int net_msg_warn;	/* Unused, but still a sysctl */
+ 
+@@ -604,7 +605,7 @@ static struct ctl_table net_core_table[]
+ 		.maxlen		= sizeof(unsigned int),
+ 		.mode		= 0644,
+ 		.proc_handler	= proc_dointvec_minmax,
+-		.extra1		= SYSCTL_ZERO,
++		.extra1		= &netdev_budget_usecs_min,
+ 	},
+ 	{
+ 		.procname	= "fb_tunnels_only_for_init_net",
diff --git a/series.conf b/series.conf
index ed5f0df..7a273b9 100644
--- a/series.conf
+++ b/series.conf
@@ -30743,6 +30743,7 @@
 	patches.suse/Bluetooth-L2CAP-Fix-L2CAP_ECRED_CONN_RSP-response.patch
 	patches.suse/net-better-track-kernel-sockets-lifetime.patch
 	patches.suse/net-loopback-Avoid-sending-IP-packets-without-an-Eth.patch
+	patches.suse/net-set-the-minimum-for-net_hotdata.netdev_budget_us.patch
 	patches.suse/ipvlan-ensure-network-headers-are-in-skb-linear-part.patch
 	patches.suse/mptcp-always-handle-address-removal-under-msk-socket.patch
 	patches.suse/ice-Fix-deinitializing-VF-in-error-path.patch