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. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
8cb42d6918
commit
8414331481
@ -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 @@ debugnet_pkt_in(struct ifnet *ifp, struct mbuf *m)
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user