test/threads: add unit test
[dpdk.git] / app / test / test_link_bonding_mode4.c
index cf12f02..d9b9c32 100644 (file)
@@ -107,12 +107,11 @@ static struct link_bonding_unittest_params test_params  = {
 
 static struct rte_eth_conf default_pmd_conf = {
        .rxmode = {
-               .mq_mode = ETH_MQ_RX_NONE,
-               .max_rx_pkt_len = RTE_ETHER_MAX_LEN,
+               .mq_mode = RTE_ETH_MQ_RX_NONE,
                .split_hdr_size = 0,
        },
        .txmode = {
-               .mq_mode = ETH_MQ_TX_NONE,
+               .mq_mode = RTE_ETH_MQ_TX_NONE,
        },
        .lpbk_mode = 0,
 };
@@ -195,8 +194,7 @@ free_pkts(struct rte_mbuf **pkts, uint16_t count)
        uint16_t i;
 
        for (i = 0; i < count; i++) {
-               if (pkts[i] != NULL)
-                       rte_pktmbuf_free(pkts[i]);
+               rte_pktmbuf_free(pkts[i]);
        }
 }
 
@@ -355,7 +353,9 @@ remove_slaves_and_stop_bonded_device(void)
        uint16_t slaves[RTE_MAX_ETHPORTS];
        uint16_t i;
 
-       rte_eth_dev_stop(test_params.bonded_port_id);
+       TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bonded_port_id),
+                       "Failed to stop bonded port %u",
+                       test_params.bonded_port_id);
 
        FOR_EACH_SLAVE(i, slave)
                remove_slave(slave);
@@ -368,7 +368,9 @@ remove_slaves_and_stop_bonded_device(void)
                        test_params.bonded_port_id, retval);
 
        FOR_EACH_PORT(i, slave) {
-               rte_eth_dev_stop(slave->port_id);
+               TEST_ASSERT_SUCCESS(rte_eth_dev_stop(slave->port_id),
+                               "Failed to stop bonded port %u",
+                               slave->port_id);
 
                TEST_ASSERT(slave->bonded == 0,
                        "Port id=%u is still marked as enslaved.", slave->port_id);
@@ -498,8 +500,8 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
        slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
 
        /* Change source address to partner address */
-       rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
-       slow_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+       rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.src_addr);
+       slow_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
                slave->port_id;
 
        lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
@@ -866,7 +868,7 @@ test_mode4_rx(void)
 
                for (i = 0; i < expected_pkts_cnt; i++) {
                        hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
-                       cnt[rte_is_same_ether_addr(&hdr->d_addr,
+                       cnt[rte_is_same_ether_addr(&hdr->dst_addr,
                                                        &bonded_mac)]++;
                }
 
@@ -914,7 +916,7 @@ test_mode4_rx(void)
 
                for (i = 0; i < expected_pkts_cnt; i++) {
                        hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
-                       eq_cnt += rte_is_same_ether_addr(&hdr->d_addr,
+                       eq_cnt += rte_is_same_ether_addr(&hdr->dst_addr,
                                                        &bonded_mac);
                }
 
@@ -1159,11 +1161,12 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave)
 
        /* Copy multicast destination address */
        rte_ether_addr_copy(&slow_protocol_mac_addr,
-                       &marker_hdr->eth_hdr.d_addr);
+                       &marker_hdr->eth_hdr.dst_addr);
 
        /* Init source address */
-       rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
-       marker_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+       rte_ether_addr_copy(&parnter_mac_default,
+                       &marker_hdr->eth_hdr.src_addr);
+       marker_hdr->eth_hdr.src_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
                slave->port_id;
 
        marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW);