X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_link_bonding.c;h=32296604d23d363f71e9010b30a37a32ffb76e8f;hb=c6a1d9b5abcec20ab8018c1093cc230a708a814c;hp=0f743fccdb92d146dd2e6185eda56ab7bfb9ec32;hpb=299191e0c9ba560a9d0f92cf75f7e9660ac8f1e2;p=dpdk.git diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 0f743fccdb..32296604d2 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -75,18 +75,15 @@ ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \ ETH_TXQ_FLAGS_NOXSUMTCP) -#define MBUF_PAYLOAD_SIZE (2048) -#define MBUF_SIZE (MBUF_PAYLOAD_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE (250) #define BURST_SIZE (32) -#define DEFAULT_MBUF_DATA_SIZE (2048) #define RTE_TEST_RX_DESC_MAX (2048) #define RTE_TEST_TX_DESC_MAX (2048) #define MAX_PKT_BURST (512) #define DEF_PKT_BURST (16) -#define BONDED_DEV_NAME ("unit_test_bonded_device") +#define BONDED_DEV_NAME ("unit_test_bond_dev") #define INVALID_SOCKET_ID (-1) #define INVALID_PORT_ID (-1) @@ -280,10 +277,9 @@ test_setup(void) nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST; if (test_params->mbuf_pool == NULL) { - test_params->mbuf_pool = rte_mempool_create("MBUF_POOL", nb_mbuf_per_pool, - MBUF_SIZE, MBUF_CACHE_SIZE, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + test_params->mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", + nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, + RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); TEST_ASSERT_NOT_NULL(test_params->mbuf_pool, "rte_mempool_create failed"); } @@ -707,9 +703,7 @@ test_set_bonding_mode(void) int bonding_modes[] = { BONDING_MODE_ROUND_ROBIN, BONDING_MODE_ACTIVE_BACKUP, BONDING_MODE_BALANCE, -#ifdef RTE_MBUF_REFCNT BONDING_MODE_BROADCAST -#endif }; /* Test supported link bonding modes */ @@ -1429,7 +1423,6 @@ test_roundrobin_tx_burst(void) return remove_slaves_and_stop_bonded_device(); } -#ifdef RTE_MBUF_REFCNT static int verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val) { @@ -1443,8 +1436,6 @@ verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val) } return 0; } -#endif - static void free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs) @@ -1549,12 +1540,10 @@ test_roundrobin_tx_burst_slave_tx_fail(void) (unsigned int)port_stats.opackets, slave_expected_tx_count); } -#ifdef RTE_MBUF_REFCNT /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); -#endif free_mbufs(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); /* Clean up and remove slaves from bonded device */ @@ -3063,12 +3052,10 @@ test_balance_tx_burst_slave_tx_fail(void) (unsigned int)port_stats.opackets, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); -#ifdef RTE_MBUF_REFCNT /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst_1[tx_count_1], TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); -#endif free_mbufs(&pkts_burst_1[tx_count_1], TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); @@ -3479,9 +3466,6 @@ 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 test_broadcast_tx_burst(void) { @@ -4009,7 +3993,6 @@ 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) @@ -4037,16 +4020,14 @@ test_close_bonded_device(void) return 0; } -static int +static void testsuite_teardown(void) { - if (test_params->pkt_eth_hdr != NULL) { - free(test_params->pkt_eth_hdr); - test_params->pkt_eth_hdr = NULL; - } + free(test_params->pkt_eth_hdr); + test_params->pkt_eth_hdr = NULL; /* Clean up and remove slaves from bonded device */ - return remove_slaves_and_stop_bonded_device(); + remove_slaves_and_stop_bonded_device(); } static void @@ -4075,7 +4056,6 @@ test_tlb_tx_burst(void) struct rte_eth_stats port_stats[32]; uint64_t sum_ports_opackets = 0, all_bond_opackets = 0, all_bond_obytes = 0; uint16_t pktlen; - uint64_t floor_obytes = 0, ceiling_obytes = 0; TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves (BONDING_MODE_TLB, 1, 3, 1), @@ -4087,7 +4067,7 @@ test_tlb_tx_burst(void) "Burst size specified is greater than supported.\n"); - /* Generate 400000 test bursts in 2s of packets to transmit */ + /* Generate bursts of packets */ for (i = 0; i < 400000; i++) { /*test two types of mac src own(bonding) and others */ if (i % 2 == 0) { @@ -4140,15 +4120,14 @@ test_tlb_tx_burst(void) TEST_ASSERT_EQUAL(sum_ports_opackets, (uint64_t)all_bond_opackets, "Total packets sent by slaves is not equal to packets sent by bond interface"); - /* distribution of packets on each slave within +/- 10% of the expected value. */ - for (i = 0; i < test_params->bonded_slave_count; i++) { - floor_obytes = (all_bond_obytes*90)/(test_params->bonded_slave_count*100); - ceiling_obytes = (all_bond_obytes*110)/(test_params->bonded_slave_count*100); - TEST_ASSERT(port_stats[i].obytes >= floor_obytes && - port_stats[i].obytes <= ceiling_obytes, - "Distribution is not even"); + /* checking if distribution of packets is balanced over slaves */ + for (i = 0; i < test_params->bonded_slave_count; i++) { + TEST_ASSERT(port_stats[i].obytes > 0 && + port_stats[i].obytes < all_bond_obytes, + "Packets are not balanced over slaves"); } + /* Put all slaves down and try and transmit */ for (i = 0; i < test_params->bonded_slave_count; i++) { virtual_ethdev_simulate_link_status_interrupt( @@ -5003,18 +4982,16 @@ static struct unit_test_suite link_bonding_test_suite = { TEST_CASE(test_alb_reply_from_client), TEST_CASE(test_alb_receive_vlan_reply), TEST_CASE(test_alb_ipv4_tx), -#ifdef RTE_MBUF_REFCNT TEST_CASE(test_broadcast_tx_burst), TEST_CASE(test_broadcast_tx_burst_slave_tx_fail), 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), - { NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */ + TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -5025,8 +5002,4 @@ test_link_bonding(void) return unit_test_suite_runner(&link_bonding_test_suite); } -static struct test_command link_bonding_cmd = { - .command = "link_bonding_autotest", - .callback = test_link_bonding, -}; -REGISTER_TEST_COMMAND(link_bonding_cmd); +REGISTER_TEST_COMMAND(link_bonding_autotest, test_link_bonding);