From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22B5346030 for ; Thu, 9 Jan 2025 15:31:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA88540EDC; Thu, 9 Jan 2025 15:31:44 +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 517EB40EDB for ; Thu, 9 Jan 2025 15:31:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736433102; 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=RhFlSvYC2iuP/RgK2Nvo/EX5Mp1R9HEarUwY3p20Cgo=; b=YQnog5WyE2W0UcEFcZNFmoHpxMvtfLpiu9biWg0KjlecfbznaWe69M3utk3WFaXqm4xlAA CF9qKhErowet2PyQzc1VuKAr9ak+E0sZ3XnMqmC4CkAtXsIFQ2Ul07budYwPKzv11fydi3 Rr+K6RtcltOxBuvturPdmPHPKKiFoFk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-272-1KRPhsVXNsi55mue12zGcw-1; Thu, 09 Jan 2025 09:31:37 -0500 X-MC-Unique: 1KRPhsVXNsi55mue12zGcw-1 X-Mimecast-MFC-AGG-ID: 1KRPhsVXNsi55mue12zGcw Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5B61C19560B8; Thu, 9 Jan 2025 14:31:36 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.23]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B173219560AD; Thu, 9 Jan 2025 14:31:33 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbox@nvidia.com, david.marchand@redhat.com, ktraynor@redhat.com, i.maximets@ovn.org Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH] vhost: fix misleading log when setting max queue num Date: Thu, 9 Jan 2025 15:31:30 +0100 Message-ID: <20250109143130.3696613-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 74U7EgDyGKaU2JqzgZxJfcbFdCxRc2lkaSj8_cYhjKw_1736433096 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org rte_vhost_driver_set_max_queue_num API returns early when called for a Vhost-user device, as this API is intended to limit the maximum number of queue pairs supported by VDUSE devices. However, a log mentioning the maximim number of queue pairs is being set is emitted unconditionally, which may confuse the end user. This patch moves this log after the backend type is checked, so that it is only called with VDUSE backends. The check on the requested value is also moved at the same place. Fixes: e1808999d36b ("vhost: restrict set max queue pair API to VDUSE") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin --- lib/vhost/socket.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index d29d15494c..07247907b0 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -844,13 +844,6 @@ rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs) struct vhost_user_socket *vsocket; int ret = 0; - VHOST_CONFIG_LOG(path, INFO, "Setting max queue pairs to %u", max_queue_pairs); - - if (max_queue_pairs > VHOST_MAX_QUEUE_PAIRS) { - VHOST_CONFIG_LOG(path, ERR, "Library only supports up to %u queue pairs", - VHOST_MAX_QUEUE_PAIRS); - return -1; - } pthread_mutex_lock(&vhost_user.mutex); vsocket = find_vhost_user_socket(path); @@ -872,6 +865,15 @@ rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs) goto unlock_exit; } + VHOST_CONFIG_LOG(path, INFO, "Setting max queue pairs to %u", max_queue_pairs); + + if (max_queue_pairs > VHOST_MAX_QUEUE_PAIRS) { + VHOST_CONFIG_LOG(path, ERR, "Library only supports up to %u queue pairs", + VHOST_MAX_QUEUE_PAIRS); + ret = -1; + goto unlock_exit; + } + vsocket->max_queue_pairs = max_queue_pairs; unlock_exit: -- 2.47.1