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 E2C62A04FD for ; Wed, 20 Jul 2022 12:49:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B85B940697; Wed, 20 Jul 2022 12:49:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 2E7334003C for ; Wed, 20 Jul 2022 12:49:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzIbb//blQNbsEM1EKBgg55aAHnZ1pDE9tRmwLb151kLc7OrCOfh7gzCuiqEwBiepjrFqpjB0D4bvnP3SOJIZKrt1ZT4DSSFXeQI7Znv3MZXw5iQWVSPtrfI/fSo6N68RDdS+2jufmJWAEeyChrf0IGmMsKJCNAMpoHHNXpHPyoRab33NYN5eeI1WTQ0IOtZJkOEHGyuco+oj4pF2AinH5G94b9IkNnD2drrR7f2ReUj0ZZvAtQ2pUckme9OD89oYlZHL5BBVFxSKq+sMHxjrc+J7WS8WaBBYIiLwusDFJ1cT8EAIqgRrZxDIiHAYM2e2IXz5r++eT8uqL5RspI6/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=XmCoLHHbNv6iMsi9ZZMyudTNXSNZ9cgIk0/70UDdS9U=; b=MkWurB+wvY31+NDZZShWrlCfz1ZW++TO8Qa5Eu3wWHn5RuJBKZsLOZt+Jxg+bNCVC9KwUvpGNGYaa9CAzrqR9YOJRgeEb7cCJfqqfLqlSk0qBtNGScL/A3UQDHr5W/b9DXkOVmsQ7hRhsFSBSfh/okm87iEB66TB8tgBQkohnAZOk/VFDW3K0LSwDu6dVa/Ts42cLCoBn5PrsFkL+OYfCk0ZimNlUB4HAeDc28ZportfhdAiSVOX+986QalM2NEA/nUgAMP8ZQr6o6U6wPF8f0FowL6UVig2bpaCEnQJscUOSAg/7PJlpJrYGehwauHb4v20clj5fECfTtsEKv3V1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=XmCoLHHbNv6iMsi9ZZMyudTNXSNZ9cgIk0/70UDdS9U=; b=mPFEXlDuv70Nb5ruflsN7zS2O0LAnnueVVHyQUCHz2pAPWporlQkb++BlYQmVwWi/OwiEWVpQ59W8jZX0xh6hlIYTvuBdUbTo/eDGi3xc+zk3yh6o+0ED4ElsjTG2+2q+ZSZ/EUfbjgx8bFSoZ0ww9FXTDR092h0i9RnasYK4mwbHkHJLhXmNWYbN90BnnXcfmq7xv2hecYq4Yojh2ZyJXlwqBal862zGeSB/qyRK1ujPLD2UoxEUd+pfC/hBCHv5y1U9Q2ZLQVmYbQ+m7YZEv7D3OLFKclUEXnaW5IZb9eYqBuj0kGviy5H6b12oFpWmOUukYE8suo0pHV0GjMQCw== Received: from BN9PR03CA0540.namprd03.prod.outlook.com (2603:10b6:408:131::35) by BL0PR12MB4881.namprd12.prod.outlook.com (2603:10b6:208:1c7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Wed, 20 Jul 2022 10:48:59 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::60) by BN9PR03CA0540.outlook.office365.com (2603:10b6:408:131::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.24 via Frontend Transport; Wed, 20 Jul 2022 10:48:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5458.17 via Frontend Transport; Wed, 20 Jul 2022 10:48:59 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Jul 2022 10:48:58 +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.26; Wed, 20 Jul 2022 03:48:55 -0700 From: Li Zhang To: , , , , Maxime Coquelin CC: , , , Subject: [PATCH 20.11] vdpa/mlx5: fix maximum number of virtqs Date: Wed, 20 Jul 2022 13:48:38 +0300 Message-ID: <20220720104838.2815387-1-lizh@nvidia.com> X-Mailer: git-send-email 2.30.2 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: 016b0794-5a68-4105-0aba-08da6a3d73ee X-MS-TrafficTypeDiagnostic: BL0PR12MB4881:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 20rvDTQe2X9N9P5z5d9e1mPCH3dsc16yNOUBC0wcPWJBrZicuyiYZfGDGQ687KenJr1+32WyNv1sMuOlPKdZ0SJoy3gD0eYvYBN4RNH0tsnFxQhxD/NA2AckI6XJtyRSvMJO5OWzcXwLC2YkoybH4Tat6C+le6N1/BDUoIEkpen+5g32C+VvGqpxVBBCD9ZheNncpE4WWMQxx4C5nPRGUfgY7p4FueFbyvsjmQ2e1A4QYBO9g13SM+Vqnfwj8ALv2iL9cYPniQn1GvfiOFMacjeaXKlhYL4s1++ki0uXkL3eXjmqk2U+VNVOu2etTtXq0jfqqWm9crTPU77mIpWsjkQS9Cz1dUe8q+NTp0MNo+k7lGaHeAJb1/yf3YCwJvNwabIMB19bWvMyp5n7rpjzq0IqNKgJh364PISTizs4GzXMsYFhS2T0hclbbkX9kn1p4e+WFLuclp1SIzFTF27Fd4Rn2LTh6S+QdIWW5jg/mRmLByKVQXG8qTNgoVTT35543w6437836gqlp6eK4bI2gXodws+Xcn1h9pFsVTOAP9xc43E5DkJ3F2cCDWM0X+pPTzu2Ds8Vmt+OqrrwEJeLGuK+Elkb+09AeC0zHf4q9ZlOaAT6HzA2ycm2h5Xu2dAvI97CwXFfJr5y/Z0BsF42BTTEObYQaPMzWRLO3rXWPbzqZPWZFHSO/IeIC70SJ4OuhHmCXYb8hemks+fWPEOQyOSvnLcFlYzFEpNN1tbJBjP9B/LKMp+8WlAkpI1IIe/oAS2nHLM6in21KWw3Q2LGaXe8FckjQr+BErbIf/hE2rvXIIE7fmNGKqES1ZfzYsw92/yHL4uvaCBFdL1GCBA/mQ== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(396003)(346002)(39860400002)(376002)(46966006)(36840700001)(40470700004)(7696005)(55016003)(54906003)(36860700001)(81166007)(40460700003)(6286002)(82310400005)(41300700001)(110136005)(26005)(478600001)(86362001)(316002)(6666004)(36756003)(16526019)(2906002)(5660300002)(70586007)(8676002)(40480700001)(2616005)(47076005)(356005)(82740400003)(8936002)(186003)(4326008)(1076003)(336012)(107886003)(83380400001)(70206006)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2022 10:48:59.5157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 016b0794-5a68-4105-0aba-08da6a3d73ee 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4881 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 [ upstream commit 6f065d1539bed56602e3c6159c99cccb3bca38e4 ] 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: c2eb33aaf967 ("vdpa/mlx5: manage virtqs by array") Cc: stable@dpdk.org Signed-off-by: Li Zhang Acked-by: Matan Azrad Reviewed-by: Maxime Coquelin --- drivers/vdpa/mlx5/mlx5_vdpa.c | 6 +++--- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 6519b9c9a..65a1edc33 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -82,7 +82,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; } @@ -139,7 +139,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; } @@ -726,7 +726,7 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, 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."); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index 0d31e1d95..a1ae02292 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -450,9 +450,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.30.2