From nobody Wed Jun 3 20:37:40 2026 X-Original-To: dev-commits-src-branches@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 4gVzz82xDgz6ggRf for ; Wed, 03 Jun 2026 20:37:40 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gVzz80VFDz3HVl for ; Wed, 03 Jun 2026 20:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780519060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZFzkmZWRtdH0z0rDJxhjSgieuXDbd6+8dh8Ly44uEmw=; b=NkHZMNo8cPDmudyNphBHjaqf3R8jlqKO2VYI9WXOnB92SY+LLZiCca5A9J8DYeADDKrA6R bBSUgd1v6Vd1go5sMVFNMWvKReUXrCf4DXd3R8Fzs6D4/nQ/kZXtrwYxx1Nk/BJRVuuI1U TVx6cybXEoWslAbTGPIgtkc3Q4+KLuqQZtfDAZ7elk+fGrczJUlCGDVOy8BRWGczvaihKf mIQ3XG4/DwIv1tv+ufUxbxrzHHfCK8x5V9l/69Jx2OSyAKocPjHBK/pE7dgs9GzechPyXQ +w0J8s6i1uzSLsKAOTIXaAE8RM4av3L+OXTDq7hVFDffe3NuBVBH+cg5JTvffg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780519060; a=rsa-sha256; cv=none; b=nLABWwGrhBRmYcVdWx6idwktasTz2n1u60ahRkSqvWJGl5nu6VwQZcG+bbHZwMQSGqPWup Nz9yVAGdM2UJrqeyoDPVwianqpwWBAlqdgBVOh8Q44ci6rjscCMTB/rzN2tD6Mf/plRyWp +EF6+FLiRPztEM6ze05v9HPZO1Z6h2bQEUTv0IOA0Ei3pG482Xh0SuB28FPUbDz3aAu/Ha x5pBpW/GDa6pZyd1PJO/Nuyhw6z5lCIbrkZ7rEckAcp9SxA9lE606DHSeYnmDYQ3j/fY2G nj2x1z+TSpV5Br62md/cCSFCxjZha9hyL5UivKLAK+HJmYX7ektIeRuCj+PuAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780519060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZFzkmZWRtdH0z0rDJxhjSgieuXDbd6+8dh8Ly44uEmw=; b=cK1lBRmOJTbWh0yC/evkopxAe1x4Ao7t89ESiztIfETrLpntm44N6BIBVvKvsD/S7geYxa Qe0SGyPrLOhpdBJu0OPBrtNQHMolS0SHVQDB3HEeIZSvzZDhhiXy/vtOZ+vni3ruglz8lW rwG/W4O0y8TvV6jzemPzGjBkxFUDm2mz51n4TZ9Zw1o+ywASnGdOCDch5mPnK1qsFJyQbx wvri531GbM/J4+6/v72fDgYtwR3ic9nRkfcBPVCw/Q6v4auFVNUtfLDtqLW9UNtcVbC1Xy TvQ1Z5lQGknjPVsn2LSLMPglKxlYJdGmtO2sD0liSj3dABfVIpLi3p4RlxzJ+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gVzz805NpzBkj for ; Wed, 03 Jun 2026 20:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3782c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 03 Jun 2026 20:37:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Colin Percival From: Arthur Kiyanovski Subject: git: 109ee0abc18d - stable/14 - ena: Budget rx descriptors, not packets List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: akiyano X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 109ee0abc18d7a4920092ea14a13e8b5987789f6 Auto-Submitted: auto-generated Date: Wed, 03 Jun 2026 20:37:40 +0000 Message-Id: <6a209094.3782c.2da83a2e@gitrepo.freebsd.org> The branch stable/14 has been updated by akiyano: URL: https://cgit.FreeBSD.org/src/commit/?id=109ee0abc18d7a4920092ea14a13e8b5987789f6 commit 109ee0abc18d7a4920092ea14a13e8b5987789f6 Author: Colin Percival AuthorDate: 2026-04-17 17:40:00 +0000 Commit: Arthur Kiyanovski CommitDate: 2026-06-03 20:35:35 +0000 ena: Budget rx descriptors, not packets We had ENA_RX_BUDGET = 256 in order to allow up to 256 received packets to be processed before we do other cleanups (handling tx packets and, critically, refilling the rx buffer ring). Since the ring holds 1024 buffers by default, this was fine for normal packets: We refill the ring when it falls below 7/8 full, and even with a large burst of incoming packets allowing it to fall by another 1/4 before we consider refilling the ring still leaves it at 7/8 - 1/4 = 5/8 full. With jumbos, the story is different: A 9k jumbo (as is used by default within the EC2 network) consumes 3 descriptors, so a single rx cleanup pass can consume 3/4 of the default-sized rx ring; if the rx buffer ring wasn't completely full before a packet burst arrives, this puts us perilously close to running out of rx buffers. This precise failure mode has been observed on some EC2 instance types within a Cluster Placement Group, resulting in the nominal 10 Gbps single-flow throughput between instances dropping to ~100 Mbps as a result of repeated rx overruns causing packet loss and ultimately retransmission timeouts. To correct this, switch from processing up to ENA_RX_BUDGET (256) packets to processing up to ENA_RX_DESC_BUDGET (256) descriptors (or slightly more, if we hit the limit in the middle of a packet). This ensures that, even with jumbos, we refill the ring before processing most of a ring worth of descriptors, and returns the throughput to expected levels. Note that theoretically up to ENA_PKT_MAX_BUFS (19) descriptors can be used for a single packet, in which case even 54 packets would exhaust the default rx buffer ring; it's not clear if this ever occurs in practice, but this fix will address that case as well. Reviewed by: akiyano Sponsored by: Amazon MFC after: 6 days Differential Revision: https://reviews.freebsd.org/D56479 (cherry picked from commit 0f7b8f79f67b25cb0727c7b7d604eb1eec91fef1) --- sys/dev/ena/ena.h | 4 ++-- sys/dev/ena/ena_datapath.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index f67c7002327d..b2156437f847 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -99,8 +99,8 @@ * of TCP retransmissions. */ #define ENA_TX_BUDGET 128 -/* RX cleanup budget. -1 stands for infinity. */ -#define ENA_RX_BUDGET 256 +/* RX cleanup budget, in descriptors. -1 stands for infinity. */ +#define ENA_RX_DESC_BUDGET 256 /* * How many times we can repeat cleanup in the io irq handling routine if the * RX or TX budget was depleted. diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index ab7b8a468c30..23cbf62b5143 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -575,7 +575,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) uint32_t do_if_input = 0; unsigned int qid; int rc, i; - int budget = ENA_RX_BUDGET; + int budget = (ENA_RX_DESC_BUDGET == -1) ? INT_MAX : ENA_RX_DESC_BUDGET; #ifdef DEV_NETMAP int done; #endif /* DEV_NETMAP */ @@ -684,7 +684,14 @@ ena_rx_cleanup(struct ena_ring *rx_ring) counter_u64_add_protected(rx_ring->rx_stats.cnt, 1); counter_u64_add_protected(adapter->hw_stats.rx_packets, 1); counter_exit(); - } while (--budget); + + /* + * Adjust our budget; note that we count descriptors, not + * packets, since we need to ensure we don't run out of rx + * buffers when receiving jumbos. + */ + budget -= ena_rx_ctx.descs; + } while (budget > 0); rx_ring->next_to_clean = next_to_clean; @@ -699,7 +706,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) tcp_lro_flush_all(&rx_ring->lro); - return (budget == 0); + return (budget <= 0); } static void