test: check stop call status
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Thu, 15 Oct 2020 13:30:36 +0000 (14:30 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 16 Oct 2020 20:26:41 +0000 (22:26 +0200)
rte_eth_dev_stop() return value was changed from void to int,
so this patch modify usage of this function across test/event
according to new return type.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
app/test/test_event_eth_rx_adapter.c
app/test/test_kni.c
app/test/test_link_bonding.c
app/test/test_link_bonding_mode4.c
app/test/test_link_bonding_rssconf.c
app/test/test_pmd_perf.c
app/test/test_pmd_ring.c
app/test/test_pmd_ring_perf.c

index dbf85be..9198767 100644 (file)
@@ -158,7 +158,9 @@ init_port_rx_intr(int num_ports)
                        default_params.rx_intr_port = portid;
                        return 0;
                }
-               rte_eth_dev_stop(portid);
+               retval = rte_eth_dev_stop(portid);
+               TEST_ASSERT(retval == 0, "Failed to stop port %u: %d\n",
+                                       portid, retval);
        }
        return 0;
 }
@@ -536,8 +538,11 @@ adapter_multi_eth_add_del(void)
 
        /* stop eth devices for existing */
        port_index = 0;
-       for (; port_index < rte_eth_dev_count_total(); port_index += 1)
-               rte_eth_dev_stop(port_index);
+       for (; port_index < rte_eth_dev_count_total(); port_index += 1) {
+               err = rte_eth_dev_stop(port_index);
+               TEST_ASSERT(err == 0, "Failed to stop port %u: %d\n",
+                                       port_index, err);
+       }
 
        /* add the max port for rx_adapter */
        port_index = rte_eth_dev_count_total();
index e47ab36..931e8cb 100644 (file)
@@ -755,7 +755,8 @@ test_kni(void)
        ret = 0;
 
 fail:
-       rte_eth_dev_stop(port_id);
+       if (rte_eth_dev_stop(port_id) != 0)
+               printf("Failed to stop port %u\n", port_id);
 
        return ret;
 }
index 3a46f94..e8b76bd 100644 (file)
@@ -613,7 +613,9 @@ test_stop_bonded_device(void)
        struct rte_eth_link link_status;
        int retval;
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        retval = rte_eth_link_get(test_params->bonded_port_id, &link_status);
        TEST_ASSERT(retval >= 0,
@@ -647,7 +649,10 @@ remove_slaves_and_stop_bonded_device(void)
                TEST_ASSERT_SUCCESS(test_remove_slave_from_bonded_device(),
                                "test_remove_slave_from_bonded_device failed");
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
+
        rte_eth_stats_reset(test_params->bonded_port_id);
        rte_eth_bond_mac_address_reset(test_params->bonded_port_id);
 
@@ -755,7 +760,9 @@ test_set_primary_slave(void)
                                test_params->slave_port_ids[i]);
 
                /* stop/start bonded eth dev to apply new MAC */
-               rte_eth_dev_stop(test_params->bonded_port_id);
+               TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                               "Failed to stop bonded port %u",
+                               test_params->bonded_port_id);
 
                TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                                "Failed to start bonded port %d",
@@ -1024,7 +1031,10 @@ test_set_bonded_port_initialization_mac_assignment(void)
                        slave_port_ids[2]),
                        "failed to set primary port on bonded device.");
 
-       rte_eth_dev_stop(bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       bonded_port_id);
+
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(bonded_port_id),
                                "Failed to start bonded pmd eth device %d.",
                                bonded_port_id);
@@ -1063,7 +1073,9 @@ test_set_bonded_port_initialization_mac_assignment(void)
         *    b - remove slave ethdevs
         *    c - Verify slave ethdevs MACs are restored
         */
-       rte_eth_dev_stop(bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       bonded_port_id);
 
        for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) {
                TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(bonded_port_id,
@@ -1769,7 +1781,9 @@ test_roundrobin_verify_mac_assignment(void)
 
        /* stop / start bonded device and verify that primary MAC address is
         * propagate to bonded device and slaves */
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                        "Failed to start bonded device");
@@ -2404,7 +2418,9 @@ test_activebackup_verify_mac_assignment(void)
        /* stop / start bonded device and verify that primary MAC address is
         * propagated to bonded device and slaves */
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                        "Failed to start device");
@@ -3335,7 +3351,9 @@ test_balance_verify_mac_assignment(void)
        /* stop / start bonded device and verify that primary MAC address is
         * propagated to bonded device and slaves */
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                        "Failed to start bonded device");
@@ -3932,7 +3950,9 @@ test_broadcast_verify_mac_assignment(void)
        /* stop / start bonded device and verify that primary MAC address is
         * propagated to bonded device and slaves */
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                        "Failed to start bonded device");
@@ -4472,7 +4492,9 @@ test_tlb_verify_mac_assignment(void)
        /* stop / start bonded device and verify that primary MAC address is
         * propagated to bonded device and slaves */
 
-       rte_eth_dev_stop(test_params->bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params->bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params->bonded_port_id);
 
        TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id),
                        "Failed to start device");
index cf12f02..2c835fa 100644 (file)
@@ -355,7 +355,9 @@ remove_slaves_and_stop_bonded_device(void)
        uint16_t slaves[RTE_MAX_ETHPORTS];
        uint16_t i;
 
-       rte_eth_dev_stop(test_params.bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params.bonded_port_id);
 
        FOR_EACH_SLAVE(i, slave)
                remove_slave(slave);
@@ -368,7 +370,9 @@ remove_slaves_and_stop_bonded_device(void)
                        test_params.bonded_port_id, retval);
 
        FOR_EACH_PORT(i, slave) {
-               rte_eth_dev_stop(slave->port_id);
+               TEST_ASSERT_SUCCESS(rte_eth_dev_stop(slave->port_id),
+                               "Failed to stop bonded port %u",
+                               slave->port_id);
 
                TEST_ASSERT(slave->bonded == 0,
                        "Port id=%u is still marked as enslaved.", slave->port_id);
index 1a9571e..5dac60c 100644 (file)
@@ -176,7 +176,8 @@ static int
 remove_slaves_and_stop_bonded_device(void)
 {
        TEST_ASSERT_SUCCESS(remove_slaves(), "Removing slaves");
-       rte_eth_dev_stop(test_params.bond_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bond_port_id),
+                       "Failed to stop port %u", test_params.bond_port_id);
        return TEST_SUCCESS;
 }
 
index d1240b7..49a805c 100644 (file)
@@ -802,7 +802,10 @@ test_pmd_perf(void)
                if (socketid != rte_eth_dev_socket_id(portid))
                        continue;
 
-               rte_eth_dev_stop(portid);
+               ret = rte_eth_dev_stop(portid);
+               if (ret != 0)
+                       printf("rte_eth_dev_stop: err=%s, port=%u\n",
+                              rte_strerror(-ret), portid);
        }
 
        return 0;
index 02873f2..86b1db2 100644 (file)
@@ -225,6 +225,7 @@ test_pmd_ring_pair_create_attach(void)
        struct rte_eth_stats stats, stats2;
        struct rte_mbuf buf, *pbuf = &buf;
        struct rte_eth_conf null_conf;
+       int ret;
 
        memset(&null_conf, 0, sizeof(struct rte_eth_conf));
 
@@ -412,8 +413,14 @@ test_pmd_ring_pair_create_attach(void)
                return TEST_FAILED;
        }
 
-       rte_eth_dev_stop(rxtx_portd);
-       rte_eth_dev_stop(rxtx_porte);
+       ret = rte_eth_dev_stop(rxtx_portd);
+       if (ret != 0)
+               printf("Error: failed to stop port %u: %s\n",
+                      rxtx_portd, rte_strerror(-ret));
+       ret = rte_eth_dev_stop(rxtx_porte);
+       if (ret != 0)
+               printf("Error: failed to stop port %u: %s\n",
+                      rxtx_porte, rte_strerror(-ret));
 
        return TEST_SUCCESS;
 }
@@ -421,13 +428,22 @@ test_pmd_ring_pair_create_attach(void)
 static void
 test_cleanup_resources(void)
 {
-       int itr;
+       int itr, ret;
        for (itr = 0; itr < NUM_RINGS; itr++)
                rte_ring_free(rxtx[itr]);
 
-       rte_eth_dev_stop(tx_porta);
-       rte_eth_dev_stop(rx_portb);
-       rte_eth_dev_stop(rxtx_portc);
+       ret = rte_eth_dev_stop(tx_porta);
+       if (ret != 0)
+               printf("Error: failed to stop port %u: %s\n",
+                      tx_porta, rte_strerror(-ret));
+       ret = rte_eth_dev_stop(rx_portb);
+       if (ret != 0)
+               printf("Error: failed to stop port %u: %s\n",
+                      rx_portb, rte_strerror(-ret));
+       ret = rte_eth_dev_stop(rxtx_portc);
+       if (ret != 0)
+               printf("Error: failed to stop port %u: %s\n",
+                      rxtx_portc, rte_strerror(-ret));
 
        rte_mempool_free(mp);
        rte_vdev_uninit("net_ring_net_ringa");
@@ -522,7 +538,8 @@ test_command_line_ring_port(void)
                                "test stats reset cmdl_port0 is failed");
                TEST_ASSERT((test_get_stats(cmdl_port0) < 0),
                                "test get stats cmdl_port0 is failed");
-               rte_eth_dev_stop(cmdl_port0);
+               TEST_ASSERT((rte_eth_dev_stop(cmdl_port0) == 0),
+                               "test stop cmdl_port0 is failed");
        }
        return TEST_SUCCESS;
 }
index 3b2ff9c..d249b7d 100644 (file)
@@ -155,7 +155,8 @@ test_ring_pmd_perf(void)
        test_bulk_enqueue_dequeue();
 
        /* release port and ring resources */
-       rte_eth_dev_stop(ring_ethdev_port);
+       if (rte_eth_dev_stop(ring_ethdev_port) != 0)
+               return -1;
        rte_eth_dev_get_name_by_port(ring_ethdev_port, name);
        rte_vdev_uninit(name);
        rte_ring_free(r);