From patchwork Tue Mar 12 10:48:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 138210 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7704343C90; Tue, 12 Mar 2024 11:49:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFAFD40ECF; Tue, 12 Mar 2024 11:49:00 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 01985402ED for ; Tue, 12 Mar 2024 11:48:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710240537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZnsRPxmXNP5QP+umVlkkEIP0TA7F2XNcYpKu8xzw1I=; b=JHbIEwBIoGqJVxcY/VUNEDsnU327p4FRotyIB+h6wWxbVVullHLhzYWLAIQfp+Lt5sQu1h 5qAmlppjQIRpr2Z4NlIrBDsGbtCXE1S5wSXVZz8Iz5xlc/8vh0Y4IXTDBzQUafSwvDFDPX xoVvJOre0udgCBh6QG12votkEhUI4GU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-392-jEAShpxIMVmMihAIZCSYhw-1; Tue, 12 Mar 2024 06:48:56 -0400 X-MC-Unique: jEAShpxIMVmMihAIZCSYhw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3CFD84B061; Tue, 12 Mar 2024 10:48:55 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FD92C478A1; Tue, 12 Mar 2024 10:48:54 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com, schalla@marvell.com Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH 1/2] net/virtio: fix vDPA device init advertising control queue Date: Tue, 12 Mar 2024 11:48:48 +0100 Message-ID: <20240312104849.667036-2-maxime.coquelin@redhat.com> In-Reply-To: <20240312104849.667036-1-maxime.coquelin@redhat.com> References: <20240312104849.667036-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 If the vDPA device advertises control queue support, but the user neither passes "cq=1" as devarg nor requests multiple queues, the initialization fails because the driver tries to setup the control queue without negotiating related feature. This patch enables the control queue at driver level as soon as the device claims to support it, and not only when multiple queue pairs are requested. Fixes: b277308e8868 ("net/virtio-user: advertise control VQ support with vDPA") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin Reviewed-by: David Marchand --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index d395fc1676..0b5db12886 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -752,7 +752,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, if (virtio_user_dev_init_max_queue_pairs(dev, queues)) dev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ); - if (dev->max_queue_pairs > 1) + if (dev->max_queue_pairs > 1 || dev->hw_cvq) cq = 1; if (!mrg_rxbuf) @@ -770,8 +770,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC); if (cq) { - /* device does not really need to know anything about CQ, - * so if necessary, we just claim to support CQ + /* Except for vDPA, the device does not really need to know + * anything about CQ, so if necessary, we just claim to support + * control queue. */ dev->frontend_features |= (1ull << VIRTIO_NET_F_CTRL_VQ); } else { From patchwork Tue Mar 12 10:48:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 138211 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2A35B43C90; Tue, 12 Mar 2024 11:49:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1EE1410E6; Tue, 12 Mar 2024 11:49:02 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8C458402D8 for ; Tue, 12 Mar 2024 11:48:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710240539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vyKmebRr4IiOxzMrZ7WgjH3kIYM8yUIv/rfcWnk4te8=; b=ciyXtY46jshji0qIuVkOM8NzvGhPP1CS7LuO/T5l7+nLoKxhi9XcQsT3W7K6MCIipOIFmv 2wiC70mrfWy84mvdYvHbctLVAusX3XDlhe4TM69zJLBWXPKvDkX5pwUw1FBnPPXtUKn/qO 1F6DgKMYECG85+3hqBlev3Lqh6NbX2M= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-1TPm4yx3M-W9wI8MQhkZ4A-1; Tue, 12 Mar 2024 06:48:57 -0400 X-MC-Unique: 1TPm4yx3M-W9wI8MQhkZ4A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C2861C07F4C; Tue, 12 Mar 2024 10:48:57 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22751C478A2; Tue, 12 Mar 2024 10:48:55 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com, schalla@marvell.com Cc: Maxime Coquelin Subject: [PATCH 2/2] net/virtio: fix notification area initialization Date: Tue, 12 Mar 2024 11:48:49 +0100 Message-ID: <20240312104849.667036-3-maxime.coquelin@redhat.com> In-Reply-To: <20240312104849.667036-1-maxime.coquelin@redhat.com> References: <20240312104849.667036-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 Notification area is a Virtio feature that require to be negotiated because not all devices support it. Currently, it is tried to be initialized as soon as the backend implements the callback, so it assumes all Vhost-vDPA devices support it. This patch skips calling the notification area map callback if the device does not advertise its support. Fixes: 0fd2782660c8 ("net/virtio-user: support notification area mapping") Signed-off-by: Maxime Coquelin Reviewed-by: David Marchand --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 0b5db12886..b2e361ef3b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -433,8 +433,9 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev) dev->kickfds[i] = kickfd; } - if (dev->ops->map_notification_area) - if (dev->ops->map_notification_area(dev)) + if (dev->device_features & (1ULL << VIRTIO_F_NOTIFICATION_DATA)) + if (dev->ops->map_notification_area && + dev->ops->map_notification_area(dev)) goto err; return 0;