git: a244d6ec4ea8 - stable/12 - ena: Extend debug prints for invalid req_id resets

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Tue, 26 Jul 2022 19:33:21 UTC
The branch stable/12 has been updated by mw:

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

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

    ena: Extend debug prints for invalid req_id resets
    
    Print information about qid if req_id is invalid. Add information about
    qid and req_id if mbuf is invalid.
    
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit a9c39b031fe89a6414174e3db82da6548d7fff0f)
---
 sys/dev/ena/ena_datapath.c | 7 +++++--
 sys/dev/ena/ena_netmap.c   | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c
index fac8cdf488f3..e3d30b32fceb 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -213,7 +213,8 @@ ena_get_tx_req_id(struct ena_ring *tx_ring, struct ena_com_io_cq *io_cq,
 		return (EAGAIN);
 
 	if (unlikely(rc != 0)) {
-		ena_log(adapter->pdev, ERR, "Invalid req_id: %hu\n", *req_id);
+		ena_log(adapter->pdev, ERR, "Invalid req_id %hu in qid %hu\n",
+		    *req_id, tx_ring->qid);
 		counter_u64_add(tx_ring->tx_stats.bad_req_id, 1);
 		goto err;
 	}
@@ -221,7 +222,9 @@ ena_get_tx_req_id(struct ena_ring *tx_ring, struct ena_com_io_cq *io_cq,
 	if (tx_ring->tx_buffer_info[*req_id].mbuf != NULL)
 		return (0);
 
-	ena_log(adapter->pdev, ERR, "tx_info doesn't have valid mbuf\n");
+	ena_log(adapter->pdev, ERR,
+	    "tx_info doesn't have valid mbuf. qid %hu req_id %hu\n",
+	    tx_ring->qid, *req_id);
 err:
 	ena_trigger_reset(adapter, ENA_REGS_RESET_INV_TX_REQ_ID);
 
diff --git a/sys/dev/ena/ena_netmap.c b/sys/dev/ena/ena_netmap.c
index e9511b033fd3..476926da373d 100644
--- a/sys/dev/ena/ena_netmap.c
+++ b/sys/dev/ena/ena_netmap.c
@@ -884,7 +884,8 @@ validate_tx_req_id(struct ena_ring *tx_ring, uint16_t req_id)
 	if (likely(req_id < tx_ring->ring_size))
 		return (0);
 
-	ena_log_nm(adapter->pdev, WARN, "Invalid req_id: %hu\n", req_id);
+	ena_log_nm(adapter->pdev, WARN, "Invalid req_id %hu in qid %hu\n",
+	    req_id, tx_ring->qid);
 	counter_u64_add(tx_ring->tx_stats.bad_req_id, 1);
 
 	ena_trigger_reset(adapter, ENA_REGS_RESET_INV_TX_REQ_ID);