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 5614846030; Thu, 9 Jan 2025 15:31:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F20F740E72; Thu, 9 Jan 2025 15:31:40 +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 8327240E4C for ; Thu, 9 Jan 2025 15:31:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736433098; 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=FaW+q0G97bPPBlrAa0IGxeSUG0pXnEHlSRZ5FyK59a2mBHGGgEFhoo+Tg0LOevGhenk5c2 5qWf5erH3AK3LkMGV9qyZa0QslJ69TGyZWzFXQhvlyM/fJ6GCnWlbA68n6s5ofyjGrFIoV JGHxHY2e1XWC+4NwPnSLEmciB0hREwk= 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: EJQIxvPMbMdc4WpNtyLRYQ7HA8l-bqjUAlJlpUXSBPo_1736433096 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 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