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 51F97A0543; Mon, 6 Jun 2022 13:21:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C5ED427F0; Mon, 6 Jun 2022 13:21:41 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id CF15740150; Mon, 6 Jun 2022 13:21:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R3e0Gaw/ohlzrB9tj7jAi6VT+S7Qn2yokj+p+dacjBT9/XPH4VgX/FIctKzGohafl+bqCnnXmD+QGo2WfFNHG5wkm1vKD7sg2JCj6qyB1y+gKFP2njdUKlNM2qFAGcbtk/PtWlhYeNteTETCrX86mLRDEC4V8v+3ULWR2JbiDtX6Akjrp46vr9EIFx46PjEunPbsuQixkfV8ZOmoXbzYwUYyZ0pmkyhBhcY1EbH8LrwR8nLebhLfrCJbBdzBAMfsYLPww8GAuvivpU9JG5pMNFHLhC33ROCXRKM4M1uj3c4f/us3ystYmBwrRaWAjDxUB7mJ8saUkrgHTLuk6eJWYQ== 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=RAN/gXubkThMQrVMf7+vEVmRYwtqH62xGWmAZeglDoQ=; b=VWtlJB5v1SaddaiPfdIwJ67RHZm7o0DCUdmbTeg/9w4/H+gDcRD3ECRMw2VKxZZOfV7BvQonU0TizYQKd/XfS9lWb5xH/G+KSE4HKemXWqllRiH5WnBrDfb7FAAH9iZJXrLkysIJAJ6zWKrmqfoJajbO4gFcH3YMxF1Qr74JaU88fhLVAzJHuUChXc8MydqmQ10o1oUdtMOj8GqiqAp7vO1I+qDphPv7AruCLB8zY19ls/Oz7mSVgRPKG5TQ9A/B7zGkqbWfvG/GGqsk4OIKETuW1+iy5YaUwT68pccyN94x1fP61ENu/vkZkTb8oxRFmsjxvteMivJtwnp+1j8OjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=RAN/gXubkThMQrVMf7+vEVmRYwtqH62xGWmAZeglDoQ=; b=IUk2Sq4naNiPFuzAK3/+nOnnpe5znCQnhThXiRgNTu2lL2yLr0iM3GfqkdRr/Ymogtdz9cp9Lz+8ml4V479oNbUf3rIyvKWSVnHc2mDKxI0stcS8pLSOW3egFRIoDew0rpWX6DhuqvVmbF1u1bb5jQQCzm+v59tgwG/GBNlTmT4+DPCLumDumPDiWADpOD9pW8AMwIhiLucPB/zmpUujPL7AYCTxg9vTVAUiDTp0yOlO46gDW9NHlSFk56pjyRZ3j68Dh3HcuzR9lxNYA60FiNb5r+0WSukMMG4tt/82aSyXh/rQ5o/h6lX5ehfbCyMjORihfLr33nvXSO7hK4mj8Q== Received: from BN8PR12CA0014.namprd12.prod.outlook.com (2603:10b6:408:60::27) by MN2PR12MB2861.namprd12.prod.outlook.com (2603:10b6:208:af::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Mon, 6 Jun 2022 11:21:37 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::9c) by BN8PR12CA0014.outlook.office365.com (2603:10b6:408:60::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.14 via Frontend Transport; Mon, 6 Jun 2022 11:21:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5314.12 via Frontend Transport; Mon, 6 Jun 2022 11:21:36 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 6 Jun 2022 11:21:36 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 6 Jun 2022 04:21:32 -0700 From: Li Zhang To: , , , , Maxime Coquelin CC: , , , , Subject: [PATCH v1 01/17] vdpa/mlx5: fix usage of capability for max number of virtqs Date: Mon, 6 Jun 2022 14:20:38 +0300 Message-ID: <20220606112109.208873-2-lizh@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220606112109.208873-1-lizh@nvidia.com> References: <20220408075606.33056-1-lizh@nvidia.com> <20220606112109.208873-1-lizh@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a53279e8-be68-4890-1152-08da47aeb85d X-MS-TrafficTypeDiagnostic: MN2PR12MB2861:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J6aPOr/dav9IfFXYEY+WM2inp0uYmOmoWo62UCdXr1AHEFyG1g/LHcI7ZZ8pLKRpdaoAXftnm2ixBABU5McD45gBA0O6mVKvI1UgUI79C7a9O11IksRgXvzotgfzoyuSpbEgAL/TFhTwbY1JvR78fl1aCEvaaXGx5rmP+cbv2RcGF8SV8xWCGTLvCck5b0Zt6UgIxsXiqt51pCYrq6z9suFdH/PtJFeIGIB7g7QEl6t0LzcutfJhEKWClNZqdXTTNknq8jmzXa27QXtRkxKEAREG+1zzMAg6S+StXsZoBAwwhG4c0JVmgxXqGFDaNPWyYGYajEw8oZuSSfnbWExEdOFM0epHKICr5LzkdCyw5ubF3NC0GCvI46CNtGvsrAM0cQi1b/q/psh83EGT6ikEZj5g7LTLHIS0wejQr7WfU4hrdE0yLNr/fJ3MmI6b3danEyHL12rHm6IMv6BD5P7d3ywvQuuETH/EdKZYUIHPdHW4dI2SPYeGCfUZMuPvRz/AjuigRIeb94csPvub6dHxBTPkcCvdWq1ZNBtzGiWjky5XgP4kyIZzTxFw0LUocrtE63CG2gYz2bUcYl8NH3a3GSukpXhD+oTKe5+WEIJH97ShhmWlxIxpkDVEb9QyAebl+d00NWrApyKomeIJP2oDQIiewhESo4Cm/GnggkTnkLOqxcYmwXjS75p+K0xyfRJ9VX9gCbg0mSVvBOE0aDezjdi2d2eyoN+EeDjdxv1Px6TnN2k+pn6tC9CNHAzZ+OkTHBp6B57e4e9SuppjNWyt2Q== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(26005)(83380400001)(36756003)(426003)(16526019)(47076005)(2616005)(1076003)(40460700003)(55016003)(186003)(336012)(82310400005)(5660300002)(4326008)(8676002)(86362001)(70586007)(70206006)(36860700001)(2906002)(8936002)(6286002)(356005)(7696005)(54906003)(508600001)(316002)(110136005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2022 11:21:36.7616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a53279e8-be68-4890-1152-08da47aeb85d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2861 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 The driver wrongly takes the capability value for the number of virtq pairs instead of just the number of virtqs. Adjust all the usages of it to be the number of virtqs. Fixes: c2eb33a ("vdpa/mlx5: manage virtqs by array") Cc: stable@dpdk.org Signed-off-by: Li Zhang --- drivers/vdpa/mlx5/mlx5_vdpa.c | 12 ++++++------ drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 76fa5d4299..ee71339b78 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -84,7 +84,7 @@ mlx5_vdpa_get_queue_num(struct rte_vdpa_device *vdev, uint32_t *queue_num) DRV_LOG(ERR, "Invalid vDPA device: %s.", vdev->device->name); return -1; } - *queue_num = priv->caps.max_num_virtio_queues; + *queue_num = priv->caps.max_num_virtio_queues / 2; return 0; } @@ -141,7 +141,7 @@ mlx5_vdpa_set_vring_state(int vid, int vring, int state) DRV_LOG(ERR, "Invalid vDPA device: %s.", vdev->device->name); return -EINVAL; } - if (vring >= (int)priv->caps.max_num_virtio_queues * 2) { + if (vring >= (int)priv->caps.max_num_virtio_queues) { DRV_LOG(ERR, "Too big vring id: %d.", vring); return -E2BIG; } @@ -388,7 +388,7 @@ mlx5_vdpa_get_stats(struct rte_vdpa_device *vdev, int qid, DRV_LOG(ERR, "Invalid device: %s.", vdev->device->name); return -ENODEV; } - if (qid >= (int)priv->caps.max_num_virtio_queues * 2) { + if (qid >= (int)priv->caps.max_num_virtio_queues) { DRV_LOG(ERR, "Too big vring id: %d for device %s.", qid, vdev->device->name); return -E2BIG; @@ -411,7 +411,7 @@ mlx5_vdpa_reset_stats(struct rte_vdpa_device *vdev, int qid) DRV_LOG(ERR, "Invalid device: %s.", vdev->device->name); return -ENODEV; } - if (qid >= (int)priv->caps.max_num_virtio_queues * 2) { + if (qid >= (int)priv->caps.max_num_virtio_queues) { DRV_LOG(ERR, "Too big vring id: %d for device %s.", qid, vdev->device->name); return -E2BIG; @@ -624,7 +624,7 @@ mlx5_vdpa_dev_probe(struct mlx5_common_device *cdev, DRV_LOG(DEBUG, "No capability to support virtq statistics."); priv = rte_zmalloc("mlx5 vDPA device private", sizeof(*priv) + sizeof(struct mlx5_vdpa_virtq) * - attr->vdpa.max_num_virtio_queues * 2, + attr->vdpa.max_num_virtio_queues, RTE_CACHE_LINE_SIZE); if (!priv) { DRV_LOG(ERR, "Failed to allocate private memory."); @@ -685,7 +685,7 @@ mlx5_vdpa_release_dev_resources(struct mlx5_vdpa_priv *priv) uint32_t i; mlx5_vdpa_dev_cache_clean(priv); - for (i = 0; i < priv->caps.max_num_virtio_queues * 2; i++) { + for (i = 0; i < priv->caps.max_num_virtio_queues; i++) { if (!priv->virtqs[i].counters) continue; claim_zero(mlx5_devx_cmd_destroy(priv->virtqs[i].counters)); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index e025be47d2..c258eb3024 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -72,7 +72,7 @@ mlx5_vdpa_virtqs_cleanup(struct mlx5_vdpa_priv *priv) { unsigned int i, j; - for (i = 0; i < priv->caps.max_num_virtio_queues * 2; i++) { + for (i = 0; i < priv->caps.max_num_virtio_queues; i++) { struct mlx5_vdpa_virtq *virtq = &priv->virtqs[i]; for (j = 0; j < RTE_DIM(virtq->umems); ++j) { @@ -492,9 +492,9 @@ mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv) DRV_LOG(INFO, "TSO is enabled without CSUM, force CSUM."); priv->features |= (1ULL << VIRTIO_NET_F_CSUM); } - if (nr_vring > priv->caps.max_num_virtio_queues * 2) { + if (nr_vring > priv->caps.max_num_virtio_queues) { DRV_LOG(ERR, "Do not support more than %d virtqs(%d).", - (int)priv->caps.max_num_virtio_queues * 2, + (int)priv->caps.max_num_virtio_queues, (int)nr_vring); return -1; } -- 2.31.1