examples/vdpa: remove useless device count
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Fri, 26 Jun 2020 14:04:39 +0000 (16:04 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 30 Jun 2020 12:52:30 +0000 (14:52 +0200)
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>
Acked-by: Adrián Moreno <amorenoz@redhat.com>
examples/vdpa/main.c

index d59c7fa..2345f98 100644 (file)
@@ -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);