DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 06/21] net/ena/base: add Rx cdesc dump on bad request ID
@ 2025-10-15  7:09 Shai Brandes
  0 siblings, 0 replies; only message in thread
From: Shai Brandes @ 2025-10-15  7:09 UTC (permalink / raw)
  To: stephen; +Cc: dev, Shai Brandes

This patch moves the check of bad req_id from ena_com_rx_pkt() to
ena_com_cdesc_rx_pkt_get(), such that on bad req_id the head will point
to it and later the descriptor will be dumped.

Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
Reviewed-by: Yosef Raisman <yraisman@amazon.com>
---
 drivers/net/ena/base/ena_eth_com.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ena/base/ena_eth_com.c b/drivers/net/ena/base/ena_eth_com.c
index fd98e5ae67..212adc7d1f 100644
--- a/drivers/net/ena/base/ena_eth_com.c
+++ b/drivers/net/ena/base/ena_eth_com.c
@@ -322,6 +322,13 @@ static int ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
 			return ENA_COM_FAULT;
 		}
 
+		if (unlikely(cdesc->base.req_id >= io_cq->q_depth)) {
+			ena_trc_err(dev,
+				    "Bad req_id in descriptor #%u on q_id: %u, req_id: %u\n",
+				    count, io_cq->qid, cdesc->base.req_id);
+			return ENA_COM_EIO;
+		}
+
 		ena_com_cq_inc_head(io_cq);
 		count++;
 		last = ENA_FIELD_GET(status,
@@ -624,7 +631,6 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
 {
 	struct ena_com_rx_buf_info *ena_buf = &ena_rx_ctx->ena_bufs[0];
 	struct ena_eth_io_rx_cdesc_ext *cdesc = NULL;
-	u16 q_depth = io_cq->q_depth;
 	u16 cdesc_idx = 0;
 	u16 nb_hw_desc;
 	u16 i = 0;
@@ -635,7 +641,7 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
 
 	rc = ena_com_cdesc_rx_pkt_get(io_cq, &cdesc_idx, &nb_hw_desc);
 	if (unlikely(rc != ENA_COM_OK))
-		return ENA_COM_FAULT;
+		return rc;
 
 	if (nb_hw_desc == 0) {
 		ena_rx_ctx->descs = nb_hw_desc;
@@ -659,8 +665,6 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
 	do {
 		ena_buf[i].len = cdesc->base.length;
 		ena_buf[i].req_id = cdesc->base.req_id;
-		if (unlikely(ena_buf[i].req_id >= q_depth))
-			return ENA_COM_EIO;
 
 		if (++i >= nb_hw_desc)
 			break;
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-15  7:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15  7:09 [PATCH 06/21] net/ena/base: add Rx cdesc dump on bad request ID Shai Brandes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).