From dccf4ea13b3438a1861fc0e40c034db303686f2e Mon Sep 17 00:00:00 2001 From: msaare123 <33455219+msaare123@users.noreply.github.com> Date: Tue, 16 Jun 2026 22:24:22 +0300 Subject: [PATCH] fix stuck poll() when interface down In linux when any of the polled interfaces is brought down (NETDEV_GOING_DOWN) rings were previosly set to NM_KR_LOCKED state. That caused nm_kr_tryget() to get stuck in retry loop inside poll() until interface was eventually brought up again. In this patch the issue was fixed by setting ring state to NM_KR_STOPPED instead of NM_KR_LOCKED. After the fix poll() will return POLLERR for interface that is brought down which in my mind is the correct operation. --- sys/dev/netmap/netmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 53e288a1d..dd1efae77 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -640,7 +640,7 @@ void netmap_disable_all_rings(if_t ifp) { if (NM_NA_VALID(ifp)) { - netmap_set_all_rings(NA(ifp), NM_KR_LOCKED); + netmap_set_all_rings(NA(ifp), NM_KR_STOPPED); } }