From nobody Thu Oct 09 13:02:13 2025 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 4cj9516RY2z6BtYV; Thu, 09 Oct 2025 13:02:13 +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 4cj9515ldjz3fBv; Thu, 09 Oct 2025 13:02:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760014933; 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=C11PG3GpIt1XeIgDem4//rg4dhaZJQ98jNIwTZ4Os4w=; b=vCPCUDK6ETR4j4PlxJnXdqwYw51/RpBB0T+PH2H8fTWBzdmzqQ9IpcR93lXbIBRMomOWzs yOeB6Dfs0+M5wkIyslVXIMlBlJXva7OxsEpDhlEf5X7Ta1AXIYEwF2N4aTGTNeKqod/WBX 4LXLpV8osyX+O6QH5D6mqisFhWvzSU5O6CJ09U/iWQoqiod2hxAqKjKO/iPuDXsNW0dht7 pVlODUQbCjHpiw1SbA4a4vcR+YGD2j2TfY24jMKx9Nj2Qny6kavk3uW1PEO1dDpKB6jGgP Bkbz+eq1ZjP3iE/EVbiomYSOcWWPa7mjY0fAS1yBzeK+M8Oi7tbQxqwdTvk5rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760014933; 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=C11PG3GpIt1XeIgDem4//rg4dhaZJQ98jNIwTZ4Os4w=; b=shSP59VjaQH0qb3XwCCezQnTfV6n5BChfV2+mgT4DeyjuKVS5e9Jh23LL6ob0KcB+gWWKZ dToOjYH/MTmhUFlLFsQ/+dFmCWrpLby3C0w9kPGGJ3z226UVEWRTtzFH28Do4agVrCq8pj MhrXrfJ2K6tcp67bgaNP3YHmlgAf5CJftr7qTvEl2DCBv8LGjUVSu0wi9LVEtL8JAGo7ll OVRLW/DPULp2DS5tTpbIXj3j6er+gRI9Q7lrVT31dNbM2Efji4slLXmtE9fgHYk6FzZ2nM UYthPyXl4DZGr76Ly1aMPqR8YgsPw5XMu2JIum0WnsKOT+yZWSI8RHvk9xYFMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760014933; a=rsa-sha256; cv=none; b=KsBx9vxR2uyPhuQRs6zVoN//SiVWC07e+hMoJurn5xTDy4+ondQOEmIJdEwxzAUOojmcRQ bjVdzV9Zo3ihiQKBVQ1U86VtAE0lXHyYp1XMbENs1C3QQHTZXxkjU/ghwZOTP5+E2md4dF 5GtbSxYFXGR7BlYF+bqmaRq1ET5kmDcgF7XSsx7ip3ztyeheNZcj477/OFYQeyzvXo4qc0 HFfPVKJzmiiOaTKJ5O1VYdLwghOfwCSJyrx24KI07YZRuKa2cPDDckvm20Nq+NkjXv6TnG Li7chXGVY2moU55MndwgIY48K9jpAciy7o99dbRW8M035wRvkdkjUYGUgbW4ww== 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 4cj9515Kkhz3kf; Thu, 09 Oct 2025 13:02:13 +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 599D2DV6027390; Thu, 9 Oct 2025 13:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 599D2Dx0027376; Thu, 9 Oct 2025 13:02:13 GMT (envelope-from git) Date: Thu, 9 Oct 2025 13:02:13 GMT Message-Id: <202510091302.599D2Dx0027376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 73f56fa542ec - main - tcp lro: use theflowid only when it has hash properties 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 73f56fa542ecf6ea6819c9e17fc60962eeb726d8 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=73f56fa542ecf6ea6819c9e17fc60962eeb726d8 commit 73f56fa542ecf6ea6819c9e17fc60962eeb726d8 Author: Michael Tuexen AuthorDate: 2025-10-09 12:37:11 +0000 Commit: Michael Tuexen CommitDate: 2025-10-09 12:37:11 +0000 tcp lro: use theflowid 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 MFC after: 5 Minutes Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D52989 --- 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;