* [PATCH 19.11 2/2] net/ena: fix reset reason being overwritten
2022-03-14 14:42 [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ Dawid Gorecki
@ 2022-03-14 14:42 ` Dawid Gorecki
2022-03-22 12:22 ` [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ Dawid Górecki
1 sibling, 0 replies; 3+ messages in thread
From: Dawid Gorecki @ 2022-03-14 14:42 UTC (permalink / raw)
To: stable; +Cc: Dawid Gorecki, Michal Krawczyk, Shai Brandes
[ upstream commit 2bae75eaa2e036020b726f61bc607a8f4142c3a8 ]
When triggering the reset, no check was performed to see if the reset
was already triggered. This could result in original reset reason being
overwritten. Add ena_trigger_reset helper function, which checks if the
reset was triggered and only sets the reset reason if the reset wasn't
triggered yet. Replace all occurrences of manually setting the reset
with ena_trigger_reset call.
Fixes: 2081d5e2e92d ("net/ena: add reset routine")
Cc: stable@dpdk.org
Signed-off-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
---
drivers/net/ena/ena_ethdev.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index dc30370a8f..818e1a179c 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -272,6 +272,15 @@ static const struct eth_dev_ops ena_dev_ops = {
.reta_query = ena_rss_reta_query,
};
+static inline void ena_trigger_reset(struct ena_adapter *adapter,
+ enum ena_regs_reset_reason_types reason)
+{
+ if (likely(!adapter->trigger_reset)) {
+ adapter->reset_reason = reason;
+ adapter->trigger_reset = true;
+ }
+}
+
static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
struct ena_com_rx_ctx *ena_rx_ctx)
{
@@ -378,8 +387,7 @@ static inline int validate_rx_req_id(struct ena_ring *rx_ring, uint16_t req_id)
PMD_DRV_LOG(ERR, "Invalid rx req_id: %hu\n", req_id);
- rx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID;
- rx_ring->adapter->trigger_reset = true;
+ ena_trigger_reset(rx_ring->adapter, ENA_REGS_RESET_INV_RX_REQ_ID);
++rx_ring->rx_stats.bad_req_id;
return -EFAULT;
@@ -402,8 +410,7 @@ static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
/* Trigger device reset */
++tx_ring->tx_stats.bad_req_id;
- tx_ring->adapter->reset_reason = ENA_REGS_RESET_INV_TX_REQ_ID;
- tx_ring->adapter->trigger_reset = true;
+ ena_trigger_reset(tx_ring->adapter, ENA_REGS_RESET_INV_TX_REQ_ID);
return -EFAULT;
}
@@ -1574,8 +1581,7 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter)
if (unlikely((rte_get_timer_cycles() - adapter->timestamp_wd) >=
adapter->keep_alive_timeout)) {
PMD_DRV_LOG(ERR, "Keep alive timeout\n");
- adapter->reset_reason = ENA_REGS_RESET_KEEP_ALIVE_TO;
- adapter->trigger_reset = true;
+ ena_trigger_reset(adapter, ENA_REGS_RESET_KEEP_ALIVE_TO);
++adapter->dev_stats.wd_expired;
}
}
@@ -1585,8 +1591,7 @@ static void check_for_admin_com_state(struct ena_adapter *adapter)
{
if (unlikely(!ena_com_get_admin_running_state(&adapter->ena_dev))) {
PMD_DRV_LOG(ERR, "ENA admin queue is not in running state!\n");
- adapter->reset_reason = ENA_REGS_RESET_ADMIN_TO;
- adapter->trigger_reset = true;
+ ena_trigger_reset(adapter, ENA_REGS_RESET_ADMIN_TO);
}
}
@@ -2133,9 +2138,8 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
&ena_rx_ctx);
if (unlikely(rc)) {
PMD_DRV_LOG(ERR, "ena_com_rx_pkt error %d\n", rc);
- rx_ring->adapter->reset_reason =
- ENA_REGS_RESET_TOO_MANY_RX_DESCS;
- rx_ring->adapter->trigger_reset = true;
+ ena_trigger_reset(rx_ring->adapter,
+ ENA_REGS_RESET_TOO_MANY_RX_DESCS);
++rx_ring->rx_stats.bad_desc_num;
return 0;
}
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ
2022-03-14 14:42 [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ Dawid Gorecki
2022-03-14 14:42 ` [PATCH 19.11 2/2] net/ena: fix reset reason being overwritten Dawid Gorecki
@ 2022-03-22 12:22 ` Dawid Górecki
1 sibling, 0 replies; 3+ messages in thread
From: Dawid Górecki @ 2022-03-22 12:22 UTC (permalink / raw)
To: christian.ehrhardt; +Cc: stable
Hi,
On Mon, Mar 14, 2022 at 03:42:34PM +0100, Dawid Gorecki wrote:
> [ upstream commit 9ae7a13f8247319f63402107c8304ba57c3f4308 ]
>
> The ena_com_config_dev_mode() performs many calculations related to LLQ
> and then performs an admin queue call to configure LLQ in the device.
>
> All of the operations performed by ena_com_config_dev_mode() are
> unnecessary if membar hasn't been found. Move the dev_mem_base check
> before ena_com_config_dev_mode() call. This prevents the unnecessary
> operations from being performed.
>
> Fixes: 2fca2a98c0d1 ("net/ena: support LLQv2")
> Cc: stable@dpdk.org
>
> Signed-off-by: Dawid Gorecki <dgr@semihalf.com>
> Reviewed-by: Michal Krawczyk <mk@semihalf.com>
> Reviewed-by: Shai Brandes <shaibran@amazon.com>
> ---
> drivers/net/ena/ena_ethdev.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
> index 7601d2fa25..dc30370a8f 100644
> --- a/drivers/net/ena/ena_ethdev.c
> +++ b/drivers/net/ena/ena_ethdev.c
> @@ -1637,6 +1637,13 @@ ena_set_queues_placement_policy(struct ena_adapter *adapter,
> return 0;
> }
>
> + if (adapter->dev_mem_base == NULL) {
> + PMD_DRV_LOG(ERR,
> + "LLQ is advertised as supported, but device doesn't expose mem bar\n");
> + ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
> + return 0;
> + }
> +
> rc = ena_com_config_dev_mode(ena_dev, llq, llq_default_configurations);
> if (unlikely(rc)) {
> PMD_INIT_LOG(WARNING, "Failed to config dev mode. "
> @@ -1649,13 +1656,6 @@ ena_set_queues_placement_policy(struct ena_adapter *adapter,
> if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST)
> return 0;
>
> - if (!adapter->dev_mem_base) {
> - PMD_DRV_LOG(ERR, "Unable to access LLQ bar resource. "
> - "Fallback to host mode policy.\n.");
> - ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
> - return 0;
> - }
> -
> ena_dev->mem_bar = adapter->dev_mem_base;
>
> return 0;
> --
> 2.35.1
>
I sent the patches last Monday but they didn't make it into the 19.11
branch. I didn't get any response but looking at the mailing list
archive it seems that the messages made it to the list. Were there any
issues with the patches or were they overlooked?
Best regards,
Dawid
^ permalink raw reply [flat|nested] 3+ messages in thread