The branch stable/13 has been updated by markj:

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

commit 533a247fa84ebf33a3f9f7c596e7e6fa629c1680
Author:     Mark Johnston <[email protected]>
AuthorDate: 2022-06-16 14:02:00 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2022-06-30 14:11:52 +0000

    debugnet: Handle batches of packets from if_input
    
    Some drivers will collect multiple mbuf chains, linked by m_nextpkt,
    before passing them to upper layers.  debugnet_pkt_in() didn't handle
    this and would process only the first packet, typically leading to
    retransmits.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 841433148101aafcec8c24ae02efb042c7dfb34b)
---
 sys/net/debugnet.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c
index fa8d64ab86c8..a197017c1767 100644
--- a/sys/net/debugnet.c
+++ b/sys/net/debugnet.c
@@ -523,7 +523,7 @@ debugnet_handle_udp(struct debugnet_pcb *pcb, struct mbuf 
**mb)
  *     m       an mbuf containing the packet received
  */
 static void
-debugnet_pkt_in(struct ifnet *ifp, struct mbuf *m)
+debugnet_input_one(struct ifnet *ifp, struct mbuf *m)
 {
        struct ifreq ifr;
        struct ether_header *eh;
@@ -582,6 +582,19 @@ done:
                m_freem(m);
 }
 
+static void
+debugnet_input(struct ifnet *ifp, struct mbuf *m)
+{
+       struct mbuf *n;
+
+       do {
+               n = m->m_nextpkt;
+               m->m_nextpkt = NULL;
+               debugnet_input_one(ifp, m);
+               m = n;
+       } while (m != NULL);
+}
+
 /*
  * Network polling primitive.
  *
@@ -736,13 +749,13 @@ debugnet_connect(const struct debugnet_conn_params *dcp,
        /*
         * We maintain the invariant that g_debugnet_pcb_inuse is always true
         * while the debugnet ifp's if_input is overridden with
-        * debugnet_pkt_in.
+        * debugnet_input().
         */
        g_debugnet_pcb_inuse = true;
 
        /* Make the card use *our* receive callback. */
        pcb->dp_drv_input = ifp->if_input;
-       ifp->if_input = debugnet_pkt_in;
+       ifp->if_input = debugnet_input;
 
        printf("%s: searching for %s MAC...\n", __func__,
            (dcp->dc_gateway == INADDR_ANY) ? "server" : "gateway");

Reply via email to