From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 61B9BA00BE;
	Thu, 11 Jun 2020 23:39:45 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5D232F72;
	Thu, 11 Jun 2020 23:39:06 +0200 (CEST)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
 [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 1AE3CF12
 for <dev@dpdk.org>; Thu, 11 Jun 2020 23:39:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1591911544;
 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=tpf1JoAefHBEkg2waoOsKBYKo3O9VnLEHnW94KLyeNw=;
 b=L7EUCglKfNPyXm4ckSfzEDvbnDSfCO5EHGzOCDbfOqZlnltRI+IMAsmuqOaJCoa6PeiaWm
 HhAZtDJJZPaA6lE3kr2TdqUTerYzZMa8VZj8SZRz4yXUD1eCbdzKg88bxUwUZZKYy6/GwE
 gzy8/KioLbvtvb0C5fbeXv4Bj0QhC5c=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-115-pjMCEG9YMNuf41ZNSdg2HA-1; Thu, 11 Jun 2020 17:39:01 -0400
X-MC-Unique: pjMCEG9YMNuf41ZNSdg2HA-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
 [10.5.11.22])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77B2B835B41;
 Thu, 11 Jun 2020 21:38:59 +0000 (UTC)
Received: from localhost.localdomain (unknown [10.36.110.37])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 4555E100238D;
 Thu, 11 Jun 2020 21:38:51 +0000 (UTC)
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, matan@mellanox.com, xiao.w.wang@intel.com,
 zhihong.wang@intel.com, xiaolong.ye@intel.com, chenbo.xia@intel.com,
 david.marchand@redhat.com, amorenoz@redhat.com, shreyansh.jain@nxp.com,
 viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Thu, 11 Jun 2020 23:37:46 +0200
Message-Id: <20200611213748.1967029-13-maxime.coquelin@redhat.com>
In-Reply-To: <20200611213748.1967029-1-maxime.coquelin@redhat.com>
References: <20200611213748.1967029-1-maxime.coquelin@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 12/14] examples/vdpa: remove useless device count
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The VDPA example now uses the vDPA class iterator, so
knowing the number of available devices beforehand is
no longer needed.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 examples/vdpa/main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 5fac139c4e..c1cd778da6 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -34,7 +34,6 @@ struct vdpa_port {
 static struct vdpa_port vports[MAX_VDPA_SAMPLE_PORTS];
 
 static char iface[MAX_PATH_LEN];
-static int dev_total;
 static int devcnt;
 static int interactive;
 static int client_mode;
@@ -219,7 +218,7 @@ static void
 vdpa_sample_quit(void)
 {
 	int i;
-	for (i = 0; i < RTE_MIN(MAX_VDPA_SAMPLE_PORTS, dev_total); i++) {
+	for (i = 0; i < RTE_MIN(MAX_VDPA_SAMPLE_PORTS, devcnt); i++) {
 		if (vports[i].ifname[0] != '\0')
 			close_vdpa(&vports[i]);
 	}
@@ -418,10 +417,6 @@ main(int argc, char *argv[])
 	argc -= ret;
 	argv += ret;
 
-	dev_total = rte_vdpa_get_device_num();
-	if (dev_total <= 0)
-		rte_exit(EXIT_FAILURE, "No available vdpa device found\n");
-
 	signal(SIGINT, signal_handler);
 	signal(SIGTERM, signal_handler);
 
-- 
2.26.2