From nobody Thu Apr 30 17:47:43 2026 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 4g61pl2x2lz6bw4v for ; Thu, 30 Apr 2026 17:47:43 +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 4g61pl2VS5z3m4v for ; Thu, 30 Apr 2026 17:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777571263; 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=/oToeGFeMx5gy1GB497WIFxItddGZour4AY9b9ZQO0o=; b=oQOA7BzBuWAr3xr5TK6dpL/DGyl9PCS0z2AaDn0Uv/UPqD+Au13qE3/SyQscpckWRt+TJk MVJx0xk3U/wxLXIE33wFCeY4c9kI1GHgyrtsgF2E4mYMFHqwaIkyuWw2SB7XPIAs/au5rk q7Pn2KPFwrsGZtCnF9HcGmAGWFT4Nz7XndBAhNUbiVa7clxnqWMFL2fsgET9IUnm0BDeyn G6onlHrZy0HMJTIq0hxTKOl6Zm6gwQksalolBA8rxj+fJbEwiULJsg3+MvahQoS9VBLG8s Or2Pu/O4PstpdtOE2LqVC4X53EoRoJ6kJMuwznaiGJI5RWFNHG0HhVq6lv7F4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777571263; a=rsa-sha256; cv=none; b=nHfCSfuGcu/6S7YUwLaFiq/i7w0iJwJfooyZrdFJvPD68dE+IST7IMvmfeDeiUBeX/Zfrw unBRT5ZFoVG/bP0hPnXKr8AAzPSuVjlukUdMTZ3faLbiYGT06Gbs3/gnMeFrAfP51i0jNz KXD2RMnDB4t3wI7unCXNKwdRtxLCHAUTgwRSWNkfkvifYffeJih52ov5xtWsppgw9q5R79 bfzBF9zcAejGx+C1ouKLCc6ezxgtdIhN7dbZ9xrGOYTdb2PAhdeY/sLjmEhJBSvIpNtWBk 5BwEjebVs3oo2sOhm5HnXlp/8xPYU7oa2PchT31A1mCCe+IrtZW15pEC8ShOfA== 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=1777571263; 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=/oToeGFeMx5gy1GB497WIFxItddGZour4AY9b9ZQO0o=; b=i7aVM7be1ujavwRF1vXdb4OfHClsP94oBJSl+/kQsADzldWjpo4VitxEfzutkcqThaq2xp zcDA4qPAsDvFO5z0Pa/ItRoOAJIejTwLdBuzqxS5iIe9wDhGxUCnfB2n0lcttbw+obzMdB 3Oq4QQ0QwPRKxH1NBKV9Q0eNRKieLVXG08OZAiIg4X60/hs5Hei1m1g9iwR0J+H44tlXnP z28Ykwh44j9Zy4XWxKrt6pM/jD8VdtONNAj6voXCk+fCYsxHDLiPScXNSgG+STPxjubHyT RV3vKRyYGqXGNJIa4MsfDD8sDaWx32F79y5o6sOpSLrZMFlDOKQ+GsQZ+VRMNw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g61pl236Sz6Rk for ; Thu, 30 Apr 2026 17:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3177a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 30 Apr 2026 17:47:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 4472de79919c - stable/15 - ena: Adjust ena_[rt]x_cleanup to return bool 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 4472de79919c03f78621b9eb1cbdf7401f09f746 Auto-Submitted: auto-generated Date: Thu, 30 Apr 2026 17:47:43 +0000 Message-Id: <69f395bf.3177a.19be8bf1@gitrepo.freebsd.org> The branch stable/15 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=4472de79919c03f78621b9eb1cbdf7401f09f746 commit 4472de79919c03f78621b9eb1cbdf7401f09f746 Author: Colin Percival AuthorDate: 2026-04-17 17:13:44 +0000 Commit: Colin Percival CommitDate: 2026-04-30 17:47:06 +0000 ena: Adjust ena_[rt]x_cleanup to return bool The ena_[rt]x_cleanup functions are limited internally to a maximum number of packets; this ensures that TX doesn't starve RX (or vice versa) and also attempts to ensure that we get a chance to refill the RX buffer ring before the device runs out of buffers and starts dropping packets. Historically these functions have returned the number of packets which they processed which ena_cleanup compares to their respective budgets to decide whether to reinvoke them. This is unnecessary complication; since the precise number of packets processed is never used, adjust the APIs of those functions to return a bool indicating if they want to be reinvoked (aka if they hit their limits). Since ena_tx_cleanup now only uses work_done if diagnostics are enabled (ena_log_io macros to nothing otherwise) eliminate that variable and pass its value (ENA_TX_BUDGET - budget) to ena_log_io directly. No functional change intended; this will simplify a future commit. Reviewed by: akiyano Sponsored by: Amazon MFC after: 6 days Differential Revision: https://reviews.freebsd.org/D56478 (cherry picked from commit f6d2c8591c10d87050c358ef20428f13c19554ca) --- sys/dev/ena/ena_datapath.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index ab082fa1810f..ab7b8a468c30 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -44,8 +44,8 @@ * Static functions prototypes *********************************************************************/ -static int ena_tx_cleanup(struct ena_ring *); -static int ena_rx_cleanup(struct ena_ring *); +static bool ena_tx_cleanup(struct ena_ring *); +static bool ena_rx_cleanup(struct ena_ring *); static inline int ena_get_tx_req_id(struct ena_ring *tx_ring, struct ena_com_io_cq *io_cq, uint16_t *req_id); static void ena_rx_hash_mbuf(struct ena_ring *, struct ena_com_rx_ctx *, @@ -75,7 +75,8 @@ ena_cleanup(void *arg, int pending) struct ena_com_io_cq *io_cq; struct ena_eth_io_intr_reg intr_reg; int qid, ena_qid; - int txc, rxc, i; + int i; + bool rx_again, tx_again; tx_ring = que->tx_ring; rx_ring = que->rx_ring; @@ -99,14 +100,14 @@ ena_cleanup(void *arg, int pending) atomic_store_8(&rx_ring->first_interrupt, 1); for (i = 0; i < ENA_CLEAN_BUDGET; ++i) { - rxc = ena_rx_cleanup(rx_ring); - txc = ena_tx_cleanup(tx_ring); + rx_again = ena_rx_cleanup(rx_ring); + tx_again = ena_tx_cleanup(tx_ring); if (unlikely(((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) || (ENA_FLAG_ISSET(ENA_FLAG_TRIGGER_RESET, adapter)))) return; - if ((txc != ENA_TX_BUDGET) && (rxc != ENA_RX_BUDGET)) + if (!rx_again && !tx_again) break; } @@ -238,7 +239,7 @@ ena_get_tx_req_id(struct ena_ring *tx_ring, struct ena_com_io_cq *io_cq, * TX_COMMIT. The first check of free descriptor is performed before the actual * loop, then repeated at the loop end. **/ -static int +static bool ena_tx_cleanup(struct ena_ring *tx_ring) { struct ena_adapter *adapter; @@ -250,7 +251,6 @@ ena_tx_cleanup(struct ena_ring *tx_ring) int rc; int commit = ENA_TX_COMMIT; int budget = ENA_TX_BUDGET; - int work_done; bool above_thresh; adapter = tx_ring->que->adapter; @@ -304,10 +304,8 @@ ena_tx_cleanup(struct ena_ring *tx_ring) } } while (likely(--budget)); - work_done = ENA_TX_BUDGET - budget; - ena_log_io(adapter->pdev, DBG, "tx: q %d done. total pkts: %d\n", - tx_ring->qid, work_done); + tx_ring->qid, ENA_TX_BUDGET - budget); /* If there is still something to commit update ring state */ if (likely(commit != ENA_TX_COMMIT)) { @@ -339,7 +337,7 @@ ena_tx_cleanup(struct ena_ring *tx_ring) tx_ring->tx_last_cleanup_ticks = ticks; - return (work_done); + return (budget == 0); } static void @@ -559,7 +557,7 @@ ena_rx_checksum(struct ena_ring *rx_ring, struct ena_com_rx_ctx *ena_rx_ctx, * ena_rx_cleanup - handle rx irq * @arg: ring for which irq is being handled **/ -static int +static bool ena_rx_cleanup(struct ena_ring *rx_ring) { struct ena_adapter *adapter; @@ -701,7 +699,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) tcp_lro_flush_all(&rx_ring->lro); - return (ENA_RX_BUDGET - budget); + return (budget == 0); } static void