git: 3d55de76e30d - stable/13 - netmap: Handle packet batches in generic mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Apr 2023 14:22:18 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=3d55de76e30d34a411630d986153ae803915e95f
commit 3d55de76e30d34a411630d986153ae803915e95f
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-04-05 20:52:41 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-04-12 14:18:48 +0000
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
(cherry picked from commit 5f6d37787f1e6aaf9b18392e8cff65ed4e094f2c)
---
sys/dev/netmap/netmap_freebsd.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c
index 19708406dc93..91c3e380117a 100644
--- a/sys/dev/netmap/netmap_freebsd.c
+++ b/sys/dev/netmap/netmap_freebsd.c
@@ -325,10 +325,17 @@ freebsd_generic_rx_handler(struct ifnet *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);
}
/*