link bonding
PATCH v8 1/7 bond: link status interrupt support
In reply to a message not in the archiveAdding support for lsc interrupt from bonded device to link bonding library with supporting unit tests in the test application.
--- app/test/test_link_bonding.c | 213 +++++++++++++++++++++++++++----- lib/librte_pmd_bond/rte_eth_bond_api.c | 4 + lib/librte_pmd_bond/rte_eth_bond_pmd.c | 6 + 3 files changed, 189 insertions(+), 34 deletions(-)
app/test/test_link_bonding.c +179 -34
@@ -39,6 +39,7 @@#include <inttypes.h> #include <errno.h> #include <sys/queue.h> +#include <sys/time.h> #include <rte_byteorder.h> #include <rte_common.h>
@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = { };static int -configure_ethdev (uint8_t port_id,uint8_t start) +configure_ethdev (uint8_t port_id,uint8_t start,uint8_t en_isr) {int q_id; +if (en_isr) + default_pmd_conf.intr_conf.lsc =1 ; +else + default_pmd_conf.intr_conf.lsc =0 ; +if (rte_eth_dev_configure (port_id, test_params->nb_rx_q, test_params->nb_tx_q, &default_pmd_conf) !=0 ) { goto error;
@@ -312,7 +318,7 @@ test_setup(void)printf ("Created virtual ethdev %s\n" , pmd_name); - retval =configure_ethdev (test_params->slave_port_ids[i],1 ); + retval =configure_ethdev (test_params->slave_port_ids[i],1 ,0 );if (retval !=0 ) {printf ("Failed to configure virtual ethdev %s\n" , pmd_name);return -1 ;
@@ -341,7 +347,7 @@ test_create_bonded_device(void)TEST_ASSERT (test_params->bonded_port_id >=0 ,"Failed to create bonded ethdev %s" ,BONDED_DEV_NAME ); -TEST_ASSERT_SUCCESS (configure_ethdev (test_params->bonded_port_id,0 ), +TEST_ASSERT_SUCCESS (configure_ethdev (test_params->bonded_port_id,0 ,0 ),"Failed to configure bonded ethdev %s" ,BONDED_DEV_NAME ); }
@@ -1081,12 +1087,12 @@ test_set_explicit_bonded_mac(void)static int -initialize_bonded_device_with_slaves (uint8_t bonding_mode, +initialize_bonded_device_with_slaves (uint8_t bonding_mode,uint8_t bond_en_isr,uint8_t number_of_slaves,uint8_t enable_slave) {/* configure bonded device */ -TEST_ASSERT_SUCCESS (configure_ethdev (test_params->bonded_port_id,0 ), -"Failed to configure bonding port (%d) in mode %d " +TEST_ASSERT_SUCCESS (configure_ethdev (test_params->bonded_port_id,0 , + bond_en_isr),"Failed to configure bonding port (%d) in mode %d " "with (%d) slaves." , test_params->bonded_port_id, bonding_mode, number_of_slaves);
@@ -1119,8 +1125,8 @@ test_adding_slave_after_bonded_device_started(void) {int i; -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,4 ,0 ) != -0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,0 ) + !=0 )return -1 ;/* Enabled slave devices */
@@ -1144,6 +1150,144 @@ test_adding_slave_after_bonded_device_started(void)return remove_slaves_and_stop_bonded_device (); } +#define TEST_STATUS_INTERRUPT_SLAVE_COUNT 4 +#define TEST_LSC_WAIT_TIMEOUT_MS 500 + +int test_lsc_interrupt_count; + +static pthread_mutex_t mutex; +static pthread_cond_t cvar; + +static void +test_bonding_lsc_event_callback(uint8_t port_id __rte_unused, + enum rte_eth_event_type type __rte_unused, void *param __rte_unused) +{ +pthread_mutex_lock (&mutex); + test_lsc_interrupt_count++; + +pthread_cond_signal (&cvar); +pthread_mutex_unlock (&mutex); +} + +static inline int +lsc_timeout (int wait_us) +{ +int retval =0 ; + +struct timespec ts; +struct timeval tp; + +gettimeofday (&tp,NULL ); + +/* Convert from timeval to timespec */ + ts.tv_sec = tp.tv_sec; + ts.tv_nsec = tp.tv_usec *1000 ; + ts.tv_nsec += wait_us *1000 ; + +pthread_mutex_lock (&mutex); +if (test_lsc_interrupt_count <1 ) + retval =pthread_cond_timedwait (&cvar, &mutex, &ts); + +pthread_mutex_unlock (&mutex); + +return retval; +} + +static int +test_status_interrupt (void ) +{ +int slave_count; +uint8_t slaves[RTE_MAX_ETHPORTS ]; + +pthread_mutex_init (&mutex,NULL ); +pthread_cond_init (&cvar,NULL ); + +/* initialized bonding device with T slaves */ +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,1 , +TEST_STATUS_INTERRUPT_SLAVE_COUNT ,1 ) !=0 ) +return -1 ; + + test_lsc_interrupt_count =0 ; + +/* register link status change interrupt callback */ +rte_eth_dev_callback_register (test_params->bonded_port_id, +RTE_ETH_EVENT_INTR_LSC , test_bonding_lsc_event_callback, + &test_params->bonded_port_id); + + slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, + slaves,RTE_MAX_ETHPORTS ); + +TEST_ASSERT_EQUAL (slave_count,TEST_STATUS_INTERRUPT_SLAVE_COUNT , +"Number of active slaves (%d) is not as expected (%d)" , + slave_count,TEST_STATUS_INTERRUPT_SLAVE_COUNT ); + +/* Bring all 4 slaves link status to down and test that we have received a +* lsc interrupts */ +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[0 ],0 ); +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[1 ],0 ); +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[2 ],0 ); + +TEST_ASSERT_EQUAL (test_lsc_interrupt_count,0 , +"Received a link status change interrupt unexpectedly" ); + +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[3 ],0 ); + +TEST_ASSERT (lsc_timeout (TEST_LSC_WAIT_TIMEOUT_MS ) ==0 , +"timed out waiting for interrupt" ); + +TEST_ASSERT (test_lsc_interrupt_count >0 , +"Did not receive link status change interrupt" ); + + slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, + slaves,RTE_MAX_ETHPORTS ); + +TEST_ASSERT_EQUAL (slave_count,0 , +"Number of active slaves (%d) is not as expected (%d)" , + slave_count,0 ); + +/* bring one slave port up so link status will change */ + test_lsc_interrupt_count =0 ; + +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[0 ],1 ); + +TEST_ASSERT (lsc_timeout (TEST_LSC_WAIT_TIMEOUT_MS ) ==0 , +"timed out waiting for interrupt" ); + +/* test that we have received another lsc interrupt */ +TEST_ASSERT (test_lsc_interrupt_count >0 , +"Did not receive link status change interrupt" ); + +/* Verify that calling the same slave lsc interrupt doesn't cause another +* lsc interrupt from bonded device */ + test_lsc_interrupt_count =0 ; + +virtual_ethdev_simulate_link_status_interrupt ( + test_params->slave_port_ids[0 ],1 ); + +TEST_ASSERT (lsc_timeout (TEST_LSC_WAIT_TIMEOUT_MS ) !=0 , +"received unexpected interrupt" ); + +TEST_ASSERT_EQUAL (test_lsc_interrupt_count,0 , +"Did not receive link status change interrupt" ); + + +/* unregister lsc callback before exiting */ +rte_eth_dev_callback_unregister (test_params->bonded_port_id, +RTE_ETH_EVENT_INTR_LSC , test_bonding_lsc_event_callback, + &test_params->bonded_port_id); + +pthread_mutex_destroy (&mutex); +pthread_cond_destroy (&cvar); + +/* Clean up and remove slaves from bonded device */ +return remove_slaves_and_stop_bonded_device (); +} + static int generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, uint8_t vlan, uint8_t ipv4, uint8_t toggle_dst_mac,
@@ -1215,7 +1359,7 @@ test_roundrobin_tx_burst(void)struct rte_mbuf *pkt_burst[MAX_PKT_BURST ];struct rte_eth_stats port_stats; -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,2 ,1 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,2 ,1 ) !=0 )return -1 ;
@@ -1285,7 +1429,7 @@ test_roundrobin_rx_burst_on_single_slave(void)int i, j, nb_rx, burst_size =25 ;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,4 ,1 ) != +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) !=0 )return -1 ;
@@ -1375,7 +1519,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void)/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,4 ,1 ) != +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) !=0 )return -1 ;
@@ -1467,7 +1611,7 @@ test_roundrobin_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[2 ], &expected_mac_addr_2);/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,4 ,1 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) !=0 )return -1 ;
@@ -1558,7 +1702,7 @@ test_roundrobin_verify_promiscuous_enable_disable(void)int i, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,4 ,1 ) != +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) !=0 )return -1 ;
@@ -1622,7 +1766,7 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)/* Initialize bonded device with TEST_RR_LINK_STATUS_SLAVE_COUNT slaves * in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN , +if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,TEST_RR_LINK_STATUS_SLAVE_COUNT ,1 ) !=0 )return -1 ;
@@ -1763,7 +1907,7 @@ test_activebackup_tx_burst(void)struct rte_mbuf *pkts_burst[MAX_PKT_BURST ];struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,2 ,1 ); + retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );return -1 ;
@@ -1863,7 +2007,7 @@ test_activebackup_rx_burst(void)int i, j, nb_rx, burst_size =17 ;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP , +if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ) !=0 )return -1 ;
@@ -1957,7 +2101,7 @@ test_activebackup_verify_promiscuous_enable_disable(void)int i, primary_port, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,4 ,1 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,4 ,1 ) !=0 )return -1 ;
@@ -2027,7 +2171,7 @@ test_activebackup_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &expected_mac_addr_1);/* Initialize bonded device with 2 slaves in active backup mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,2 ,1 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 ) !=0 )return -1 ;
@@ -2166,7 +2310,7 @@ test_activebackup_verify_slave_link_status_change_failover(void) }/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP , +if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ) !=0 )return -1 ;
@@ -2337,7 +2481,7 @@ test_balance_xmit_policy_configuration(void) {int retval; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP , + retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );
@@ -2417,7 +2561,7 @@ test_balance_l2_tx_burst(void)int retval, i;struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE , + retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );
@@ -2519,7 +2663,7 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,2 ,1 ); + retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );return -1 ;
@@ -2647,7 +2791,7 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,2 ,1 ); + retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );return -1 ;
@@ -2785,7 +2929,7 @@ test_balance_rx_burst(void)memset (gen_pkt_burst,0 ,sizeof (gen_pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,3 ,1 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,3 ,1 ) !=0 )return -1 ;
@@ -2874,7 +3018,7 @@ test_balance_verify_promiscuous_enable_disable(void)int i, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,4 ,1 ) !=0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,4 ,1 ) !=0 )return -1 ;rte_eth_promiscuous_enable (test_params->bonded_port_id);
@@ -2928,7 +3072,7 @@ test_balance_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &expected_mac_addr_1);/* Initialize bonded device with 2 slaves in active backup mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,2 ,1 ) !=0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 ) !=0 )return -1 ;/* Verify that bonded MACs is that of first slave and that the other slave
@@ -3058,7 +3202,7 @@ test_balance_verify_slave_link_status_change_behaviour(void)memset (pkt_burst,0 ,sizeof (pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE , +if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ,1 ) !=0 )return -1 ;
@@ -3251,7 +3395,7 @@ test_broadcast_tx_burst(void)struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,2 ,1 ); + retval =initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,0 ,2 ,1 );if (retval !=0 ) {printf ("Failed to initialize_bonded_device_with_slaves.\n" );return -1 ;
@@ -3344,7 +3488,7 @@ test_broadcast_rx_burst(void)memset (gen_pkt_burst,0 ,sizeof (gen_pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,3 ,1 ) !=0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,0 ,3 ,1 ) !=0 )return -1 ;
@@ -3436,7 +3580,7 @@ test_broadcast_verify_promiscuous_enable_disable(void)int i, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,4 ,1 ) !=0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,4 ,1 ) !=0 )return -1 ;rte_eth_promiscuous_enable (test_params->bonded_port_id);
@@ -3492,7 +3636,7 @@ test_broadcast_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[2 ], &expected_mac_addr_1);/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,4 ,1 ) !=0 ) +if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,0 ,4 ,1 ) !=0 )return -1 ;/* Verify that all MACs are the same as first slave added to bonded
@@ -3592,7 +3736,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)memset (pkt_burst,0 ,sizeof (pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST , +if (initialize_bonded_device_with_slaves (BONDING_MODE_BROADCAST ,0 ,BROADCAST_LINK_STATUS_NUM_OF_SLAVES ,1 ) !=0 )return -1 ;
@@ -3729,7 +3873,7 @@ test_reconfigure_bonded_device(void) test_params->nb_rx_q =4 ; test_params->nb_tx_q =4 ; -if (configure_ethdev (test_params->bonded_port_id,0 ) !=0 ) { +if (configure_ethdev (test_params->bonded_port_id,0 ,0 ) !=0 ) {printf ("failed to reconfigure bonded device" );return -1 ; }
@@ -3738,7 +3882,7 @@ test_reconfigure_bonded_device(void) test_params->nb_rx_q =2 ; test_params->nb_tx_q =2 ; -if (configure_ethdev (test_params->bonded_port_id,0 ) !=0 ) { +if (configure_ethdev (test_params->bonded_port_id,0 ,0 ) !=0 ) {printf ("failed to reconfigure bonded device with less rx/tx queues" );return -1 ; }
@@ -3786,6 +3930,7 @@ static struct unit_test_suite link_bonding_test_suite = {TEST_CASE (test_set_bonding_mode),TEST_CASE (test_set_primary_slave),TEST_CASE (test_set_explicit_bonded_mac), +TEST_CASE (test_status_interrupt),TEST_CASE (test_adding_slave_after_bonded_device_started),TEST_CASE (test_roundrobin_tx_burst), TEST_CASE(test_roundrobin_rx_burst_on_single_slave),
lib/librte_pmd_bond/rte_eth_bond_api.c +4 -0
@@ -177,6 +177,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) pci_drv->id_table->vendor_id =PCI_ANY_ID ; pci_drv->id_table->subsystem_vendor_id =PCI_ANY_ID ; + pci_drv->drv_flags =RTE_PCI_DRV_INTR_LSC ; + internals =rte_zmalloc_socket (name,sizeof (*internals),0 , socket_id);if (internals ==NULL ) {RTE_LOG (ERR ,PMD ,"Unable to malloc internals on socket\n" );
@@ -200,6 +202,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) eth_dev->data->nb_rx_queues = (uint16_t )1 ; eth_dev->data->nb_tx_queues = (uint16_t )1 ; +TAILQ_INIT (&(eth_dev->callbacks)); + eth_dev->data->dev_link.link_status =0 ; eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
lib/librte_pmd_bond/rte_eth_bond_pmd.c +6 -0
@@ -930,6 +930,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,struct rte_eth_link link;int i, valid_slave =0 , active_pos =-1 ; +uint8_t lsc_flag =0 ;if (type !=RTE_ETH_EVENT_INTR_LSC || param ==NULL )return ;
@@ -975,6 +976,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,/* If first active slave, then change link status */ bonded_eth_dev->data->dev_link.link_status =1 ; internals->current_primary_port = port_id; + lsc_flag =1 ;/* Inherit eth dev link properties from first active slave */ link_properties_set(bonded_eth_dev,
@@ -999,6 +1001,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,/* No active slaves, change link status to down and reset other * link properties */ if (internals->active_slave_count <1 ) { + lsc_flag =1 ; bonded_eth_dev->data->dev_link.link_status =0 ;link_properties_reset (bonded_eth_dev);
@@ -1014,6 +1017,9 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type, internals->current_primary_port = internals->primary_port; } } + +if (lsc_flag) +_rte_eth_dev_callback_process (bonded_eth_dev,RTE_ETH_EVENT_INTR_LSC ); }struct eth_dev_ops default_dev_ops = {
Signature · 1 line
1.7.4.1
PATCH v8 2/7 bond: removing switch statement from rx burst method
In reply to a message not in the archive--- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 65 +++++++++++++++++-------------- 1 files changed, 36 insertions(+), 29 deletions(-)
lib/librte_pmd_bond/rte_eth_bond_pmd.c +36 -29
@@ -59,35 +59,38 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) internals = bd_rx_q->dev_private; -switch (internals->mode) { -case BONDING_MODE_ROUND_ROBIN : -#ifdef RTE_MBUF_REFCNT -case BONDING_MODE_BROADCAST : -#endif -case BONDING_MODE_BALANCE : -for (i =0 ; i < internals->active_slave_count && nb_pkts; i++) { -/* Offset of pointer to *bufs increases as packets are received -* from other slaves */ - num_rx_slave =rte_eth_rx_burst (internals->active_slaves[i], - bd_rx_q->queue_id, bufs + num_rx_total, nb_pkts); -if (num_rx_slave) { - num_rx_total += num_rx_slave; - nb_pkts -= num_rx_slave; - } + +for (i =0 ; i < internals->active_slave_count && nb_pkts; i++) { +/* Offset of pointer to *bufs increases as packets are received +* from other slaves */ + num_rx_slave =rte_eth_rx_burst (internals->active_slaves[i], + bd_rx_q->queue_id, bufs + num_rx_total, nb_pkts); +if (num_rx_slave) { + num_rx_total += num_rx_slave; + nb_pkts -= num_rx_slave; } -break ; -case BONDING_MODE_ACTIVE_BACKUP : - num_rx_slave =rte_eth_rx_burst (internals->current_primary_port, - bd_rx_q->queue_id, bufs, nb_pkts); -if (num_rx_slave) - num_rx_total = num_rx_slave; -break ; } +return num_rx_total; }static uint16_t -bond_ethdev_tx_round_robin (void *queue,struct rte_mbuf **bufs, +bond_ethdev_rx_burst_active_backup (void *queue,struct rte_mbuf **bufs, +uint16_t nb_pkts) +{ +struct bond_dev_private *internals; + +/* Cast to structure, containing bonded device's port id and queue id */ +struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue; + + internals = bd_rx_q->dev_private; + +return rte_eth_rx_burst (internals->current_primary_port, + bd_rx_q->queue_id, bufs, nb_pkts); +} + +static uint16_t +bond_ethdev_tx_burst_round_robin (void *queue,struct rte_mbuf **bufs,uint16_t nb_pkts) {struct bond_dev_private *dev_private;
@@ -136,7 +139,7 @@ bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf **bufs, }static uint16_t -bond_ethdev_tx_active_backup (void *queue, +bond_ethdev_tx_burst_active_backup (void *queue,struct rte_mbuf **bufs,uint16_t nb_pkts) {struct bond_dev_private *internals;
@@ -272,7 +275,8 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t slave_count, uint8_t policy) }static uint16_t -bond_ethdev_tx_balance (void *queue,struct rte_mbuf **bufs,uint16_t nb_pkts) +bond_ethdev_tx_burst_balance (void *queue,struct rte_mbuf **bufs, +uint16_t nb_pkts) {struct bond_dev_private *internals;struct bond_tx_queue *bd_tx_q;
@@ -486,24 +490,27 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int mode)switch (mode) {case BONDING_MODE_ROUND_ROBIN : - eth_dev->tx_pkt_burst = bond_ethdev_tx_round_robin; + eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_round_robin; + eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;break ;case BONDING_MODE_ACTIVE_BACKUP : - eth_dev->tx_pkt_burst = bond_ethdev_tx_active_backup; + eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_active_backup; + eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;break ;case BONDING_MODE_BALANCE : - eth_dev->tx_pkt_burst = bond_ethdev_tx_balance; + eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance; + eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;break ;#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST : eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast; + eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;break ;#endif default :return -1 ; } - eth_dev->rx_pkt_burst = bond_ethdev_rx_burst; internals->mode = mode;return 0 ;
Signature · 1 line
1.7.4.1
PATCH v8 3/7 bond: fix naming inconsistency in tx_burst_round_robin
In reply to a message not in the archive--- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
lib/librte_pmd_bond/rte_eth_bond_pmd.c +5 -5
@@ -93,7 +93,7 @@ static uint16_t bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { -struct bond_dev_private *dev_private; +struct bond_dev_private *internals;struct bond_tx_queue *bd_tx_q;struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS ][nb_pkts];
@@ -108,13 +108,13 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,int i, cs_idx =0 ; bd_tx_q = (struct bond_tx_queue *)queue; - dev_private = bd_tx_q->dev_private; + internals = bd_tx_q->dev_private;/* Copy slave list to protect against slave up/down changes during tx * bursting */ - num_of_slaves = dev_private->active_slave_count; -memcpy (slaves, dev_private->active_slaves, -sizeof (dev_private->active_slaves[0 ]) * num_of_slaves); + num_of_slaves = internals->active_slave_count; +memcpy (slaves, internals->active_slaves, +sizeof (internals->active_slaves[0 ]) * num_of_slaves);if (num_of_slaves <1 )return num_tx_total;
Signature · 1 line
1.7.4.1
PATCH v8 4/7 bond: free mbufs if transmission fails in bonding tx_burst functions
In reply to a message not in the archive--- app/test/packet_burst_generator.c | 11 +- app/test/packet_burst_generator.h | 15 +- app/test/test_link_bonding.c | 435 ++++++++++++++++++++++++++++++-- app/test/virtual_pmd.c | 78 +++++-- app/test/virtual_pmd.h | 7 + lib/librte_pmd_bond/rte_eth_bond_pmd.c | 83 +++++-- 6 files changed, 551 insertions(+), 78 deletions(-)
app/test/packet_burst_generator.c +5 -6
@@ -74,8 +74,7 @@ static inline void copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, - buf, (size_t) len); + rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, buf, (size_t) len);return ; }copy_buf_to_pkt_segs (buf, len, pkt, offset);
@@ -191,12 +190,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr,*/ #define RTE_MAX_SEGS_PER_PKT 255/**< pkt.nb_segs is a 8-bit unsigned char. */ +int generate_packet_burst (struct rte_mempool *mp,struct rte_mbuf **pkts_burst, -struct ether_hdr *eth_hdr,uint8_t vlan_enabled, -void *ip_hdr,uint8_t ipv4,struct udp_hdr *udp_hdr, -int nb_pkt_per_burst,uint8_t pkt_len, -uint8_t nb_pkt_segs) +struct ether_hdr *eth_hdr,uint8_t vlan_enabled,void *ip_hdr, +uint8_t ipv4,struct udp_hdr *udp_hdr,int nb_pkt_per_burst, +uint8_t pkt_len,uint8_t nb_pkt_segs) {int i, nb_pkt =0 ;size_t eth_hdr_size;
app/test/packet_burst_generator.h +7 -8
@@ -47,13 +47,13 @@ extern "C" {#define IPV4_ADDR (a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \ ((c & 0xff) << 8) | (d & 0xff)) -#define PACKET_BURST_GEN_PKT_LEN 60 -#define PACKET_BURST_GEN_PKT_LEN_128 128 +#define PACKET_BURST_GEN_PKT_LEN 60 +#define PACKET_BURST_GEN_PKT_LEN_128 128 +void initialize_eth_header (struct ether_hdr *eth_hdr,struct ether_addr *src_mac, -struct ether_addr *dst_mac,uint8_t vlan_enabled, -uint16_t van_id); +struct ether_addr *dst_mac,uint8_t vlan_enabled,uint16_t van_id); uint16_t initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port,
@@ -70,10 +70,9 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr,int generate_packet_burst (struct rte_mempool *mp,struct rte_mbuf **pkts_burst, -struct ether_hdr *eth_hdr,uint8_t vlan_enabled, -void *ip_hdr,uint8_t ipv4,struct udp_hdr *udp_hdr, -int nb_pkt_per_burst,uint8_t pkt_len, -uint8_t nb_pkt_segs); +struct ether_hdr *eth_hdr,uint8_t vlan_enabled,void *ip_hdr, +uint8_t ipv4,struct udp_hdr *udp_hdr,int nb_pkt_per_burst, +uint8_t pkt_len,uint8_t nb_pkt_segs); #ifdef __cplusplus }
app/test/test_link_bonding.c +407 -28
519 lines not on this page · raw message
app/test/virtual_pmd.c +60 -18
125 lines not on this page · raw message
app/test/virtual_pmd.h +7 -0
@@ -67,6 +67,13 @@ void virtual_ethdev_rx_burst_fn_set_success(uint8_t port_id, uint8_t success);void virtual_ethdev_tx_burst_fn_set_success (uint8_t port_id,uint8_t success); +/* if a value greater than zero is set for packet_fail_count then virtual +* device tx burst function will fail that many packet from burst or all +* packets if packet_fail_count is greater than the number of packets in the +* burst */ +void virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count (uint8_t port_id, +uint8_t packet_fail_count); + #ifdef __cplusplus }#endif
lib/librte_pmd_bond/rte_eth_bond_pmd.c +65 -18
135 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v8 5/7 testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist
In reply to a message not in the archive--- app/test-pmd/cmdline.c | 2 +- app/test-pmd/testpmd.c | 3 ++- app/test-pmd/testpmd.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
app/test-pmd/cmdline.c +1 -1
@@ -3642,7 +3642,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,/* Update number of ports */ nb_ports =rte_eth_dev_count (); -reconfig (port_id); +reconfig (port_id, res->socket);rte_eth_promiscuous_enable (port_id); }
app/test-pmd/testpmd.c +2 -1
@@ -630,7 +630,7 @@ init_config(void)void -reconfig (portid_t new_port_id) +reconfig (portid_t new_port_id,unsigned socket_id) {struct rte_port *port;
@@ -649,6 +649,7 @@ reconfig(portid_t new_port_id)/* set flag to initialize port/queue */ port->need_reconfig =1 ; port->need_reconfig_queues =1 ; + port->socket_id = socket_id;init_port_config (); }
app/test-pmd/testpmd.h +1 -1
@@ -457,7 +457,7 @@ void fwd_config_display(void);void rxtx_config_display (void );void fwd_config_setup (void );void set_def_fwd_config (void ); -void reconfig (portid_t new_port_id); +void reconfig (portid_t new_port_id,unsigned socket_id);int init_fwd_streams (void );void port_mtu_set (portid_t port_id,uint16_t mtu);
Signature · 1 line
1.7.4.1
PATCH v8 6/7 bond: lsc polling support
In reply to a message not in the archive--- app/test-pmd/cmdline.c | 63 +++++ app/test/test.h | 7 +- app/test/test_link_bonding.c | 265 ++++++++++++------- app/test/virtual_pmd.c | 17 +- app/test/virtual_pmd.h | 48 +++- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 19 ++ lib/librte_pmd_bond/rte_eth_bond.h | 80 ++++++ lib/librte_pmd_bond/rte_eth_bond_api.c | 315 ++++++++++++++------- lib/librte_pmd_bond/rte_eth_bond_args.c | 28 ++- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 393 ++++++++++++++++++++------- lib/librte_pmd_bond/rte_eth_bond_private.h | 71 +++-- 11 files changed, 958 insertions(+), 348 deletions(-)
app/test-pmd/cmdline.c +63 -0
@@ -462,6 +462,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set bonding xmit_balance_policy (port_id) (l2|l23|l34)\n" " Set the transmit balance policy for bonded device running in balance mode.\n\n" + +"set bonding mon_period (port_id) (value)\n" +" Set the bonding link status monitoring polling period in ms.\n\n" #endif ,list_pkt_forwarding_modes ()
@@ -3733,6 +3736,65 @@ cmdline_parse_inst_t cmd_set_bond_mac_addr = { } }; + +/* *** SET LINK STATUS MONITORING POLLING PERIOD ON BONDED DEVICE *** */ +struct cmd_set_bond_mon_period_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t bonding; +cmdline_fixed_string_t mon_period; +uint8_t port_num; +uint32_t period_ms; +}; + +static void cmd_set_bond_mon_period_parsed (void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_bond_mon_period_result *res = parsed_result; +int ret; + +if (res->port_num >= nb_ports) { +printf ("Port id %d must be less than %d\n" , res->port_num, nb_ports); +return ; + } + + ret =rte_eth_bond_link_monitoring_set (res->port_num, res->period_ms); + +/* check the return value and print it if is < 0 */ +if (ret <0 ) +printf ("set_bond_mac_addr error: (%s)\n" ,strerror (-ret)); +} + +cmdline_parse_token_string_t cmd_set_bond_mon_period_set = + TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_bond_mon_period_bonding = + TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result, + bonding,"bonding" ); +cmdline_parse_token_string_t cmd_set_bond_mon_period_mon_period = + TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result, + mon_period,"mon_period" ); +cmdline_parse_token_num_t cmd_set_bond_mon_period_portnum = + TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result, + port_num,UINT8 ); +cmdline_parse_token_num_t cmd_set_bond_mon_period_period_ms = + TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result, + period_ms,UINT32 ); + +cmdline_parse_inst_t cmd_set_bond_mon_period = { + .f = cmd_set_bond_mon_period_parsed, + .data = (void *)0 , + .help_str ="set bonding mon_period (port_id) (period_ms): " , + .tokens = { + (void *)&cmd_set_bond_mon_period_set, + (void *)&cmd_set_bond_mon_period_bonding, + (void *)&cmd_set_bond_mon_period_mon_period, + (void *)&cmd_set_bond_mon_period_portnum, + (void *)&cmd_set_bond_mon_period_period_ms, +NULL + } +}; +#endif /* RTE_LIBRTE_PMD_BOND */ /* *** SET FORWARDING MODE *** */
@@ -7787,6 +7849,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *) &cmd_create_bonded_device, (cmdline_parse_inst_t *) &cmd_set_bond_mac_addr, (cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy, + (cmdline_parse_inst_t *) &cmd_set_bond_mon_period, #endif (cmdline_parse_inst_t *)&cmd_vlan_offload, (cmdline_parse_inst_t *)&cmd_vlan_tpid,
app/test/test.h +4 -3
@@ -62,14 +62,15 @@#define TEST_ASSERT_SUCCESS (val, msg, ...) do { \ if (!(val == 0)) { \ - printf("TestCase %s() line %d failed: " \ - msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + printf("TestCase %s() line %d failed (err %d): " \ + msg "\n", __func__, __LINE__, val, \ + ##__VA_ARGS__); \ return -1; \ } \ } while (0)#define TEST_ASSERT_FAIL (val, msg, ...) do { \ - if (!(val != -1)) { \ + if (!(val != 0)) { \ printf("TestCase %s() line %d failed: " \ msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ return -1; \
app/test/test_link_bonding.c +168 -97
439 lines not on this page · raw message
app/test/virtual_pmd.c +15 -2
@@ -456,6 +456,14 @@ virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint8_t port_id, }void +virtual_ethdev_set_link_status (uint8_t port_id,uint8_t link_status) +{ +struct rte_eth_dev *vrtl_eth_dev = &rte_eth_devices[port_id]; + + vrtl_eth_dev->data->dev_link.link_status = link_status; +} + +void virtual_ethdev_simulate_link_status_interrupt (uint8_t port_id,uint8_t link_status) {
@@ -503,7 +511,7 @@ get_number_of_sockets(void)int virtual_ethdev_create (const char *name,struct ether_addr *mac_addr, -uint8_t socket_id) +uint8_t socket_id,uint8_t isr_support) {struct rte_pci_device *pci_dev =NULL ;struct rte_eth_dev *eth_dev =NULL ;
@@ -553,7 +561,12 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, pci_dev->numa_node = socket_id; pci_drv->name = virtual_ethdev_driver_name; pci_drv->id_table = id_table; - pci_drv->drv_flags =RTE_PCI_DRV_INTR_LSC ; + +if (isr_support) + pci_drv->drv_flags |=RTE_PCI_DRV_INTR_LSC ; +else + pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC ; + eth_drv->pci_drv = (struct rte_pci_driver )(*pci_drv); eth_dev->driver = eth_drv;
app/test/virtual_pmd.h +34 -14
72 lines not on this page · raw message
doc/guides/testpmd_app_ug/testpmd_funcs.rst +19 -0
@@ -1479,6 +1479,25 @@ For example, set a Link Bonding device (port 10) to use a balance policy of laye testpmd> set bonding xmit_balance_policy 10 l34 + +set bonding mon_period +~~~~~~~~~~~~~~~~~~~~~~ + +Set the link status monitoring polling period in milliseconds for a bonding devicie. + +This adds support for PMD slave devices which do not support link status interrupts. +When the mon_period is set to a value greater than 0 then all PMD's which do not support +link status ISR will be queried every polling interval to check if their link status has changed. + +set bonding mon_period (port_id) (value) + +For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms + +.. code-block:: console + + testpmd> set bonding mon_period 5 150 + + show bonding config ~~~~~~~~~~~~~~~~~~~
lib/librte_pmd_bond/rte_eth_bond.h +80 -0
86 lines not on this page · raw message
lib/librte_pmd_bond/rte_eth_bond_api.c +210 -105
522 lines not on this page · raw message
lib/librte_pmd_bond/rte_eth_bond_args.c +25 -3
@@ -118,7 +118,7 @@ parse_port_id(const char *port_str) }if (port_id <0 || port_id >RTE_MAX_ETHPORTS ) { -RTE_LOG (ERR ,PMD ,"Invalid slave port value (%s) specified.\n" , +RTE_BOND_LOG (ERR ,"Slave port specified (%s) outside expected range" , port_str);return -1 ; }
@@ -138,9 +138,10 @@ bond_ethdev_parse_slave_port_kvarg(const char *key __rte_unused,if (strcmp (key,PMD_BOND_SLAVE_PORT_KVARG ) ==0 ) {int port_id =parse_port_id (value); -if (port_id <0 ) +if (port_id <0 ) { +RTE_BOND_LOG (ERR ,"Invalid slave port value (%s) specified" , value);return -1 ; -else + }else slave_ports->slaves[slave_ports->slave_count++] = (uint8_t )port_id; }
@@ -174,6 +175,7 @@ bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused,#endif return 0 ;default : +RTE_BOND_LOG (ERR ,"Invalid slave mode value (%s) specified" , value);return -1 ; } }
@@ -252,3 +254,23 @@ bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused,/* Parse MAC */ return cmdline_parse_etheraddr (NULL , value, extra_args); } + +int +bond_ethdev_parse_time_ms_kvarg(const char *key __rte_unused, +const char *value,void *extra_args) +{ +uint32_t time_ms; +char *endptr; + +if (value ==NULL || extra_args ==NULL ) +return -1 ; + + errno =0 ; + time_ms = (uint32_t )strtol (value, &endptr,10 ); +if (*endptr !=0 || errno !=0 ) +return -1 ; + + *(uint32_t *)extra_args = time_ms; + +return 0 ; +}
lib/librte_pmd_bond/rte_eth_bond_pmd.c +294 -99
580 lines not on this page · raw message
lib/librte_pmd_bond/rte_eth_bond_private.h +46 -25
134 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v8 7/7 bond: unit test test macro refactor
In reply to a message not in the archive--- app/test/test_link_bonding.c | 2576 +++++++++++++------------------- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 16 +- 2 files changed, 1046 insertions(+), 1546 deletions(-)
app/test/test_link_bonding.c +1038 -1538
@@ -31,6 +31,7 @@* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "unistd.h" #include <string.h> #include <stdarg.h> #include <stdio.h>
@@ -265,7 +266,7 @@ static pthread_cond_t cvar = PTHREAD_COND_INITIALIZER;static int test_setup (void ) { -int i, retval, nb_mbuf_per_pool; +int i, nb_mbuf_per_pool;struct ether_addr *mac_addr = (struct ether_addr *)slave_mac;/* Allocate ethernet packet header with space for VLAN header */
@@ -273,10 +274,8 @@ test_setup(void) test_params->pkt_eth_hdr =malloc (sizeof (struct ether_hdr ) +sizeof (struct vlan_hdr )); -if (test_params->pkt_eth_hdr ==NULL ) { -printf ("ethernet header struct allocation failed!\n" ); -return -1 ; - } +TEST_ASSERT_NOT_NULL (test_params->pkt_eth_hdr, +"Ethernet header struct allocation failed!" ); } nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST +
@@ -286,10 +285,8 @@ test_setup(void)MBUF_SIZE ,MBUF_CACHE_SIZE ,sizeof (struct rte_pktmbuf_pool_private ), rte_pktmbuf_pool_init,NULL , rte_pktmbuf_init,NULL , rte_socket_id(), 0); -if (test_params->mbuf_pool ==NULL ) { -printf ("rte_mempool_create failed\n" ); -return -1 ; - } +TEST_ASSERT_NOT_NULL (test_params->mbuf_pool, +"rte_mempool_create failed" ); }/* Create / Initialize virtual eth devs */
@@ -303,20 +300,12 @@ test_setup(void) test_params->slave_port_ids[i] =virtual_ethdev_create (pmd_name, mac_addr,rte_socket_id (),1 ); -if (test_params->slave_port_ids[i] <0 ) { -printf ("Failed to create virtual virtual ethdev %s\n" , pmd_name); -return -1 ; - } +TEST_ASSERT (test_params->slave_port_ids[i] >=0 , +"Failed to create virtual virtual ethdev %s" , pmd_name); -printf ("Created virtual ethdev %s\n" , pmd_name); - - retval =configure_ethdev (test_params->slave_port_ids[i],1 ,0 ); -if (retval !=0 ) { -printf ("Failed to configure virtual ethdev %s\n" , pmd_name); -return -1 ; - } - -printf ("Configured virtual ethdev %s\n" , pmd_name); +TEST_ASSERT_SUCCESS (configure_ethdev ( + test_params->slave_port_ids[i],1 ,0 ), +"Failed to configure virtual ethdev %s" , pmd_name); } slaves_initialized =1 ; }
@@ -350,14 +339,14 @@ test_create_bonded_device(void) current_slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -TEST_ASSERT (current_slave_count ==0 , +TEST_ASSERT_EQUAL (current_slave_count,0 ,"Number of slaves %d is great than expected %d." , current_slave_count,0 ); current_slave_count =rte_eth_bond_active_slaves_get ( test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -TEST_ASSERT (current_slave_count ==0 , +TEST_ASSERT_EQUAL (current_slave_count,0 ,"Number of active slaves %d is great than expected %d." , current_slave_count,0 );
@@ -375,30 +364,21 @@ test_create_bonded_device_with_invalid_params(void)/* Invalid name */ port_id =rte_eth_bond_create (NULL , test_params->bonding_mode,rte_socket_id ()); -if (port_id >=0 ) { -printf ("Created bonded device unexpectedly.\n" ); -return -1 ; - } +TEST_ASSERT (port_id <0 ,"Created bonded device unexpectedly" ); test_params->bonding_mode =INVALID_BONDING_MODE ;/* Invalid bonding mode */ port_id =rte_eth_bond_create (BONDED_DEV_NAME , test_params->bonding_mode,rte_socket_id ()); -if (port_id >=0 ) { -printf ("Created bonded device unexpectedly.\n" ); -return -1 ; - } +TEST_ASSERT (port_id <0 ,"Created bonded device unexpectedly." ); test_params->bonding_mode =BONDING_MODE_ROUND_ROBIN ;/* Invalid socket id */ port_id =rte_eth_bond_create (BONDED_DEV_NAME , test_params->bonding_mode,INVALID_SOCKET_ID ); -if (port_id >=0 ) { -printf ("Created bonded device unexpectedly.\n" ); -return -1 ; - } +TEST_ASSERT (port_id <0 ,"Created bonded device unexpectedly." );return 0 ; }
@@ -436,23 +416,15 @@ test_add_slave_to_bonded_device(void)static int test_add_slave_to_invalid_bonded_device (void ) { -int retval; -/* Invalid port ID */ - retval =rte_eth_bond_slave_add (test_params->bonded_port_id +5 , - test_params->slave_port_ids[test_params->bonded_slave_count]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_slave_add (test_params->bonded_port_id +5 , + test_params->slave_port_ids[test_params->bonded_slave_count]), +"Expected call to failed as invalid port specified." );/* Non bonded device */ - retval =rte_eth_bond_slave_add (test_params->slave_port_ids[0 ], - test_params->slave_port_ids[test_params->bonded_slave_count]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_slave_add (test_params->slave_port_ids[0 ], + test_params->slave_port_ids[test_params->bonded_slave_count]), +"Expected call to failed as invalid port specified." );return 0 ; }
@@ -504,23 +476,17 @@ test_remove_slave_from_bonded_device(void)static int test_remove_slave_from_invalid_bonded_device (void ) { -int retval; -/* Invalid port ID */ - retval =rte_eth_bond_slave_remove (test_params->bonded_port_id +5 , - test_params->slave_port_ids[test_params->bonded_slave_count -1 ]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_slave_remove ( + test_params->bonded_port_id +5 , + test_params->slave_port_ids[test_params->bonded_slave_count -1 ]), +"Expected call to failed as invalid port specified." );/* Non bonded device */ - retval =rte_eth_bond_slave_remove (test_params->slave_port_ids[0 ], - test_params->slave_port_ids[test_params->bonded_slave_count -1 ]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_slave_remove ( + test_params->slave_port_ids[0 ], + test_params->slave_port_ids[test_params->bonded_slave_count -1 ]), +"Expected call to failed as invalid port specified." );return 0 ; }
@@ -530,7 +496,7 @@ static int bonded_id = 2;static int test_add_already_bonded_slave_to_bonded_device (void ) { -int retval, port_id, current_slave_count; +int port_id, current_slave_count;uint8_t slaves[RTE_MAX_ETHPORTS ];char pmd_name[RTE_ETH_NAME_MAX_LEN ];
@@ -538,29 +504,22 @@ test_add_already_bonded_slave_to_bonded_device(void) current_slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count !=1 ) { -printf ("Number of slaves (%d) is not that expected (%d).\n" , - current_slave_count,1 ); -return -1 ; - } +TEST_ASSERT_EQUAL (current_slave_count,1 , +"Number of slaves (%d) is not that expected (%d)." , + current_slave_count,1 );snprintf (pmd_name,RTE_ETH_NAME_MAX_LEN ,"%s_%d" ,BONDED_DEV_NAME , ++bonded_id); port_id =rte_eth_bond_create (pmd_name, test_params->bonding_mode,rte_socket_id ()); -if (port_id <0 ) { -printf ("Failed to create bonded device.\n" ); -return -1 ; - } +TEST_ASSERT (port_id >=0 ,"Failed to create bonded device." ); - retval =rte_eth_bond_slave_add (port_id, - test_params->slave_port_ids[test_params->bonded_slave_count -1 ]); -if (retval ==0 ) { -printf ("Added slave (%d) to bonded port (%d) unexpectedly.\n" , - test_params->slave_port_ids[test_params->bonded_slave_count-1 ], - port_id); -return -1 ; - } +TEST_ASSERT (rte_eth_bond_slave_add (port_id, + test_params->slave_port_ids[test_params->bonded_slave_count -1 ]) + <0 , +"Added slave (%d) to bonded port (%d) unexpectedly." , + test_params->slave_port_ids[test_params->bonded_slave_count-1 ], + port_id);return test_remove_slave_from_bonded_device (); }
@@ -569,50 +528,47 @@ test_add_already_bonded_slave_to_bonded_device(void)static int test_get_slaves_from_bonded_device (void ) { -int retval, current_slave_count; - +int current_slave_count;uint8_t slaves[RTE_MAX_ETHPORTS ]; - retval =test_add_slave_to_bonded_device (); -if (retval !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (test_add_slave_to_bonded_device (), +"Failed to add slave to bonded device" );/* Invalid port id */ current_slave_count =rte_eth_bond_slaves_get (INVALID_PORT_ID , slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid port id unexpectedly succeeded" ); current_slave_count =rte_eth_bond_active_slaves_get (INVALID_PORT_ID , slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid port id unexpectedly succeeded" );/* Invalid slaves pointer */ current_slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id,NULL ,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid slave array unexpectedly succeeded" ); current_slave_count =rte_eth_bond_active_slaves_get ( test_params->bonded_port_id,NULL ,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid slave array unexpectedly succeeded" );/* non bonded device*/ current_slave_count =rte_eth_bond_slaves_get ( test_params->slave_port_ids[0 ],NULL ,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid port id unexpectedly succeeded" ); current_slave_count =rte_eth_bond_active_slaves_get ( test_params->slave_port_ids[0 ],NULL ,RTE_MAX_ETHPORTS ); -if (current_slave_count >=0 ) -return -1 ; +TEST_ASSERT (current_slave_count <0 , +"Invalid port id unexpectedly succeeded" ); - retval =test_remove_slave_from_bonded_device (); -if (retval !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (test_remove_slave_from_bonded_device (), +"Failed to remove slaves from bonded device" );return 0 ; }
@@ -623,15 +579,13 @@ test_add_remove_multiple_slaves_to_from_bonded_device(void) {int i; -for (i =0 ; i <TEST_MAX_NUMBER_OF_PORTS ; i++) { -if (test_add_slave_to_bonded_device () !=0 ) -return -1 ; - } +for (i =0 ; i <TEST_MAX_NUMBER_OF_PORTS ; i++) +TEST_ASSERT_SUCCESS (test_add_slave_to_bonded_device (), +"Failed to add slave to bonded device" ); -for (i =0 ; i <TEST_MAX_NUMBER_OF_PORTS ; i++) { -if (test_remove_slave_from_bonded_device () !=0 ) -return -1 ; - } +for (i =0 ; i <TEST_MAX_NUMBER_OF_PORTS ; i++) +TEST_ASSERT_SUCCESS (test_remove_slave_from_bonded_device (), +"Failed to remove slaves from bonded device" );return 0 ; }
@@ -659,8 +613,8 @@ test_start_bonded_device(void)uint8_t slaves[RTE_MAX_ETHPORTS ];/* Add slave to bonded device*/ -if (test_add_slave_to_bonded_device () !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (test_add_slave_to_bonded_device (), +"Failed to add slave to bonded device" ); TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonded_port_id), "Failed to start bonded pmd eth device %d.",
@@ -673,43 +627,30 @@ test_start_bonded_device(void) current_slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count != test_params->bonded_slave_count) { -printf ("Number of slaves (%d) is not expected value (%d).\n" , - current_slave_count, test_params->bonded_slave_count); -return -1 ; - } +TEST_ASSERT_EQUAL (current_slave_count, test_params->bonded_slave_count, +"Number of slaves (%d) is not expected value (%d)." , + current_slave_count, test_params->bonded_slave_count); current_slave_count =rte_eth_bond_active_slaves_get ( test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count != test_params->bonded_slave_count) { -printf ("Number of active slaves (%d) is not expected value (%d).\n" , - current_slave_count, test_params->bonded_slave_count); -return -1 ; - } +TEST_ASSERT_EQUAL (current_slave_count, test_params->bonded_slave_count, +"Number of active slaves (%d) is not expected value (%d)." , + current_slave_count, test_params->bonded_slave_count); current_bonding_mode =rte_eth_bond_mode_get (test_params->bonded_port_id); -if (current_bonding_mode != test_params->bonding_mode) { -printf ("Bonded device mode (%d) is not expected value (%d).\n" , - current_bonding_mode, test_params->bonding_mode); -return -1 ; - - } +TEST_ASSERT_EQUAL (current_bonding_mode, test_params->bonding_mode, +"Bonded device mode (%d) is not expected value (%d).\n" , + current_bonding_mode, test_params->bonding_mode); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (primary_port != test_params->slave_port_ids[0 ]) { -printf ("Primary port (%d) is not expected value (%d).\n" , - primary_port, test_params->slave_port_ids[0 ]); -return -1 ; - - } +TEST_ASSERT_EQUAL (primary_port, test_params->slave_port_ids[0 ], +"Primary port (%d) is not expected value (%d)." , + primary_port, test_params->slave_port_ids[0 ]);rte_eth_link_get (test_params->bonded_port_id, &link_status); -if (!link_status.link_status) { -printf ("Bonded port (%d) status (%d) is not expected value (%d).\n" , - test_params->bonded_port_id, link_status.link_status,1 ); -return -1 ; - - } +TEST_ASSERT_EQUAL (link_status.link_status,1 , +"Bonded port (%d) status (%d) is not expected value (%d).\n" , + test_params->bonded_port_id, link_status.link_status,1 );return 0 ; }
@@ -725,40 +666,32 @@ test_stop_bonded_device(void)rte_eth_dev_stop (test_params->bonded_port_id);rte_eth_link_get (test_params->bonded_port_id, &link_status); -if (link_status.link_status) { -printf ("Bonded port (%d) status (%d) is not expected value (%d).\n" , - test_params->bonded_port_id, link_status.link_status,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (link_status.link_status,0 , +"Bonded port (%d) status (%d) is not expected value (%d)." , + test_params->bonded_port_id, link_status.link_status,0 ); current_slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count != test_params->bonded_slave_count) { -printf ("Number of slaves (%d) is not expected value (%d).\n" , - current_slave_count, test_params->bonded_slave_count); -return -1 ; - } +TEST_ASSERT_EQUAL (current_slave_count, test_params->bonded_slave_count, +"Number of slaves (%d) is not expected value (%d)." , + current_slave_count, test_params->bonded_slave_count); current_slave_count =rte_eth_bond_active_slaves_get ( test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (current_slave_count !=0 ) { -printf ("Number of active slaves (%d) is not expected value (%d).\n" , - current_slave_count,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (current_slave_count,0 , +"Number of active slaves (%d) is not expected value (%d)." , + current_slave_count,0 );return 0 ; } -static int remove_slaves_and_stop_bonded_device (void ) +static int +remove_slaves_and_stop_bonded_device (void ) {/* Clean up and remove slaves from bonded device */ -while (test_params->bonded_slave_count >0 ) { -if (test_remove_slave_from_bonded_device () !=0 ) { -printf ("test_remove_slave_from_bonded_device failed\n" ); -return -1 ; - } - } +while (test_params->bonded_slave_count >0 ) +TEST_ASSERT_SUCCESS (test_remove_slave_from_bonded_device (), +"test_remove_slave_from_bonded_device failed" );rte_eth_dev_stop (test_params->bonded_port_id);rte_eth_stats_reset (test_params->bonded_port_id);
@@ -770,8 +703,7 @@ static int remove_slaves_and_stop_bonded_device(void)static int test_set_bonding_mode (void ) { -int i; -int retval, bonding_mode; +int i, bonding_mode;int bonding_modes[] = {BONDING_MODE_ROUND_ROBIN ,BONDING_MODE_ACTIVE_BACKUP ,
@@ -784,56 +716,39 @@ test_set_bonding_mode(void)/* Test supported link bonding modes */ for (i =0 ; i < (int )RTE_DIM (bonding_modes); i++) {/* Invalid port ID */ - retval =rte_eth_bond_mode_set (INVALID_PORT_ID , bonding_modes[i]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port (%d) specified.\n" , -INVALID_PORT_ID ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_mode_set (INVALID_PORT_ID , + bonding_modes[i]), +"Expected call to failed as invalid port (%d) specified." , +INVALID_PORT_ID );/* Non bonded device */ - retval =rte_eth_bond_mode_set (test_params->slave_port_ids[0 ], - bonding_modes[i]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port (%d) specified.\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_mode_set (test_params->slave_port_ids[0 ], + bonding_modes[i]), +"Expected call to failed as invalid port (%d) specified." , + test_params->slave_port_ids[0 ]); - retval =rte_eth_bond_mode_set (test_params->bonded_port_id, - bonding_modes[i]); -if (retval !=0 ) { -printf ("Failed to set link bonding mode on port (%d) to (%d).\n" , - test_params->bonded_port_id, bonding_modes[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_mode_set (test_params->bonded_port_id, + bonding_modes[i]), +"Failed to set link bonding mode on port (%d) to (%d)." , + test_params->bonded_port_id, bonding_modes[i]); bonding_mode =rte_eth_bond_mode_get (test_params->bonded_port_id); -if (bonding_mode != bonding_modes[i]) { -printf ("Link bonding mode (%d) of port (%d) is not expected value (%d).\n" , - bonding_mode, test_params->bonded_port_id, - bonding_modes[i]); -return -1 ; - } - +TEST_ASSERT_EQUAL (bonding_mode, bonding_modes[i], +"Link bonding mode (%d) of port (%d) is not expected value (%d)." , + bonding_mode, test_params->bonded_port_id, + bonding_modes[i]);/* Invalid port ID */ bonding_mode =rte_eth_bond_mode_get (INVALID_PORT_ID ); -if (bonding_mode >=0 ) { -printf ("Expected call to failed as invalid port (%d) specified.\n" , -INVALID_PORT_ID ); -return -1 ; - } - +TEST_ASSERT (bonding_mode <0 , +"Expected call to failed as invalid port (%d) specified." , +INVALID_PORT_ID );/* Non bonded device */ bonding_mode =rte_eth_bond_mode_get (test_params->slave_port_ids[0 ]); -if (bonding_mode >=0 ) { -printf ("Expected call to failed as invalid port (%d) specified.\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } - +TEST_ASSERT (bonding_mode <0 , +"Expected call to failed as invalid port (%d) specified." , + test_params->slave_port_ids[0 ]); }return remove_slaves_and_stop_bonded_device ();
@@ -847,36 +762,24 @@ test_set_primary_slave(void)struct ether_addr *expected_mac_addr;/* Add 4 slaves to bonded device */ -for (i = test_params->bonded_slave_count; i <4 ; i++) { - retval =test_add_slave_to_bonded_device (); -if (retval !=0 ) { -printf ("Failed to add slave to bonded device.\n" ); -return -1 ; - } - } - retval =rte_eth_bond_mode_set (test_params->bonded_port_id, -BONDING_MODE_ROUND_ROBIN ); -if (retval !=0 ) { -printf ("Failed to set link bonding mode on port (%d) to (%d).\n" , - test_params->bonded_port_id,BONDING_MODE_ROUND_ROBIN ); -return -1 ; - } +for (i = test_params->bonded_slave_count; i <4 ; i++) +TEST_ASSERT_SUCCESS (test_add_slave_to_bonded_device (), +"Failed to add slave to bonded device." ); + +TEST_ASSERT_SUCCESS (rte_eth_bond_mode_set (test_params->bonded_port_id, +BONDING_MODE_ROUND_ROBIN ), +"Failed to set link bonding mode on port (%d) to (%d)." , + test_params->bonded_port_id,BONDING_MODE_ROUND_ROBIN );/* Invalid port ID */ - retval =rte_eth_bond_primary_set (INVALID_PORT_ID , - test_params->slave_port_ids[i]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_primary_set (INVALID_PORT_ID , + test_params->slave_port_ids[i]), +"Expected call to failed as invalid port specified." );/* Non bonded device */ - retval =rte_eth_bond_primary_set (test_params->slave_port_ids[i], - test_params->slave_port_ids[i]); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_primary_set (test_params->slave_port_ids[i], + test_params->slave_port_ids[i]), +"Expected call to failed as invalid port specified." );/* Set slave as primary * Verify slave it is now primary slave
@@ -884,32 +787,27 @@ test_set_primary_slave(void)* Verify that MAC address of all bonded slaves are that of primary slave */ for (i =0 ; i <4 ; i++) { - retval =rte_eth_bond_primary_set (test_params->bonded_port_id, - test_params->slave_port_ids[i]); -if (retval !=0 ) { -printf ("Failed to set bonded port (%d) primary port to (%d)\n" , - test_params->bonded_port_id, - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_primary_set (test_params->bonded_port_id, + test_params->slave_port_ids[i]), +"Failed to set bonded port (%d) primary port to (%d)" , + test_params->bonded_port_id, test_params->slave_port_ids[i]); retval =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (retval <0 ) { -printf ("Failed to read primary port from bonded port (%d)\n" , +TEST_ASSERT (retval >=0 , +"Failed to read primary port from bonded port (%d)\n" , test_params->bonded_port_id); -return -1 ; - }else if (retval != test_params->slave_port_ids[i]) { -printf ("Bonded port (%d) primary port (%d) not expected value (%d)\n" , - test_params->bonded_port_id, retval, - test_params->slave_port_ids[i]); -return -1 ; - } + +TEST_ASSERT_EQUAL (retval, test_params->slave_port_ids[i], +"Bonded port (%d) primary port (%d) not expected value (%d)\n" , + test_params->bonded_port_id, retval, + test_params->slave_port_ids[i]);/* stop/start bonded eth dev to apply new MAC */ rte_eth_dev_stop (test_params->bonded_port_id); -if (rte_eth_dev_start (test_params->bonded_port_id) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (rte_eth_dev_start (test_params->bonded_port_id), +"Failed to start bonded port %d" , + test_params->bonded_port_id); expected_mac_addr = (struct ether_addr *)&slave_mac; expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] =
@@ -917,56 +815,44 @@ test_set_primary_slave(void)/* Check primary slave MAC */ rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (expected_mac_addr, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port mac address not set to that of primary port\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (expected_mac_addr, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port mac address not set to that of primary port\n" );/* Check bonded MAC */ rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&read_mac_addr, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port mac address not set to that of primary port\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&read_mac_addr, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port mac address not set to that of primary port\n" );/* Check other slaves MACs */ for (j =0 ; j <4 ; j++) {if (j != i) {rte_eth_macaddr_get (test_params->slave_port_ids[j], &read_mac_addr); -if (memcmp (expected_mac_addr, &read_mac_addr, -sizeof (read_mac_addr))) { -printf ("slave port mac address not set to that of primary port\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (expected_mac_addr, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port mac address not set to that of primary " +"port" ); } } }/* Test with none existent port */ - retval =rte_eth_bond_primary_get (test_params->bonded_port_id +10 ); -if (retval >=0 ) { -printf ("read primary port from expectedly\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_primary_get (test_params->bonded_port_id +10 ), +"read primary port from expectedly" );/* Test with slave port */ - retval =rte_eth_bond_primary_get (test_params->slave_port_ids[0 ]); -if (retval >=0 ) { -printf ("read primary port from expectedly\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_primary_get (test_params->slave_port_ids[0 ]), +"read primary port from expectedly\n" ); -if (remove_slaves_and_stop_bonded_device () !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (remove_slaves_and_stop_bonded_device (), +"Failed to stop and remove slaves from bonded device" );/* No slaves */ - retval =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (retval >=0 ) { -printf ("read primary port from expectedly\n" ); -return -1 ; - } +TEST_ASSERT (rte_eth_bond_primary_get (test_params->bonded_port_id) <0 , +"read primary port from expectedly\n" );return 0 ; }
@@ -974,7 +860,7 @@ test_set_primary_slave(void)static int test_set_explicit_bonded_mac (void ) { -int i, retval; +int i;struct ether_addr read_mac_addr;struct ether_addr *mac_addr;
@@ -983,87 +869,62 @@ test_set_explicit_bonded_mac(void) mac_addr = (struct ether_addr *)explicit_bonded_mac;/* Invalid port ID */ - retval =rte_eth_bond_mac_address_set (INVALID_PORT_ID , mac_addr); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_mac_address_set (INVALID_PORT_ID , mac_addr), +"Expected call to failed as invalid port specified." );/* Non bonded device */ - retval =rte_eth_bond_mac_address_set (test_params->slave_port_ids[0 ], - mac_addr); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_mac_address_set ( + test_params->slave_port_ids[0 ], mac_addr), +"Expected call to failed as invalid port specified." );/* NULL MAC address */ - retval =rte_eth_bond_mac_address_set (test_params->bonded_port_id,NULL ); -if (retval ==0 ) { -printf ("Expected call to failed as NULL MAC specified\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_mac_address_set ( + test_params->bonded_port_id,NULL ), +"Expected call to failed as NULL MAC specified" ); - retval =rte_eth_bond_mac_address_set (test_params->bonded_port_id, - mac_addr); -if (retval !=0 ) { -printf ("Failed to set MAC address on bonded port (%d)\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_mac_address_set ( + test_params->bonded_port_id, mac_addr), +"Failed to set MAC address on bonded port (%d)" , + test_params->bonded_port_id);/* Add 4 slaves to bonded device */ for (i = test_params->bonded_slave_count; i <4 ; i++) { - retval =test_add_slave_to_bonded_device (); -if (retval !=0 ) { -printf ("Failed to add slave to bonded device.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (test_add_slave_to_bonded_device (), +"Failed to add slave to bonded device.\n" ); }/* Check bonded MAC */ rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (mac_addr, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port mac address not set to that of primary port\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (mac_addr, &read_mac_addr,sizeof (read_mac_addr)), +"bonded port mac address not set to that of primary port" );/* Check other slaves MACs */ for (i =0 ; i <4 ; i++) {rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (mac_addr, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port mac address not set to that of primary port\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (mac_addr, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port mac address not set to that of primary port" ); }/* test resetting mac address on bonded device */ -if (rte_eth_bond_mac_address_reset (test_params->bonded_port_id) !=0 ) { -printf ("Failed to reset MAC address on bonded port (%d)\n" , - test_params->bonded_port_id); - -return -1 ; - } - -if (rte_eth_bond_mac_address_reset (test_params->slave_port_ids[0 ]) ==0 ) { -printf ("Reset MAC address on bonded port (%d) unexpectedly\n" , - test_params->slave_port_ids[1 ]); +TEST_ASSERT_SUCCESS ( +rte_eth_bond_mac_address_reset (test_params->bonded_port_id), +"Failed to reset MAC address on bonded port (%d)" , + test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_FAIL ( +rte_eth_bond_mac_address_reset (test_params->slave_port_ids[0 ]), +"Reset MAC address on bonded port (%d) unexpectedly" , + test_params->slave_port_ids[1 ]);/* test resetting mac address on bonded device with no slaves */ +TEST_ASSERT_SUCCESS (remove_slaves_and_stop_bonded_device (), +"Failed to remove slaves and stop bonded device" ); -if (remove_slaves_and_stop_bonded_device () !=0 ) -return -1 ; - -if (rte_eth_bond_mac_address_reset (test_params->bonded_port_id) !=0 ) { -printf ("Failed to reset MAC address on bonded port (%d)\n" , +TEST_ASSERT_SUCCESS (rte_eth_bond_mac_address_reset (test_params->bonded_port_id), +"Failed to reset MAC address on bonded port (%d)" , test_params->bonded_port_id); -return -1 ; - } -return 0 ; }
@@ -1179,9 +1040,10 @@ test_status_interrupt(void)uint8_t slaves[RTE_MAX_ETHPORTS ];/* initialized bonding device with T slaves */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,1 , -TEST_STATUS_INTERRUPT_SLAVE_COUNT ,1 ) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,1 , +TEST_STATUS_INTERRUPT_SLAVE_COUNT ,1 ), +"Failed to initialise bonded device" ); test_lsc_interrupt_count =0 ;
@@ -1313,10 +1175,8 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, 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 ; - } +TEST_ASSERT_EQUAL (generated_burst_size, burst_size, +"Failed to generate packet burst" );return generated_burst_size; }
@@ -1326,51 +1186,43 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,static int test_roundrobin_tx_burst (void ) { -int i, burst_size, nb_tx; +int i, burst_size;struct rte_mbuf *pkt_burst[MAX_PKT_BURST ];struct rte_eth_stats port_stats; -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,2 ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,2 ,1 ), +"Failed to intialise bonded device" ); burst_size =20 * test_params->bonded_slave_count; -if (burst_size >MAX_PKT_BURST ) { -printf ("Burst size specified is greater than supported.\n" ); -return -1 ; - } +TEST_ASSERT (burst_size <=MAX_PKT_BURST , +"Burst size specified is greater than supported." );/* Generate test bursts of packets to transmit */ -if (generate_test_burst (pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ) != burst_size) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst (pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ), + burst_size,"failed to generate test burst" );/* Send burst on bonded port */ - nb_tx =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkt_burst, - burst_size); -if (nb_tx != burst_size) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst ( + test_params->bonded_port_id,0 , pkt_burst, burst_size), burst_size, +"tx burst failed" );/* Verify bonded port tx stats */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.opackets != (uint64_t )burst_size) { -printf ("Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, (unsigned int )port_stats.opackets, - burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size, +"Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + burst_size);/* Verify slave ports tx stats */ for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_stats_get (test_params->slave_port_ids[i], &port_stats); -if (port_stats.opackets != - (uint64_t )burst_size / test_params->bonded_slave_count) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets, - burst_size / test_params->bonded_slave_count); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, + (uint64_t )burst_size / test_params->bonded_slave_count, +"Slave Port (%d) opackets value (%u) not as expected (%d)\n" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + burst_size / test_params->bonded_slave_count); }/* Put all slaves down and try and transmit */
@@ -1380,10 +1232,9 @@ test_roundrobin_tx_burst(void) }/* Send burst on bonded port */ - nb_tx =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkt_burst, - burst_size); -if (nb_tx !=0 ) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst (test_params->bonded_port_id,0 , + pkt_burst, burst_size),0 , +"tx burst return unexpected value" );/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -1529,17 +1380,17 @@ test_roundrobin_rx_burst_on_single_slave(void)struct rte_eth_stats port_stats; -int i, j, nb_rx, burst_size =25 ; +int i, j, burst_size =25 ;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) != -0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ), +"Failed to initialize bonded device with slaves" );/* Generate test bursts of packets to transmit */ -if (generate_test_burst (gen_pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ) != - burst_size) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + gen_pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ), burst_size, +"burst generation failed" );for (i =0 ; i < test_params->bonded_slave_count; i++) {/* Add rx data to slave */
@@ -1548,21 +1399,18 @@ test_roundrobin_rx_burst_on_single_slave(void)/* Call rx burst on bonded device */ /* Send burst on bonded port */ - nb_rx =rte_eth_rx_burst (test_params->bonded_port_id,0 , rx_pkt_burst, -MAX_PKT_BURST ); -if (nb_rx != burst_size) { -printf ("round-robin rx burst failed" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_rx_burst ( + test_params->bonded_port_id,0 , rx_pkt_burst, +MAX_PKT_BURST ), burst_size, +"round-robin rx burst failed" );/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size) { -printf ("Bonded Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.ipackets, burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size, +"Bonded Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, + (unsigned int )port_stats.ipackets, burst_size); +/* Verify bonded slave devices rx count */
@@ -1571,19 +1419,15 @@ test_roundrobin_rx_burst_on_single_slave(void)rte_eth_stats_get (test_params->slave_port_ids[j], &port_stats);if (i == j) { -if (port_stats.ipackets != (uint64_t )burst_size) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[i], - (unsigned int )port_stats.ipackets, burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size, +"Slave Port (%d) ipackets value (%u) not as expected" +" (%d)" , test_params->slave_port_ids[i], + (unsigned int )port_stats.ipackets, burst_size); }else { -if (port_stats.ipackets !=0 ) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[i], - (unsigned int )port_stats.ipackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets,0 , +"Slave Port (%d) ipackets value (%u) not as expected" +" (%d)" , test_params->slave_port_ids[i], + (unsigned int )port_stats.ipackets,0 ); }/* Reset bonded slaves stats */
@@ -1620,17 +1464,16 @@ test_roundrobin_rx_burst_on_multiple_slaves(void)int burst_size[TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT ] = {15 ,13 ,36 };int i, nb_rx; -/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) != -0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ), +"Failed to initialize bonded device with slaves" );/* Generate test bursts of packets to transmit */ for (i =0 ; i <TEST_ROUNDROBIN_TX_BURST_SLAVE_COUNT ; i++) { -if (generate_test_burst (&gen_pkt_burst[i][0 ], burst_size[i],0 ,1 ,0 ,0 , -0 ) != burst_size[i]) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + &gen_pkt_burst[i][0 ], burst_size[i],0 ,1 ,0 ,0 ,0 ), + burst_size[i],"burst generation failed" ); }/* Add rx data to slaves */
@@ -1643,55 +1486,42 @@ test_roundrobin_rx_burst_on_multiple_slaves(void)/* Send burst on bonded port */ nb_rx =rte_eth_rx_burst (test_params->bonded_port_id,0 , rx_pkt_burst,MAX_PKT_BURST ); -if (nb_rx != burst_size[0 ] + burst_size[1 ] + burst_size[2 ]) { -printf ("round-robin rx burst failed (%d != %d)\n" , nb_rx, - burst_size[0 ] + burst_size[1 ] + burst_size[2 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (nb_rx , burst_size[0 ] + burst_size[1 ] + burst_size[2 ], +"round-robin rx burst failed (%d != %d)\n" , nb_rx, + burst_size[0 ] + burst_size[1 ] + burst_size[2 ]);/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )(burst_size[0 ] + burst_size[1 ] + - burst_size[2 ])) { -printf ("Bonded Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, (unsigned int )port_stats.ipackets, - burst_size[0 ] + burst_size[1 ] + burst_size[2 ]); -return -1 ; - } - +TEST_ASSERT_EQUAL (port_stats.ipackets, + (uint64_t )(burst_size[0 ] + burst_size[1 ] + burst_size[2 ]), +"Bonded Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.ipackets, + burst_size[0 ] + burst_size[1 ] + burst_size[2 ]);/* Verify bonded slave devices rx counts */ rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[0 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[0 ], - (unsigned int )port_stats.ipackets, burst_size[0 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[0 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[0 ], + (unsigned int )port_stats.ipackets, burst_size[0 ]);rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[1 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[1 ], - (unsigned int )port_stats.ipackets, burst_size[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[1 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[1 ], (unsigned int )port_stats.ipackets, + burst_size[1 ]);rte_eth_stats_get (test_params->slave_port_ids[2 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[2 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[2 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , test_params->slave_port_ids[2 ], (unsigned int )port_stats.ipackets, burst_size[2 ]); -return -1 ; - }rte_eth_stats_get (test_params->slave_port_ids[3 ], &port_stats); -if (port_stats.ipackets !=0 ) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[3 ], - (unsigned int )port_stats.ipackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets,0 , +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[3 ], + (unsigned int )port_stats.ipackets,0 );/* free mbufs */ for (i =0 ; i <MAX_PKT_BURST ; i++) {
@@ -1708,91 +1538,77 @@ test_roundrobin_verify_mac_assignment(void) {struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; -int i, retval; +int i;rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &expected_mac_addr_0);rte_eth_macaddr_get (test_params->slave_port_ids[2 ], &expected_mac_addr_2);/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ), +"Failed to initialize bonded device with slaves" );/* Verify that all MACs are the same as first slave added to bonded dev */ for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr, -sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[i]); }/* change primary and verify that MAC addresses haven't changed */ - retval =rte_eth_bond_primary_set (test_params->bonded_port_id, - test_params->slave_port_ids[2 ]); -if (retval !=0 ) { -printf ("Failed to set bonded port (%d) primary port to (%d)\n" , - test_params->bonded_port_id, test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_primary_set (test_params->bonded_port_id, + test_params->slave_port_ids[2 ]), +"Failed to set bonded port (%d) primary port to (%d)" , + test_params->bonded_port_id, test_params->slave_port_ids[i]);for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr, -sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address has changed to that of primary port without stop/start toggle of bonded device\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address has changed to that of primary" +" port without stop/start toggle of bonded device" , + test_params->slave_port_ids[i]); }/* stop / start bonded device and verify that primary MAC address is * propagate to bonded device and slaves */ -rte_eth_dev_stop (test_params->bonded_port_id); -if (rte_eth_dev_start (test_params->bonded_port_id) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (rte_eth_dev_start (test_params->bonded_port_id), +"Failed to start bonded device" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_2, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of new primary port\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS ( +memcmp (&expected_mac_addr_2, &read_mac_addr,sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of new primary port" , + test_params->slave_port_ids[i]);for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (&expected_mac_addr_2, &read_mac_addr, -sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of new primary port\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_2, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of new primary" +" port" , test_params->slave_port_ids[i]); }/* Set explicit MAC address */ -if (rte_eth_bond_mac_address_set (test_params->bonded_port_id, - (struct ether_addr *)bonded_mac) !=0 ) { -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_mac_address_set ( + test_params->bonded_port_id, (struct ether_addr *)bonded_mac), +"Failed to set MAC" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of new primary port\n" , +TEST_ASSERT_SUCCESS (memcmp (bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of new primary port" , test_params->slave_port_ids[i]); -return -1 ; - }for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_macaddr_get (test_params->slave_port_ids[i], &read_mac_addr); -if (memcmp (bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of new primary port\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)),"slave port (%d) mac address not set to" +" that of new primary port\n" , test_params->slave_port_ids[i]); }/* Clean up and remove slaves from bonded device */
@@ -1805,44 +1621,38 @@ test_roundrobin_verify_promiscuous_enable_disable(void)int i, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ) != -0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,4 ,1 ), +"Failed to initialize bonded device with slaves" );rte_eth_promiscuous_enable (test_params->bonded_port_id); promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=1 ) { -printf ("Port (%d) promiscuous mode not enabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (promiscuous_en,1 , +"Port (%d) promiscuous mode not enabled" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { - promiscuous_en =rte_eth_promiscuous_get (test_params->slave_port_ids[i]); -if (promiscuous_en !=1 ) { -printf ("slave port (%d) promiscuous mode not enabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } + promiscuous_en =rte_eth_promiscuous_get ( + test_params->slave_port_ids[i]); +TEST_ASSERT_EQUAL (promiscuous_en,1 , +"slave port (%d) promiscuous mode not enabled" , + test_params->slave_port_ids[i]); }rte_eth_promiscuous_disable (test_params->bonded_port_id); promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=0 ) { -printf ("Port (%d) promiscuous mode not disabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (promiscuous_en,0 , +"Port (%d) promiscuous mode not disabled\n" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { - promiscuous_en =rte_eth_promiscuous_get (test_params->slave_port_ids[i]); -if (promiscuous_en !=0 ) { -printf ("slave port (%d) promiscuous mode not disabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } + promiscuous_en =rte_eth_promiscuous_get ( + test_params->slave_port_ids[i]); +TEST_ASSERT_EQUAL (promiscuous_en,0 , +"Port (%d) promiscuous mode not disabled\n" , + test_params->slave_port_ids[i]); }/* Clean up and remove slaves from bonded device */
@@ -1869,26 +1679,22 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)/* Initialize bonded device with TEST_RR_LINK_STATUS_SLAVE_COUNT slaves * in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ROUND_ROBIN ,0 , -TEST_RR_LINK_STATUS_SLAVE_COUNT ,1 ) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ROUND_ROBIN ,0 ,TEST_RR_LINK_STATUS_SLAVE_COUNT ,1 ), +"Failed to initialize bonded device with slaves" );/* Verify Current Slaves Count /Active Slave Count is */ slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=TEST_RR_LINK_STATUS_SLAVE_COUNT ) { -printf ("Number of slaves (%d) is not as expected (%d).\n" , slave_count, -TEST_RR_LINK_STATUS_SLAVE_COUNT ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,TEST_RR_LINK_STATUS_SLAVE_COUNT , +"Number of slaves (%d) is not as expected (%d)." , + slave_count,TEST_RR_LINK_STATUS_SLAVE_COUNT ); slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=TEST_RR_LINK_STATUS_SLAVE_COUNT ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,TEST_RR_LINK_STATUS_SLAVE_COUNT ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,TEST_RR_LINK_STATUS_SLAVE_COUNT , +"Number of active slaves (%d) is not as expected (%d)." , + slave_count,TEST_RR_LINK_STATUS_SLAVE_COUNT );/* Set 2 slaves eth_devs link status to down */ virtual_ethdev_simulate_link_status_interrupt(
@@ -1896,13 +1702,12 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[3 ],0 ); -if (rte_eth_bond_active_slaves_get (test_params->bonded_port_id, - slaves,RTE_MAX_ETHPORTS ) != -TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT ); -return -1 ; - } + slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, + slaves,RTE_MAX_ETHPORTS ); +TEST_ASSERT_EQUAL (slave_count, +TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT , +"Number of active slaves (%d) is not as expected (%d).\n" , + slave_count,TEST_RR_LINK_STATUS_EXPECTED_ACTIVE_SLAVE_COUNT ); burst_size =20 ;
@@ -1913,19 +1718,16 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)* 3. Verify stats for bonded eth_dev (opackets = burst_size) * 4. Verify stats for slave eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) */ -if (generate_test_burst (tx_pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ) != - burst_size) { -printf ("generate_test_burst failed\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL ( +generate_test_burst (tx_pkt_burst, burst_size,0 ,1 ,0 ,0 ,0 ), + burst_size,"generate_test_burst failed" );rte_eth_stats_reset (test_params->bonded_port_id); -if (rte_eth_tx_burst (test_params->bonded_port_id,0 , tx_pkt_burst, - burst_size) != burst_size) { -printf ("rte_eth_tx_burst failed\n" ); -return -1 ; - } + +TEST_ASSERT_EQUAL ( +rte_eth_tx_burst (test_params->bonded_port_id,0 , tx_pkt_burst, + burst_size), burst_size,"rte_eth_tx_burst failed" );rte_eth_stats_get (test_params->bonded_port_id, &port_stats); TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)burst_size,
@@ -1963,27 +1765,24 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)* 6. Verify stats for slave eth_devs (s0 = 10, s1 = 0, s2 = 10, s3 = 0) */ for (i =0 ; i <TEST_RR_LINK_STATUS_SLAVE_COUNT ; i++) { -if (generate_test_burst (&gen_pkt_burst[i][0 ], burst_size,0 ,1 ,0 ,0 ,0 ) - != burst_size) { -return -1 ; - } +TEST_ASSERT_EQUAL (generate_test_burst ( + &gen_pkt_burst[i][0 ], burst_size,0 ,1 ,0 ,0 ,0 ), + burst_size,"failed to generate packet burst" ); +virtual_ethdev_add_mbufs_to_rx_queue (test_params->slave_port_ids[i], &gen_pkt_burst[i][0 ], burst_size); } -if (rte_eth_rx_burst (test_params->bonded_port_id,0 , rx_pkt_burst, -MAX_PKT_BURST ) != burst_size + burst_size) { -printf ("rte_eth_rx_burst\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_rx_burst ( + test_params->bonded_port_id,0 , rx_pkt_burst,MAX_PKT_BURST ), + burst_size + burst_size, +"rte_eth_rx_burst failed" );/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )(burst_size + burst_size)) { -printf ("(%d) port_stats.ipackets not as expected\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets , (uint64_t )(burst_size + burst_size), +"(%d) port_stats.ipackets not as expected\n" , + test_params->bonded_port_id);/* free mbufs */ for (i =0 ; i <MAX_PKT_BURST ; i++) {
@@ -2005,7 +1804,6 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)uint8_t polling_slave_mac[] = {0xDE ,0xAD ,0xBE ,0xEF ,0x00 ,0x00 }; -#include "unistd.h" int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT ] = {-1 ,-1 };
@@ -2039,7 +1837,8 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void)TEST_ASSERT_SUCCESS (rte_eth_bond_slave_add (test_params->bonded_port_id, polling_test_slaves[i]),"Failed to add slave %s(%d) to bonded device %d" , - slave_name, polling_test_slaves[i], test_params->bonded_port_id); + slave_name, polling_test_slaves[i], + test_params->bonded_port_id); }/* Initialize bonded device */
@@ -2101,15 +1900,13 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void)static int test_activebackup_tx_burst (void ) { -int i, retval, pktlen, primary_port, burst_size, generated_burst_size, nb_tx; +int i, pktlen, primary_port, burst_size;struct rte_mbuf *pkts_burst[MAX_PKT_BURST ];struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 ); -if (retval !=0 ) { -printf ("Failed to initialize_bonded_device_with_slaves.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 ,1 ,1 ), +"Failed to initialize bonded device with slaves" );initialize_eth_header (test_params->pkt_eth_hdr, (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0,0 ,0 );
@@ -2120,32 +1917,25 @@ test_activebackup_tx_burst(void) burst_size =20 * test_params->bonded_slave_count; -if (burst_size >MAX_PKT_BURST ) { -printf ("Burst size specified is greater than supported.\n" ); -return -1 ; - } +TEST_ASSERT (burst_size <MAX_PKT_BURST , +"Burst size specified is greater than supported." );/* 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,PACKET_BURST_GEN_PKT_LEN ,1 ); -if (generated_burst_size != burst_size) -return -1 ; +TEST_ASSERT_EQUAL (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 ), + burst_size,"failed to generate burst correctly" );/* Send burst on bonded port */ - nb_tx =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst, - burst_size); -if (nb_tx != burst_size) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst, + burst_size), burst_size,"tx burst failed" );/* Verify bonded port tx stats */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.opackets != (uint64_t )burst_size) { -printf ("Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, (unsigned int )port_stats.opackets, - burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size, +"Bonded Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + burst_size); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id);
@@ -2153,35 +1943,28 @@ test_activebackup_tx_burst(void)for (i =0 ; i < test_params->bonded_slave_count; i++) {rte_eth_stats_get (test_params->slave_port_ids[i], &port_stats);if (test_params->slave_port_ids[i] == primary_port) { -if (port_stats.opackets != (uint64_t )burst_size) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets, - burst_size / test_params->bonded_slave_count); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size, +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, + (unsigned int )port_stats.opackets, + burst_size / test_params->bonded_slave_count); }else { -if (port_stats.opackets !=0 ) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, + (unsigned int )port_stats.opackets,0 ); } }/* Put all slaves down and try and transmit */ for (i =0 ; i < test_params->bonded_slave_count; i++) { -virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[i],0 ); }/* Send burst on bonded port */ - nb_tx =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst, - burst_size); -if (nb_tx !=0 ) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst (test_params->bonded_port_id,0 , + pkts_burst, burst_size),0 ,"Sending empty burst failed" );/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -2199,78 +1982,63 @@ test_activebackup_rx_burst(void)int primary_port; -int i, j, nb_rx, burst_size =17 ; - -/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 , -TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ) - !=0 ) -return -1 ; +int i, j, burst_size =17 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 , +TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ), +"Failed to initialize bonded device with slaves" ); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (primary_port <0 ) { -printf ("failed to get primary slave for bonded port (%d)" , - test_params->bonded_port_id); - } +TEST_ASSERT (primary_port >=0 , +"failed to get primary slave for bonded port (%d)" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) {/* Generate test bursts of packets to transmit */ -if (generate_test_burst (&gen_pkt_burst[0 ], burst_size,0 ,1 ,0 ,0 ,0 ) - != burst_size) { -return -1 ; - } +TEST_ASSERT_EQUAL (generate_test_burst ( + &gen_pkt_burst[0 ], burst_size,0 ,1 ,0 ,0 ,0 ), + burst_size,"burst generation failed" );/* Add rx data to slave */ virtual_ethdev_add_mbufs_to_rx_queue (test_params->slave_port_ids[i], &gen_pkt_burst[0 ], burst_size);/* Call rx burst on bonded device */ - nb_rx =rte_eth_rx_burst (test_params->bonded_port_id,0 , - &rx_pkt_burst[0 ],MAX_PKT_BURST ); -if (nb_rx <0 ) { -printf ("rte_eth_rx_burst failed\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_rx_burst (test_params->bonded_port_id,0 , + &rx_pkt_burst[0 ],MAX_PKT_BURST ), burst_size, +"rte_eth_rx_burst failed" );if (test_params->slave_port_ids[i] == primary_port) {/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size) { -printf ("Bonded Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.ipackets, burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size, +"Bonded Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, + (unsigned int )port_stats.ipackets, burst_size);/* Verify bonded slave devices rx count */ for (j =0 ; j < test_params->bonded_slave_count; j++) {rte_eth_stats_get (test_params->slave_port_ids[j], &port_stats);if (i == j) { -if (port_stats.ipackets != (uint64_t )burst_size) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[i], - (unsigned int )port_stats.ipackets, burst_size); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size, +"Slave Port (%d) ipackets value (%u) not as " +"expected (%d)" , test_params->slave_port_ids[i], + (unsigned int )port_stats.ipackets, burst_size); }else { -if (port_stats.ipackets !=0 ) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[i], - (unsigned int )port_stats.ipackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets,0 , +"Slave Port (%d) ipackets value (%u) not as " +"expected (%d)\n" , test_params->slave_port_ids[i], + (unsigned int )port_stats.ipackets,0 ); } } }else {for (j =0 ; j < test_params->bonded_slave_count; j++) {rte_eth_stats_get (test_params->slave_port_ids[j], &port_stats); -if (port_stats.ipackets !=0 ) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[i], - (unsigned int )port_stats.ipackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets,0 , +"Slave Port (%d) ipackets value (%u) not as expected " +"(%d)" , test_params->slave_port_ids[i], + (unsigned int )port_stats.ipackets,0 ); } }
@@ -2296,61 +2064,48 @@ test_activebackup_verify_promiscuous_enable_disable(void)int i, primary_port, promiscuous_en;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,4 ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 ,4 ,1 ), +"Failed to initialize bonded device with slaves" ); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (primary_port <0 ) { -printf ("failed to get primary slave for bonded port (%d)" , - test_params->bonded_port_id); - } +TEST_ASSERT (primary_port >=0 , +"failed to get primary slave for bonded port (%d)" , + test_params->bonded_port_id);rte_eth_promiscuous_enable (test_params->bonded_port_id); - promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=1 ) { -printf ("Port (%d) promiscuous mode not enabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get (test_params->bonded_port_id),1 , +"Port (%d) promiscuous mode not enabled" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { promiscuous_en =rte_eth_promiscuous_get ( test_params->slave_port_ids[i]);if (primary_port == test_params->slave_port_ids[i]) { -if (promiscuous_en !=1 ) { -printf ("slave port (%d) promiscuous mode not enabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_EQUAL (promiscuous_en,1 , +"slave port (%d) promiscuous mode not enabled" , + test_params->slave_port_ids[i]); }else { -if (promiscuous_en !=0 ) { -printf ("slave port (%d) promiscuous mode enabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_EQUAL (promiscuous_en,0 , +"slave port (%d) promiscuous mode enabled" , + test_params->slave_port_ids[i]); } }rte_eth_promiscuous_disable (test_params->bonded_port_id); - promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=0 ) { -printf ("Port (%d) promiscuous mode not disabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get (test_params->bonded_port_id),0 , +"Port (%d) promiscuous mode not disabled\n" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { promiscuous_en =rte_eth_promiscuous_get ( test_params->slave_port_ids[i]); -if (promiscuous_en !=0 ) { -printf ("slave port (%d) promiscuous mode not disabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } +TEST_ASSERT_EQUAL (promiscuous_en,0 , +"slave port (%d) promiscuous mode not disabled\n" , + test_params->slave_port_ids[i]); }/* Clean up and remove slaves from bonded device */
@@ -2366,117 +2121,102 @@ test_activebackup_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &expected_mac_addr_1);/* Initialize bonded device with 2 slaves in active backup mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 ), +"Failed to initialize bonded device with slaves" );/* Verify that bonded MACs is that of first slave and that the other slave * MAC hasn't been changed */ rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not as expected\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not as expected" , + test_params->slave_port_ids[1 ]);/* change primary and verify that MAC addresses haven't changed */ -if (rte_eth_bond_primary_set (test_params->bonded_port_id, - test_params->slave_port_ids[1 ]) !=0 ) { -printf ("Failed to set bonded port (%d) primary port to (%d)\n" , - test_params->bonded_port_id, test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_bond_primary_set (test_params->bonded_port_id, + test_params->slave_port_ids[1 ]),0 , +"Failed to set bonded port (%d) primary port to (%d)" , + test_params->bonded_port_id, test_params->slave_port_ids[1 ]);rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not as expected\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not as expected" , + test_params->slave_port_ids[1 ]);/* stop / start bonded device and verify that primary MAC address is * propagated to bonded device and slaves */ rte_eth_dev_stop (test_params->bonded_port_id); -if (rte_eth_dev_start (test_params->bonded_port_id) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (rte_eth_dev_start (test_params->bonded_port_id), +"Failed to start device" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not as expected\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not as expected" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[1 ]);/* Set explicit MAC address */ -if (rte_eth_bond_mac_address_set (test_params->bonded_port_id, - (struct ether_addr *)bonded_mac) !=0 ) { -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_mac_address_set ( + test_params->bonded_port_id, (struct ether_addr *)bonded_mac), +"failed to set MAC address" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of bonded port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of bonded port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not as expected\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not as expected" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of bonded port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of bonded port" , + test_params->slave_port_ids[1 ]);/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -2498,38 +2238,32 @@ test_activebackup_verify_slave_link_status_change_failover(void)memset (pkt_burst,0 ,sizeof (pkt_burst));/* Generate packet burst for testing */ -if (generate_test_burst (&pkt_burst[0 ][0 ], burst_size,0 ,1 ,0 ,0 ,0 ) != - burst_size) { -printf ("generate_test_burst failed\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (generate_test_burst ( + &pkt_burst[0 ][0 ], burst_size,0 ,1 ,0 ,0 ,0 ), burst_size, +"generate_test_burst failed" );/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 , -TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 , +TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ,1 ), +"Failed to initialize bonded device with slaves" );/* Verify Current Slaves Count /Active Slave Count is */ slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=4 ) { -printf ("Number of slaves (%d) is not as expected (%d).\n" , - slave_count,4 ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,4 , +"Number of slaves (%d) is not as expected (%d)." , + slave_count,4 ); slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=4 ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,4 ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,4 , +"Number of active slaves (%d) is not as expected (%d)." , + slave_count,4 ); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (primary_port != test_params->slave_port_ids[0 ]) -printf ("Primary port not as expected" ); +TEST_ASSERT_EQUAL (primary_port, test_params->slave_port_ids[0 ], +"Primary port not as expected" );/* Bring 2 slaves down and verify active slave count */ virtual_ethdev_simulate_link_status_interrupt(
@@ -2537,12 +2271,10 @@ test_activebackup_verify_slave_link_status_change_failover(void)virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[3 ],0 ); -if (rte_eth_bond_active_slaves_get (test_params->bonded_port_id, slaves, -RTE_MAX_ETHPORTS ) !=2 ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,2 ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_bond_active_slaves_get ( + test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ),2 , +"Number of active slaves (%d) is not as expected (%d)." , + slave_count,2 );virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[1 ],1 );
@@ -2555,106 +2287,84 @@ test_activebackup_verify_slave_link_status_change_failover(void)virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[0 ],0 ); -if (rte_eth_bond_active_slaves_get (test_params->bonded_port_id, slaves, -RTE_MAX_ETHPORTS ) !=3 ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,3 ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_bond_active_slaves_get ( + test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ), +3 , +"Number of active slaves (%d) is not as expected (%d)." , + slave_count,3 ); primary_port =rte_eth_bond_primary_get (test_params->bonded_port_id); -if (primary_port != test_params->slave_port_ids[2 ]) -printf ("Primary port not as expected" ); +TEST_ASSERT_EQUAL (primary_port, test_params->slave_port_ids[2 ], +"Primary port not as expected" );/* Verify that pkts are sent on new primary slave */ -if (rte_eth_tx_burst (test_params->bonded_port_id,0 , &pkt_burst[0 ][0 ], burst_size) - != burst_size) { -printf ("rte_eth_tx_burst failed\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_tx_burst ( + test_params->bonded_port_id,0 , &pkt_burst[0 ][0 ], + burst_size), burst_size,"rte_eth_tx_burst failed" );rte_eth_stats_get (test_params->slave_port_ids[2 ], &port_stats); -if (port_stats.opackets != (uint64_t )burst_size) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[2 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size, +"(%d) port_stats.opackets not as expected" , + test_params->slave_port_ids[2 ]);rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected\n" , + test_params->slave_port_ids[0 ]); +rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected\n" , + test_params->slave_port_ids[1 ]); +rte_eth_stats_get (test_params->slave_port_ids[3 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[3 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected\n" , + test_params->slave_port_ids[3 ]);/* Generate packet burst for testing */ for (i =0 ; i <TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ; i++) { -if (generate_test_burst (&pkt_burst[i][0 ], burst_size,0 ,1 ,0 ,0 ,0 ) != - burst_size) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + &pkt_burst[i][0 ], burst_size,0 ,1 ,0 ,0 ,0 ), burst_size, +"generate_test_burst failed" );virtual_ethdev_add_mbufs_to_rx_queue ( test_params->slave_port_ids[i], &pkt_burst[i][0 ], burst_size); } -if (rte_eth_rx_burst (test_params->bonded_port_id,0 , rx_pkt_burst, -MAX_PKT_BURST ) != burst_size) { -printf ("rte_eth_rx_burst\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_rx_burst ( + test_params->bonded_port_id,0 , rx_pkt_burst,MAX_PKT_BURST ), + burst_size,"rte_eth_rx_burst\n" );/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size) { -printf ("(%d) port_stats.ipackets not as expected\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size, +"(%d) port_stats.ipackets not as expected" , + test_params->bonded_port_id);rte_eth_stats_get (test_params->slave_port_ids[2 ], &port_stats); -if (port_stats.opackets != (uint64_t )burst_size) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[2 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size, +"(%d) port_stats.opackets not as expected" , + test_params->slave_port_ids[2 ]);rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected" , + test_params->slave_port_ids[0 ]);rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected" , + test_params->slave_port_ids[1 ]);rte_eth_stats_get (test_params->slave_port_ids[3 ], &port_stats); -if (port_stats.opackets !=0 ) { -printf ("(%d) port_stats.opackets not as expected\n" , - test_params->slave_port_ids[3 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets,0 , +"(%d) port_stats.opackets not as expected" , + test_params->slave_port_ids[3 ]);/* free mbufs */ -for (i =0 ; i <TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT ; i++) {for (j =0 ; j <MAX_PKT_BURST ; j++) {if (pkt_burst[i][j] !=NULL ) {
@@ -2664,7 +2374,6 @@ test_activebackup_verify_slave_link_status_change_failover(void) } } -/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device (); }
@@ -2674,70 +2383,49 @@ test_activebackup_verify_slave_link_status_change_failover(void)static int test_balance_xmit_policy_configuration (void ) { -int retval; - - retval =initialize_bonded_device_with_slaves (BONDING_MODE_ACTIVE_BACKUP ,0 , -2 ,1 ); -if (retval !=0 ) { -printf ("Failed to initialize_bonded_device_with_slaves.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_ACTIVE_BACKUP ,0 ,2 ,1 ), +"Failed to initialize_bonded_device_with_slaves." );/* Invalid port id */ - retval =rte_eth_bond_xmit_policy_set (INVALID_PORT_ID , -BALANCE_XMIT_POLICY_LAYER2 ); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_xmit_policy_set ( +INVALID_PORT_ID ,BALANCE_XMIT_POLICY_LAYER2 ), +"Expected call to failed as invalid port specified." );/* Set xmit policy on non bonded device */ - retval =rte_eth_bond_xmit_policy_set (test_params->slave_port_ids[0 ], -BALANCE_XMIT_POLICY_LAYER2 ); -if (retval ==0 ) { -printf ("Expected call to failed as invalid port specified.\n" ); -return -1 ; - } +TEST_ASSERT_FAIL (rte_eth_bond_xmit_policy_set ( + test_params->slave_port_ids[0 ],BALANCE_XMIT_POLICY_LAYER2 ), +"Expected call to failed as invalid port specified." ); - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER2 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } -if (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id) != -BALANCE_XMIT_POLICY_LAYER2 ) { -printf ("balance xmit policy not as expected.\n" ); -return -1 ; - } - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER23 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } -if (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id) != -BALANCE_XMIT_POLICY_LAYER23 ) { -printf ("balance xmit policy not as expected.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER2 ), +"Failed to set balance xmit policy." ); - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER34 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } -if (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id) != -BALANCE_XMIT_POLICY_LAYER34 ) { -printf ("balance xmit policy not as expected.\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id), +BALANCE_XMIT_POLICY_LAYER2 ,"balance xmit policy not as expected." ); + + +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER23 ), +"Failed to set balance xmit policy." ); + +TEST_ASSERT_EQUAL (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id), +BALANCE_XMIT_POLICY_LAYER23 , +"balance xmit policy not as expected." ); + + +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER34 ), +"Failed to set balance xmit policy." ); + +TEST_ASSERT_EQUAL (rte_eth_bond_xmit_policy_get (test_params->bonded_port_id), +BALANCE_XMIT_POLICY_LAYER34 , +"balance xmit policy not as expected." );/* Invalid port id */ -if (rte_eth_bond_xmit_policy_get (INVALID_PORT_ID ) >=0 ) -return -1 ; +TEST_ASSERT_FAIL (rte_eth_bond_xmit_policy_get (INVALID_PORT_ID ), +"Expected call to failed as invalid port specified." );/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -2752,24 +2440,16 @@ test_balance_l2_tx_burst(void)int burst_size[TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT ] = {10 ,15 };uint16_t pktlen; - -int retval, i; +int i;struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 , -TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT ,1 ); -if (retval !=0 ) { -printf ("Failed to initialize_bonded_device_with_slaves.\n" ); -return -1 ; - } - - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER2 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT ,1 ), +"Failed to initialize_bonded_device_with_slaves." ); +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER2 ), +"Failed to set balance xmit policy." );initialize_eth_header (test_params->pkt_eth_hdr, (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0,0 ,0 );
@@ -2779,54 +2459,50 @@ test_balance_l2_tx_burst(void) dst_addr_0, pktlen);/* Generate a burst 1 of packets to transmit */ -if (generate_packet_burst (test_params->mbuf_pool, &pkts_burst[0 ][0 ], +TEST_ASSERT_EQUAL (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 ], -PACKET_BURST_GEN_PKT_LEN ,1 ) != burst_size[0 ]) -return -1 ; +PACKET_BURST_GEN_PKT_LEN ,1 ), burst_size[0 ], +"failed to generate packet burst" );initialize_eth_header (test_params->pkt_eth_hdr, (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1,0 ,0 );/* Generate a burst 2 of packets to transmit */ -if (generate_packet_burst (test_params->mbuf_pool, &pkts_burst[1 ][0 ], +TEST_ASSERT_EQUAL (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 ], -PACKET_BURST_GEN_PKT_LEN ,1 ) != burst_size[1 ]) -return -1 ; +PACKET_BURST_GEN_PKT_LEN ,1 ), burst_size[1 ], +"failed to generate packet burst" );/* Send burst 1 on bonded port */ for (i =0 ; i <TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT ; i++) { -if (rte_eth_tx_burst (test_params->bonded_port_id,0 , &pkts_burst[i][0 ], - burst_size[i]) != burst_size[i]) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst (test_params->bonded_port_id,0 , + &pkts_burst[i][0 ], burst_size[i]), + burst_size[i],"Failed to transmit packet burst" ); } +/* Verify bonded port tx stats */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.opackets != (uint64_t )(burst_size[0 ] + burst_size[1 ])) { -printf ("Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets, burst_size[0 ] + burst_size[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, + (uint64_t )(burst_size[0 ] + burst_size[1 ]), +"Bonded Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + burst_size[0 ] + burst_size[1 ]);/* Verify slave ports tx stats */ rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.opackets != (uint64_t )burst_size[0 ]) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[0 ], - (unsigned int )port_stats.opackets, burst_size[0 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size[0 ], +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[0 ], (unsigned int )port_stats.opackets, + burst_size[0 ]);rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.opackets != (uint64_t )burst_size[1 ]) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[1 ], ( -unsigned int )port_stats.opackets, burst_size[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )burst_size[1 ], +"Slave Port (%d) opackets value (%u) not as expected (%d)\n" , + test_params->slave_port_ids[1 ], (unsigned int )port_stats.opackets, + burst_size[1 ]);/* Put all slaves down and try and transmit */ for (i =0 ; i < test_params->bonded_slave_count; i++) {
@@ -2836,9 +2512,9 @@ test_balance_l2_tx_burst(void) }/* Send burst on bonded port */ -if (rte_eth_tx_burst (test_params->bonded_port_id,0 , &pkts_burst[0 ][0 ], - burst_size[0 ]) !=0 ) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst ( + test_params->bonded_port_id,0 , &pkts_burst[0 ][0 ], burst_size[0 ]), +0 ,"Expected zero packet" );/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -2848,81 +2524,65 @@ static int balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, uint8_t toggle_mac_addr, uint8_t toggle_ip_addr) { - int retval, i; -int burst_size_1, burst_size_2, nb_tx_1, nb_tx_2; + int i, burst_size_1, burst_size_2, nb_tx_1, nb_tx_2;struct rte_mbuf *pkts_burst_1[MAX_PKT_BURST ];struct rte_mbuf *pkts_burst_2[MAX_PKT_BURST ];struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 ); -if (retval !=0 ) { -printf ("Failed to initialize_bonded_device_with_slaves.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,2 ,1 ), +"Failed to initialize_bonded_device_with_slaves." ); - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER23 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER23 ), +"Failed to set balance xmit policy." ); burst_size_1 =20 ; burst_size_2 =10 ; -if (burst_size_1 >MAX_PKT_BURST || burst_size_2 >MAX_PKT_BURST ) { -printf ("Burst size specified is greater than supported.\n" ); -return -1 ; - } +TEST_ASSERT (burst_size_1 <MAX_PKT_BURST || burst_size_2 <MAX_PKT_BURST , +"Burst size specified is greater than supported." );/* Generate test bursts of packets to transmit */ -if (generate_test_burst (pkts_burst_1, burst_size_1, vlan_enabled, ipv4, -0 ,0 ,0 ) != burst_size_1) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + pkts_burst_1, burst_size_1, vlan_enabled, ipv4,0 ,0 ,0 ), + burst_size_1,"failed to generate packet burst" ); -if (generate_test_burst (pkts_burst_2, burst_size_2, vlan_enabled, ipv4, - toggle_mac_addr, toggle_ip_addr,0 ) != burst_size_2) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst (pkts_burst_2, burst_size_2, vlan_enabled, ipv4, + toggle_mac_addr, toggle_ip_addr,0 ), burst_size_2, +"failed to generate packet burst" );/* Send burst 1 on bonded port */ nb_tx_1 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_1, burst_size_1); -if (nb_tx_1 != burst_size_1) -return -1 ; +TEST_ASSERT_EQUAL (nb_tx_1, burst_size_1,"tx burst failed" );/* Send burst 2 on bonded port */ nb_tx_2 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_2, burst_size_2); -if (nb_tx_2 != burst_size_2) -return -1 ; +TEST_ASSERT_EQUAL (nb_tx_2, burst_size_2,"tx burst failed" );/* Verify bonded port tx stats */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.opackets != (uint64_t )(nb_tx_1 + nb_tx_2)) { -printf ("Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets, nb_tx_1 + nb_tx_2); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )(nb_tx_1 + nb_tx_2), +"Bonded Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + nb_tx_1 + nb_tx_2);/* Verify slave ports tx stats */ rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.opackets != (uint64_t )nb_tx_1) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[0 ], - (unsigned int )port_stats.opackets, nb_tx_1); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )nb_tx_1, +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[0 ], (unsigned int )port_stats.opackets, + nb_tx_1);rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.opackets != (uint64_t )nb_tx_2) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[1 ], - (unsigned int )port_stats.opackets, nb_tx_2); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )nb_tx_2, +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[1 ], (unsigned int )port_stats.opackets, + nb_tx_2);/* Put all slaves down and try and transmit */ for (i =0 ; i < test_params->bonded_slave_count; i++) {
@@ -2932,10 +2592,10 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, }/* Send burst on bonded port */ - nb_tx_1 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_1, - burst_size_1); -if (nb_tx_1 !=0 ) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst ( + test_params->bonded_port_id,0 , pkts_burst_1, + burst_size_1),0 ,"Expected zero packet" ); +/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -2976,82 +2636,66 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, uint8_t toggle_mac_addr, uint8_t toggle_ip_addr, uint8_t toggle_udp_port) { - int retval, i; -int burst_size_1, burst_size_2, nb_tx_1, nb_tx_2; + int i, burst_size_1, burst_size_2, nb_tx_1, nb_tx_2;struct rte_mbuf *pkts_burst_1[MAX_PKT_BURST ];struct rte_mbuf *pkts_burst_2[MAX_PKT_BURST ];struct rte_eth_stats port_stats; - retval =initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 ); -if (retval !=0 ) { -printf ("Failed to initialize_bonded_device_with_slaves.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,2 ,1 ), +"Failed to initialize_bonded_device_with_slaves." ); - retval =rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER34 ); -if (retval !=0 ) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER34 ), +"Failed to set balance xmit policy." ); burst_size_1 =20 ; burst_size_2 =10 ; -if (burst_size_1 >MAX_PKT_BURST || burst_size_2 >MAX_PKT_BURST ) { -printf ("Burst size specified is greater than supported.\n" ); -return -1 ; - } +TEST_ASSERT (burst_size_1 <MAX_PKT_BURST || burst_size_2 <MAX_PKT_BURST , +"Burst size specified is greater than supported." );/* Generate test bursts of packets to transmit */ -if (generate_test_burst (pkts_burst_1, burst_size_1, vlan_enabled, ipv4,0 , -0 ,0 ) != burst_size_1) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + pkts_burst_1, burst_size_1, vlan_enabled, ipv4,0 ,0 ,0 ), + burst_size_1,"failed to generate burst" ); -if (generate_test_burst (pkts_burst_2, burst_size_2, vlan_enabled, ipv4, - toggle_mac_addr, toggle_ip_addr, toggle_udp_port) != burst_size_2) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst (pkts_burst_2, burst_size_2, + vlan_enabled, ipv4, toggle_mac_addr, toggle_ip_addr, + toggle_udp_port), burst_size_2,"failed to generate burst" );/* Send burst 1 on bonded port */ nb_tx_1 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_1, burst_size_1); -if (nb_tx_1 != burst_size_1) -return -1 ; +TEST_ASSERT_EQUAL (nb_tx_1, burst_size_1,"tx burst failed" );/* Send burst 2 on bonded port */ nb_tx_2 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_2, burst_size_2); -if (nb_tx_2 != burst_size_2) -return -1 ; +TEST_ASSERT_EQUAL (nb_tx_2, burst_size_2,"tx burst failed" );/* Verify bonded port tx stats */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.opackets != (uint64_t )(nb_tx_1 + nb_tx_2)) { -printf ("Bonded Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, - (unsigned int )port_stats.opackets, nb_tx_1 + nb_tx_2); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )(nb_tx_1 + nb_tx_2), +"Bonded Port (%d) opackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.opackets, + nb_tx_1 + nb_tx_2);/* Verify slave ports tx stats */ rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.opackets != (uint64_t )nb_tx_1) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[0 ], - (unsigned int )port_stats.opackets, nb_tx_1); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )nb_tx_1, +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[0 ], (unsigned int )port_stats.opackets, + nb_tx_1);rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.opackets != (uint64_t )nb_tx_2) { -printf ("Slave Port (%d) opackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[1 ], - (unsigned int )port_stats.opackets, nb_tx_2); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.opackets, (uint64_t )nb_tx_2, +"Slave Port (%d) opackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[1 ], (unsigned int )port_stats.opackets, + nb_tx_2);/* Put all slaves down and try and transmit */ for (i =0 ; i < test_params->bonded_slave_count; i++) {
@@ -3061,10 +2705,9 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4, }/* Send burst on bonded port */ - nb_tx_1 =rte_eth_tx_burst (test_params->bonded_port_id,0 , pkts_burst_1, - burst_size_1); -if (nb_tx_1 !=0 ) -return -1 ; +TEST_ASSERT_EQUAL (rte_eth_tx_burst ( + test_params->bonded_port_id,0 , pkts_burst_1, + burst_size_1),0 ,"Expected zero packet" );/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -3253,21 +2896,23 @@ test_balance_rx_burst(void)struct rte_eth_stats port_stats;int burst_size[TEST_BALANCE_RX_BURST_SLAVE_COUNT ] = {10 ,5 ,30 }; -int i, j, nb_rx; +int i, j;memset (gen_pkt_burst,0 ,sizeof (gen_pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,3 ,1 ) - !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,3 ,1 ), +"Failed to intialise bonded device" );/* Generate test bursts of packets to transmit */ for (i =0 ; i <TEST_BALANCE_RX_BURST_SLAVE_COUNT ; i++) { -if (generate_test_burst (&gen_pkt_burst[i][0 ], burst_size[i],0 ,0 ,1 , -0 ,0 ) != burst_size[i]) -return -1 ; +TEST_ASSERT_EQUAL (generate_test_burst ( + &gen_pkt_burst[i][0 ], burst_size[i],0 ,0 ,1 , +0 ,0 ), burst_size[i], +"failed to generate packet burst" ); } +/* Add rx data to slaves */ for (i =0 ; i <TEST_BALANCE_RX_BURST_SLAVE_COUNT ; i++) { virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i],
@@ -3276,56 +2921,44 @@ test_balance_rx_burst(void)/* Call rx burst on bonded device */ /* Send burst on bonded port */ - nb_rx =rte_eth_rx_burst (test_params->bonded_port_id,0 , rx_pkt_burst, -MAX_PKT_BURST ); -if (nb_rx != burst_size[0 ] + burst_size[1 ] + burst_size[2 ]) { -printf ("balance rx burst failed\n" ); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_rx_burst (test_params->bonded_port_id,0 , + rx_pkt_burst,MAX_PKT_BURST ), + burst_size[0 ] + burst_size[1 ] + burst_size[2 ], +"balance rx burst failed\n" );/* Verify bonded device rx count */ rte_eth_stats_get (test_params->bonded_port_id, &port_stats); -if (port_stats.ipackets != (uint64_t )(burst_size[0 ] + burst_size[1 ] + - burst_size[2 ])) { -printf ("Bonded Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->bonded_port_id, (unsigned int )port_stats.ipackets, - burst_size[0 ] + burst_size[1 ] + burst_size[2 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, + (uint64_t )(burst_size[0 ] + burst_size[1 ] + burst_size[2 ]), +"Bonded Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->bonded_port_id, (unsigned int )port_stats.ipackets, + burst_size[0 ] + burst_size[1 ] + burst_size[2 ]);/* Verify bonded slave devices rx counts */ rte_eth_stats_get (test_params->slave_port_ids[0 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[0 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[0 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , test_params->slave_port_ids[0 ], (unsigned int )port_stats.ipackets, burst_size[0 ]); -return -1 ; - }rte_eth_stats_get (test_params->slave_port_ids[1 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[1 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[1 ], - (unsigned int )port_stats.ipackets, burst_size[1 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[1 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[1 ], (unsigned int )port_stats.ipackets, + burst_size[1 ]);rte_eth_stats_get (test_params->slave_port_ids[2 ], &port_stats); -if (port_stats.ipackets != (uint64_t )burst_size[2 ]) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[2 ], - (unsigned int )port_stats.ipackets, burst_size[2 ]); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets, (uint64_t )burst_size[2 ], +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[2 ], (unsigned int )port_stats.ipackets, + burst_size[2 ]);rte_eth_stats_get (test_params->slave_port_ids[3 ], &port_stats); -if (port_stats.ipackets !=0 ) { -printf ("Slave Port (%d) ipackets value (%u) not as expected (%d)\n" , - test_params->slave_port_ids[3 ], - (unsigned int )port_stats.ipackets,0 ); -return -1 ; - } +TEST_ASSERT_EQUAL (port_stats.ipackets,0 , +"Slave Port (%d) ipackets value (%u) not as expected (%d)" , + test_params->slave_port_ids[3 ], (unsigned int )port_stats.ipackets, +0 );/* free mbufs */ for (i =0 ; i <TEST_BALANCE_RX_BURST_SLAVE_COUNT ; i++) {
@@ -3344,48 +2977,37 @@ test_balance_rx_burst(void)static int test_balance_verify_promiscuous_enable_disable (void ) { -int i, promiscuous_en; +int i;/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,4 ,1 ) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,4 ,1 ), +"Failed to intialise bonded device" );rte_eth_promiscuous_enable (test_params->bonded_port_id); - promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=1 ) { -printf ("Port (%d) promiscuous mode not enabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get (test_params->bonded_port_id),1 , +"Port (%d) promiscuous mode not enabled" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { - promiscuous_en =rte_eth_promiscuous_get ( +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get ( + test_params->slave_port_ids[i]),1 , +"Port (%d) promiscuous mode not enabled" , test_params->slave_port_ids[i]); -if (promiscuous_en !=1 ) { -printf ("slave port (%d) promiscuous mode not enabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } }rte_eth_promiscuous_disable (test_params->bonded_port_id); - promiscuous_en =rte_eth_promiscuous_get (test_params->bonded_port_id); -if (promiscuous_en !=0 ) { -printf ("Port (%d) promiscuous mode not disabled\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get (test_params->bonded_port_id),0 , +"Port (%d) promiscuous mode not disabled" , + test_params->bonded_port_id);for (i =0 ; i < test_params->bonded_slave_count; i++) { - promiscuous_en =rte_eth_promiscuous_get ( +TEST_ASSERT_EQUAL (rte_eth_promiscuous_get ( + test_params->slave_port_ids[i]),0 , +"Port (%d) promiscuous mode not disabled" , test_params->slave_port_ids[i]); -if (promiscuous_en !=0 ) { -printf ("slave port (%d) promiscuous mode not disabled\n" , - test_params->slave_port_ids[i]); -return -1 ; - } }/* Clean up and remove slaves from bonded device */
@@ -3401,115 +3023,102 @@ test_balance_verify_mac_assignment(void)rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &expected_mac_addr_1);/* Initialize bonded device with 2 slaves in active backup mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 ,2 ,1 ) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,2 ,1 ), +"Failed to intialise bonded device" );/* Verify that bonded MACs is that of first slave and that the other slave * MAC hasn't been changed */ rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[1 ]);/* change primary and verify that MAC addresses haven't changed */ -if (rte_eth_bond_primary_set (test_params->bonded_port_id, - test_params->slave_port_ids[1 ]) !=0 ) { -printf ("Failed to set bonded port (%d) primary port to (%d)\n" , - test_params->bonded_port_id, test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (rte_eth_bond_primary_set (test_params->bonded_port_id, + test_params->slave_port_ids[1 ]), +"Failed to set bonded port (%d) primary port to (%d)\n" , + test_params->bonded_port_id, test_params->slave_port_ids[1 ]);rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_0, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_0, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[1 ]);/* stop / start bonded device and verify that primary MAC address is * propagated to bonded device and slaves */ rte_eth_dev_stop (test_params->bonded_port_id); -if (rte_eth_dev_start (test_params->bonded_port_id) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (rte_eth_dev_start (test_params->bonded_port_id), +"Failed to start bonded device" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of primary port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of primary port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[0 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[0 ]);rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&expected_mac_addr_1, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of primary port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&expected_mac_addr_1, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of primary port" , + test_params->slave_port_ids[1 ]);/* Set explicit MAC address */ -if (rte_eth_bond_mac_address_set (test_params->bonded_port_id, - (struct ether_addr *)bonded_mac) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (rte_eth_bond_mac_address_set ( + test_params->bonded_port_id, (struct ether_addr *)bonded_mac), +"failed to set MAC" );rte_eth_macaddr_get (test_params->bonded_port_id, &read_mac_addr); -if (memcmp (&bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("bonded port (%d) mac address not set to that of bonded port\n" , - test_params->bonded_port_id); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"bonded port (%d) mac address not set to that of bonded port" , + test_params->bonded_port_id);rte_eth_macaddr_get (test_params->slave_port_ids[0 ], &read_mac_addr); -if (memcmp (&bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not as expected\n" , +TEST_ASSERT_SUCCESS (memcmp (&bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not as expected\n" , test_params->slave_port_ids[0 ]); -return -1 ; - }rte_eth_macaddr_get (test_params->slave_port_ids[1 ], &read_mac_addr); -if (memcmp (&bonded_mac, &read_mac_addr,sizeof (read_mac_addr))) { -printf ("slave port (%d) mac address not set to that of bonded port\n" , - test_params->slave_port_ids[1 ]); -return -1 ; - } +TEST_ASSERT_SUCCESS (memcmp (&bonded_mac, &read_mac_addr, +sizeof (read_mac_addr)), +"slave port (%d) mac address not set to that of bonded port" , + test_params->slave_port_ids[1 ]);/* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device ();
@@ -3531,32 +3140,27 @@ test_balance_verify_slave_link_status_change_behaviour(void)memset (pkt_burst,0 ,sizeof (pkt_burst));/* Initialize bonded device with 4 slaves in round robin mode */ -if (initialize_bonded_device_with_slaves (BONDING_MODE_BALANCE ,0 , -TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ,1 ) !=0 ) -return -1 ; +TEST_ASSERT_SUCCESS (initialize_bonded_device_with_slaves ( +BONDING_MODE_BALANCE ,0 ,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ,1 ), +"Failed to intialise bonded device" ); + +TEST_ASSERT_SUCCESS (rte_eth_bond_xmit_policy_set ( + test_params->bonded_port_id,BALANCE_XMIT_POLICY_LAYER2 ), +"Failed to set balance xmit policy." ); -if (rte_eth_bond_xmit_policy_set (test_params->bonded_port_id, -BALANCE_XMIT_POLICY_LAYER2 )) { -printf ("Failed to set balance xmit policy.\n" ); -return -1 ; - }/* Verify Current Slaves Count /Active Slave Count is */ slave_count =rte_eth_bond_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ) { -printf ("Number of slaves (%d) is not as expected (%d).\n" , slave_count, -TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT , +"Number of slaves (%d) is not as expected (%d)." , + slave_count,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ); slave_count =rte_eth_bond_active_slaves_get (test_params->bonded_port_id, slaves,RTE_MAX_ETHPORTS ); -if (slave_count !=TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ) { -printf ("Number of active slaves (%d) is not as expected (%d).\n" , - slave_count,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT ); -return -1 ; - } +TEST_ASSERT_EQUAL (slave_count,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT , +"Number of active slaves (%d) is not as expected (%d)." , + slave_count,TEST_BALANCE_LINK_STATUS_SLAVE_COUNT );/* Set 2 slaves link status to down */ virtual_ethdev_simulate_link_status_interrupt(
@@ -3564,106 +3168,80 @@ test_balance_verify_slave_link_status_change_behaviour(void)virtual_ethdev_simulate_link_status_interrupt ( test_params->slave_port_ids[3 ],0 ); -if (rte_eth_bond_active_slaves_get (test_params->bonded_port_id, - slaves,RTE_MAX_ETHPORTS ) !=2 ) { - printf("Number of active slaves (%d) is not as expected (%d).\n",
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.4.1
Part of the diff is not shown here. View the raw message.
Declan,
There are still some missing spaces:
WARNING:MISSING_SPACE: break quoted strings at a space character #2002: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1406:
+ "Invalid lsc polling interval value specified for bonded"
+ "device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character #2016: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1420:
+ "LSC polling interval can be specified only once for bonded"
+ "device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character #2040: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1444:
+ "Failed to set link up propagation delay (%u ms) on bonded"
+ "device %s\n", link_up_delay_ms, name);
WARNING:MISSING_SPACE: break quoted strings at a space character #2061: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1465:
+ "Invalid link down propagation delay value specified for"
+ "bonded device %s\n", name);
WARNING:MISSING_SPACE: break quoted strings at a space character #3674: FILE: app/test/test_link_bonding.c:3672:
+ "slave port (%d) mac address not set to that of new primary"
+ "port", test_params->slave_port_ids[i]);
I'm fixing it for you because I'm losing confidence all bonding patches will be ready on time.
Some i40e patches won't be applied today because I spend more time on bonding. For next release cycle, I'll have to be more strict.
Please Declan, could you be the bonding maintainer and ensure other bonding patches (mode 4, mode 5, fixes) to come are ready and nothing will delay their integration?
Thanks
Signature · 3 lines
Thomas 2014-11-24 16:33, Declan Doherty:
Quoted 18 lines
v8:
- Missing typo fix
- Missing whitespacev7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this was already committed in commitaca4360340f169dcc11b1a9be955b44de8b9f6ebDeclan Doherty (7):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency intx_burst_round_robin
bond: free mbufs if transmission fails in bondingtx_burstfunctions
testpmd: adding parameter to reconfig method to setsocket_idwhen
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor
2014-11-24 19:32, Thomas Monjalon:
Quoted 2 lines
I'm fixing it for you because I'm losing confidence all bonding patches will be ready on time.
I've just understood what happened.
I think it's a wrong git manipulation: the fixes were squashed in the last commit, so the patch 6/7 was still having issues.
Signature · 1 line
Thomas
2014-11-24 16:33, Declan Doherty:
Quoted 45 lines
v8:
- Missing typo fix
- Missing whitespacev7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this was already committed in commitaca4360340f169dcc11b1a9be955b44de8b9f6ebv6:
- Re-based to dpdk.org addressing associated issues forMBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.v5:
- Fix uninitialized variable inbroadcast_tx_burstfunction which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch setsv4:
- Re-based to account for changes in master.
- Fix forrte_eth_bond_slaves_get()introduced in v3 patch set
- Addressed issue around disabling/enabling link status polling around adding/ removing slaves devices.v3 :
- Typo fix for the bond free mbufs patch.
- Re-based to account for changes in the mbuf patches.
- Add support for slave devices which don't support link status interrupts
- Tidy up the link bonding unit test so that all tests use the new test macros.v2 :
Addresses issues with the logic around the handling of fail transmissions. In this version all modes behave in a manner similar to a standard PMD, returning the number of successfully transmitted mbufs and with the failing mbufs at the end of bufs array for freeing / retransmission by the application softwarev1:
This patch set adds support for link status interrupt in the link bonding pmd. It also contains some patches to tidy up the code structure and to of the link bonding code and to fix bugs relating to transmission failures in the under lying slave pmd which could lead to leaked mbufs.
Quoted 9 lines
Declan Doherty (7):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency intx_burst_round_robin
bond: free mbufs if transmission fails in bondingtx_burstfunctions
testpmd: adding parameter to reconfig method to setsocket_idwhen
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor
Applied with some minor fixes.
Thanks
Signature · 1 line
Thomas
Quoted 67 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, November 24, 2014 9:54 PM
To: Doherty, Declan
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v8 0/7] link bonding2014-11-24 16:33, Declan Doherty:
Quoted 7 lines
v8:
- Missing typo fix
- Missing whitespacev7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" asthis
Quoted 1 line
was already committed in commit
aca4360340f169dcc11b1a9be955b44de8b9f6ebQuoted 4 lines
v6:
- Re-based to dpdk.org addressing associated issues forMBUF_REFCNT
- Added details to testpmd user guide for new command to set link statuspolling interval.
Quoted 10 lines
v5:
- Fix uninitialized variable inbroadcast_tx_burstfunction which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch setsv4:
- Re-based to account for changes in master.
- Fix forrte_eth_bond_slaves_get()introduced in v3 patch set
- Addressed issue around disabling/enabling link status polling aroundadding/
Quoted 23 lines
removing slaves devices.
v3 :
- Typo fix for the bond free mbufs patch.
- Re-based to account for changes in the mbuf patches.
- Add support for slave devices which don't support link status interrupts
- Tidy up the link bonding unit test so that all tests use the new test macros.v2 :
Addresses issues with the logic around the handling of fail transmissions. In this version all modes behave in a manner similar to a standard PMD, returning the number of successfully transmitted mbufs and with the failing mbufs at the end of bufs array for freeing / retransmission by the application softwarev1:
This patch set adds support for link status interrupt in the link bonding pmd. It also contains some patches to tidy up the code structure and to of the link bonding code and to fix bugs relating to transmission failures in the under lying slave pmd which could lead to leaked mbufs.
Quoted 9 lines
Declan Doherty (7):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency intx_burst_round_robin
bond: free mbufs if transmission fails in bondingtx_burstfunctions
testpmd: adding parameter to reconfig method to setsocket_idwhen
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor
Quoted 5 lines
Applied with some minor fixes.
Thanks
--
Thomas
Hi Thomas,
I noticed some problems with applying link bonding mode 4 patches after you applied Declan's patches. Link bonding mode 4 0001-bond-add-mode-4-support.patch won't apply because of this error:
Checking patch lib/librte_pmd_bond/rte_eth_bond_private.h...
error: while searching for:
#define RTE_BOND_LOG(lvl, msg, ...) \
RTE_LOG(lvl, PMD, "%s(%d) - " msg "\n", __func__, __LINE__, ##__VA_ARGS__);extern const char *pmd_bond_init_valid_arguments[];
extern const char *driver_name;
error: patch failed: lib/librte_pmd_bond/rte_eth_bond_private.h:60
error: lib/librte_pmd_bond/rte_eth_bond_private.h: patch does not apply
This happens because originally in Declan's [PATCH v8 6/7] bond: lsc polling support there is a semicolon at the end of RTE_LOG... line , and my patch is looking for this semicolon also.
So do you want me to send a v6 patch fixing this issue?
The second issue is that Link bonding mode 4 0002-testpmd-add-mode-4-support.patch won't apply also, because of this error;
error: while searching for:
/* Update number of ports */
nb_ports = rte_eth_dev_count();
reconfig(port_id, res->socket);
rte_eth_promiscuous_enable(port_id);
}error: patch failed: app/test-pmd/cmdline.c:3646
error: app/test-pmd/cmdline.c: patch does not apply
This is probably because you didn't apply Declan's patch:
[PATCH v8 5/7] testpmd: adding parameter to reconfig
This is a part of this patch:
app/test-pmd/cmdline.c +1 -1
@@ -3642,7 +3642,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,/* Update number of ports */ nb_ports =rte_eth_dev_count (); -reconfig (port_id); +reconfig (port_id, res->socket);rte_eth_promiscuous_enable (port_id); }
A message that is not in the archive (sent off-list or not yet received): 60ABE07DBB3A454EB7FAD707B4BB1582138BC9F8-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org
2014-11-25 10:56, Jastrzebski, MichalX K:
Quoted 9 lines
I noticed some problems with applying link bonding mode 4 patches after you applied Declan's patches. Link bonding mode 4 0001-bond-add-mode-4-support.patch won't apply because of this error:
Checking patchlib/librte_pmd_bond/rte_eth_bond_private.h...
error: while searching for:#define RTE_BOND_LOG(lvl, msg, ...) \ RTE_LOG(lvl, PMD, "%s(%d) - " msg "\n", __func__, __LINE__, ##__VA_ARGS__);extern const char *pmd_bond_init_valid_arguments[];
Quoted 8 lines
extern const char
*driver_name;error: patch failed:
lib/librte_pmd_bond/rte_eth_bond_private.h:60
error:lib/librte_pmd_bond/rte_eth_bond_private.h: patch does not applyThis happens because originally in Declan's [PATCH v8 6/7] bond: lsc polling support there is a semicolon at the end of
RTE_LOG... line , and my patch is looking for this semicolon also.
So do you want me to send a v6 patch fixing this issue?
I can fix this type of conflict by myself but I want you send a v6 because v5 had no commit log.
I want also a review from Declan. If it's already done, please add the acked-by in your patch.
Quoted 10 lines
The second issue is that Link bonding mode 4 0002-testpmd-add-mode-4-support.patch won't apply also, because of this error;
error: while searching for:/* Update number of ports */ nb_ports = rte_eth_dev_count(); reconfig(port_id, res->socket); rte_eth_promiscuous_enable(port_id); }
Quoted 5 lines
error: patch failed:
app/test-pmd/cmdline.c:3646
error:app/test-pmd/cmdline.c: patch does not applyThis is probably because you didn't apply Declan's patch:
[PATCH v8 5/7] testpmd: adding parameter to reconfig
Oh yes ! It's totally my fault. The patch has mysteriously disappeared. It's fixed now.
Thanks for reporting
Signature · 1 line
Thomas