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 B751EA00C2; Wed, 30 Nov 2022 16:58:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EDEC42D0D; Wed, 30 Nov 2022 16:57:12 +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 B550D42D4D for ; Wed, 30 Nov 2022 16:57:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669823829; 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=zHst2LnMsNFbZzYIuU+pK4XspkjXl3TvejCiSu+Lmss=; b=Y0O67HrWDKzjzd3WEzNqeN/e3JfWgPlpaplLJNVHabAtCuuVl51v9gElSU5TPN7Z1Bw7b+ 6sHKBq6zAehr5hcSRat0JMgy3twOLda7E9Ecqe5LlMKe1nhNc1xlnwmvxWy9lagSS2DJhs HTY6aOuzQKXLamH8VcD/q4kivTc0/cs= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-s_GEkDtTNkiWWTCjBAl5Kw-1; Wed, 30 Nov 2022 10:57:07 -0500 X-MC-Unique: s_GEkDtTNkiWWTCjBAl5Kw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96504382C978; Wed, 30 Nov 2022 15:57:07 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73C4840C83D9; Wed, 30 Nov 2022 15:57:06 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, eperezma@redhat.com Cc: Maxime Coquelin Subject: [PATCH v1 13/21] net/virtio-user: simplify queues setup Date: Wed, 30 Nov 2022 16:56:31 +0100 Message-Id: <20221130155639.150553-14-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-1-maxime.coquelin@redhat.com> References: <20221130155639.150553-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 The only reason two loops were needed to iterate over queues at setup time was to be able to print whether it was a Tx or Rx queue. This patch changes queues iteration to a single loop. Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 19599aa3f6..873c6aa036 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -118,19 +118,11 @@ static int virtio_user_queue_setup(struct virtio_user_dev *dev, int (*fn)(struct virtio_user_dev *, uint32_t)) { - uint32_t i, queue_sel; + uint32_t i; - for (i = 0; i < dev->max_queue_pairs; ++i) { - queue_sel = 2 * i + VTNET_SQ_RQ_QUEUE_IDX; - if (fn(dev, queue_sel) < 0) { - PMD_DRV_LOG(ERR, "(%s) setup rx vq %u failed", dev->path, i); - return -1; - } - } - for (i = 0; i < dev->max_queue_pairs; ++i) { - queue_sel = 2 * i + VTNET_SQ_TQ_QUEUE_IDX; - if (fn(dev, queue_sel) < 0) { - PMD_DRV_LOG(INFO, "(%s) setup tx vq %u failed", dev->path, i); + for (i = 0; i < dev->max_queue_pairs * 2; ++i) { + if (fn(dev, i) < 0) { + PMD_DRV_LOG(ERR, "(%s) setup VQ %u failed", dev->path, i); return -1; } } -- 2.38.1