app: check status of getting ethdev info
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Thu, 12 Sep 2019 16:42:15 +0000 (17:42 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 12:45:35 +0000 (14:45 +0200)
rte_eth_dev_info_get() return value was changed from void to int, so
this patch modify rte_eth_dev_info_get() usage across apps
according to its new return type.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/proc-info/main.c
app/test-eventdev/test_perf_common.c
app/test-eventdev/test_pipeline_common.c
app/test/test_event_eth_rx_adapter.c
app/test/test_kni.c
app/test/test_link_bonding_rssconf.c
app/test/test_pmd_ring.c

index a89b51b..34eb7a7 100644 (file)
@@ -683,7 +683,12 @@ show_port(void)
                if (ret == 0)
                        printf("\t  -- mtu (%d)\n", mtu);
 
-               rte_eth_dev_info_get(i, &dev_info);
+               ret = rte_eth_dev_info_get(i, &dev_info);
+               if (ret != 0) {
+                       printf("Error during getting device (port %u) info: %s\n",
+                               i, strerror(-ret));
+                       return;
+               }
 
                printf("  - queue\n");
                for (j = 0; j < dev_info.nb_rx_queues; j++) {
@@ -836,7 +841,13 @@ show_tm(void)
                memset(&cap, 0, sizeof(cap));
                memset(&error, 0, sizeof(error));
 
-               rte_eth_dev_info_get(i, &dev_info);
+               ret = rte_eth_dev_info_get(i, &dev_info);
+               if (ret != 0) {
+                       printf("Error during getting device (port %u) info: %s\n",
+                               i, strerror(-ret));
+                       return;
+               }
+
                printf("  - Generic for port (%u)\n"
                        "\t  -- driver name %s\n"
                        "\t  -- max vf (%u)\n"
index aa925a7..e75582b 100644 (file)
@@ -660,6 +660,7 @@ int
 perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 {
        uint16_t i;
+       int ret;
        struct test_perf *t = evt_test_priv(test);
        struct rte_eth_conf port_conf = {
                .rxmode = {
@@ -688,7 +689,12 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
                struct rte_eth_dev_info dev_info;
                struct rte_eth_conf local_port_conf = port_conf;
 
-               rte_eth_dev_info_get(i, &dev_info);
+               ret = rte_eth_dev_info_get(i, &dev_info);
+               if (ret != 0) {
+                       evt_err("Error during getting device (port %u) info: %s\n",
+                                       i, strerror(-ret));
+                       return ret;
+               }
 
                local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
                        dev_info.flow_type_rss_offloads;
index 16c49b8..ef8ae28 100644 (file)
@@ -159,6 +159,7 @@ int
 pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 {
        uint16_t i;
+       int ret;
        uint8_t nb_queues = 1;
        struct test_pipeline *t = evt_test_priv(test);
        struct rte_eth_rxconf rx_conf;
@@ -191,7 +192,13 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
                if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
                        t->internal_port = 0;
 
-               rte_eth_dev_info_get(i, &dev_info);
+               ret = rte_eth_dev_info_get(i, &dev_info);
+               if (ret != 0) {
+                       evt_err("Error during getting device (port %u) info: %s\n",
+                               i, strerror(-ret));
+                       return ret;
+               }
+
                rx_conf = dev_info.default_rxconf;
                rx_conf.offloads = port_conf.rxmode.offloads;
 
index 953b827..950bc67 100644 (file)
@@ -45,7 +45,9 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 
        retval = rte_eth_dev_configure(port, 0, 0, port_conf);
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0)
+               return retval;
 
        default_params.rx_rings = RTE_MIN(dev_info.max_rx_queues,
                                        MAX_NUM_RX_QUEUE);
index 7a65de1..2c33374 100644 (file)
@@ -436,7 +436,13 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
        memset(&info, 0, sizeof(info));
        memset(&ops, 0, sizeof(ops));
 
-       rte_eth_dev_info_get(port_id, &info);
+       ret = rte_eth_dev_info_get(port_id, &info);
+       if (ret != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port_id, strerror(-ret));
+               return -1;
+       }
+
        if (info.device)
                bus = rte_bus_find_by_device(info.device);
        if (bus && !strcmp(bus->name, "pci")) {
@@ -622,7 +628,14 @@ test_kni(void)
        memset(&info, 0, sizeof(info));
        memset(&conf, 0, sizeof(conf));
        memset(&ops, 0, sizeof(ops));
-       rte_eth_dev_info_get(port_id, &info);
+
+       ret = rte_eth_dev_info_get(port_id, &info);
+       if (ret != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port_id, strerror(-ret));
+               return -1;
+       }
+
        if (info.device)
                bus = rte_bus_find_by_device(info.device);
        else
@@ -658,7 +671,15 @@ test_kni(void)
        memset(&conf, 0, sizeof(conf));
        memset(&info, 0, sizeof(info));
        memset(&ops, 0, sizeof(ops));
-       rte_eth_dev_info_get(port_id, &info);
+
+       ret = rte_eth_dev_info_get(port_id, &info);
+       if (ret != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port_id, strerror(-ret));
+               ret = -1;
+               goto fail;
+       }
+
        if (info.device)
                bus = rte_bus_find_by_device(info.device);
        else
index 65de3b9..1a9571e 100644 (file)
@@ -329,7 +329,11 @@ test_propagate(void)
        uint64_t rss_hf = 0;
        uint64_t default_rss_hf = 0;
 
-       rte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);
+       retval = rte_eth_dev_info_get(test_params.bond_port_id,
+                                               &test_params.bond_dev_info);
+       TEST_ASSERT((retval == 0),
+                       "Error during getting device (port %u) info: %s\n",
+                       test_params.bond_port_id, strerror(-retval));
 
        /*
         *  Test hash function propagation
@@ -443,10 +447,16 @@ test_rss(void)
        /**
         * Configure bonding port in RSS mq mode
         */
+       int ret;
+
        TEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,
                        &rss_pmd_conf, 0), "Failed to configure bonding device\n");
 
-       rte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);
+       ret = rte_eth_dev_info_get(test_params.bond_port_id,
+                                       &test_params.bond_dev_info);
+       TEST_ASSERT((ret == 0),
+                       "Error during getting device (port %u) info: %s\n",
+                       test_params.bond_port_id, strerror(-ret));
 
        TEST_ASSERT_SUCCESS(bond_slaves(), "Bonding slaves failed");
 
@@ -468,10 +478,16 @@ test_rss(void)
 static int
 test_rss_lazy(void)
 {
+       int ret;
+
        TEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,
                        &default_pmd_conf, 0), "Failed to configure bonding device\n");
 
-       rte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);
+       ret = rte_eth_dev_info_get(test_params.bond_port_id,
+                                               &test_params.bond_dev_info);
+       TEST_ASSERT((ret == 0),
+                       "Error during getting device (port %u) info: %s\n",
+                       test_params.bond_port_id, strerror(-ret));
 
        TEST_ASSERT_SUCCESS(bond_slaves(), "Bonding slaves failed");
 
@@ -532,6 +548,10 @@ test_setup(void)
                rte_eth_dev_default_mac_addr_set(port->port_id, &mac_addr);
 
                rte_eth_dev_info_get(port->port_id, &port->dev_info);
+               retval = rte_eth_dev_info_get(port->port_id, &port->dev_info);
+               TEST_ASSERT((retval == 0),
+                               "Error during getting device (port %u) info: %s\n",
+                               test_params.bond_port_id, strerror(-retval));
        }
 
        if (test_params.bond_port_id == INVALID_PORT_ID) {
@@ -545,8 +565,11 @@ test_setup(void)
                TEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,
                                &default_pmd_conf, 0), "Failed to configure bonding device\n");
 
-               rte_eth_dev_info_get(test_params.bond_port_id,
-                               &test_params.bond_dev_info);
+               retval = rte_eth_dev_info_get(test_params.bond_port_id,
+                                               &test_params.bond_dev_info);
+               TEST_ASSERT((retval == 0),
+                               "Error during getting device (port %u) info: %s\n",
+                               test_params.bond_port_id, strerror(-retval));
        }
 
        return TEST_SUCCESS;
index 6414bbd..65ab6e7 100644 (file)
@@ -490,10 +490,17 @@ static int
 test_command_line_ring_port(void)
 {
        int port, cmdl_port0 = -1;
+       int ret;
+
        /* find a port created with the --vdev=net_ring0 command line option */
        RTE_ETH_FOREACH_DEV(port) {
                struct rte_eth_dev_info dev_info;
-               rte_eth_dev_info_get(port, &dev_info);
+
+               ret = rte_eth_dev_info_get(port, &dev_info);
+               TEST_ASSERT((ret == 0),
+                               "Error during getting device (port %d) info: %s\n",
+                               port, strerror(-ret));
+
                if (!strcmp(dev_info.driver_name, "Rings PMD")) {
                        printf("found a command line ring port=%d\n", port);
                        cmdl_port0 = port;