Skip to content

Commit

Permalink
net/ena: trigger reset on Tx prepare failure
Browse files Browse the repository at this point in the history
[ upstream commit b57e105 ]

If the prepare function failed, then it means the descriptors are in the
invalid state.

This condition now triggers the reset, which should be further handled
by the application.

To notify the application about prepare function failure, the error log
was added. In general, it should never fail in normal conditions, as the
Tx function checks for the available space in the Tx ring before the
preparation even starts.

Fixes: 2081d5e ("net/ena: add reset routine")

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
  • Loading branch information
Gerwand authored and bluca committed Jul 26, 2021
1 parent f91f60b commit 66d9de1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ena/ena_ethdev.c
Expand Up @@ -2537,7 +2537,11 @@ static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf)
rc = ena_com_prepare_tx(tx_ring->ena_com_io_sq, &ena_tx_ctx,
&nb_hw_desc);
if (unlikely(rc)) {
PMD_DRV_LOG(ERR, "Failed to prepare Tx buffers, rc: %d\n", rc);
++tx_ring->tx_stats.prepare_ctx_err;
tx_ring->adapter->reset_reason =
ENA_REGS_RESET_DRIVER_INVALID_STATE;
tx_ring->adapter->trigger_reset = true;
return rc;
}

Expand Down

0 comments on commit 66d9de1

Please sign in to comment.