examples: enclose DPDK includes with angle brackets
[dpdk.git] / examples / bbdev_app / main.c
index 3d36629..e512c80 100644 (file)
 #include <getopt.h>
 #include <signal.h>
 
-#include "rte_atomic.h"
-#include "rte_common.h"
-#include "rte_eal.h"
-#include "rte_cycles.h"
-#include "rte_ether.h"
-#include "rte_ethdev.h"
-#include "rte_ip.h"
-#include "rte_lcore.h"
-#include "rte_malloc.h"
-#include "rte_mbuf.h"
-#include "rte_memory.h"
-#include "rte_mempool.h"
-#include "rte_log.h"
-#include "rte_bbdev.h"
-#include "rte_bbdev_op.h"
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_eal.h>
+#include <rte_cycles.h>
+#include <rte_ether.h>
+#include <rte_ethdev.h>
+#include <rte_ip.h>
+#include <rte_lcore.h>
+#include <rte_malloc.h>
+#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
+#include <rte_log.h>
+#include <rte_bbdev.h>
+#include <rte_bbdev_op.h>
 
 /* LLR values - negative value for '1' bit */
 #define LLR_1_BIT 0x81
@@ -312,6 +312,7 @@ check_port_link_status(uint16_t port_id)
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
        uint8_t count;
        struct rte_eth_link link;
+       int link_get_err = -EINVAL;
 
        printf("\nChecking link status.");
        fflush(stdout);
@@ -319,14 +320,16 @@ check_port_link_status(uint16_t port_id)
        for (count = 0; count <= MAX_CHECK_TIME &&
                        !rte_atomic16_read(&global_exit_flag); count++) {
                memset(&link, 0, sizeof(link));
-               rte_eth_link_get_nowait(port_id, &link);
+               link_get_err = rte_eth_link_get_nowait(port_id, &link);
 
-               if (link.link_status) {
+               if (link_get_err >= 0 && link.link_status) {
                        const char *dp = (link.link_duplex ==
                                ETH_LINK_FULL_DUPLEX) ?
                                "full-duplex" : "half-duplex";
-                       printf("\nPort %u Link Up - speed %u Mbps - %s\n",
-                               port_id, link.link_speed, dp);
+                       printf("\nPort %u Link Up - speed %s - %s\n",
+                               port_id,
+                               rte_eth_link_speed_to_str(link.link_speed),
+                               dp);
                        return 0;
                }
                printf(".");
@@ -334,7 +337,12 @@ check_port_link_status(uint16_t port_id)
                rte_delay_ms(CHECK_INTERVAL);
        }
 
-       printf("\nPort %d Link Down\n", port_id);
+       if (link_get_err >= 0)
+               printf("\nPort %d Link Down\n", port_id);
+       else
+               printf("\nGet link failed (port %d): %s\n", port_id,
+                      rte_strerror(-link_get_err));
+
        return 0;
 }
 
@@ -484,7 +492,13 @@ initialize_ports(struct app_config_params *app_params,
                return ret;
        }
 
-       rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
+       ret = rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
+       if (ret < 0) {
+               printf("rte_eth_macaddr_get: err=%d, queue=%u\n",
+                       ret, q);
+               return -1;
+       }
+
        print_mac(port_id, &bbdev_port_eth_addr);
 
        return 0;
@@ -647,6 +661,8 @@ print_stats(struct stats_lcore_params *stats_lcore)
                print_lcore_stats(stats_lcore->lconf[l_id].lcore_stats, l_id);
        }
 
+       fflush(stdout);
+
        free(xstats);
        free(xstats_names);
 }
@@ -1028,7 +1044,7 @@ main(int argc, char **argv)
        struct stats_lcore_params stats_lcore;
        struct rte_ring *enc_to_dec_ring;
        bool stats_thread_started = false;
-       unsigned int master_lcore_id = rte_get_master_lcore();
+       unsigned int main_lcore_id = rte_get_main_lcore();
 
        rte_atomic16_init(&global_exit_flag);
 
@@ -1131,9 +1147,9 @@ main(int argc, char **argv)
        stats_lcore.app_params = &app_params;
        stats_lcore.lconf = lcore_conf;
 
-       RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+       RTE_LCORE_FOREACH_WORKER(lcore_id) {
                if (lcore_conf[lcore_id].core_type != 0)
-                       /* launch per-lcore processing loop on slave lcores */
+                       /* launch per-lcore processing loop on worker lcores */
                        rte_eal_remote_launch(processing_loop,
                                        &lcore_conf[lcore_id], lcore_id);
                else if (!stats_thread_started) {
@@ -1145,15 +1161,15 @@ main(int argc, char **argv)
        }
 
        if (!stats_thread_started &&
-                       lcore_conf[master_lcore_id].core_type != 0)
+                       lcore_conf[main_lcore_id].core_type != 0)
                rte_exit(EXIT_FAILURE,
                                "Not enough lcores to run the statistics printing loop!");
-       else if (lcore_conf[master_lcore_id].core_type != 0)
-               processing_loop(&lcore_conf[master_lcore_id]);
+       else if (lcore_conf[main_lcore_id].core_type != 0)
+               processing_loop(&lcore_conf[main_lcore_id]);
        else if (!stats_thread_started)
                stats_loop(&stats_lcore);
 
-       RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+       RTE_LCORE_FOREACH_WORKER(lcore_id) {
                ret |= rte_eal_wait_lcore(lcore_id);
        }