From nobody Thu Jun 30 14:15:29 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C1D288B72AC; Thu, 30 Jun 2022 14:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LYgN150PQz4qw5; Thu, 30 Jun 2022 14:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656598529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=37DSI495wslnmaqS9WQXpPNQtHwdE4P34GKIqeWNBcA=; b=WN0RJO7ZA8IUVKxY8LZomkaOia0HPtHHYH6llr0rUGCupg8fe/ql7ZiCVqE/E/s0BtqgRX uHS2NDtW+zGIhG+c4fuo6miAQ+gICwOW9Ii22Nk4x5phOcQ2A5HHW28KFlmc+lbjrU80Kg sd3783//BVj78lxDUVk8PLtlQ/VbH6gSQDBXl3OQFWi32uEtI7qmlDheR21tb0Zy6GETGj 4gUGnPFWljJL+LorQkCrYBolto/Ho0khT8FCCOhqLvbDwjvyGiHV7o8YCQh7LiyN34KEUd ZVj2lPi81B5zfe1+Y/d3OPRuRlSbA5c8zcCo1jTvPYDkk6BY98d2qnr2Dy1jPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 884D82746C; Thu, 30 Jun 2022 14:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25UEFTod051270; Thu, 30 Jun 2022 14:15:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25UEFT84051269; Thu, 30 Jun 2022 14:15:29 GMT (envelope-from git) Date: Thu, 30 Jun 2022 14:15:29 GMT Message-Id: <202206301415.25UEFT84051269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 533a247fa84e - stable/13 - debugnet: Handle batches of packets from if_input List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 533a247fa84ebf33a3f9f7c596e7e6fa629c1680 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656598529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=37DSI495wslnmaqS9WQXpPNQtHwdE4P34GKIqeWNBcA=; b=ElvhTN4JXveI7v1Y7lJjFx3l4Mu8xfo1HOgixeLGGc6ZlAkps5oECXaoZdani/TiQVDgIE RpyvT76KuscyxKFmOht2RrbXnwOY/VTxFGX6MwSFP1h3VGlFEz4gYVVSVnfUR/N6aTL5TE sa2gwQ+1nebN49q4qVpI0p1fgqJgxx5Nj/rgY9CuJ9eWTCLq0NLmUnTZk9AmjxZMkyjdtO FCf7/7dW1mpFc5ZH05goi29W4sm6aaFe1sgIbhbL9Pa9unEfUN3AGIZ4RsRxILDfJJGx1w 3hq0e6nWzV9ikojx4UDNjVPbzVFf5imo2njDnWN/IYKeOag/kAnRA4bOtmQdFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656598529; a=rsa-sha256; cv=none; b=UomO1Pp71gYRmcTF/KfBusVqkUSyJ5so7KUOVWZTUBNHgpRyedU2GvsWjJMyZDni+S/Wj0 UM2SJb1Hgn561h/AcgQRsL5EPMfDTj4wGZ59JaNTg3L3Q8L5xPZy1b85UeP2NhVRy65mDC 76JZz42bu38s2DSGSTdFsKEZB02F3fB3NXat57de0hJyWA2rJv2uDtLnP2Rmifw6KymX8i sOlfJjqiGci2XoxRZLRrlKvSzx+pyT2YfZbjcUr6o0y4YPGctc/9OYCeC4XROmDvlQLDjc /bDN6ntAlIcCkiSNIFOoiFauZAEgdgDJ0/UruuDmDnakNXny5RPp1YSD6NNSLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=533a247fa84ebf33a3f9f7c596e7e6fa629c1680 commit 533a247fa84ebf33a3f9f7c596e7e6fa629c1680 Author: Mark Johnston AuthorDate: 2022-06-16 14:02:00 +0000 Commit: Mark Johnston 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");