From patchwork Fri Feb 17 12:31:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 124123 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 539FE41CBF; Fri, 17 Feb 2023 13:31:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F16F40EE3; Fri, 17 Feb 2023 13:31:28 +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 4F07140EE1 for ; Fri, 17 Feb 2023 13:31:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676637086; 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; bh=V4m/qFv+hF2zGTQ36aikGi6SheDP1Pq5wKXvlDL0thA=; b=cDU5XnqrDpeQ8Ap3bJ5c8OPVUaK1iDHwJc4+1HO10Cx75SSz3JoS9jtssyFiEZm+3uvNMM r4HVRLjXBa8fefQpM3PX8tQknKllNgrC6RRdLavtDPKDKj/L25T4QRX0vCmWlgtEd3FPQc Vb71Vu1bOlUqnLBvD93m8ydgrV13kZg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-Dfp9Og7WNqarQ0z6oCNPXA-1; Fri, 17 Feb 2023 07:31:22 -0500 X-MC-Unique: Dfp9Og7WNqarQ0z6oCNPXA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21E93882820; Fri, 17 Feb 2023 12:31:22 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD1002166B30; Fri, 17 Feb 2023 12:31:20 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, weix.ling@intel.com, chenbo.xia@intel.com, david.marchand@redhat.com Cc: Maxime Coquelin Subject: [PATCH] net/virtio-user: fix vhost-kernel initialization Date: Fri, 17 Feb 2023 13:31:19 +0100 Message-Id: <20230217123119.145894-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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 This patch fixes a regression causing devices with Vhost-kernel backends initialization to fail. Indeed, Vhost-kernel backend init expects dev->max_queue_pairs to be set at setup time, while its assignment was moved after backend setup when adding control queue support for Vhost-vdpa backends. It is safe to set dev->max_queue_pairs early for Vhost-kernel backends as if the backend does not support multiqueue, its setup will fail. Bugzilla ID: 1161 Fixes: 7be724856315 ("net/virtio-user: get max number of queue pairs from device") Reported-by: Wei Ling Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index ccb4d7326b..f46a131b5c 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -689,6 +689,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, dev->started = 0; dev->queue_pairs = 1; /* mq disabled by default */ + dev->max_queue_pairs = queues; /* initialize to user requested value for kernel backend */ dev->queue_size = queue_size; dev->is_server = server; dev->mac_specified = 0;