Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 19:30:52 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c41b1259ceb1 - stable/13 - ena: Store ticks of last Tx cleanup
Message-ID:  <202207261930.26QJUqMQ029637@gitrepo.freebsd.org>

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

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

commit c41b1259ceb110b9ca0b0f57e7c153d0194d7084
Author:     Dawid Gorecki <dgr@semihalf.com>
AuthorDate: 2022-06-10 09:18:09 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-07-26 19:30:15 +0000

    ena: Store ticks of last Tx cleanup
    
    Store timestamp of last cleanup in Tx ring structure. This does not
    change anything during normal operation of the driver but could be
    useful when the device fails for some reason.
    
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit d8aba82b5ca75f1a5bff609af141844c4fc9de70)
---
 sys/dev/ena/ena.c          | 17 ++++++++++++++---
 sys/dev/ena/ena.h          |  2 ++
 sys/dev/ena/ena_datapath.c |  2 ++
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index d127f87ac8c6..044a8327972e 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -439,6 +439,7 @@ ena_init_io_rings_advanced(struct ena_adapter *adapter)
 		/* Allocate Tx statistics. */
 		ena_alloc_counters((counter_u64_t *)&txr->tx_stats,
 		    sizeof(txr->tx_stats));
+		txr->tx_last_cleanup_ticks = ticks;
 
 		/* Allocate Rx statistics. */
 		ena_alloc_counters((counter_u64_t *)&rxr->rx_stats,
@@ -3007,6 +3008,8 @@ check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
 	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;
@@ -3040,10 +3043,18 @@ check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
 		/* Check again if packet is still waiting */
 		if (unlikely(time_offset > adapter->missing_tx_timeout)) {
 
-			if (!tx_buf->print_once)
+			if (!tx_buf->print_once) {
+				time_since_last_cleanup = TICKS_2_USEC(ticks -
+				    tx_ring->tx_last_cleanup_ticks);
+				missing_tx_comp_to =
+				    sbttoms(adapter->missing_tx_timeout);
 				ena_log(pdev, WARN, "Found a Tx that wasn't "
-				    "completed on time, qid %d, index %d.\n",
-				    tx_ring->qid, i);
+				    "completed on time, qid %d, index %d."
+				    "%d usecs have passed since last cleanup."
+				    "Missing Tx timeout value %d msecs.\n",
+				    tx_ring->qid, i, time_since_last_cleanup,
+				    missing_tx_comp_to);
+			}
 
 			tx_buf->print_once = true;
 			missed_tx++;
diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h
index 85f353e7ab54..56e14bd800ff 100644
--- a/sys/dev/ena/ena.h
+++ b/sys/dev/ena/ena.h
@@ -374,6 +374,8 @@ struct ena_ring {
 	/* Used for LLQ */
 	uint8_t *push_buf_intermediate_buf;
 
+	int tx_last_cleanup_ticks;
+
 #ifdef DEV_NETMAP
 	bool initialized;
 #endif /* DEV_NETMAP */
diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c
index 6c18a4f5c1f9..85e9274eef14 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -344,6 +344,8 @@ ena_tx_cleanup(struct ena_ring *tx_ring)
 		ENA_RING_MTX_UNLOCK(tx_ring);
 	}
 
+	tx_ring->tx_last_cleanup_ticks = ticks;
+
 	return (work_done);
 }
 



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