New upstream version 16.11.5
[deb_dpdk.git] / examples / bond / main.c
index 53bd044..f1303e3 100644 (file)
@@ -67,7 +67,6 @@
 #include <rte_debug.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_ring.h>
 #include <rte_log.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
@@ -161,7 +160,7 @@ static struct rte_eth_conf port_conf = {
                .hw_ip_checksum = 0, /**< IP checksum offload enabled */
                .hw_vlan_filter = 0, /**< VLAN filtering disabled */
                .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
-               .hw_strip_crc   = 0, /**< CRC stripped by hardware */
+               .hw_strip_crc   = 1, /**< CRC stripped by hardware */
        },
        .rx_adv_conf = {
                .rss_conf = {
@@ -438,6 +437,11 @@ static void cmd_obj_send_parsed(void *parsed_result,
                                (BOND_IP_3 << 16) | (BOND_IP_4 << 24);
 
        created_pkt = rte_pktmbuf_alloc(mbuf_pool);
+       if (created_pkt == NULL) {
+               cmdline_printf(cl, "Failed to allocate mbuf\n");
+               return;
+       }
+
        pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr);
        created_pkt->data_len = pkt_size;
        created_pkt->pkt_len = pkt_size;
@@ -590,10 +594,14 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
                return;
        }
        global_flag_stru_p->LcoreMainIsRunning = 0;
-       rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
-       cmdline_printf(cl,
-                       "lcore_main stopped on core:%d\n",
-                       global_flag_stru_p->LcoreMainCore);
+       if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+               cmdline_printf(cl,
+                               "error: lcore_main can not stop on core:%d\n",
+                               global_flag_stru_p->LcoreMainCore);
+       else
+               cmdline_printf(cl,
+                               "lcore_main stopped on core:%d\n",
+                               global_flag_stru_p->LcoreMainCore);
        rte_spinlock_unlock(&global_flag_stru_p->lock);
 }
 
@@ -628,10 +636,14 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
                return;
        }
        global_flag_stru_p->LcoreMainIsRunning = 0;
-       rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
-       cmdline_printf(cl,
-                       "lcore_main stopped on core:%d\n",
-                       global_flag_stru_p->LcoreMainCore);
+       if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+               cmdline_printf(cl,
+                               "error: lcore_main can not stop on core:%d\n",
+                               global_flag_stru_p->LcoreMainCore);
+       else
+               cmdline_printf(cl,
+                               "lcore_main stopped on core:%d\n",
+                               global_flag_stru_p->LcoreMainCore);
        rte_spinlock_unlock(&global_flag_stru_p->lock);
        cmdline_quit(cl);
 }