From nobody Sat Feb 7 18:29:05 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6509A37C0ED for ; Thu, 29 Jan 2026 08:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675925; cv=none; b=Ruath4kCQ416NpjbtQvo7or/II1TIZVfJgtjuo4RIvpWN/PZIkXqtASvb9PkQeAetNzKHetJcaRV4wKvsVaNbMmsG+LS44OW89r1si4Q6Wf0EDYTzXqVIWTMlMCrfRAGXiFA4wFRs0dewaRKtEVN0OlJob0ojaT1jSdB7HwVjEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769675925; c=relaxed/simple; bh=Vtker4lyl2lvi38SnhE/UuR/KI2fAI/2XATb1tU9EE8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=koT+DMuBT4ER0KOpOCqb73/PLOIEFEm+Ius1vZEmhygqbuCX9jddYv8RSTH2i8V/JpcwlVAL53ohnMmal+Wit/53W1rCy4xU1KlckBmQ7GjxZR2CAhpUGBX6LZbOKcxnuMrNVCNy0+9SqqxbvsWiveazvxcEov59aJp5imxFD84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E7NIdfwU; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E7NIdfwU" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-48068ed1eccso6387315e9.2 for ; Thu, 29 Jan 2026 00:38:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769675916; x=1770280716; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=H3fGmsw/yPXYFbykpa/JGZYx8vq9SSYs4JmuZVSCkbk=; b=E7NIdfwUzZzlCI8ZobHUuUgw3FD5J3th1gG7FDG3BHJwX6WXzfgJFFJpsXWHyVBbPW bwsVs95/AFl/e8oQBsn7H11akke2QxyhTd6+Bw6nXKNX8mtY8MO4SqYpSlJfrr8OI2ee 8OtIRhQcwvfcuhVkqzVkILKmuMR1xTpt8+jiHTm15HYJUyk6KHw6sSTj15CvyMsy9LQl ebnpDK8k6BXvpcZHeBgnlDeEcQddWGaKSP3w8xC862YOoRhe6n/hidVh+QTV5ACR8aSV Z5zrSUT2oqRMGgM/QqcY7+yrjbW7avG8H6GmhSFJ6rCCJf4sYMo6PjSSZTTquTlIUcQc GLrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769675916; x=1770280716; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H3fGmsw/yPXYFbykpa/JGZYx8vq9SSYs4JmuZVSCkbk=; b=MhRME0+vlCYKHwnMRmnGMdqbKYmzA/9tNAc6wiXRm3NUW6dBaaaSITQLwja+CqoyeT QtLHQ12THOfS/O+i/iGNuDOWywgMjQt8vxnzQ5sWW/EJB3Yp8vaHNNbnfCxL4a8pAAoA d0cojGZupLrXMubLuJILL3nTj+th0OHQzldRUN87ANT6F7SMvMFXVJ5kHdz531WnY/OF T9q9Ou+CIgDwsqd5lIqo6JUdzsBDoeF6vqiqD7jQMPpwi3aIVLS0Rpx3n66YIyGGiB4I Kr2VSMFR4WCm1o5mtvpeB+7kv5JW2+ouWI0vh0RR/yrn/2qTnhDjCGe+FgKUsItZrU4b Y+9Q== X-Forwarded-Encrypted: i=1; AJvYcCVwReLjxqgXcQgCrIdcrztFo5s6ccpgq078cjmg9Crnsl8XRqwrtfh1PfJj/aQwLHW4pLAOv+46O4MOLYc=@vger.kernel.org X-Gm-Message-State: AOJu0YwGsnOL+aA2xQMTPtsn/KeToaXnUOK/pT0TvNaMuyPsmf55vJV5 BZB8MJWLWx4TuaB42KELYDS9tQ5FsOhGJ/HZNArCMVc4oS+SAc16Wfup X-Gm-Gg: AZuq6aK8iQcAlxU9KPpIHHZzb1XBWG/GoK+SwItmdmvCXPvcwG+QNBAx29PTWqXqxsH q2CzqXiV4JLcwJTRqYGc1M8CU/OMGsGMETiTPqH4w8vwVSr359XyU2tQ1Ju+11jIHXzjhdo0/aB wgqUfN1Dt28jV4uRYgNdpSFsQgxXA8ra1kepOmYS34cepE5lwDF5icOGv9r1iK5tNessxrg0Du0 DXNKgQAUh0f0RlfAuGCqnquG/MiimcK8f0DlUJZmptdlEg2mmj7rW8XWt4njyDaJ/BZHnPZLUbB 0winMyaMKaDwvYaTTCxGNPS5pRHcMil+TChflUvEwoTHhLQ9nt6C634M7XgSEn8UA1jJhDdKLhC ftAIlxzV42TJ0JC9FJulTBGfOMWsvYRzMxIAkg5DSs7AnqpR49hS+eyVSHfNJ0tkoPZwfnmiGqT FD+9FM X-Received: by 2002:a05:600c:b8a:b0:480:3b4e:41b8 with SMTP id 5b1f17b1804b1-48069c7586amr102407485e9.33.1769675915793; Thu, 29 Jan 2026 00:38:35 -0800 (PST) Received: from wdesk. ([164.215.131.151]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066c40e04sm180260415e9.13.2026.01.29.00.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 00:38:35 -0800 (PST) From: Mahdi Faramarzpour To: netdev@vger.kernel.org Cc: Willem de Bruijn , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org (open list), kshitiz.bartariya@zohomail.in, Mahdi Faramarzpour Subject: [PATCH net-next] udp: add drop count for packets in udp_prod_queue Date: Thu, 29 Jan 2026 12:08:06 +0330 Message-Id: <20260129083806.204752-1-mahdifrmx@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit adds SNMP drop count increment for the packets in per NUMA queues which were introduced in commit b650bf0977d3 ("udp: remove busylock and add per NUMA queues"). note that SNMP counters are incremented currently by the caller for skb. And that these skbs on the intermediate queue cannot be counted there so need similar logic in their error path. Signed-off-by: Mahdi Faramarzpour Reviewed-by: Eric Dumazet Reviewed-by: Willem de Bruijn --- v7: - revert the last change and fix style v6: https://lore.kernel.org/netdev/20260128070311.48892-1-mahdifrmx@gmail.c= om/ - increasing a single counter based on socket family v5: https://lore.kernel.org/netdev/20260122185357.50922-1-mahdifrmx@gmail.c= om/ - check if drop counts are non-zero before increasing countrers v4: https://lore.kernel.org/netdev/20260108102950.49417-1-mahdifrmx@gmail.c= om/ - move all changes to unlikely(to_drop) branch v3: https://lore.kernel.org/netdev/20260105114732.140719-1-mahdifrmx@gmail.= com/ - remove the unreachable UDP_MIB_RCVBUFERRORS code v2: https://lore.kernel.org/netdev/20260105071218.10785-1-mahdifrmx@gmail.c= om/ - change ENOMEM to ENOBUFS v1: https://lore.kernel.org/netdev/20260104105732.427691-1-mahdifrmx@gmail.= com/ --- net/ipv4/udp.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ffe074cb5..6ad7296db 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1793,14 +1793,32 @@ int __udp_enqueue_schedule_skb(struct sock *sk, str= uct sk_buff *skb) } =20 if (unlikely(to_drop)) { + int err_ipv4 =3D 0; + int err_ipv6 =3D 0; + for (nb =3D 0; to_drop !=3D NULL; nb++) { skb =3D to_drop; + if (skb->protocol =3D=3D htons(ETH_P_IP)) + err_ipv4++; + else + err_ipv6++; to_drop =3D skb->next; skb_mark_not_on_list(skb); - /* TODO: update SNMP values. */ sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_PROTO_MEM); } numa_drop_add(&udp_sk(sk)->drop_counters, nb); + if (err_ipv4 > 0) { + SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_MEMERRORS, + err_ipv4); + SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_INERRORS, + err_ipv4); + } + if (err_ipv6 > 0) { + SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_MEMERRORS, + err_ipv6); + SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_INERRORS, + err_ipv6); + } } =20 atomic_sub(total_size, &udp_prod_queue->rmem_alloc); --=20 2.34.1