Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2024 15:59:56 GMT
From:      Osama Abboud <osamaabb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 374695be6523 - stable/13 - ena: Count all currently missing TX completions in check
Message-ID:  <202410311559.49VFxu0U056503@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by osamaabb:

URL: https://cgit.FreeBSD.org/src/commit/?id=374695be65238bcf392576538f0fe99f09c5dbc8

commit 374695be65238bcf392576538f0fe99f09c5dbc8
Author:     Osama Abboud <osamaabb@amazon.com>
AuthorDate: 2024-08-07 06:24:18 +0000
Commit:     Osama Abboud <osamaabb@FreeBSD.org>
CommitDate: 2024-10-31 14:55:19 +0000

    ena: Count all currently missing TX completions in check
    
    Currently we count all of the newly added and already existing
    missing tx completions in each iteration of
    check_missing_comp_in_tx_queue() causing duplicate counts
    to missing_tx_comp stat.
    
    This commit adds a new counter new_missed_tx within the relevant
    function which only counts the newly added missing tx completions
    in each iteration of check_missing_comp_in_tx_queue().
    This will allow us to update missing_tx_comp stat accurately without
    counting duplicates.
    
    Approved by: cperciva (mentor)
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit 1f67704e2cd85a507776312b52dc63d8690b9260)
---
 sys/dev/ena/ena.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index 3da424a7c9dd..719dd4b58bae 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -3059,13 +3059,13 @@ static int
 check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
     struct ena_ring *tx_ring)
 {
+	uint32_t missed_tx = 0, new_missed_tx = 0;
 	device_t pdev = adapter->pdev;
 	struct bintime curtime, time;
 	struct ena_tx_buffer *tx_buf;
 	int time_since_last_cleanup;
 	int missing_tx_comp_to;
 	sbintime_t time_offset;
-	uint32_t missed_tx = 0;
 	int i, rc = 0;
 
 	getbinuptime(&curtime);
@@ -3108,13 +3108,15 @@ check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
 				    "%d msecs have passed since last cleanup. Missing Tx timeout value %d msecs.\n",
 				    tx_ring->qid, i, time_since_last_cleanup,
 				    missing_tx_comp_to);
+				/* Add new TX completions which are missed */
+				new_missed_tx++;
 			}
 
 			tx_buf->print_once = false;
 			missed_tx++;
 		}
 	}
-
+	/* Checking if this TX ring missing TX completions have passed the threshold */
 	if (unlikely(missed_tx > adapter->missing_tx_threshold)) {
 		ena_log(pdev, ERR,
 		    "The number of lost tx completion is above the threshold "
@@ -3123,8 +3125,8 @@ check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
 		ena_trigger_reset(adapter, ENA_REGS_RESET_MISS_TX_CMPL);
 		rc = EIO;
 	}
-
-	counter_u64_add(tx_ring->tx_stats.missing_tx_comp, missed_tx);
+	/* Add the newly discovered missing TX completions */
+	counter_u64_add(tx_ring->tx_stats.missing_tx_comp, new_missed_tx);
 
 	return (rc);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410311559.49VFxu0U056503>