Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

udp: add drop count for packets in udp_prod_queue

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 <mahdifrmx@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260129083806.204752-1-mahdifrmx@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Mahdi Faramarzpour and committed by
Jakub Kicinski
820990d6 ed9b7004

+19 -1
+19 -1
net/ipv4/udp.c
··· 1794 1794 } 1795 1795 1796 1796 if (unlikely(to_drop)) { 1797 + int err_ipv4 = 0; 1798 + int err_ipv6 = 0; 1799 + 1797 1800 for (nb = 0; to_drop != NULL; nb++) { 1798 1801 skb = to_drop; 1802 + if (skb->protocol == htons(ETH_P_IP)) 1803 + err_ipv4++; 1804 + else 1805 + err_ipv6++; 1799 1806 to_drop = skb->next; 1800 1807 skb_mark_not_on_list(skb); 1801 - /* TODO: update SNMP values. */ 1802 1808 sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_PROTO_MEM); 1803 1809 } 1804 1810 numa_drop_add(&udp_sk(sk)->drop_counters, nb); 1811 + if (err_ipv4 > 0) { 1812 + SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_MEMERRORS, 1813 + err_ipv4); 1814 + SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_INERRORS, 1815 + err_ipv4); 1816 + } 1817 + if (err_ipv6 > 0) { 1818 + SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_MEMERRORS, 1819 + err_ipv6); 1820 + SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_INERRORS, 1821 + err_ipv6); 1822 + } 1805 1823 } 1806 1824 1807 1825 atomic_sub(total_size, &udp_prod_queue->rmem_alloc);