aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-04-05 20:52:41 +0000
committerMark Johnston <markj@FreeBSD.org>2023-04-05 21:07:48 +0000
commit5f6d37787f1e6aaf9b18392e8cff65ed4e094f2c (patch)
tree124a7ab702aafea38d9922fd2d8324b360c0dcab
parentf401d82ef7cf5038d41e46097fd2d2b6ecaf8ca1 (diff)
downloadsrc-5f6d37787f1e6aaf9b18392e8cff65ed4e094f2c.tar.gz
src-5f6d37787f1e6aaf9b18392e8cff65ed4e094f2c.zip
netmap: Handle packet batches in generic mode
ifnets are allowed to pass batches of multiple packets to if_input, linked by the m_nextpkt pointer. iflib_rxeof() sometimes does this, for example. Netmap's generic mode did not handle this and would only deliver the first packet in the batch, leaking the rest. PR: 270636 Reviewed by: vmaffione MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39426
-rw-r--r--sys/dev/netmap/netmap_freebsd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c
index e67d26d6788f..5a540b6c98b3 100644
--- a/sys/dev/netmap/netmap_freebsd.c
+++ b/sys/dev/netmap/netmap_freebsd.c
@@ -325,10 +325,17 @@ freebsd_generic_rx_handler(if_t ifp, struct mbuf *m)
return;
}
- stolen = generic_rx_handler(ifp, m);
- if (!stolen) {
- NA(ifp)->if_input(ifp, m);
- }
+ do {
+ struct mbuf *n;
+
+ n = m->m_nextpkt;
+ m->m_nextpkt = NULL;
+ stolen = generic_rx_handler(ifp, m);
+ if (!stolen) {
+ NA(ifp)->if_input(ifp, m);
+ }
+ m = n;
+ } while (m != NULL);
}
/*