DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shai Brandes <shaibran@amazon.com>
To: <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, Shai Brandes <shaibran@amazon.com>
Subject: [PATCH 06/21] net/ena/base: add Rx cdesc dump on bad request ID
Date: Wed, 15 Oct 2025 10:09:32 +0300	[thread overview]
Message-ID: <20251015070932.504-1-shaibran@amazon.com> (raw)

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


                 reply	other threads:[~2025-10-15  7:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251015070932.504-1-shaibran@amazon.com \
    --to=shaibran@amazon.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).