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 598C743D66; Wed, 27 Mar 2024 10:40:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 267D340E6E; Wed, 27 Mar 2024 10:40:48 +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 A23164029F for ; Wed, 27 Mar 2024 10:40:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711532444; 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=pCNI8mll5OoEItNXoreyyTyewsh9Xw84tzRnAJwAIRk=; b=F9VYoHzHgTghLWtKH0NvEjrWaWpAyANR3ukplm+XAeNcVa+665IGAWzvmFZyZuNIsGZUM+ f3KW4xVIhu5S9Jo/deEA6abwWNUuw5O8xYn5xL88us2tJjcZZqUazioBVGkeVuPLsnkh4H dqE1jSW9YHjUMTRshQqdlpzTPQy7Iq8= 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-350-MA9G2RnoOEWC2Y93g59xxA-1; Wed, 27 Mar 2024 05:40:42 -0400 X-MC-Unique: MA9G2RnoOEWC2Y93g59xxA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 7E80738157A8; Wed, 27 Mar 2024 09:40:42 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15BBD1074E; Wed, 27 Mar 2024 09:40:40 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com Cc: Maxime Coquelin Subject: [PATCH 1/4] net/virtio: rename Virtio-user queue iterator Date: Wed, 27 Mar 2024 10:40:29 +0100 Message-ID: <20240327094032.2400951-2-maxime.coquelin@redhat.com> In-Reply-To: <20240327094032.2400951-1-maxime.coquelin@redhat.com> References: <20240327094032.2400951-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 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 This is a preliminary rework to prepare for iterating over queues for non-setup operations. Also, remove the error log that does not provide much information given the callbacks already provide one. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 4fdfe70e7c..c3d44880f5 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -129,7 +129,7 @@ virtio_user_kick_queue(struct virtio_user_dev *dev, uint32_t queue_sel) } static int -virtio_user_queue_setup(struct virtio_user_dev *dev, +virtio_user_foreach_queue(struct virtio_user_dev *dev, int (*fn)(struct virtio_user_dev *, uint32_t)) { uint32_t i, nr_vq; @@ -138,12 +138,9 @@ virtio_user_queue_setup(struct virtio_user_dev *dev, if (dev->hw_cvq) nr_vq++; - for (i = 0; i < nr_vq; i++) { - if (fn(dev, i) < 0) { - PMD_DRV_LOG(ERR, "(%s) setup VQ %u failed", dev->path, i); + for (i = 0; i < nr_vq; i++) + if (fn(dev, i) < 0) return -1; - } - } return 0; } @@ -157,7 +154,7 @@ virtio_user_dev_set_features(struct virtio_user_dev *dev) pthread_mutex_lock(&dev->mutex); /* Step 0: tell vhost to create queues */ - if (virtio_user_queue_setup(dev, virtio_user_create_queue) < 0) + if (virtio_user_foreach_queue(dev, virtio_user_create_queue) < 0) goto error; features = dev->features; @@ -205,7 +202,7 @@ virtio_user_start_device(struct virtio_user_dev *dev) goto error; /* Step 3: kick queues */ - ret = virtio_user_queue_setup(dev, virtio_user_kick_queue); + ret = virtio_user_foreach_queue(dev, virtio_user_kick_queue); if (ret < 0) goto error; -- 2.44.0