Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 19:33:36 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 417cd20ee3c4 - stable/12 - ena: Fix LLQ descriptor reconfiguration
Message-ID:  <202207261933.26QJXamT034081@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=417cd20ee3c470ae76bfc9305eea5600588c28b9

commit 417cd20ee3c470ae76bfc9305eea5600588c28b9
Author:     Michal Krawczyk <mk@semihalf.com>
AuthorDate: 2022-07-05 10:59:25 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-07-26 19:33:05 +0000

    ena: Fix LLQ descriptor reconfiguration
    
    After the device reset, the LLQ configuration descriptor wasn't passed
    to the hardware. On a 6-generation AWS instances (like C6gn), it is
    required to pass the LLQ descriptor after the device reset, otherwise
    the hardware will be missing the LLQ configuration resulting in
    performance degradation.
    
    This patch reconfigures the LLQ each time the ena_device_init() is
    called. This means that the LLQ descriptor will be passed during the
    initial configuration and after a reset.
    
    The ena_map_llq_mem_bar() function call was moved before the
    ena_device_init() call, to make sure that the mem bar is available.
    
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
    
    (cherry picked from commit 3324e304c14d121dc04338a38c7f3277cbfba58b)
---
 sys/dev/ena/ena.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index 3efc0021a746..a93e55e36bde 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -2583,8 +2583,7 @@ ena_map_llq_mem_bar(device_t pdev, struct ena_com_dev *ena_dev)
 	    RF_ACTIVE);
 	if (unlikely(adapter->memory == NULL)) {
 		ena_log(pdev, WARN,
-		    "unable to allocate LLQ bar resource. Fallback to host mode policy.\n");
-		ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
+		    "Unable to allocate LLQ bar resource. LLQ mode won't be used.\n");
 		return (0);
 	}
 
@@ -2769,6 +2768,7 @@ static int
 ena_device_init(struct ena_adapter *adapter, device_t pdev,
     struct ena_com_dev_get_features_ctx *get_feat_ctx, int *wd_active)
 {
+	struct ena_llq_configurations llq_config;
 	struct ena_com_dev *ena_dev = adapter->ena_dev;
 	bool readless_supported;
 	uint32_t aenq_groups;
@@ -2848,6 +2848,15 @@ ena_device_init(struct ena_adapter *adapter, device_t pdev,
 
 	*wd_active = !!(aenq_groups & BIT(ENA_ADMIN_KEEP_ALIVE));
 
+	set_default_llq_configurations(&llq_config, &get_feat_ctx->llq);
+
+	rc = ena_set_queues_placement_policy(pdev, ena_dev, &get_feat_ctx->llq,
+	    &llq_config);
+	if (unlikely(rc != 0)) {
+		ena_log(pdev, ERR, "Failed to set placement policy\n");
+		goto err_admin_init;
+	}
+
 	return (0);
 
 err_admin_init:
@@ -3491,7 +3500,6 @@ static int
 ena_attach(device_t pdev)
 {
 	struct ena_com_dev_get_features_ctx get_feat_ctx;
-	struct ena_llq_configurations llq_config;
 	struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 };
 	static int version_printed;
 	struct ena_adapter *adapter;
@@ -3564,7 +3572,11 @@ ena_attach(device_t pdev)
 		goto err_bus_free;
 	}
 
-	ena_dev->tx_mem_queue_type = ENA_ADMIN_PLACEMENT_POLICY_HOST;
+	rc = ena_map_llq_mem_bar(pdev, ena_dev);
+	if (unlikely(rc != 0)) {
+		ena_log(pdev, ERR, "Failed to map ENA mem bar");
+		goto err_bus_free;
+	}
 
 	/* Initially clear all the flags */
 	ENA_FLAG_ZERO(adapter);
@@ -3577,21 +3589,6 @@ ena_attach(device_t pdev)
 		goto err_bus_free;
 	}
 
-	set_default_llq_configurations(&llq_config, &get_feat_ctx.llq);
-
-	rc = ena_map_llq_mem_bar(pdev, ena_dev);
-	if (unlikely(rc != 0)) {
-		ena_log(pdev, ERR, "failed to map ENA mem bar");
-		goto err_com_free;
-	}
-
-	rc = ena_set_queues_placement_policy(pdev, ena_dev, &get_feat_ctx.llq,
-	    &llq_config);
-	if (unlikely(rc != 0)) {
-		ena_log(pdev, ERR, "failed to set placement policy\n");
-		goto err_com_free;
-	}
-
 	if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV)
 		adapter->disable_meta_caching = !!(
 		    get_feat_ctx.llq.accel_mode.u.get.supported_flags &



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207261933.26QJXamT034081>