From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA09DA051C; Fri, 26 Jun 2020 16:07:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0CF9F1C0D8; Fri, 26 Jun 2020 16:06:23 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 4F04F1C0D7 for ; Fri, 26 Jun 2020 16:06:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593180381; 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=G+/FPsP0tIYYyfEXY+dtp7S9cavYMKqYIZXlrUXzKQA=; b=FFykQm1U/8AiTKPG7c4MbtXJ7ESWnuMOzTWmmegoVQSz0yD5Whv6m6Q+s3XVaI8vvyL/WQ C+AmwyNElB1zV6OE8AYK8qdd/Ig9s7Ckgrrb8RQUf2yhR+c9RjUTAgrwXzD14FHeY7PqcM m/2PBFaUi+xa7Pcc3cVVNctFLYbdTXU= 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-468-BbGqL1-9PVOJo0GDMtvQ0A-1; Fri, 26 Jun 2020 10:06:20 -0400 X-MC-Unique: BbGqL1-9PVOJo0GDMtvQ0A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77860800D5C; Fri, 26 Jun 2020 14:06:18 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.110.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBCA15BAE1; Fri, 26 Jun 2020 14:06:15 +0000 (UTC) From: Maxime Coquelin To: matan@mellanox.com, xiao.w.wang@intel.com, zhihong.wang@intel.com, chenbo.xia@intel.com, david.marchand@redhat.com, amorenoz@redhat.com, viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com, grive@u256.net, dev@dpdk.org Cc: Maxime Coquelin Date: Fri, 26 Jun 2020 16:04:39 +0200 Message-Id: <20200626140441.1441763-13-maxime.coquelin@redhat.com> In-Reply-To: <20200626140441.1441763-1-maxime.coquelin@redhat.com> References: <20200626140441.1441763-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The VDPA example now uses the vDPA class iterator, so knowing the number of available devices beforehand is no longer needed. Acked-by: Adrián Moreno Signed-off-by: Maxime Coquelin --- examples/vdpa/main.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c index d59c7fa9b4..2345f98665 100644 --- a/examples/vdpa/main.c +++ b/examples/vdpa/main.c @@ -38,7 +38,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; @@ -227,7 +226,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]); } @@ -399,7 +398,7 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl, res->bdf); return; } - 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].dev == vdev) { vport = &vports[i]; break; @@ -536,10 +535,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