From nobody Thu Jun 16 14:36:24 2022 X-Original-To: dev-commits-src-main@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 9333185DBB5; Thu, 16 Jun 2022 14:36:24 +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 4LP4Vc3fXcz3tHw; Thu, 16 Jun 2022 14:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655390184; 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=NuEK8axnGTLEiXM6pO9/Sg8K3u3JfCNbUNwqoW3I8/4=; b=N6h9m3FhO27VQdXjo3Q+PPnsTsxC2eAcJ59pBipiopv0v3k0IAksSWOkNTfuekJ896Rx+D +HEiEJG3t5XPPAUus28DKg8ID0YKw6A0o1Sbwz9IenPFPX/vmXCRtWoup3kxUYs9MinK+s Bfk1VMHy1Q7JVHEbc21sRLScgefDg54zj22T4C6bTcE448bDaftIQIsDSdV64dj5NC40s1 NH6D+nEm5fzT4fJl3zYoA0u0uA2pfxgVJ38GPr0408RsW7eba0kDSLtkxM/rkKAxHaMsR7 28X3DyHQs7fTxdP/T9r/ciW7pgiFSDfj+0kcz9yUqnmOfdhzv2p1rMOMleITdg== 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 5959A4F5D; Thu, 16 Jun 2022 14:36:24 +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 25GEaOZN056665; Thu, 16 Jun 2022 14:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25GEaO6N056664; Thu, 16 Jun 2022 14:36:24 GMT (envelope-from git) Date: Thu, 16 Jun 2022 14:36:24 GMT Message-Id: <202206161436.25GEaO6N056664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 841433148101 - main - debugnet: Handle batches of packets from if_input List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 841433148101aafcec8c24ae02efb042c7dfb34b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655390184; 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=NuEK8axnGTLEiXM6pO9/Sg8K3u3JfCNbUNwqoW3I8/4=; b=PyB8zCUEUctkPYOmHUUgqt4F7EGIH+Uj4v8zsp2eVxI2koa7RYAiFvayVhCv7RJZ4l3+mT cFSOjRAkbzYWNLIEAKZURlSNmmEzCKldCPeRy6sGxlxxHX4b6JSV1nlK2SoqUfdpVdVwJc j/yRLgpMoa9mAXP52mtkmHFDe1t4DFCuyrZIoDTIFu9SxCsEgAUhb8v9JeUY2lsUQNLv10 1KGNx65bs8GU4NydDSQiPFYjdKjigceFCGZ1fKcVBjWiiTjKkuvqKmbPGlrKtSZBCajyc/ trkoH1mQicsH8jgZbKRgdvyNAU1tAUZ6CFJFOmqNO9HYyZu1b+zAEus17AVwBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655390184; a=rsa-sha256; cv=none; b=XeTY5qL0J82fYttAWEqJ24bnaPavBVuYI47NdV8L+ibYZkegN7a5zP/kRs/WIuyI8icGr7 3GIYp7DWgIqGhxzgbU7lhUqcKObv+3jLi3srbHTEBnnW9DAvQDiYULAI1bO8pHSo9Ea498 IB1qakfBced93MjKNPY7zus83EA6m27qsjVzf3CSHAdddAaphEP3gjUQYqeItvyr13DuiM Bi0n3rRYLcQdWOCyE4/7GbBdiCy6AXmHfvSogWHk4K85EHjdgUj4RpiBlbyMO/JsEWEP8z 8jFcixirNvI0Z/PKPbIirVOY1PQPC9t+Wb55wirQw7xlWv3EQ7tJpV6PjKO0kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=841433148101aafcec8c24ae02efb042c7dfb34b commit 841433148101aafcec8c24ae02efb042c7dfb34b Author: Mark Johnston AuthorDate: 2022-06-16 14:02:00 +0000 Commit: Mark Johnston CommitDate: 2022-06-16 14:02:00 +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. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- 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");