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.
This commit is contained in:
Dawid Gorecki 2022-06-10 11:18:09 +02:00 committed by Marcin Wojtas
parent 90232d18ca
commit d8aba82b5c
3 changed files with 18 additions and 3 deletions

View File

@ -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++;

View File

@ -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 */

View File

@ -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);
}