Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2023 19:52:48 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: df40e30c9786 - main - netmap: Try to count packet drops in emulated mode
Message-ID:  <202301231952.30NJqml9015563@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=df40e30c9786ccbf51e3acdf936d5c0e20815652

commit df40e30c9786ccbf51e3acdf936d5c0e20815652
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-01-23 19:42:41 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-01-23 19:42:41 +0000

    netmap: Try to count packet drops in emulated mode
    
    Right now we have little visibility into packet drops within netmap.
    Start trying to make packet loss issues more visible by counting queue
    drops in the transmit path, and in the input path for interfaces running
    in emulated mode, where we place received packets in a bounded software
    queue that is processed by rxsync.
    
    Reviewed by:    vmaffione
    MFC after:      1 week
    Sponsored by:   Zenarmor
    Sponsored by:   OPNsense
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D38064
---
 sys/dev/netmap/netmap.c         | 4 +++-
 sys/dev/netmap/netmap_generic.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index 448d9a81eefb..37723fb36fe8 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -4329,8 +4329,10 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m)
 	mbq_unlock(q);
 
 done:
-	if (m)
+	if (m) {
+		if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
 		m_freem(m);
+	}
 	/* unconditionally wake up listeners */
 	kring->nm_notify(kring, 0);
 	/* this is normally netmap_notify(), but for nics
diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c
index f075cd4bd306..83908f10a3fe 100644
--- a/sys/dev/netmap/netmap_generic.c
+++ b/sys/dev/netmap/netmap_generic.c
@@ -837,8 +837,10 @@ generic_rx_handler(struct ifnet *ifp, struct mbuf *m)
 		 * support RX scatter-gather. */
 		nm_prlim(2, "Warning: driver pushed up big packet "
 				"(size=%d)", (int)MBUF_LEN(m));
+		if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
 		m_freem(m);
 	} else if (unlikely(mbq_len(&kring->rx_queue) > na->num_rx_desc)) {
+		if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
 		m_freem(m);
 	} else {
 		mbq_safe_enqueue(&kring->rx_queue, m);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301231952.30NJqml9015563>