From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D921AA034E for ; Mon, 21 Feb 2022 16:38:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D40F9410E0; Mon, 21 Feb 2022 16:38:12 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 2744A4013F for ; Mon, 21 Feb 2022 16:38:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CYcUfSqGHjaOMRcgJXVb130oMyv4rK7F2LNO7GUNmrU=; b=WHPR7drLeOgP44nCrS9kSDU6OfHbAd0CtaYVslROYN1Rt5LqKlHcn1CnFibQFJno6jXH0L Gkbboj7Awjvbb2UbKb6oS3u4iv1TpmYqTIk3ByUOxD18qR85GMz8CIGPlHqkQur7lSslpQ Hp70sh6YBUyrvfnQZOY0mQzQdCEaHe8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446-uKzEzhl1N0CIe0AfqHgw8g-1; Mon, 21 Feb 2022 10:38:07 -0500 X-MC-Unique: uKzEzhl1N0CIe0AfqHgw8g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D33382F47; Mon, 21 Feb 2022 15:38:06 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id C34E97E2F4; Mon, 21 Feb 2022 15:38:05 +0000 (UTC) From: Kevin Traynor To: Michael Baum Cc: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix memory socket selection in ASO management' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:33:51 +0000 Message-Id: <20220221153625.152324-42-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/407b3ae746fe09e1c20292ba80a400c040985042 Thanks. Kevin --- >From 407b3ae746fe09e1c20292ba80a400c040985042 Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Wed, 8 Dec 2021 16:51:34 +0200 Subject: [PATCH] net/mlx5: fix memory socket selection in ASO management [ upstream commit 147f6fb42bd7637b37a9180b0774275531c05f9b ] In ASO objects creation (WQE, CQE and MR), socket number is given as a parameter. The selection was wrongly socket 0 hardcoded even if the user didn't configure memory for this socket. This patch replaces the selection to default socket (SOCKET_ID_ANY). Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_aso.c | 117 +++++++++---------------------- 1 file changed, 32 insertions(+), 85 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index ddf4328dec..eb7fc43da3 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -14,48 +14,4 @@ #include "mlx5_flow.h" -/** - * Destroy Completion Queue used for ASO access. - * - * @param[in] cq - * ASO CQ to destroy. - */ -static void -mlx5_aso_cq_destroy(struct mlx5_aso_cq *cq) -{ - if (cq->cq_obj.cq) - mlx5_devx_cq_destroy(&cq->cq_obj); - memset(cq, 0, sizeof(*cq)); -} - -/** - * Create Completion Queue used for ASO access. - * - * @param[in] ctx - * Context returned from mlx5 open_device() glue function. - * @param[in/out] cq - * Pointer to CQ to create. - * @param[in] log_desc_n - * Log of number of descriptors in queue. - * @param[in] socket - * Socket to use for allocation. - * @param[in] uar_page_id - * UAR page ID to use. - * - * @return - * 0 on success, a negative errno value otherwise and rte_errno is set. - */ -static int -mlx5_aso_cq_create(void *ctx, struct mlx5_aso_cq *cq, uint16_t log_desc_n, - int socket, int uar_page_id) -{ - struct mlx5_devx_cq_attr attr = { - .uar_page_id = uar_page_id, - }; - - cq->log_desc_n = log_desc_n; - cq->cq_ci = 0; - return mlx5_devx_cq_create(ctx, &cq->cq_obj, log_desc_n, &attr, socket); -} - /** * Free MR resources. @@ -85,6 +41,4 @@ mlx5_aso_dereg_mr(struct mlx5_common_device *cdev, struct mlx5_pmd_mr *mr) * @param[in/out] mr * Pointer to MR to create. - * @param[in] socket - * Socket to use for allocation. * * @return @@ -93,11 +47,10 @@ mlx5_aso_dereg_mr(struct mlx5_common_device *cdev, struct mlx5_pmd_mr *mr) static int mlx5_aso_reg_mr(struct mlx5_common_device *cdev, size_t length, - struct mlx5_pmd_mr *mr, int socket) + struct mlx5_pmd_mr *mr) { - int ret; mr->addr = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, length, 4096, - socket); + SOCKET_ID_ANY); if (!mr->addr) { DRV_LOG(ERR, "Failed to create ASO bits mem for MR."); @@ -123,5 +76,5 @@ mlx5_aso_destroy_sq(struct mlx5_aso_sq *sq) { mlx5_devx_sq_destroy(&sq->sq_obj); - mlx5_aso_cq_destroy(&sq->cq); + mlx5_devx_cq_destroy(&sq->cq.cq_obj); memset(sq, 0, sizeof(*sq)); } @@ -227,18 +180,10 @@ mlx5_aso_ct_init_sq(struct mlx5_aso_sq *sq) * Create Send Queue used for ASO access. * - * @param[in] ctx - * Context returned from mlx5 open_device() glue function. + * @param[in] cdev + * Pointer to the mlx5 common device. * @param[in/out] sq * Pointer to SQ to create. - * @param[in] socket - * Socket to use for allocation. * @param[in] uar * User Access Region object. - * @param[in] pdn - * Protection Domain number to use. - * @param[in] log_desc_n - * Log of number of descriptors in queue. - * @param[in] ts_format - * timestamp format supported by the queue. * * @return @@ -246,14 +191,18 @@ mlx5_aso_ct_init_sq(struct mlx5_aso_sq *sq) */ static int -mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket, void *uar, - uint32_t pdn, uint16_t log_desc_n, uint32_t ts_format) +mlx5_aso_sq_create(struct mlx5_common_device *cdev, struct mlx5_aso_sq *sq, + void *uar) { - struct mlx5_devx_create_sq_attr attr = { + struct mlx5_devx_cq_attr cq_attr = { + .uar_page_id = mlx5_os_get_devx_uar_page_id(uar), + }; + struct mlx5_devx_create_sq_attr sq_attr = { .user_index = 0xFFFF, .wq_attr = (struct mlx5_devx_wq_attr){ - .pd = pdn, + .pd = cdev->pdn, .uar_page = mlx5_os_get_devx_uar_page_id(uar), }, - .ts_format = mlx5_ts_format_conv(ts_format), + .ts_format = + mlx5_ts_format_conv(cdev->config.hca_attr.sq_ts_format), }; struct mlx5_devx_modify_sq_attr modify_attr = { @@ -263,12 +212,16 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket, void *uar, int ret; - if (mlx5_aso_cq_create(ctx, &sq->cq, log_desc_n, socket, - mlx5_os_get_devx_uar_page_id(uar))) + if (mlx5_devx_cq_create(cdev->ctx, &sq->cq.cq_obj, + MLX5_ASO_QUEUE_LOG_DESC, &cq_attr, + SOCKET_ID_ANY)) goto error; - sq->log_desc_n = log_desc_n; - attr.cqn = sq->cq.cq_obj.cq->id; + sq->cq.cq_ci = 0; + sq->cq.log_desc_n = MLX5_ASO_QUEUE_LOG_DESC; + sq->log_desc_n = MLX5_ASO_QUEUE_LOG_DESC; + sq_attr.cqn = sq->cq.cq_obj.cq->id; /* for mlx5_aso_wqe that is twice the size of mlx5_wqe */ - log_wqbb_n = log_desc_n + 1; - ret = mlx5_devx_sq_create(ctx, &sq->sq_obj, log_wqbb_n, &attr, socket); + log_wqbb_n = sq->log_desc_n + 1; + ret = mlx5_devx_sq_create(cdev->ctx, &sq->sq_obj, log_wqbb_n, &sq_attr, + SOCKET_ID_ANY); if (ret) { DRV_LOG(ERR, "Can't create SQ object."); @@ -314,10 +267,8 @@ mlx5_aso_queue_init(struct mlx5_dev_ctx_shared *sh, case ASO_OPC_MOD_FLOW_HIT: if (mlx5_aso_reg_mr(cdev, (MLX5_ASO_AGE_ACTIONS_PER_POOL / 8) * - sq_desc_n, &sh->aso_age_mng->aso_sq.mr, 0)) + sq_desc_n, &sh->aso_age_mng->aso_sq.mr)) return -1; - if (mlx5_aso_sq_create(cdev->ctx, &sh->aso_age_mng->aso_sq, 0, - sh->tx_uar.obj, cdev->pdn, - MLX5_ASO_QUEUE_LOG_DESC, - cdev->config.hca_attr.sq_ts_format)) { + if (mlx5_aso_sq_create(cdev, &sh->aso_age_mng->aso_sq, + sh->tx_uar.obj)) { mlx5_aso_dereg_mr(cdev, &sh->aso_age_mng->aso_sq.mr); return -1; @@ -326,8 +277,6 @@ mlx5_aso_queue_init(struct mlx5_dev_ctx_shared *sh, break; case ASO_OPC_MOD_POLICER: - if (mlx5_aso_sq_create(cdev->ctx, &sh->mtrmng->pools_mng.sq, 0, - sh->tx_uar.obj, cdev->pdn, - MLX5_ASO_QUEUE_LOG_DESC, - cdev->config.hca_attr.sq_ts_format)) + if (mlx5_aso_sq_create(cdev, &sh->mtrmng->pools_mng.sq, + sh->tx_uar.obj)) return -1; mlx5_aso_mtr_init_sq(&sh->mtrmng->pools_mng.sq); @@ -336,10 +285,8 @@ mlx5_aso_queue_init(struct mlx5_dev_ctx_shared *sh, /* 64B per object for query. */ if (mlx5_aso_reg_mr(cdev, 64 * sq_desc_n, - &sh->ct_mng->aso_sq.mr, 0)) + &sh->ct_mng->aso_sq.mr)) return -1; - if (mlx5_aso_sq_create(cdev->ctx, &sh->ct_mng->aso_sq, 0, - sh->tx_uar.obj, cdev->pdn, - MLX5_ASO_QUEUE_LOG_DESC, - cdev->config.hca_attr.sq_ts_format)) { + if (mlx5_aso_sq_create(cdev, &sh->ct_mng->aso_sq, + sh->tx_uar.obj)) { mlx5_aso_dereg_mr(cdev, &sh->ct_mng->aso_sq.mr); return -1; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:45.559397290 +0000 +++ 0042-net-mlx5-fix-memory-socket-selection-in-ASO-manageme.patch 2022-02-21 15:22:44.087704116 +0000 @@ -1 +1 @@ -From 147f6fb42bd7637b37a9180b0774275531c05f9b Mon Sep 17 00:00:00 2001 +From 407b3ae746fe09e1c20292ba80a400c040985042 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 147f6fb42bd7637b37a9180b0774275531c05f9b ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org