From patchwork Mon Jul 8 12:00:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13726493 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2072.outbound.protection.outlook.com [40.107.95.72]) (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 DD43E823DF; Mon, 8 Jul 2024 12:02:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440153; cv=fail; b=lA+aVaJl4O3Nk53ONohTpSWLOZ1AMn1lJSf9unpBAKJ15DKO9cASERGhx9sDZUKZdKKkbESLJwP+xdHEhdYsbrCOPBB5mnvrnedgHYLm7H5+L69gp2/T2enJQRAP72iSp9j1r5Uwugo83LfbBojBkf/Zwgbk1P4cYpgokdLxurk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440153; c=relaxed/simple; bh=LIkAqiXldR1JJu4c3worPdJiI6If5bbvP3LoaKyTXPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=p7U5CoCtCr1x+Sw4Ug/vOp6oub+lWs3aWUAuxR/OBMpv/HP2IgTb2cpYJbkdRqWhp0xYxxRqLAsDVOBYILcMx/VXeJlKupjNT7/5hgOpA8LpgvaABXHkpoJS+13jvHPW02PT2tyg+xyIctRo8ChzaxvIdX3FAWuWFUgbw95US5w= 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=baZ2m+ki; arc=fail smtp.client-ip=40.107.95.72 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="baZ2m+ki" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BkArWJxivfIhfKhUclDYbtNIOD6UjLQvSfyeITZSR9rBkSLDlMw4jjKE4VoU159dGXm+6rIy/uax2W75TgoISxuqBLDGhmvPiptQVs5/wrcZ3oz3atwnbi2unKkaDMLATo/iKqwkvEw9aasPOWql6WxpZy4xHgd8ZYKmxQfTq5ivzJf9mz6cuDpi+1EB41PKUIWNu9n4CbCso6upunOehRZS24fmx3aTLbvtB/4FReKc84S5Ce5i77xKpPJa/aSuqWvt0Jkeb53V/ZHHOce9tpdKCnsphztmCCp9vA2GDD4Tnn05N18Th1gFDob9q3/7keFxv5rNxMQ2WjBtpLB8zQ== 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=AtyvVBYdcxD9Rj/nFWt7i6rnQILL/qRJ0iRZbPyhNEA=; b=EAhRZrWLUi+56yqlZqNUdnY2QGc7OXXZxxPAwLhGIOZO09NpkJEggJQuajxuZEmqG7ViHYPJYgI8rtRXpPJ1udTY2NJFM4cFMD3WKdObwP1LbvkimbufRJ5WI4RtN6EHljhm7IpIF6ht7JWGYRoRxEg2i5V8tMaAPOItCbylg9gvzxdFuOAXOZz7pz4THg1AkmWCcwebbBx9vOIe83AvdiTpxrQU2sPCZs6Xn5UNN3r/Bsx/KIez1AhfKYaJ7xyiQNpCz4BHVw9AffksJjKcFFwmzPo49Pe5gl5cnt0lwYIo1GMvzwcxe77NyqJROz8J2wVYBvwRuMLo+NHqoLWrzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=oracle.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=AtyvVBYdcxD9Rj/nFWt7i6rnQILL/qRJ0iRZbPyhNEA=; b=baZ2m+kiTpJ+ZC+A1LlrFKsJli7pYes3qSsoqmeuCw2SIhJzB5raWHPah9K8w4Xwk1Wl5s3Y0qYpUsgZzvIQLqsBJlpysdVOssLi2ArGNxWlEleiChQvx0p3ppQW/RBuLx9uSuz2HML7FCvtpij+U/ZjjkXHIYPk8Sm/OFXl4BKacD8kh+5bKRJ27En+huLhLUX5piVjJVFaTFAb7kFwWPBhhk+k0P+uXPnZBRXey3POTQKVzNHLrLM4uh6QM2Sa6xJRfXS2ZJFmlvRfmrm0ABKWoJFx5Kz+QPgmHoB4kaFmj9UaBxhIryl9o4MwFjXybRUSBnGSbljyCLgTMsKqgA== Received: from BLAPR03CA0024.namprd03.prod.outlook.com (2603:10b6:208:32b::29) by PH7PR12MB5595.namprd12.prod.outlook.com (2603:10b6:510:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:02:26 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:208:32b:cafe::56) by BLAPR03CA0024.outlook.office365.com (2603:10b6:208:32b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Mon, 8 Jul 2024 12:02:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 12:02:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 8 Jul 2024 05:01:47 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.1544.4; Mon, 8 Jul 2024 05:01:47 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 8 Jul 2024 05:01:43 -0700 From: Dragos Tatulea Date: Mon, 8 Jul 2024 15:00:36 +0300 Subject: [PATCH vhost v3 12/24] vdpa/mlx5: Set an initial size on the VQ Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240708-stage-vdpa-vq-precreate-v3-12-afe3c766e393@nvidia.com> References: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@nvidia.com> In-Reply-To: <20240708-stage-vdpa-vq-precreate-v3-0-afe3c766e393@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: BL6PEPF00020E63:EE_|PH7PR12MB5595:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cfe4bba-6b39-442e-ec5b-08dc9f45d529 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/zBaZOlu/ITr1lszvDDemqhEIRWoZV8?= =?utf-8?q?WS+Dt1EDGzRR7BTpmtqD1lXLdtiDYSXxRyz3Egiglxh0AfMT4ICEg6XYtRmAh+wvC?= =?utf-8?q?JOyG86PYDZALN7cGdNiKKAEJ5lE40uxBzDmnHddzrywrFAgi7ETDVzpOtzI5Tqqbv?= =?utf-8?q?00V4zfHw8xleUDRdMBtyFjZKSwk9JvapAIjp36+ZO5RO2eIFeJwLrjHz0Sq/x5oaq?= =?utf-8?q?eJ3P/ZzhPX6ghfRAZO8lQLQnkCttz7Pe7ZX1ut7Ah3fI6EUBE+BZ4M+Ib+/5WR+d9?= =?utf-8?q?h8g9sFK7T8/BuYnZ8H/wux52FMykj60UnnRfw3QPpN6XE4TMkOV1UMyjDzTBXuvWm?= =?utf-8?q?EY4Pvo49unK9pborf3nXsTnYhihs2tkI6YONIEZiWl2JKdBMKBu3UyYLPbRqw9V4d?= =?utf-8?q?9w+LepJ+n5g/X6VsKixzyGFDeKqE0WX0PKCSeh1iMo9vKuu3N31hn2RyQIlwy4Wer?= =?utf-8?q?q7iHo77z/6xdBabChUz0sn9U/+P7T5VNemgpIggiAKQAzQZFY2JXrcB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VyNEHkNWRGFz?= =?utf-8?q?DXkfR1N876R?= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:02:25.5747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cfe4bba-6b39-442e-ec5b-08dc9f45d529 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5595 The virtqueue size is a pre-requisite for setting up any virtqueue resources. For the upcoming optimization of creating virtqueues at device add, the virtqueue size has to be configured. The queue size check in setup_vq() will always be false. So remove it. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index db86e541b788..406cc590fe42 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -58,6 +58,8 @@ MODULE_LICENSE("Dual BSD/GPL"); */ #define MLX5V_DEFAULT_VQ_COUNT 2 +#define MLX5V_DEFAULT_VQ_SIZE 256 + struct mlx5_vdpa_cq_buf { struct mlx5_frag_buf_ctrl fbc; struct mlx5_frag_buf frag_buf; @@ -1445,9 +1447,6 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) u16 idx = mvq->index; int err; - if (!mvq->num_ent) - return 0; - if (mvq->initialized) return 0; @@ -3523,6 +3522,7 @@ static void mvqs_set_defaults(struct mlx5_vdpa_net *ndev) mvq->ndev = ndev; mvq->fwqp.fw = true; mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE; + mvq->num_ent = MLX5V_DEFAULT_VQ_SIZE; } }