net/ena/base: add Rx cdesc dump on bad request ID
PATCH v2 5/20 net/ena/base: add Rx cdesc dump on bad request ID
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 <[email protected]>
Reviewed-by Amit Bernstein <[email protected]>
Reviewed-by Yosef Raisman <[email protected]>
--- drivers/net/ena/base/ena_eth_com.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ena/base/ena_eth_com.c +8 -4
@@ -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;
Signature · 1 line
2.17.1