net/vmxnet3: use contiguous allocation for DMA memory
[dpdk.git] / examples / flow_filtering / main.c
index 58e2685..0bb81a8 100644 (file)
 #include <rte_mbuf.h>
 #include <rte_net.h>
 #include <rte_flow.h>
+#include <rte_cycles.h>
 
 static volatile bool force_quit;
 
-static uint8_t port_id;
+static uint16_t port_id;
 static uint16_t nr_queues = 5;
 static uint8_t selected_queue = 1;
 struct rte_mempool *mbuf_pool;
@@ -119,13 +120,23 @@ main_loop(void)
        rte_eth_dev_close(port_id);
 }
 
+#define CHECK_INTERVAL 1000  /* 100ms */
+#define MAX_REPEAT_TIMES 90  /* 9s (90 * 100ms) in total */
+
 static void
 assert_link_status(void)
 {
        struct rte_eth_link link;
+       uint8_t rep_cnt = MAX_REPEAT_TIMES;
 
        memset(&link, 0, sizeof(link));
-       rte_eth_link_get(port_id, &link);
+       do {
+               rte_eth_link_get(port_id, &link);
+               if (link.link_status == ETH_LINK_UP)
+                       break;
+               rte_delay_ms(CHECK_INTERVAL);
+       } while (--rep_cnt);
+
        if (link.link_status == ETH_LINK_DOWN)
                rte_exit(EXIT_FAILURE, ":: error: link is still down\n");
 }