Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp614097rdb; Thu, 15 Feb 2024 09:48:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVoS5VtWaAXS9VEEePF4oy/Bt7Mo4BGipq3M+RJg3FflFR43qYZi8NNYWleAwiyyEknEDsvZ1RD5svsh4tq3b8ALLZWaKySgjWeiEt5wg== X-Google-Smtp-Source: AGHT+IFDpqEwMTOQolTaeVa8oKPr/RNGI09NGUo73vHu+fY0bASNWnBLCJ1Vda1ffN2xmwaXBfRL X-Received: by 2002:a25:c792:0:b0:dcc:d455:2ab9 with SMTP id w140-20020a25c792000000b00dccd4552ab9mr2392891ybe.27.1708019284691; Thu, 15 Feb 2024 09:48:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708019284; cv=pass; d=google.com; s=arc-20160816; b=lN6d3rtpsrRWrxvtmLH/ih8BXaGHQuA6alNBU4TSoDVTBu5N8SQ6QGusfPQdeMjMvL 0lnLs/gFFrTXpwIbb7NfTHZsBnyLPkF4E+hlJAAXgX/vo0lY5H+vxtbdAwpSawqC0TJv 5FLNFRoB2KhyUpPSBZIFr9LfwnzCaNK5y1ugKQKZ6kw2xyZG7ryPk/91wqgtXnkRSZLL 0pPKMTUeoN0MVlgeIybH5YYFUmT30JTn9ENlWBhtQmIXRfXfE99Fz85a5zI38b6GWm63 hISu4gMr1k4dlGoPUj2zpe3HqirvQimSWs/wtj09PH4otCnVEyl8Z7MGfQoaqFGnkX8f 5MpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=PJ/JEvX0jmjLAMAQh6ULKyKsJAdiUkLyj1BxUN+t8+0=; fh=hhtOf+F6aafNs1CeTMF0im0NseXKuzW8G1W7FOZPguw=; b=KKC7ml45iaeSd1JKC1zxqljG0cI5R+Tj8ULMOEsy5mE3a9QBi7Spzzq7hlT4FF8zWi mbdj6HVkds6iLN3qUDYFO2YmI1oFg2WEebDqbH46A1+RRKY50hdWypXQYz+do8MyjTEz 2s/8V0aPdnA7ATLSWWYgGZCUHUporGhNLnUYNrFKm5dIC/jo7EOpXgU0bKiS6d/PnIpA JV0tx8we4/ns5Z1Bop4Esqbz8iGK9QaH87mRMniaT0ARGfErCj8+MeiNCt01ppcx8YU9 qKZciWXpD+dbxB8a/p28v4jEEa98koWfZzdjke1+hlf2+xOJxXjO7qODlxZJQv8SS2C6 mi1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=ak+LTUXk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-67434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b23-20020a05620a0cd700b007871f6e9e57si1865717qkj.721.2024.02.15.09.48.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:48:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=ak+LTUXk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-67434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 724291C23401 for ; Thu, 15 Feb 2024 17:48:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C1091386B2; Thu, 15 Feb 2024 17:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ak+LTUXk" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 83CC21384AB for ; Thu, 15 Feb 2024 17:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019226; cv=none; b=tnUuXdfyxmuO+AL5ZV9ZEoKKl3AN1/lU+/2QTttUk/Abe4Eo+ZCrjLMd6pE4jaiRQHrtL06bYaP8GXfGOXpWtS4FGBoc99KQMzw8gjZVIPjai6laCb0blxpcq0PZVhoMLvx0lTFMOcE9MEVpT9/0A3bykxVorVkbpjqCVfVFraY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019226; c=relaxed/simple; bh=jHG9H8i9qhAeOn57Plf+Ex4DiuuEmdAlsRWhZjMgxes=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=bhxYJrQTKkCa6ACDefIXdcZJB7Uw5AtJpiJhkJ1YCloeHUL4fa9lbSYVJV4/2N03R+6Y1rlLwupyEfhJRBpkp3YDPbMgZEo8xSfpyEPZCraBr/zNu1bBeaaFdCjvUW94mEf5WSjfMw6GAbf4huv+tT0ZgVukJKjo0Y3L8fIsXiA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ak+LTUXk; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FFTY34030192; Thu, 15 Feb 2024 17:46:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=PJ/JEvX0jmjLAMAQh6ULKyKsJAdiUkLyj1BxUN+t8+0=; b=ak+LTUXktNYa0FN1G7vC/Ie/HMVe5lOgIe6W7EBrBtEy1cC6BVIKYLEp/vkwO+BQK1Po i4yVzWDtq8cEIlNiWhdePrv0eDmmTGPqlPfA6JFjEDIZKmTEuNuY/4Bsb1b4+TyDgl26 6vwecyGQqRhhXiklcplznEValSKBPl9M0v4Z/p07Vd06wBggxynhD+bElo83KE4ehbxR A5vO8c/FIrS2Dfp0zK6VokmlB06fgT2iYjNjDsHmYSVVRZNpNRIScDAxOvILpelbKlYU zSLeMyNfk2IyYAE7iy28b3viNOgptPRCtux1AW/ZQIAWSJA6WDzikXGxEOCLFCNDBneN fA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w91f033yp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 17:46:56 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41FGtsou014987; Thu, 15 Feb 2024 17:46:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykakd72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 17:46:55 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41FHfld4023373; Thu, 15 Feb 2024 17:46:55 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-162-170.vpn.oracle.com [10.65.162.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3w5ykakd5w-1; Thu, 15 Feb 2024 17:46:55 +0000 From: Jonah Palmer To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, si-wei.liu@oracle.com, virtualization@lists.linux-foundation.org, dtatulea@nvidia.com Cc: jonah.palmer@oracle.com, boris.ostrovsky@oracle.com, leiyang@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] vdpa/mlx5: Allow CVQ size changes Date: Thu, 15 Feb 2024 12:46:47 -0500 Message-Id: <20240215174647.3885093-1-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-15_16,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150143 X-Proofpoint-ORIG-GUID: ZRaBVuTFXVW_8jdqLGv_AjIlXszMx3D6 X-Proofpoint-GUID: ZRaBVuTFXVW_8jdqLGv_AjIlXszMx3D6 The MLX driver was not updating its control virtqueue size at set_vq_num and instead always initialized to MLX5_CVQ_MAX_ENT (16) at setup_cvq_vring. Qemu would try to set the size to 64 by default, however, because the CVQ size always was initialized to 16, an error would be thrown when sending >16 control messages (as used-ring entry 17 is initialized to 0). For example, starting a guest with x-svq=on and then executing the following command would produce the error below: # for i in {1..20}; do ifconfig eth0 hw ether XX:xx:XX:xx:XX:XX; done qemu-system-x86_64: Insufficient written data (0) [ 435.331223] virtio_net virtio0: Failed to set mac address by vq command. SIOCSIFHWADDR: Invalid argument Signed-off-by: Jonah Palmer --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 778821bab7d9..c74de1fe6a94 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2276,9 +2276,15 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num) struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); struct mlx5_vdpa_virtqueue *mvq; - if (!is_index_valid(mvdev, idx) || is_ctrl_vq_idx(mvdev, idx)) + if (!is_index_valid(mvdev, idx)) return; + if (is_ctrl_vq_idx(mvdev, idx)) { + struct mlx5_control_vq *cvq = &mvdev->cvq; + cvq->vring.vring.num = num; + return; + } + mvq = &ndev->vqs[idx]; mvq->num_ent = num; } @@ -2963,7 +2969,7 @@ static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) u16 idx = cvq->vring.last_avail_idx; err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features, - MLX5_CVQ_MAX_ENT, false, + cvq->vring.vring.num, false, (struct vring_desc *)(uintptr_t)cvq->desc_addr, (struct vring_avail *)(uintptr_t)cvq->driver_addr, (struct vring_used *)(uintptr_t)cvq->device_addr); -- 2.39.3