From nobody Thu Oct 9 13:11:11 2025 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 4cj9HM5MjMz6Bv6N; Thu, 09 Oct 2025 13:11:11 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cj9HM4mdhz3ftv; Thu, 09 Oct 2025 13:11:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760015471; 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=lNNXLKsaaBkpga2oUl7GJEhyFAYCq72pNGK0XND4SX8=; b=JlQZnmZe5RQ4NKUhRouPIGc8T4CTmp6Ne8612taysGlH3pwVVoHgipPIXr5jJxOvtpJvXP 1OD9IY+hRG+G2mcMpjU86g+719pnD/bPeynai4wi7HP0zsgmHYXrBGtagTJZ68xdEsuklL JDu1y6zfl75wqhPSLAPTRncNg18motM6LeEfHN2InQIgGcPrKT+2Kl9k4EKKZ509Lxpypa kdYpvuxyS0w0ym3BDQNKywnzNP4t3svKKddfTUs54K2bYm5ebLy3Ai7dwW2/Nf3YCtwUCT XZ3fSMeB+BFWnisXUMF+P6ijrbUSIHUcXTQdYrJ/m/c3gKg4lED4f5Xx/rZ08Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760015471; 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=lNNXLKsaaBkpga2oUl7GJEhyFAYCq72pNGK0XND4SX8=; b=thVPHzvJnJ+WFeKeIMwYeIv25gdkVjg5tM4YmMSakKhH+ToWvSbnWLKBBLGgRwn1FMqH73 L9qM72N1odXK0KF0VNGGEx/pyKt2RIoBLDBwWEhquru+OA9G9jljPjqSR2Q7RtwS0A9+0t pT3ynr/zv8/Q7CwrKMOSWAl0eOXWco/KB8Sr9nD+mlCclO3uqWn3nnGMVsFYH9WVhionkr nCEteCNLW7bH6B4OgV79d2rxG+arN+MG2rrlRtwivrshyz+Jk7dZG1NOnxhuigoc/Z1X94 4oi3EWlwhZrWz0XsU1xFKGYGQyM2AumaGesJSaMGFZpd3oTT+wa+Ldd5Ax9Ocw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760015471; a=rsa-sha256; cv=none; b=aZZigxqP/NwnjUspfDcEu9APZ3UyOVkOJX1u4M28bYT9/6xAyUAcjPpdNR5qu1XDIHjJoI hDYiHQ9ywi9d+Ll0HBVLnR4or0S9+JZQvgUqej1I/vAZU8S6QPeaiRLzHyeqrmdJyp3TUo EWyEdcVKd9ch2t0YbXNyZtzR4deY3jmIWRweIQ0ufZPFLzJwLWga/3sHF5aOa4koyi6CdZ TrNV88oRZQCwCqc/hA8sJGGRefqFnoMikf2EsTUjA6foEO7eWWBk/P2gM++DnHNtzPRxaX Se7wG6AcCbAuuM3JyNJgJ9ke39OMnUbcSGY+RA3ffrZHdJ82AvFVAuHGWkixLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cj9HM4Mydz3ms; Thu, 09 Oct 2025 13:11:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 599DBBAY041882; Thu, 9 Oct 2025 13:11:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 599DBBpX041879; Thu, 9 Oct 2025 13:11:11 GMT (envelope-from git) Date: Thu, 9 Oct 2025 13:11:11 GMT Message-Id: <202510091311.599DBBpX041879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 4774687d4087 - stable/15 - tcp lro: use the flowid only when it has hash properties 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 4774687d4087cf40e46939f29473f7cb8c269ad5 Auto-Submitted: auto-generated The branch stable/15 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=4774687d4087cf40e46939f29473f7cb8c269ad5 commit 4774687d4087cf40e46939f29473f7cb8c269ad5 Author: Michael Tuexen AuthorDate: 2025-10-09 12:37:11 +0000 Commit: Michael Tuexen CommitDate: 2025-10-09 12:53:09 +0000 tcp lro: use the flowid only when it has hash properties When a packet is provided to LRO using tcp_lro_queue_mbuf(), a sequence number is computed based on the m_pkthdr.flowid provided by he driver. The implicit assumption is that the m_pkthdr.flowid has hash properties. The recent use of tcp_lro_queue_mbuf() in iflib exposed a bug in at least one driver (igc) , which * reports always that is uses M_HASHTYPE_OPAQUE. * sets in some cases m_pkthdr.flowid not consistently for packets belonging to the same TCP connection. This results in severe performance problems for the base TCP stack, since it handles the packets in the wrong sequence, although they were received in the correct sequence. To protect against such misbehaving drivers, just take the m_pkthdr.flowid only into account, if it has hash properties. The performance problems were observed by gallatin@ and analyzed together with rrs@. Reviewed by: gallatin Tested by: gallatin Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D52989 (cherry picked from commit 73f56fa542ecf6ea6819c9e17fc60962eeb726d8) --- sys/netinet/tcp_lro.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 64efa4bf060f..9b5baf115855 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1475,10 +1475,11 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb) } /* create sequence number */ - lc->lro_mbuf_data[lc->lro_mbuf_count].seq = - (((uint64_t)M_HASHTYPE_GET(mb)) << 56) | - (((uint64_t)mb->m_pkthdr.flowid) << 24) | - ((uint64_t)lc->lro_mbuf_count); + lc->lro_mbuf_data[lc->lro_mbuf_count].seq = lc->lro_mbuf_count; + if (M_HASHTYPE_ISHASH(mb)) + lc->lro_mbuf_data[lc->lro_mbuf_count].seq |= + (((uint64_t)M_HASHTYPE_GET(mb)) << 56) | + (((uint64_t)mb->m_pkthdr.flowid) << 24); /* enter mbuf */ lc->lro_mbuf_data[lc->lro_mbuf_count].mb = mb;