bus/dpaa: add QMAN interface driver
[dpdk.git] / examples / l2fwd-keepalive / main.c
index 5fdbdef..83bc542 100644 (file)
@@ -53,7 +53,6 @@
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_per_lcore.h>
 #include <rte_launch.h>
 #include <rte_atomic.h>
 #include <rte_cycles.h>
@@ -567,6 +566,7 @@ main(int argc, char **argv)
        unsigned lcore_id, rx_lcore_id;
        unsigned nb_ports_in_mask = 0;
        struct sigaction signal_handler;
+       struct rte_keepalive_shm *ka_shm;
 
        memset(&signal_handler, 0, sizeof(signal_handler));
        terminate_signal_received = 0;
@@ -676,6 +676,13 @@ main(int argc, char **argv)
                                "Cannot configure device: err=%d, port=%u\n",
                                ret, (unsigned) portid);
 
+               ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+                                                      &nb_txd);
+               if (ret < 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Cannot adjust number of descriptors: err=%d, port=%u\n",
+                               ret, (unsigned) portid);
+
                rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
 
                /* init one RX queue */
@@ -751,9 +758,8 @@ main(int argc, char **argv)
        rte_timer_subsystem_init();
        rte_timer_init(&stats_timer);
 
+       ka_shm = NULL;
        if (check_period > 0) {
-               struct rte_keepalive_shm *ka_shm;
-
                ka_shm = rte_keepalive_shm_create();
                if (ka_shm == NULL)
                        rte_exit(EXIT_FAILURE,
@@ -813,5 +819,7 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       if (ka_shm != NULL)
+               rte_keepalive_shm_cleanup(ka_shm);
        return 0;
 }