[PATCH v2 05/20] net/ena/base: add Rx cdesc dump on bad request ID
Shai Brandes
shaibran at amazon.com
Wed Oct 15 14:06:43 CEST 2025
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 at amazon.com>
Reviewed-by: Amit Bernstein <amitbern at amazon.com>
Reviewed-by: Yosef Raisman <yraisman at 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
More information about the dev
mailing list