patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Dawid Gorecki <dgr@semihalf.com>
To: stable@dpdk.org
Cc: Dawid Gorecki <dgr@semihalf.com>,
	Michal Krawczyk <mk@semihalf.com>,
	Shai Brandes <shaibran@amazon.com>
Subject: [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ
Date: Mon, 14 Mar 2022 15:42:34 +0100	[thread overview]
Message-ID: <20220314144228.2475-1-dgr@semihalf.com> (raw)

[ 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


             reply	other threads:[~2022-03-15 11:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 14:42 Dawid Gorecki [this message]
2022-03-14 14:42 ` [PATCH 19.11 2/2] net/ena: fix reset reason being overwritten Dawid Gorecki
2022-03-22 12:22 ` [PATCH 19.11 1/2] net/ena: check memory BAR before initializing LLQ Dawid Górecki

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=20220314144228.2475-1-dgr@semihalf.com \
    --to=dgr@semihalf.com \
    --cc=mk@semihalf.com \
    --cc=shaibran@amazon.com \
    --cc=stable@dpdk.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).