app/testpmd: check status of getting MAC address
[dpdk.git] / app / test-pmd / config.c
index 24158e5..957c61f 100644 (file)
@@ -273,7 +273,13 @@ nic_xstats_display(portid_t port_id)
 void
 nic_xstats_clear(portid_t port_id)
 {
-       rte_eth_xstats_reset(port_id);
+       int ret;
+
+       ret = rte_eth_xstats_reset(port_id);
+       if (ret != 0) {
+               printf("%s: Error: failed to reset xstats (port %u): %s",
+                      __func__, port_id, strerror(ret));
+       }
 }
 
 void
@@ -448,9 +454,11 @@ skip_parse:
 
                        /* List ports with matching device name */
                        RTE_ETH_FOREACH_DEV_OF(port_id, dev) {
-                               rte_eth_macaddr_get(port_id, &mac_addr);
                                printf("\n\tPort id: %-2d", port_id);
-                               print_ethaddr("\n\tMAC address: ", &mac_addr);
+                               if (eth_macaddr_get_print_err(port_id,
+                                                             &mac_addr) == 0)
+                                       print_ethaddr("\n\tMAC address: ",
+                                                     &mac_addr);
                                rte_eth_dev_get_name_by_port(port_id, name);
                                printf("\n\tDevice name: %s", name);
                                printf("\n");
@@ -478,7 +486,9 @@ port_infos_display(portid_t port_id)
                return;
        }
        port = &ports[port_id];
-       rte_eth_link_get_nowait(port_id, &link);
+       ret = eth_link_get_nowait_print_err(port_id, &link);
+       if (ret < 0)
+               return;
 
        ret = eth_dev_info_get_print_err(port_id, &dev_info);
        if (ret != 0)
@@ -486,8 +496,8 @@ port_infos_display(portid_t port_id)
 
        printf("\n%s Infos for port %-2d %s\n",
               info_border, port_id, info_border);
-       rte_eth_macaddr_get(port_id, &mac_addr);
-       print_ethaddr("MAC address: ", &mac_addr);
+       if (eth_macaddr_get_print_err(port_id, &mac_addr) == 0)
+               print_ethaddr("MAC address: ", &mac_addr);
        rte_eth_dev_get_name_by_port(port_id, name);
        printf("\nDevice name: %s", name);
        printf("\nDriver name: %s", dev_info.driver_name);
@@ -629,14 +639,18 @@ port_summary_display(portid_t port_id)
                return;
        }
 
-       rte_eth_link_get_nowait(port_id, &link);
+       ret = eth_link_get_nowait_print_err(port_id, &link);
+       if (ret < 0)
+               return;
 
        ret = eth_dev_info_get_print_err(port_id, &dev_info);
        if (ret != 0)
                return;
 
        rte_eth_dev_get_name_by_port(port_id, name);
-       rte_eth_macaddr_get(port_id, &mac_addr);
+       ret = eth_macaddr_get_print_err(port_id, &mac_addr);
+       if (ret != 0)
+               return;
 
        printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n",
                port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
@@ -3515,10 +3529,13 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
 {
        int diag;
        struct rte_eth_link link;
+       int ret;
 
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return 1;
-       rte_eth_link_get_nowait(port_id, &link);
+       ret = eth_link_get_nowait_print_err(port_id, &link);
+       if (ret < 0)
+               return 1;
        if (rate > link.link_speed) {
                printf("Invalid rate value:%u bigger than link speed: %u\n",
                        rate, link.link_speed);