[dpdk-dev] [PATCH 12/14] examples/vdpa: remove useless device count

Maxime Coquelin maxime.coquelin at redhat.com
Thu Jun 11 23:37:46 CEST 2020


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 at 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



More information about the dev mailing list