From patchwork Mon Jun 17 15:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700948 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1D31741FE; Mon, 17 Jun 2024 15:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636978; cv=fail; b=idhnCF+FON4bdK2vJCTuHggU/eW/Mj9af1bAzsuKSI7EiiQzl6hpC5T/AxddpAnm7ergkaDwUdKmEchrmpLnPO2+XKO0fusNhRMTSszcsBrXmhClzbHbTyHC3MPwmix6OkUgo2WbPKjAEXjGpB4rVo9KUdsChPkIQ6Qo7R2ZG1I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636978; c=relaxed/simple; bh=AFKqxZPICXDBRRM3Jnaz0zJRsTPE9v92jV4IJ15lGpI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ocZx1YEDrgMwNt/bPtrv7AaFYxPzgjMbVJnqEFJC2gOUUK8e3p2qRnExlLQ2iEVHMlHAF2o7j+s1iHKTPL+unXGfJoYdzr0evSn8VlCUxWEXGZZD36rfcRk4KQao7Gikd0edSO2OBxUxCbBAK6WFVBX3rgW2xSS4oEIyVmGx3dg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=JnZU86bk; arc=fail smtp.client-ip=40.107.243.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="JnZU86bk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cA1tKSCHsZ44Gl6PeVmtKVMZa8kgiPpR1fX9sYCmBMayujzXbPjOkyOufhJQXM2Jj6iLE9nPebFiNPBMd3QBMPq8N64l0PL+VqMYVOqPD4jG+7jNl6PgxgSNn1lwcHYKRLfC+LUWIVExTyNPN7SzbKbVl7PAuB6AuJFypOmWXPBWznM9LzqtFnjimNmgBLiqNAcIJ7/g36Txju2Vb0cf6bGyRBw6Op1FkmuEdyzU2uJqESaMcLYNixH3/wW6uAVuK0yevq3rA5iFnaPZuwcKZ+AKf+f/L0Cy4nHfwV172cyQuXiq9sPW+kUuoFepI77XeZb6VtGYkUu7OseSg9PoKA== 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=f2qeVJE78M3ALmMWqAx3P0GQv/ossQz7wdatKeTQmhE=; b=VfOHo2JFoiHwBGGucw8dpNRWZuFS3QOdSFjGOY0F69tNoqy/IPIuWaeinH4PZCiZMRXtiv1d1nq6735M6JWbG0fRzsSnvIrq1DfXL+a9nenPZ0aFnPlD02kqD1mGo41IW6J81vT+a8DsElO9VNUftpvZrVs6DZas152mu/WLS5CD7VGKbqYaxmh6VGGgkpMlDC7Op3ZPjXfD6Ch66d7308BJEl4uae9KS29j6kiLuupr+2oZAF2etX/jT9/Kyp4Nb++YKccVHE7RQIH4eOOFC51vtkHTRxhWLLj49wEpAJBTH8w48pLFT9BhnraYSFdHThFIIdpI/Wf91QBwIw7KUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com 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 (0) 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=f2qeVJE78M3ALmMWqAx3P0GQv/ossQz7wdatKeTQmhE=; b=JnZU86bkLUJ/HXQr5Jfi0HdvpLPnx6ph70+untYPC86ixtGCoajK1tjIKLwDdstjkakNmyebqcJ50mJ0XaMnMSOLPk2dRCdsCVfmCHQziZrp+MS8KNV6LPdCfnVvhRJ5fykZv+UGNuUKSc7yxgUDHVJK+gohnaQD97DmugZO47he66RbkR5Tb+PLIvbhLO0GboHDJ4loOAouK0szuUVFr31KYCVNM8c68MWarcRWsiCL4mWeDlHJf7VtWfkYf12J9LfbCbQz5GZFdJHe+r3qXddCmlmI8ge8wOOyBhaJ4JrV8epIHGPDEZDuh4lkU7q7/dd8YS7oniQLJV6I56synQ== Received: from SJ0PR03CA0124.namprd03.prod.outlook.com (2603:10b6:a03:33c::9) by PH0PR12MB7486.namprd12.prod.outlook.com (2603:10b6:510:1e9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 15:09:33 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::68) by SJ0PR03CA0124.outlook.office365.com (2603:10b6:a03:33c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:32 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:18 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:17 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:09:14 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:57 +0300 Subject: [PATCH vhost 23/23] vdpa/mlx5: Don't enable non-active VQs in .set_vq_ready() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-23-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|PH0PR12MB7486:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fd2aaea-9aa8-469a-ded9-08dc8edf7e0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|7416011|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9TkzxFjNQ8ols7pHN97Hx36rQ3wAxlU?= =?utf-8?q?WGoy1yibreQKmdtODoOKElqMFuxxthfgrp0aG1Pw6UZ9Vs/90y0rgeWn3hqEvXQHu?= =?utf-8?q?3r9eCFHKdu2Z72Jfo+K4wuOQn/NA36hj4MaliYRaW7s1sEWYNug5e33IkLKtWlMCB?= =?utf-8?q?7gE4DiUZTFOXB09WzlSUY94NwAisaQDbAfY34BkdpkoJ1iZKgtBrNMzc8+MF3tJQU?= =?utf-8?q?cssShB+JKNd0MUCfi/7tfKK0UMzs/O6VvoBRnqSRvTAQ9GzgPOMQ5gbUH+cxu/B2j?= =?utf-8?q?harQRYt3asucrIr5p9JnyOkkwI8GmovsFf26XMdGZLRbkgEZctM1KWHKkffLLC1U/?= =?utf-8?q?69G+0XbmGLWJ/kTTJNao4dkAPjQ1TUR0BtVXl6HW7BmYggV9jZ0Heg+PkRTEh7TrD?= =?utf-8?q?trjtosqatFaZQjChS5DCtDufUL9dGU7tsk61WmEYP57l55g6i4xRIVw7WTJfPk9Bd?= =?utf-8?q?4eskFDKw17HLoPC6JBHUAfAJiE4K3UVNz7ITvmWp6heTHGjooKA1o9r6HJPr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-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(7416011)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:32.3144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fd2aaea-9aa8-469a-ded9-08dc8edf7e0d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002314.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7486 VQ indices in the range [cur_num_qps, max_vqs) represent queues that have not yet been activated. .set_vq_ready should not activate these VQs. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio PĂ©rez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1a5ee0d2b47f..a969a7f105a6 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1575,6 +1575,9 @@ static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq if (!mvq->initialized) return 0; + if (mvq->index >= ndev->cur_num_vqs) + return 0; + switch (mvq->fw_state) { case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: /* Due to a FW quirk we need to modify the VQ fields first then change state.