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 12F32A0548; Thu, 4 Nov 2021 13:50:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A10B742740; Thu, 4 Nov 2021 13:50:04 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2068.outbound.protection.outlook.com [40.107.92.68]) by mails.dpdk.org (Postfix) with ESMTP id C6FD54271B for ; Thu, 4 Nov 2021 13:50:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CEtyzyCt6OKv3xVXNuILkXq5e10s4f/54sFjw1XrqdV5HENEdYZ8VsHlebBCCOH4c7nXnXBChIlS6t01q4sSbHW6+s0k2l27VjdFCox1naYThU39Dat/XtsiyHzceK1b4R/HAaJyJCrylh9Y+TvtcMdV6UjXjIoLv+mOXwExteOqo0gF00unVVe/xKxktgfArmgLzMDD7BGz3SZP2lr44KtFbD8FwljRaZuiWmKbQsNjaj5I08o6YEXfC8Qw+mVgW/0hKQBihhCB3CydsiJh4QCKGkIyuRvgc25LUyzqRagbWRc+2IaJXWkUOszj/QjnTNLtOg/v8oc+arZsiVoU/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XrUsgZM8b2y/auhjIPSQEdN7+T5GfgEO08JbxTibM9w=; b=jDvXUpC7i69BZjTyar3q95OPyKDmHS90WfVu10izVoRm+yM9z6AdsvWcxxpgbyJX3D2oqVTiXN4hSdlTLY/Q6L58jcjPtnpocWyLADs71eGSKPpLP1gQrmJGv3Gi/uP0daCLIwi22Tuy/r//sOqG2LvtlleT+yeDz/L7osV6+P35l+KB4ROk2oqC4inixXR/ky25jIp8exU427HlR6OweISVydrGuLES5im48YB3xA0C3u2GQ7RxWSpVMaM2uauenSQYTjvDoZa+wSBVgGyLFUDz44lzARF6SmShFqa/64od7zCrh3q+olat/Aee2QDwNSmc2eThcoMuwI3+BolghQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XrUsgZM8b2y/auhjIPSQEdN7+T5GfgEO08JbxTibM9w=; b=M2CEqvcAlUQ6x96tsSzJNHhw2/F79g6zXdbx5szClb9lyyf5sccnoMPc9q69paU087rjYKk5KcO0Img3CPz2PAHK2r/+knciYEjNdMDDCp/X1uTX5u6CiVmJC+wAjBw+/4DY4Q1Arb5/V0KjXjGUt9Qz7q7NMeaua9W5O03bHojF4X0v9N2NFGZBrb3hN6CG/YE+riIwHdyvq/GLs9PKj4VXNcNPVcSYn3xebJTpIAJwhnqMERJAdPznk0TQt3RY84BMzK41upbySpaML1zTZDZlhQhU+eSOlwjwxTnD/WZsP8oqtmJm9rd60oPBMgiypUN3ymGx5WQAjaBKWaskzQ== Received: from BN9PR03CA0391.namprd03.prod.outlook.com (2603:10b6:408:111::6) by BL1PR12MB5189.namprd12.prod.outlook.com (2603:10b6:208:308::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Thu, 4 Nov 2021 12:50:01 +0000 Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::2b) by BN9PR03CA0391.outlook.office365.com (2603:10b6:408:111::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Thu, 4 Nov 2021 12:50:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT045.mail.protection.outlook.com (10.13.177.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Thu, 4 Nov 2021 12:50:01 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 4 Nov 2021 12:49:56 +0000 From: Raja Zidane To: CC: Matan Azrad Date: Thu, 4 Nov 2021 12:49:29 +0000 Message-ID: <20211104124929.24899-5-rzidane@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211104124929.24899-1-rzidane@nvidia.com> References: <20211104124929.24899-1-rzidane@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4550dc57-4106-42ee-9782-08d99f919d93 X-MS-TrafficTypeDiagnostic: BL1PR12MB5189: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZAEhptgFdA2MhzLNaN8OWG14+kMC9mw5RiC+k31vu77WWZ6Ulv3jqWEMQaJIJ8T1v+6nwap64l0D9pZD4lmvRFZajYA8Wc1ufxUMfplJqukcyqN5fpk4iE2gtVdT+FCEWX2DM7ZOcWJt9h4u6iktFmlixIZO2ooG+L+CNXSXl76mLxsSnQSBXlZysOrTTBIvKUgDQxRCObFVijjKJfdgVaxnVY3/8a/At3PT0lvNwMnEXNY5FqugOt9Sxhuj/1HACisyONU3hJgO8/7Dk6MngOruwSoIWNp1FOW2O0RpnqeRN8rceF06ayDG4mewB7KI/J3ELm5MzNvAwPJ21yTNWcPC8JMI2Sj/sQEM+PvjUx1gveTwWwW1eJfnFsT0pyAzImKJd2C2hgjPs/+8PB2jyV0VABYLwIQqxqQ56fg9zWOhY/tSILA7k/z8CWp+jeZ2KRCfcw1pz3BR/ChIS+VNundBTR4h4yhL6TyeDhizhOUKez9++JnCkb94s4avztm9WFHzSGmn8gZzKWO9XmXX/V/yJpCKSvaRstazVQtHipv4juEpsxqTY960P7/xUGKnHmEQdDzX/Ct8x5jt5h5HUpM+7rYNq5A4H2lID7PGW3PXRSX+3YnUTx8cW1IVYxY1gJbL9CzH2tMrpDd+XUz9z5zSbE2NY2BlyvZvSvSxIpystlYAAxGvZQEFIr1TRdSR3tpk0G1HSJCiZzaMGb5kVA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(4326008)(86362001)(55016002)(16526019)(8676002)(70206006)(2906002)(6666004)(47076005)(8936002)(508600001)(186003)(336012)(70586007)(5660300002)(7636003)(36860700001)(82310400003)(1076003)(426003)(107886003)(6286002)(356005)(6916009)(2616005)(26005)(83380400001)(36756003)(316002)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2021 12:50:01.0566 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4550dc57-4106-42ee-9782-08d99f919d93 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5189 Subject: [dpdk-dev] [PATCH 4/4] common/mlx5: fix RQ size configuration in QP create X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The number of WQEBBs was provided to QP create, and QP size was calculated by multiplying the number of WQEBBs by 64, which is the send WQE size. When creating RQ in the QP (i.e., vdpa driver), the queue size was bigger because the receive WQE size is 16. Provide queue size to QP create instead of the number of WQEBBs. Fixes: f9213ab12cf9 ("common/mlx5: share DevX queue pair operations") Signed-off-by: Raja Zidane Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common_devx.c | 9 ++++----- drivers/common/mlx5/mlx5_common_devx.h | 2 +- drivers/compress/mlx5/mlx5_compress.c | 5 +++-- drivers/crypto/mlx5/mlx5_crypto.c | 5 +++-- drivers/regex/mlx5/mlx5_regex_control.c | 4 ++-- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 5 +++-- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_devx.c b/drivers/common/mlx5/mlx5_common_devx.c index 0e58308b0b..cd491012a0 100644 --- a/drivers/common/mlx5/mlx5_common_devx.c +++ b/drivers/common/mlx5/mlx5_common_devx.c @@ -305,8 +305,8 @@ mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp) * Context returned from mlx5 open_device() glue function. * @param[in/out] qp_obj * Pointer to QP to create. - * @param[in] log_wqbb_n - * Log of number of WQBBs in queue. + * @param[in] queue_size + * Size of queue to create. * @param[in] attr * Pointer to QP attributes structure. * @param[in] socket @@ -316,7 +316,7 @@ mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n, +mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t queue_size, struct mlx5_devx_qp_attr *attr, int socket) { struct mlx5_devx_obj *qp = NULL; @@ -324,7 +324,6 @@ mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n, void *umem_buf = NULL; size_t alignment = MLX5_WQE_BUF_ALIGNMENT; uint32_t umem_size, umem_dbrec; - uint32_t num_of_wqbbs = RTE_BIT32(log_wqbb_n); int ret; if (alignment == (size_t)-1) { @@ -333,7 +332,7 @@ mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n, return -rte_errno; } /* Allocate memory buffer for WQEs and doorbell record. */ - umem_size = MLX5_WQE_SIZE * num_of_wqbbs; + umem_size = queue_size; umem_dbrec = RTE_ALIGN(umem_size, MLX5_DBR_SIZE); umem_size += MLX5_DBR_SIZE; umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size, diff --git a/drivers/common/mlx5/mlx5_common_devx.h b/drivers/common/mlx5/mlx5_common_devx.h index 7138bd7914..14e90ddb38 100644 --- a/drivers/common/mlx5/mlx5_common_devx.h +++ b/drivers/common/mlx5/mlx5_common_devx.h @@ -76,7 +76,7 @@ void mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp); __rte_internal int mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, - uint32_t log_wqbb_n, + uint32_t queue_size, struct mlx5_devx_qp_attr *attr, int socket); __rte_internal diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 6bb750781f..e7344c9d92 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -247,8 +247,9 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, qp_attr.num_of_send_wqbbs = RTE_BIT32(log_ops_n); qp_attr.mmo = priv->mmo_decomp_qp && priv->mmo_comp_qp && priv->mmo_dma_qp; - ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp, log_ops_n, &qp_attr, - socket_id); + ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp, + qp_attr.num_of_send_wqbbs * + MLX5_WQE_SIZE, &qp_attr, socket_id); if (ret != 0) { DRV_LOG(ERR, "Failed to create QP."); goto err; diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 7931a84070..56941a5c1c 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -641,8 +641,9 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, attr.num_of_send_wqbbs = RTE_BIT32(log_wqbb_n); attr.ts_format = mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format); - ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp_obj, log_wqbb_n, - &attr, socket_id); + ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp_obj, + attr.num_of_send_wqbbs * MLX5_WQE_SIZE, + &attr, socket_id); if (ret) { DRV_LOG(ERR, "Failed to create QP."); goto error; diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c index 4491f1c98a..2c1d933bbf 100644 --- a/drivers/regex/mlx5/mlx5_regex_control.c +++ b/drivers/regex/mlx5/mlx5_regex_control.c @@ -155,8 +155,8 @@ regex_ctrl_create_hw_qp(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp, log_nb_desc)); attr.mmo = priv->mmo_regex_qp_cap; ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp_obj->qp_obj, - MLX5_REGEX_WQE_LOG_NUM(priv->has_umr, log_nb_desc), - &attr, SOCKET_ID_ANY); + attr.num_of_send_wqbbs * MLX5_WQE_SIZE, &attr, + SOCKET_ID_ANY); if (ret) { DRV_LOG(ERR, "Can't create QP object."); rte_errno = ENOMEM; diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index 759d7633c9..3590afd52c 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -613,8 +613,9 @@ mlx5_vdpa_event_qp_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n, attr.num_of_send_wqbbs = 0; /* No need SQ. */ attr.ts_format = mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format); - ret = mlx5_devx_qp_create(priv->cdev->ctx, &(eqp->sw_qp), log_desc_n, - &attr, SOCKET_ID_ANY); + ret = mlx5_devx_qp_create(priv->cdev->ctx, &(eqp->sw_qp), + attr.num_of_receive_wqes * + MLX5_WSEG_SIZE, &attr, SOCKET_ID_ANY); if (ret) { DRV_LOG(ERR, "Failed to create SW QP(%u).", rte_errno); goto error; -- 2.17.1