app/test: allow to create packets of different sizes
[dpdk.git] / app / test / test_link_bonding.c
index db5b180..d407e4f 100644 (file)
@@ -788,7 +788,10 @@ test_set_bonding_mode(void)
        int bonding_modes[] = { BONDING_MODE_ROUND_ROBIN,
                                                        BONDING_MODE_ACTIVE_BACKUP,
                                                        BONDING_MODE_BALANCE,
-                                                       BONDING_MODE_BROADCAST };
+#ifdef RTE_MBUF_REFCNT
+                                                       BONDING_MODE_BROADCAST
+#endif
+                                                       };
 
        /* Test supported link bonding modes */
        for (i = 0; i < (int)RTE_DIM(bonding_modes);    i++) {
@@ -1189,9 +1192,12 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,
        }
 
        /* Generate burst of packets to transmit */
-       generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
-                       pkts_burst,     test_params->pkt_eth_hdr, vlan, ip_hdr, ipv4,
-                       test_params->pkt_udp_hdr, burst_size);
+       generated_burst_size =
+               generate_packet_burst(test_params->mbuf_pool,
+                                     pkts_burst, test_params->pkt_eth_hdr,
+                                     vlan, ip_hdr, ipv4,
+                                     test_params->pkt_udp_hdr, burst_size,
+                                     PACKET_BURST_GEN_PKT_LEN_128, 1);
        if (generated_burst_size != burst_size) {
                printf("Failed to generate packet burst");
                return -1;
@@ -1778,9 +1784,12 @@ test_activebackup_tx_burst(void)
        }
 
        /* Generate a burst of packets to transmit */
-       generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
-                       pkts_burst,     test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-                       1, test_params->pkt_udp_hdr, burst_size);
+       generated_burst_size =
+               generate_packet_burst(test_params->mbuf_pool,
+                                     pkts_burst, test_params->pkt_eth_hdr, 0,
+                                     test_params->pkt_ipv4_hdr, 1,
+                                     test_params->pkt_udp_hdr, burst_size,
+                                     PACKET_BURST_GEN_PKT_LEN, 1);
        if (generated_burst_size != burst_size)
                return -1;
 
@@ -2432,8 +2441,10 @@ test_balance_l2_tx_burst(void)
 
        /* Generate a burst 1 of packets to transmit */
        if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[0][0],
-                       test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-                       test_params->pkt_udp_hdr, burst_size[0]) != burst_size[0])
+                                 test_params->pkt_eth_hdr, 0,
+                                 test_params->pkt_ipv4_hdr, 1,
+                                 test_params->pkt_udp_hdr, burst_size[0],
+                                 PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[0])
                return -1;
 
        initialize_eth_header(test_params->pkt_eth_hdr,
@@ -2441,8 +2452,10 @@ test_balance_l2_tx_burst(void)
 
        /* Generate a burst 2 of packets to transmit */
        if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0],
-                       test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-                       test_params->pkt_udp_hdr, burst_size[1]) != burst_size[1])
+                                 test_params->pkt_eth_hdr, 0,
+                                 test_params->pkt_ipv4_hdr, 1,
+                                 test_params->pkt_udp_hdr, burst_size[1],
+                                 PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[1])
                return -1;
 
        /* Send burst 1 on bonded port */
@@ -3227,6 +3240,7 @@ test_balance_verify_slave_link_status_change_behaviour(void)
        return remove_slaves_and_stop_bonded_device();
 }
 
+#ifdef RTE_MBUF_REFCNT
 /** Broadcast Mode Tests */
 
 static int
@@ -3259,9 +3273,12 @@ test_broadcast_tx_burst(void)
        }
 
        /* Generate a burst of packets to transmit */
-       generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
-                       pkts_burst,     test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-                       1, test_params->pkt_udp_hdr, burst_size);
+       generated_burst_size =
+               generate_packet_burst(test_params->mbuf_pool,
+                                     pkts_burst, test_params->pkt_eth_hdr, 0,
+                                     test_params->pkt_ipv4_hdr, 1,
+                                     test_params->pkt_udp_hdr, burst_size,
+                                     PACKET_BURST_GEN_PKT_LEN, 1);
        if (generated_burst_size != burst_size)
                return -1;
 
@@ -3704,6 +3721,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
        /* Clean up and remove slaves from bonded device */
        return remove_slaves_and_stop_bonded_device();
 }
+#endif
 
 static int
 test_reconfigure_bonded_device(void)
@@ -3797,11 +3815,13 @@ static struct unit_test_suite link_bonding_test_suite  = {
                TEST_CASE(test_balance_verify_promiscuous_enable_disable),
                TEST_CASE(test_balance_verify_mac_assignment),
                TEST_CASE(test_balance_verify_slave_link_status_change_behaviour),
+#ifdef RTE_MBUF_REFCNT
                TEST_CASE(test_broadcast_tx_burst),
                TEST_CASE(test_broadcast_rx_burst),
                TEST_CASE(test_broadcast_verify_promiscuous_enable_disable),
                TEST_CASE(test_broadcast_verify_mac_assignment),
                TEST_CASE(test_broadcast_verify_slave_link_status_change_behaviour),
+#endif
                TEST_CASE(test_reconfigure_bonded_device),
                TEST_CASE(test_close_bonded_device),