Skip to contentSkip to conversation

link bonding

PATCH Superseded Declan Doherty 9 participants 91 messages Aug 19, 2014 – Nov 25, 2014 20 messages not in the archive Page 2 of 3

lore
Share & tools
lore
#59 lore raw

PATCH v5 4/8 bond: free mbufs if transmission fails in bonding tx_burst functions

In reply to a message not in the archive
---
 app/test/test_link_bonding.c           | 393 ++++++++++++++++++++++++++++++++-
 app/test/virtual_pmd.c                 |  79 +++++--
 app/test/virtual_pmd.h                 |   7 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |  83 +++++--
 4 files changed, 524 insertions(+), 38 deletions(-)
app/test/test_link_bonding.c +391 -2
index cce32ed..1a847eb 100644
@@ -663,6 +663,9 @@ enable_bonded_slaves(void)
 	int i;
 
 	for (i = 0; i < test_params->bonded_slave_count; i++) {
+		virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i],
+				1);
+
 		virtual_ethdev_simulate_link_status_interrupt(
 				test_params->slave_port_ids[i], 1);
 	}
@@ -1413,6 +1416,135 @@ test_roundrobin_tx_burst(void)
 }
 
 static int
+verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val)
+{
+	int i, refcnt;
+
+	for (i = 0; i < nb_mbufs; i++) {
+		refcnt = rte_mbuf_refcnt_read(mbufs[i]);
+		TEST_ASSERT_EQUAL(refcnt, val,
+			"mbuf ref count (%d)is not the expected value (%d)",
+			refcnt, val);
+	}
+	return 0;
+}
+
+
+static void
+free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs)
+{
+	int i;
+
+	for (i = 0; i < nb_mbufs; i++)
+		rte_pktmbuf_free(mbufs[i]);
+}
+
+#define TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT		(2)
+#define TEST_RR_SLAVE_TX_FAIL_BURST_SIZE		(64)
+#define TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT		(22)
+#define TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX	(1)
+
+static int
+test_roundrobin_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkt_burst[MAX_PKT_BURST];
+	struct rte_mbuf *expected_tx_fail_pkts[MAX_PKT_BURST];
+
+	struct rte_eth_stats port_stats;
+
+	int i, first_fail_idx, tx_count;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_ROUND_ROBIN, 0,
+			TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
+			"Failed to intialise bonded device");
+
+	/* Generate test bursts of packets to transmit */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkt_burst,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE, 0, 1, 0, 0, 0),
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE,
+			"Failed to generate test packet burst");
+
+	/* Copy references to packets which we expect not to be transmitted */
+	first_fail_idx = (TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			(TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT *
+			TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)) +
+			TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX;
+
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		expected_tx_fail_pkts[i] = pkt_burst[first_fail_idx +
+				(i * TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)];
+	}
+
+	/* Set virtual slave to only fail transmission of
+	 * TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT packets in burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkt_burst,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE);
+
+	TEST_ASSERT_EQUAL(tx_count, TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Transmitted (%d) an unexpected (%d) number of packets", tx_count,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_tx_fail_pkts[i], pkt_burst[i + tx_count],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_tx_fail_pkts[i], pkt_burst[i + tx_count]);
+	}
+
+	/* Verify bonded port tx stats */
+	rte_eth_stats_get(test_params->bonded_port_id, &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Bonded Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify slave ports tx stats */
+	for (i = 0; i < test_params->bonded_slave_count; i++) {
+		int slave_expected_tx_count;
+
+		rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats);
+
+		slave_expected_tx_count = TEST_RR_SLAVE_TX_FAIL_BURST_SIZE /
+				test_params->bonded_slave_count;
+
+		if (i == TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX)
+			slave_expected_tx_count = slave_expected_tx_count -
+					TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT;
+
+		TEST_ASSERT_EQUAL(port_stats.opackets,
+				(uint64_t)slave_expected_tx_count,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[i],
+				(unsigned int)port_stats.opackets, slave_expected_tx_count);
+	}
+
+	/* Verify that all mbufs have a ref value of zero */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkt_burst[tx_count],
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
+static int
 test_roundrobin_rx_burst_on_single_slave(void)
 {
 	struct rte_mbuf *gen_pkt_burst[MAX_PKT_BURST] = { NULL };
@@ -2900,6 +3032,141 @@ test_balance_l34_tx_burst_ipv6_toggle_udp_port(void)
 	return balance_l34_tx_burst(0, 0, 0, 0, 1);
 }
 
+#define TEST_BAL_SLAVE_TX_FAIL_SLAVE_COUNT			(2)
+#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1			(40)
+#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2			(20)
+#define TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT		(25)
+#define TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX	(0)
+
+static int
+test_balance_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkts_burst_1[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1];
+	struct rte_mbuf *pkts_burst_2[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2];
+
+	struct rte_mbuf *expected_fail_pkts[TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT];
+
+	struct rte_eth_stats port_stats;
+
+	int i, first_tx_fail_idx, tx_count_1, tx_count_2;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_BALANCE, 0,
+			TEST_BAL_SLAVE_TX_FAIL_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.");
+
+
+	/* Generate test bursts for transmission */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_1,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1, 0, 0, 0, 0, 0),
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1,
+			"Failed to generate test packet burst 1");
+
+	first_tx_fail_idx = TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT;
+
+	/* copy mbuf referneces for expected transmission failures */
+	for (i = 0; i < TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		expected_fail_pkts[i] = pkts_burst_1[i + first_tx_fail_idx];
+	}
+
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_2,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, 0, 0, 1, 0, 0),
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+			"Failed to generate test packet burst 2");
+
+
+	/* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail
+	 * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+
+	/* Transmit burst 1 */
+	tx_count_1 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_1,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1);
+
+	TEST_ASSERT_EQUAL(tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst_1[i + tx_count_1],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_fail_pkts[i], pkts_burst_1[i + tx_count_1]);
+	}
+
+	/* Transmit burst 2 */
+	tx_count_2 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_2,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	TEST_ASSERT_EQUAL(tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+
+	/* Verify bonded port tx stats */
+	rte_eth_stats_get(test_params->bonded_port_id, &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)((TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) +
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2),
+			"Bonded Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			(TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) +
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	/* Verify slave ports tx stats */
+
+	rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+				TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[0],
+				(unsigned int)port_stats.opackets,
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+				TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+
+
+
+	rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+				(uint64_t)TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[1],
+				(unsigned int)port_stats.opackets,
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	/* Verify that all mbufs have a ref value of zero */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst_1[tx_count_1],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkts_burst_1[tx_count_1],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
 #define TEST_BALANCE_RX_BURST_SLAVE_COUNT (3)
 
 static int
@@ -3412,7 +3679,7 @@ test_broadcast_tx_burst(void)
 	/* 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 * test_params->bonded_slave_count) {
+	if (nb_tx != burst_size) {
 		printf("Bonded Port (%d) rx burst failed, packets transmitted value (%u) not as expected (%d)\n",
 				test_params->bonded_port_id,
 				nb_tx, burst_size);
@@ -3455,6 +3722,125 @@ test_broadcast_tx_burst(void)
 	return remove_slaves_and_stop_bonded_device();
 }
 
+
+#define TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT		(3)
+#define TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE			(40)
+#define TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT	(15)
+#define TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT	(10)
+
+static int
+test_broadcast_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE];
+	struct rte_mbuf *expected_fail_pkts[TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT];
+
+	struct rte_eth_stats port_stats;
+
+	int i, tx_count;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_BROADCAST, 0,
+			TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
+			"Failed to intialise bonded device");
+
+	/* Generate test bursts for transmission */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE, 0, 0, 0, 0, 0),
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE,
+			"Failed to generate test packet burst");
+
+	for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) {
+		expected_fail_pkts[i] = pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT + i];
+	}
+
+	/* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail
+	 * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[0],
+			0);
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[1],
+			0);
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[2],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[0],
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[1],
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[2],
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+	/* Transmit burst */
+	tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE);
+
+	TEST_ASSERT_EQUAL(tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst[i + tx_count],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_fail_pkts[i], pkts_burst[i + tx_count]);
+	}
+
+	/* Verify slave ports tx stats */
+
+	rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+
+	rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+
+	/* Verify that all mbufs who transmission failed have a ref value of one */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst[tx_count],
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkts_burst[tx_count],
+		TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
 #define BROADCAST_RX_BURST_NUM_OF_SLAVES (3)
 
 static int
@@ -3767,7 +4153,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
 	}
 
 	if (rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt_burst[0][0],
-			burst_size) != (burst_size * slave_count)) {
+			burst_size) != burst_size) {
 		printf("rte_eth_tx_burst failed\n");
 		return -1;
 	}
@@ -3915,6 +4301,7 @@ static struct unit_test_suite link_bonding_test_suite  = {
 		TEST_CASE(test_status_interrupt),
 		TEST_CASE(test_adding_slave_after_bonded_device_started),
 		TEST_CASE(test_roundrobin_tx_burst),
+		TEST_CASE(test_roundrobin_tx_burst_slave_tx_fail),
 		TEST_CASE(test_roundrobin_rx_burst_on_single_slave),
 		TEST_CASE(test_roundrobin_rx_burst_on_multiple_slaves),
 		TEST_CASE(test_roundrobin_verify_promiscuous_enable_disable),
@@ -3938,11 +4325,13 @@ static struct unit_test_suite link_bonding_test_suite  = {
 		TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_ip_addr),
 		TEST_CASE(test_balance_l34_tx_burst_vlan_ipv6_toggle_ip_addr),
 		TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_udp_port),
+		TEST_CASE(test_balance_tx_burst_slave_tx_fail),
 		TEST_CASE(test_balance_rx_burst),
 		TEST_CASE(test_balance_verify_promiscuous_enable_disable),
 		TEST_CASE(test_balance_verify_mac_assignment),
 		TEST_CASE(test_balance_verify_slave_link_status_change_behaviour),
 		TEST_CASE(test_broadcast_tx_burst),
+		TEST_CASE(test_broadcast_tx_burst_slave_tx_fail),
 		TEST_CASE(test_broadcast_rx_burst),
 		TEST_CASE(test_broadcast_verify_promiscuous_enable_disable),
 		TEST_CASE(test_broadcast_verify_mac_assignment),
app/test/virtual_pmd.c +61 -18

126 lines not on this page · raw message

app/test/virtual_pmd.h +7 -0
index 766b6ac..3b5c911 100644
@@ -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.12.2
#60 lore raw

PATCH v5 5/8 test app: adding support for generating variable sized packet

In reply to a message not in the archive
---
 app/test/packet_burst_generator.c | 25 ++++++++-----------------
 app/test/packet_burst_generator.h |  6 +++++-
 app/test/test_link_bonding.c      | 14 +++++++++-----
 3 files changed, 22 insertions(+), 23 deletions(-)
app/test/packet_burst_generator.c +8 -17
index 9e747a4..b2824dc 100644
@@ -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,20 +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. */
 
-#define TXONLY_DEF_PACKET_LEN 64
-#define TXONLY_DEF_PACKET_LEN_128 128
-
-uint16_t tx_pkt_length = TXONLY_DEF_PACKET_LEN;
-uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = {
-		TXONLY_DEF_PACKET_LEN_128,
-};
-
-uint8_t  tx_pkt_nb_segs = 1;
 
 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 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;
@@ -221,9 +212,9 @@ nomore_mbuf:
 			break;
 		}
 
-		pkt->data_len = tx_pkt_seg_lengths[0];
+		pkt->data_len = pkt_len;
 		pkt_seg = pkt;
-		for (i = 1; i < tx_pkt_nb_segs; i++) {
+		for (i = 1; i < nb_pkt_segs; i++) {
 			pkt_seg->next = rte_pktmbuf_alloc(mp);
 			if (pkt_seg->next == NULL) {
 				pkt->nb_segs = i;
@@ -231,7 +222,7 @@ nomore_mbuf:
 				goto nomore_mbuf;
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = tx_pkt_seg_lengths[i];
+			pkt_seg->data_len = pkt_len;
 		}
 		pkt_seg->next = NULL; /* Last segment of packet. */
 
@@ -259,8 +250,8 @@ nomore_mbuf:
 		 * Complete first mbuf of packet and append it to the
 		 * burst of packets to be transmitted.
 		 */
-		pkt->nb_segs = tx_pkt_nb_segs;
-		pkt->pkt_len = tx_pkt_length;
+		pkt->nb_segs = nb_pkt_segs;
+		pkt->pkt_len = pkt_len;
 		pkt->l2_len = eth_hdr_size;
 
 		if (ipv4) {
app/test/packet_burst_generator.h +5 -1
index 5b3cd6c..f86589e 100644
@@ -47,6 +47,9 @@ 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
+
 
 void
 initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
@@ -68,7 +71,8 @@ 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 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 +9 -5
index 1a847eb..50355a3 100644
@@ -1338,7 +1338,8 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,
 	/* Generate burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, vlan, ip_hdr, ipv4,
-			test_params->pkt_udp_hdr, burst_size);
+			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;
@@ -2056,7 +2057,7 @@ test_activebackup_tx_burst(void)
 	/* Generate a burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-			1, test_params->pkt_udp_hdr, burst_size);
+			1, test_params->pkt_udp_hdr, burst_size, PACKET_BURST_GEN_PKT_LEN, 1);
 	if (generated_burst_size != burst_size)
 		return -1;
 
@@ -2709,7 +2710,8 @@ test_balance_l2_tx_burst(void)
 	/* Generate a burst 1 of packets to transmit */
 	if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[0][0],
 			test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-			test_params->pkt_udp_hdr, burst_size[0]) != burst_size[0])
+			test_params->pkt_udp_hdr, burst_size[0],
+			PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[0])
 		return -1;
 
 	initialize_eth_header(test_params->pkt_eth_hdr,
@@ -2718,7 +2720,8 @@ test_balance_l2_tx_burst(void)
 	/* Generate a burst 2 of packets to transmit */
 	if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0],
 			test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-			test_params->pkt_udp_hdr, burst_size[1]) != burst_size[1])
+			test_params->pkt_udp_hdr, burst_size[1],
+			PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[1])
 		return -1;
 
 	/* Send burst 1 on bonded port */
@@ -3672,7 +3675,8 @@ test_broadcast_tx_burst(void)
 	/* Generate a burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-			1, test_params->pkt_udp_hdr, burst_size);
+			1, test_params->pkt_udp_hdr, burst_size, PACKET_BURST_GEN_PKT_LEN,
+			1);
 	if (generated_burst_size != burst_size)
 		return -1;
 
Signature · 1 line
1.7.12.2
#61 lore raw

PATCH v5 6/8 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
index 0b972f9..e9cf53e 100644
@@ -3618,7 +3618,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
index f76406f..5740804 100644
@@ -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
index 9cbfeac..5a3423c 100644
@@ -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.12.2
#62 lore raw

PATCH v5 7/8 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               | 258 ++++++++++++-------
 app/test/virtual_pmd.c                     |  17 +-
 app/test/virtual_pmd.h                     |  48 +++-
 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    |  30 ++-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c     | 393 +++++++++++++++++++++--------
 lib/librte_pmd_bond/rte_eth_bond_private.h |  71 ++++--
 10 files changed, 934 insertions(+), 348 deletions(-)
app/test-pmd/cmdline.c +63 -0
index e9cf53e..490893d 100644
@@ -439,6 +439,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()
@@ -3709,6 +3712,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 *** */
@@ -7457,6 +7519,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
index 98ab804..24b1640 100644
@@ -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 +162 -96

400 lines not on this page · raw message

app/test/virtual_pmd.c +15 -2
index 72f527e..e105c84 100644
@@ -457,6 +457,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)
 {
@@ -504,7 +512,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;
@@ -554,7 +562,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

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 +26 -4
index 11d9816..bbbc69b 100644
@@ -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;
 	}
@@ -172,6 +173,7 @@ bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused,
 	case BONDING_MODE_BROADCAST:
 		return 0;
 	default:
+		RTE_BOND_LOG(ERR, "Invalid slave mode value (%s) specified", value);
 		return -1;
 	}
 }
@@ -191,7 +193,7 @@ bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused,
 	if (*endptr != 0 || errno != 0)
 		return -1;
 
-	/* validate mode value */
+	/* validate socket id value */
 	if (socket_id >= 0 && socket_id < number_of_sockets()) {
 		*(uint8_t *)extra_args = (uint8_t)socket_id;
 		return 0;
@@ -250,3 +252,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.12.2
#63 lore raw

PATCH v5 8/8 bond: unit test test macro refactor

In reply to a message not in the archive
---
 app/test/test_link_bonding.c | 2574 +++++++++++++++++-------------------------
 1 file changed, 1036 insertions(+), 1538 deletions(-)
app/test/test_link_bonding.c +1036 -1538
index c32b685..c4fcaf7 100644
@@ -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,
@@ -781,56 +713,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();
@@ -844,36 +759,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
@@ -881,32 +784,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] =
@@ -914,56 +812,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;
 }
@@ -971,7 +857,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;
 
@@ -980,87 +866,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;
 }
 
@@ -1176,9 +1037,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_interupt_count = 0;
 
@@ -1310,10 +1172,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;
 }
@@ -1323,51 +1183,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 */
@@ -1377,10 +1229,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();
@@ -1523,17 +1374,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 */
@@ -1542,21 +1393,17 @@ 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 */
@@ -1565,19 +1412,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 */
@@ -1614,17 +1457,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 */
@@ -1635,57 +1477,44 @@ test_roundrobin_rx_burst_on_multiple_slaves(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,
+	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++) {
@@ -1702,91 +1531,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 */
@@ -1799,44 +1614,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 */
@@ -1863,26 +1672,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(
@@ -1890,13 +1695,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;
 
@@ -1907,19 +1711,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,
@@ -1957,27 +1758,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++) {
@@ -1999,7 +1797,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 } ;
 
@@ -2033,7 +1830,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 */
@@ -2095,15 +1893,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);
@@ -2114,32 +1910,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);
 
@@ -2147,35 +1936,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();
@@ -2193,78 +1975,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);
 			}
 		}
 
@@ -2290,61 +2057,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 */
@@ -2360,117 +2114,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 addres");
 
 	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();
@@ -2492,38 +2231,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(
@@ -2531,12 +2264,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);
@@ -2549,103 +2280,81 @@ 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 */
 
@@ -2658,7 +2367,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();
 }
@@ -2668,70 +2376,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();
@@ -2746,24 +2433,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);
@@ -2773,54 +2452,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++) {
@@ -2830,9 +2505,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();
@@ -2842,81 +2517,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++) {
@@ -2926,10 +2585,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();
@@ -2970,82 +2629,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++) {
@@ -3055,10 +2698,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();
@@ -3246,21 +2888,22 @@ 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],
@@ -3269,56 +2912,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++) {
@@ -3337,48 +2968,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 */
@@ -3394,115 +3014,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();
@@ -3524,32 +3131,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(
@@ -3557,106 +3159,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",
-				slave_count, 2);
-		return -1;
-	}
[… more lines in the raw message]

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.12.2

Part of the diff is not shown here. View the raw message.

#64 lore raw
In reply to a message not in the archive
Quoted 15 lines

-----Original Message-----
From: Doherty, Declan
Sent: Tuesday, October 14, 2014 2:00 PM
To: [email protected]
Cc: Jiajia, SunX; De Lara Guarch, Pablo; [email protected]; Doherty, Declan
Subject: [PATCH v5 0/8] link bonding

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

[..]

Quoted 30 lines

failures in the under lying slave pmd which could lead to leaked mbufs.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                     |   65 +-
 app/test-pmd/testpmd.c                     |    3 +-
 app/test-pmd/testpmd.h                     |    2 +-
 app/test/packet_burst_generator.c          |   25 +-
 app/test/packet_burst_generator.h          |    6 +-
 app/test/test.h                            |    7 +-
 app/test/test_link_bonding.c               | 3342 ++++++++++++++--------------
 app/test/virtual_pmd.c                     |   96 +-
 app/test/virtual_pmd.h                     |   53 +-
 lib/librte_pmd_bond/rte_eth_bond.h         |   80 +
 lib/librte_pmd_bond/rte_eth_bond_api.c     |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c    |   30 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c     |  550 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h |   71 +-
 14 files changed, 2691 insertions(+), 1958 deletions(-)
Quoted 2 lines

--
1.7.12.2

Tested-by
#65 lore raw
In reply to a message not in the archive

- Tested Commit: f7aaae2fe6f7f9a78eab7313d77e92b934693b5d
- OS: Fedora20 3.11.10-301.fc20.x86_64 and 3.16.6-200.fc20.x86_64
- GCC: gcc version 4.8.2
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection [8086:10fb]
- Default x86_64-native-linuxapp-gcc configuration
- Total 18 cases, 18 passed, 0 failed

TOPO:
* Connections ports between tester/ixia and DUT
- TESTER(Or IXIA)-------DUT
- portA------------------port0
- portB------------------port1
- portC------------------port2
- portD------------------port3
* Connections ports between tester/ixia and switch and DUT
- TESTER(Or IXIA)-------SWITCH
- SWITCH---------DUT
- TESTER(Or IXIA)----------------------DUT
- portA------------------switch

  -                        switch----------port0
  -                        switch----------port1
  -                        switch----------port2

- portB----------------------------------port3

Test Setup#1 for Functional test
================================

Tester has 4 ports(portA--portD), and DUT has 4 ports(port0--port3), then connect portA to port0, portB to port1, portC to port2, portD to port3.

Test Setup#2 for Functional test
================================

Tester has 2 ports(portA--portB), DUT has 4 ports(port0--port3), and a switch that supports IEEE 802.3ad Dynamic link aggregation, then connect port0-port2 to the switch for dynamic link aggregation, connect portA to aggregated interface on the switch, connect portB to port3.

- Case: Basic bonding--Create bonded devices and slaves
Description:
Use Setup#1.
Create bonded device and add some ports as salve of bonded device,
Then removed slaves or added slaves or change the bonding primary slave Or change bonding mode and so on.
Expected test result:
Verify the basic functions are normal.

- Case: Basic bonding--MAC Address Test
Description:
Use Setup#1.
Create bonded device and add some ports as slaves of bonded device,
Check that the changes of the bonded device and slave MAC
Expected test result:
Verify the behavior of bonded device and slave according to the mode.

- Case: Basic bonding--Device Promiscuous Mode Test
Description:
Use Setup#1.
Create bonded device and add some ports as slaves of bonded device,
Set promiscuous mode on or off, then send packets to the bonded device Or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves according to the mode.

- Case: Mode 0(Round Robin) TX/RX test
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring one slave link down
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, Bring the link on either port 0, 1 or 2 down. And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring all slave links down
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, Bring the links down on all bonded ports. And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 1(Active Backup) TX/RX Test
Description:
Use Setup#1.
Create bonded device with mode 1 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Change active slave, RX/TX test
Description:
Use Setup#1.
Continuing from previous test case.Change the active slave port from port0
to port1.Verify that the bonded device's MAC has changed to slave1's MAC.

testpmd> set bonding primary 1 4

Repeat the transmission and reception(TX/RX) test verify that data is now transmitted and received through the new active slave and no longer through port0
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Link up/down active eth dev Description:
Use Setup#1.

Bring link between port A and port0 down. If tester is ixia, can use IxExplorer to set the "Simulate Cable Disconnect" at the port property. Verify that the active slave has been changed from port0. Repeat the transmission and reception test verify that data is now transmitted and received through the new active slave and no longer through port0

Bring port0 to link down at the remote end.Verify the active slave has been changed from port0. send 100 packets to port3.

testpmd> show port stats 4----(Verify port3 have 100 rx packets,meanwhile
port4 have 100 tx packets,the current primary port have 100 tx packets,and port0 doesn`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Bring all slave links down
Description:
Use Setup#1.
Bring all slave ports of bonded port down.
Verify that bonded callback for link down is called and no active slaves. Verify that data cannot be sent or received through bonded port. Send 100 packets to port3 and verify that bonded port can't TX 100 packets.

Bring port 0-2 to link down at the remote end. Verify port4 has been link down and has no active slave. Send 100 rx packets to port3.

testpmd> show port stats 4----(Verify port3 have 100 rx packets,meanwhile
port4 doesn`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 2(Balance XOR) TX Load Balance test
Description:
Use Setup#1.
Bonded port will activate each slave eth dev based on the following hash function:

((dst_mac XOR src_mac) % (number of slave ports))

Send 300 packets from IXIA port D to non-bonded port(port3),and verify these packets will be forwarded to bonded device. The bonded device will transimit these packets to all slaves. Verify that each slave receive correct number of packets according to the policy. The total number of packets which received by slave should be equal as 300 packets.

Create 3 streams in the IXIA,which streams source MAC are 00:00:03:00:0F:00, 00:00:03:00:0F:01,00:00:03:00:0F:02 respectively (make sure generate different value by the policy ((dst_mac XOR src_mac) % (number of slave ports)) ) and dest MAC all is 90:E2:BA:4A:54:80(this value should been your unbonded port address). Respectively send 100 packets to port3 by the 3 streams.

testpmd> show port stats all----(Verify port3 have 300 rx packets, port4 have 300 tx packets,and port 0-2 have 100 tx packets respectively)

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) TX Load Balance Link down
Description:
Use Setup#1.
ring link down of one slave.
Send 300 packets from non-bonded port(port3), and verify these
packets will be forwarded to bonded device.
Verify that each active slave receive correct number of packets (according to the mode policy), and the down slave will not receive packets.
Link down slave 0 at the remote end.Create 3 streams in the IXIA like case13. Then respectively send 100 packets to port3 by the 3 streams.

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) Bring all slave links down Description:
Use Setup#1.
Bring all slave links down.
Verify that bonded callback for link down is called. Verify no packet can be sent.

Bring all slaves to link down at the remote end.Create 3 streams in the IXIA like case13.Then respectively send 100 packets to port3 by the 3 streams.

testpmd> show port info 4----(Verify bonding port has been linked down)
testpmd> show port stats all----(Verify port3 have 300 rx packets,meanwhile
port 0,1,2 and 4 don`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) Layer 3+4 forwarding
Description:
Use Setup#1.
Use "xmit_hash_policy()" to change to this forwarding mode
Create a stream of traffic which will exercise all slave ports using the transmit policy

((SRC_PORT XOR DST_PORT) XOR ((SRC_IP XOR DST_IP) AND 0xffff) % # of Slaves

Transmit data through bonded device, verify TX packet count for each slave port is as expected

Create 3 streams on a port which is mapped with unbonded port 3 at the IXIA end.
And set different IP by the transmit policy.Then send 100 packets on each stream.

testpmd> show port stats all----(Verify port3 have 300 rx packets,
meanwhile port4 have 300 rx packets, port 0-2 have 100 tx packets respectively)

Add Vlan tag in the previouse 3 streams. Everthing else remains the same. Then send 100 packets on each stream. Verify the packet statics is the same as above.

testpmd> show port stats all----(Verify port3
have 300 rx packets,meanwhile port4 have 300 rx packets,port 0-2 have 100 tx packets respecitvely)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) RX test
Description:
Use Setup#1.
Send 100 packets to each bonded slaves(port0,1,2)
Verify that each slave receives 100 packets and the bonded device receive a total 300 packets. Verify that the bonded device forwards 300 packets to the non-bonded port(port4).

Send 100 packets to port0,1,2 respectively.

testpmd> show port stats all----(Verify port0,1,2 have 100 tx packets respectively
and port4 have 300 rx packets,and port3 have 300 tx packets)

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 3(Broadcast) TX/RX Test
Description:
Use Setup#1.
Add ports 0-2 as slave devices to the bonded port 4. Make all slaves
to be active slaves on bonded device.

RX: Send a packet stream(100 packets) from port A on the traffic
generator to be forwarded through the bonded port4 to port3.
Verify the sum of the packets transmitted from the traffic generator portA is equal the total received packets on port0, port4 and portD(Traffic generator).

testpmd> show port stats all---(Verify port0 receive 100 packets,
and port4 receive 100 packets, and port3 transmit 100 packets)

TX: Send a packet stream(100 packets) from portD on the traffic generator
to be forwarded through port3 to the bonded port4. Verify the sum of the packets(100packets) transmitted from the traffic generator port is equal the total received packets on port4, portA and transmitted to port0.

testpmd> show port stats all---(Verify port3 RX 100 packets,
and port0,1,2 TX 100 packets,port4 has 300 TX packets)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

- Case: Mode 3(Broadcast) Bring one slave link down
Description:
Use Setup#1.
Bring one slave port link down. Send 100 packets through portD to port3,
then port3 forwards to bondede device(port4), verify that the bonded device
and other slaves TX the correct number of packets(100 packets for each port).
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

- Case: Mode 3(Broadcast) Bring all slave links down
Description:
Use Setup#1.
Bring all slave ports of bonded port down
Verify that bonded callback for link down is called Verify that data cannot be sent or received through bonded port.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

Quoted 78 lines

-----Original Message-----
From: Doherty, Declan
Sent: Tuesday, October 14, 2014 9:00 PM
To: [email protected]
Cc: Jiajia, SunX; De Lara Guarch, Pablo; [email protected]; Doherty, Declan
Subject: [PATCH v5 0/8] link bonding

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a
build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_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.
- Rebased 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 software

v1:

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.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                     |   65 +-
 app/test-pmd/testpmd.c                     |    3 +-
 app/test-pmd/testpmd.h                     |    2 +-
 app/test/packet_burst_generator.c          |   25 +-
 app/test/packet_burst_generator.h          |    6 +-
 app/test/test.h                            |    7 +-
 app/test/test_link_bonding.c               | 3342 ++++++++++++++------
--------
 app/test/virtual_pmd.c                     |   96 +-
 app/test/virtual_pmd.h                     |   53 +-
 lib/librte_pmd_bond/rte_eth_bond.h         |   80 +
 lib/librte_pmd_bond/rte_eth_bond_api.c     |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c    |   30 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c     |  550 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h |   71 +-
 14 files changed, 2691 insertions(+), 1958 deletions(-)

--
1.7.12.2

#66 lore raw

v6 cover link bonding

In reply to a message not in the archive

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_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.
- Rebased 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 software

v1:

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.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   25 +-
 app/test/packet_burst_generator.h           |    6 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3347 ++++++++++++++-------------
 app/test/virtual_pmd.c                      |   96 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2715 insertions(+), 1959 deletions(-)
Signature · 1 line
1.7.12.2

A message that is not in the archive (sent off-list or not yet received): 1415362978-6306-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#68 lore raw

PATCH v6 1/8 bond: link status interrupt support

Adding 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
index 214d2a2..e1c5596 100644
@@ -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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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,
@@ -1212,7 +1356,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;
 
@@ -1282,7 +1426,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;
 
@@ -1372,7 +1516,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;
 
@@ -1464,7 +1608,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;
 
@@ -1555,7 +1699,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;
 
@@ -1619,7 +1763,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;
 
@@ -1760,7 +1904,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;
@@ -1857,7 +2001,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;
@@ -1951,7 +2095,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;
 
@@ -2021,7 +2165,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;
 
@@ -2160,7 +2304,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;
@@ -2331,7 +2475,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");
@@ -2411,7 +2555,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");
@@ -2509,7 +2653,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;
@@ -2637,7 +2781,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;
@@ -2775,7 +2919,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;
 
@@ -2864,7 +3008,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);
@@ -2918,7 +3062,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
@@ -3048,7 +3192,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;
 
@@ -3241,7 +3385,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;
@@ -3331,7 +3475,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;
 
 
@@ -3423,7 +3567,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);
@@ -3479,7 +3623,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
@@ -3579,7 +3723,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;
 
@@ -3716,7 +3860,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;
 	}
@@ -3725,7 +3869,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;
 	}
@@ -3773,6 +3917,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
index 75f5694..dd33119 100644
@@ -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
index 147028b..de0cd56 100644
@@ -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.12.2
#69 lore raw

PATCH v6 2/8 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 file changed, 36 insertions(+), 29 deletions(-)
lib/librte_pmd_bond/rte_eth_bond_pmd.c +36 -29
index de0cd56..f2fe930 100644
@@ -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.12.2
#70 lore raw

PATCH v6 3/8 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 file changed, 5 insertions(+), 5 deletions(-)
lib/librte_pmd_bond/rte_eth_bond_pmd.c +5 -5
index f2fe930..6e770af 100644
@@ -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.12.2
#71 lore raw

PATCH v6 4/8 bond: free mbufs if transmission fails in bonding tx_burst functions

In reply to a message not in the archive
---
 app/test/test_link_bonding.c           | 393 ++++++++++++++++++++++++++++++++-
 app/test/virtual_pmd.c                 |  79 +++++--
 app/test/virtual_pmd.h                 |   7 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |  83 +++++--
 4 files changed, 524 insertions(+), 38 deletions(-)
app/test/test_link_bonding.c +391 -2
index e1c5596..af19066 100644
@@ -663,6 +663,9 @@ enable_bonded_slaves(void)
 	int i;
 
 	for (i = 0; i < test_params->bonded_slave_count; i++) {
+		virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i],
+				1);
+
 		virtual_ethdev_simulate_link_status_interrupt(
 				test_params->slave_port_ids[i], 1);
 	}
@@ -1416,6 +1419,135 @@ test_roundrobin_tx_burst(void)
 }
 
 static int
+verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val)
+{
+	int i, refcnt;
+
+	for (i = 0; i < nb_mbufs; i++) {
+		refcnt = rte_mbuf_refcnt_read(mbufs[i]);
+		TEST_ASSERT_EQUAL(refcnt, val,
+			"mbuf ref count (%d)is not the expected value (%d)",
+			refcnt, val);
+	}
+	return 0;
+}
+
+
+static void
+free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs)
+{
+	int i;
+
+	for (i = 0; i < nb_mbufs; i++)
+		rte_pktmbuf_free(mbufs[i]);
+}
+
+#define TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT		(2)
+#define TEST_RR_SLAVE_TX_FAIL_BURST_SIZE		(64)
+#define TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT		(22)
+#define TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX	(1)
+
+static int
+test_roundrobin_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkt_burst[MAX_PKT_BURST];
+	struct rte_mbuf *expected_tx_fail_pkts[MAX_PKT_BURST];
+
+	struct rte_eth_stats port_stats;
+
+	int i, first_fail_idx, tx_count;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_ROUND_ROBIN, 0,
+			TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
+			"Failed to intialise bonded device");
+
+	/* Generate test bursts of packets to transmit */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkt_burst,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE, 0, 1, 0, 0, 0),
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE,
+			"Failed to generate test packet burst");
+
+	/* Copy references to packets which we expect not to be transmitted */
+	first_fail_idx = (TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			(TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT *
+			TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)) +
+			TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX;
+
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		expected_tx_fail_pkts[i] = pkt_burst[first_fail_idx +
+				(i * TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)];
+	}
+
+	/* Set virtual slave to only fail transmission of
+	 * TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT packets in burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkt_burst,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE);
+
+	TEST_ASSERT_EQUAL(tx_count, TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Transmitted (%d) an unexpected (%d) number of packets", tx_count,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_tx_fail_pkts[i], pkt_burst[i + tx_count],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_tx_fail_pkts[i], pkt_burst[i + tx_count]);
+	}
+
+	/* Verify bonded port tx stats */
+	rte_eth_stats_get(test_params->bonded_port_id, &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Bonded Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify slave ports tx stats */
+	for (i = 0; i < test_params->bonded_slave_count; i++) {
+		int slave_expected_tx_count;
+
+		rte_eth_stats_get(test_params->slave_port_ids[i], &port_stats);
+
+		slave_expected_tx_count = TEST_RR_SLAVE_TX_FAIL_BURST_SIZE /
+				test_params->bonded_slave_count;
+
+		if (i == TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX)
+			slave_expected_tx_count = slave_expected_tx_count -
+					TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT;
+
+		TEST_ASSERT_EQUAL(port_stats.opackets,
+				(uint64_t)slave_expected_tx_count,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[i],
+				(unsigned int)port_stats.opackets, slave_expected_tx_count);
+	}
+
+	/* Verify that all mbufs have a ref value of zero */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkt_burst[tx_count],
+			TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
+static int
 test_roundrobin_rx_burst_on_single_slave(void)
 {
 	struct rte_mbuf *gen_pkt_burst[MAX_PKT_BURST] = { NULL };
@@ -2903,6 +3035,141 @@ test_balance_l34_tx_burst_ipv6_toggle_udp_port(void)
 	return balance_l34_tx_burst(0, 0, 0, 0, 1);
 }
 
+#define TEST_BAL_SLAVE_TX_FAIL_SLAVE_COUNT			(2)
+#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1			(40)
+#define TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2			(20)
+#define TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT		(25)
+#define TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX	(0)
+
+static int
+test_balance_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkts_burst_1[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1];
+	struct rte_mbuf *pkts_burst_2[TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2];
+
+	struct rte_mbuf *expected_fail_pkts[TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT];
+
+	struct rte_eth_stats port_stats;
+
+	int i, first_tx_fail_idx, tx_count_1, tx_count_2;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_BALANCE, 0,
+			TEST_BAL_SLAVE_TX_FAIL_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.");
+
+
+	/* Generate test bursts for transmission */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_1,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1, 0, 0, 0, 0, 0),
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1,
+			"Failed to generate test packet burst 1");
+
+	first_tx_fail_idx = TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT;
+
+	/* copy mbuf referneces for expected transmission failures */
+	for (i = 0; i < TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		expected_fail_pkts[i] = pkts_burst_1[i + first_tx_fail_idx];
+	}
+
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst_2,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2, 0, 0, 1, 0, 0),
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+			"Failed to generate test packet burst 2");
+
+
+	/* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail
+	 * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+
+	/* Transmit burst 1 */
+	tx_count_1 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_1,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1);
+
+	TEST_ASSERT_EQUAL(tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count_1, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst_1[i + tx_count_1],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_fail_pkts[i], pkts_burst_1[i + tx_count_1]);
+	}
+
+	/* Transmit burst 2 */
+	tx_count_2 = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst_2,
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	TEST_ASSERT_EQUAL(tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count_2, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+
+	/* Verify bonded port tx stats */
+	rte_eth_stats_get(test_params->bonded_port_id, &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)((TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) +
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2),
+			"Bonded Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			(TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT) +
+			TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	/* Verify slave ports tx stats */
+
+	rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets, (uint64_t)
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+				TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[0],
+				(unsigned int)port_stats.opackets,
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_1 -
+				TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+
+
+
+	rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+				(uint64_t)TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2,
+				"Slave Port (%d) opackets value (%u) not as expected (%d)",
+				test_params->slave_port_ids[1],
+				(unsigned int)port_stats.opackets,
+				TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2);
+
+	/* Verify that all mbufs have a ref value of zero */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst_1[tx_count_1],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkts_burst_1[tx_count_1],
+			TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
 #define TEST_BALANCE_RX_BURST_SLAVE_COUNT (3)
 
 static int
@@ -3416,7 +3683,7 @@ test_broadcast_tx_burst(void)
 	/* 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 * test_params->bonded_slave_count) {
+	if (nb_tx != burst_size) {
 		printf("Bonded Port (%d) rx burst failed, packets transmitted value (%u) not as expected (%d)\n",
 				test_params->bonded_port_id,
 				nb_tx, burst_size);
@@ -3459,6 +3726,125 @@ test_broadcast_tx_burst(void)
 	return remove_slaves_and_stop_bonded_device();
 }
 
+
+#define TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT		(3)
+#define TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE			(40)
+#define TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT	(15)
+#define TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT	(10)
+
+static int
+test_broadcast_tx_burst_slave_tx_fail(void)
+{
+	struct rte_mbuf *pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE];
+	struct rte_mbuf *expected_fail_pkts[TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT];
+
+	struct rte_eth_stats port_stats;
+
+	int i, tx_count;
+
+	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+			BONDING_MODE_BROADCAST, 0,
+			TEST_BCAST_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
+			"Failed to intialise bonded device");
+
+	/* Generate test bursts for transmission */
+	TEST_ASSERT_EQUAL(generate_test_burst(pkts_burst,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE, 0, 0, 0, 0, 0),
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE,
+			"Failed to generate test packet burst");
+
+	for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) {
+		expected_fail_pkts[i] = pkts_burst[TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT + i];
+	}
+
+	/* Set virtual slave TEST_BAL_SLAVE_TX_FAIL_FAILING_SLAVE_IDX to only fail
+	 * transmission of TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT packets of burst */
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[0],
+			0);
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[1],
+			0);
+	virtual_ethdev_tx_burst_fn_set_success(
+			test_params->slave_port_ids[2],
+			0);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[0],
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[1],
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+			test_params->slave_port_ids[2],
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+	/* Transmit burst */
+	tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkts_burst,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE);
+
+	TEST_ASSERT_EQUAL(tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT,
+			"Transmitted (%d) packets, expected to transmit (%d) packets",
+			tx_count, TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	/* Verify that failed packet are expected failed packets */
+	for (i = 0; i < TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT; i++) {
+		TEST_ASSERT_EQUAL(expected_fail_pkts[i], pkts_burst[i + tx_count],
+				"expected mbuf (%d) pointer %p not expected pointer %p",
+				i, expected_fail_pkts[i], pkts_burst[i + tx_count]);
+	}
+
+	/* Verify slave ports tx stats */
+
+	rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+
+	rte_eth_stats_get(test_params->slave_port_ids[1], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats);
+
+	TEST_ASSERT_EQUAL(port_stats.opackets,
+			(uint64_t)TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT,
+			"Port (%d) opackets value (%u) not as expected (%d)",
+			test_params->bonded_port_id, (unsigned int)port_stats.opackets,
+			TEST_BCAST_SLAVE_TX_FAIL_BURST_SIZE -
+			TEST_BCAST_SLAVE_TX_FAIL_MAX_PACKETS_COUNT);
+
+
+	/* Verify that all mbufs who transmission failed have a ref value of one */
+	TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst[tx_count],
+			TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT, 1),
+			"mbufs refcnts not as expected");
+
+	free_mbufs(&pkts_burst[tx_count],
+		TEST_BCAST_SLAVE_TX_FAIL_MIN_PACKETS_COUNT);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
 #define BROADCAST_RX_BURST_NUM_OF_SLAVES (3)
 
 static int
@@ -3771,7 +4157,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
 	}
 
 	if (rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt_burst[0][0],
-			burst_size) != (burst_size * slave_count)) {
+			burst_size) != burst_size) {
 		printf("rte_eth_tx_burst failed\n");
 		return -1;
 	}
@@ -3920,6 +4306,7 @@ static struct unit_test_suite link_bonding_test_suite  = {
 		TEST_CASE(test_status_interrupt),
 		TEST_CASE(test_adding_slave_after_bonded_device_started),
 		TEST_CASE(test_roundrobin_tx_burst),
+		TEST_CASE(test_roundrobin_tx_burst_slave_tx_fail),
 		TEST_CASE(test_roundrobin_rx_burst_on_single_slave),
 		TEST_CASE(test_roundrobin_rx_burst_on_multiple_slaves),
 		TEST_CASE(test_roundrobin_verify_promiscuous_enable_disable),
@@ -3943,12 +4330,14 @@ static struct unit_test_suite link_bonding_test_suite  = {
 		TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_ip_addr),
 		TEST_CASE(test_balance_l34_tx_burst_vlan_ipv6_toggle_ip_addr),
 		TEST_CASE(test_balance_l34_tx_burst_ipv6_toggle_udp_port),
+		TEST_CASE(test_balance_tx_burst_slave_tx_fail),
 		TEST_CASE(test_balance_rx_burst),
 		TEST_CASE(test_balance_verify_promiscuous_enable_disable),
 		TEST_CASE(test_balance_verify_mac_assignment),
 		TEST_CASE(test_balance_verify_slave_link_status_change_behaviour),
 #ifdef RTE_MBUF_REFCNT
 		TEST_CASE(test_broadcast_tx_burst),
+		TEST_CASE(test_broadcast_tx_burst_slave_tx_fail),
 		TEST_CASE(test_broadcast_rx_burst),
 		TEST_CASE(test_broadcast_verify_promiscuous_enable_disable),
 		TEST_CASE(test_broadcast_verify_mac_assignment),
app/test/virtual_pmd.c +61 -18

126 lines not on this page · raw message

app/test/virtual_pmd.h +7 -0
index 766b6ac..3b5c911 100644
@@ -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.12.2
#72 lore raw

PATCH v6 5/8 test app: adding support for generating variable sized packet

In reply to a message not in the archive
---
 app/test/packet_burst_generator.c | 25 ++++++++-----------------
 app/test/packet_burst_generator.h |  6 +++++-
 app/test/test_link_bonding.c      | 14 +++++++++-----
 3 files changed, 22 insertions(+), 23 deletions(-)
app/test/packet_burst_generator.c +8 -17
index 9e747a4..b2824dc 100644
@@ -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,20 +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. */
 
-#define TXONLY_DEF_PACKET_LEN 64
-#define TXONLY_DEF_PACKET_LEN_128 128
-
-uint16_t tx_pkt_length = TXONLY_DEF_PACKET_LEN;
-uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = {
-		TXONLY_DEF_PACKET_LEN_128,
-};
-
-uint8_t  tx_pkt_nb_segs = 1;
 
 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 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;
@@ -221,9 +212,9 @@ nomore_mbuf:
 			break;
 		}
 
-		pkt->data_len = tx_pkt_seg_lengths[0];
+		pkt->data_len = pkt_len;
 		pkt_seg = pkt;
-		for (i = 1; i < tx_pkt_nb_segs; i++) {
+		for (i = 1; i < nb_pkt_segs; i++) {
 			pkt_seg->next = rte_pktmbuf_alloc(mp);
 			if (pkt_seg->next == NULL) {
 				pkt->nb_segs = i;
@@ -231,7 +222,7 @@ nomore_mbuf:
 				goto nomore_mbuf;
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = tx_pkt_seg_lengths[i];
+			pkt_seg->data_len = pkt_len;
 		}
 		pkt_seg->next = NULL; /* Last segment of packet. */
 
@@ -259,8 +250,8 @@ nomore_mbuf:
 		 * Complete first mbuf of packet and append it to the
 		 * burst of packets to be transmitted.
 		 */
-		pkt->nb_segs = tx_pkt_nb_segs;
-		pkt->pkt_len = tx_pkt_length;
+		pkt->nb_segs = nb_pkt_segs;
+		pkt->pkt_len = pkt_len;
 		pkt->l2_len = eth_hdr_size;
 
 		if (ipv4) {
app/test/packet_burst_generator.h +5 -1
index 5b3cd6c..f86589e 100644
@@ -47,6 +47,9 @@ 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
+
 
 void
 initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
@@ -68,7 +71,8 @@ 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 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 +9 -5
index af19066..547ee78 100644
@@ -1341,7 +1341,8 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,
 	/* Generate burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, vlan, ip_hdr, ipv4,
-			test_params->pkt_udp_hdr, burst_size);
+			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;
@@ -2059,7 +2060,7 @@ test_activebackup_tx_burst(void)
 	/* Generate a burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-			1, test_params->pkt_udp_hdr, burst_size);
+			1, test_params->pkt_udp_hdr, burst_size, PACKET_BURST_GEN_PKT_LEN, 1);
 	if (generated_burst_size != burst_size)
 		return -1;
 
@@ -2712,7 +2713,8 @@ test_balance_l2_tx_burst(void)
 	/* Generate a burst 1 of packets to transmit */
 	if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[0][0],
 			test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-			test_params->pkt_udp_hdr, burst_size[0]) != burst_size[0])
+			test_params->pkt_udp_hdr, burst_size[0],
+			PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[0])
 		return -1;
 
 	initialize_eth_header(test_params->pkt_eth_hdr,
@@ -2721,7 +2723,8 @@ test_balance_l2_tx_burst(void)
 	/* Generate a burst 2 of packets to transmit */
 	if (generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0],
 			test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, 1,
-			test_params->pkt_udp_hdr, burst_size[1]) != burst_size[1])
+			test_params->pkt_udp_hdr, burst_size[1],
+			PACKET_BURST_GEN_PKT_LEN, 1) != burst_size[1])
 		return -1;
 
 	/* Send burst 1 on bonded port */
@@ -3676,7 +3679,8 @@ test_broadcast_tx_burst(void)
 	/* Generate a burst of packets to transmit */
 	generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
 			pkts_burst,	test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr,
-			1, test_params->pkt_udp_hdr, burst_size);
+			1, test_params->pkt_udp_hdr, burst_size, PACKET_BURST_GEN_PKT_LEN,
+			1);
 	if (generated_burst_size != burst_size)
 		return -1;
 
Signature · 1 line
1.7.12.2
#73 lore raw

PATCH v6 6/8 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
index 4c3fc76..be12c13 100644
@@ -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
index f76406f..5740804 100644
@@ -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
index 9cbfeac..5a3423c 100644
@@ -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.12.2
#74 lore raw

PATCH v6 7/8 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
index be12c13..ee8c121 100644
@@ -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
index 98ab804..24b1640 100644
@@ -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
index 72f527e..e105c84 100644
@@ -457,6 +457,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)
 {
@@ -504,7 +512,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;
@@ -554,7 +562,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
index c0d0033..394f4bf 100755
@@ -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
index 05a2b07..d8ce681 100644
@@ -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.12.2
#75 lore raw

PATCH v6 8/8 bond: unit test test macro refactor

In reply to a message not in the archive
---
 app/test/test_link_bonding.c | 2574 +++++++++++++++++-------------------------
 1 file changed, 1036 insertions(+), 1538 deletions(-)
app/test/test_link_bonding.c +1036 -1538
index 4aa57a7..aa6a52f 100644
@@ -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_interupt_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,17 @@ 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 +1418,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 +1463,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 */
@@ -1641,57 +1483,44 @@ test_roundrobin_rx_burst_on_multiple_slaves(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,
+	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 +1537,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 +1620,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 +1678,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 +1701,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 +1717,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 +1764,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 +1803,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 +1836,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 +1899,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 +1916,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 +1942,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 +1981,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 +2063,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 +2120,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 addres");
 
 	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 +2237,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 +2270,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,103 +2286,81 @@ 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 */
 
@@ -2664,7 +2373,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 +2382,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 +2439,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 +2458,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 +2511,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 +2523,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 +2591,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 +2635,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 +2704,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();
@@ -3254,21 +2896,22 @@ 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],
@@ -3277,56 +2920,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++) {
@@ -3345,48 +2976,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 */
@@ -3402,115 +3022,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();
@@ -3532,32 +3139,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(
@@ -3565,106 +3167,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",
-				slave_count, 2);
-		return -1;
-	}
[… more lines in the raw message]

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.12.2

Part of the diff is not shown here. View the raw message.

#76 lore raw
In reply to a message not in the archive
Quoted 75 lines

-----Original Message-----
From: Doherty, Declan
Sent: Friday, November 07, 2014 12:23 PM
To: [email protected]
Cc: De Lara Guarch, Pablo; [email protected]; Doherty, Declan
Subject: [PATCH v6 0/8] link bonding

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_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.
- Rebased 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 software

v1:

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.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   25 +-
 app/test/packet_burst_generator.h           |    6 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3347 ++++++++++++++-------------
 app/test/virtual_pmd.c                      |   96 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2715 insertions(+), 1959 deletions(-)
Quoted 2 lines

--
1.7.12.2

A message that is not in the archive (sent off-list or not yet received): E115CCD9D858EF4F90C690B0DCB4D89726834C36-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#78 lore raw

Hey Thomas, have you had a chance to have a look at this patchset, if you have any comments or issues can you let me know asap, as the patch sets for link bonding modes 4 & 5 are dependent on this set and I don't want to be blocking them from the next release candidate.

Thanks
Declan

Quoted 86 lines

-----Original Message-----
From: De Lara Guarch, Pablo
Sent: Friday, November 7, 2014 4:41 PM
To: Doherty, Declan; [email protected]
Cc: [email protected]
Subject: RE: [PATCH v6 0/8] link bonding

Quoted 73 lines

-----Original Message-----
From: Doherty, Declan
Sent: Friday, November 07, 2014 12:23 PM
To: [email protected]
Cc: De Lara Guarch, Pablo; [email protected]; Doherty, Declan
Subject: [PATCH v6 0/8] link bonding

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_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.
- Rebased 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 software

v1:

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.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   25 +-
 app/test/packet_burst_generator.h           |    6 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3347 ++++++++++++++-------------
 app/test/virtual_pmd.c                      |   96 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2715 insertions(+), 1959 deletions(-)
Quoted 2 lines

--
1.7.12.2

A message that is not in the archive (sent off-list or not yet received): 345C63BAECC1AD42A2EC8C63AFFC3ADC27422D1C-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org

#80 lore raw

2014-11-21 17:07, Doherty, Declan:

Quoted 4 lines

Hey Thomas, have you had a chance to have a look at this patchset, if you have any comments or issues can you let me know asap, as the patch sets for link bonding modes 4 & 5 are dependent on this set and I don't want to be blocking them from the next release candidate.

Declan, your patchset doesn't touch anything else than the bonding area (except socket_id parameter in testpmd), it is acked and it has a test report since today.
You are the author (and implicit maintainer) of bonding, so I consider I don't need to review this patchset.

Conclusion: yes, it should be applied shortly.

Signature · 1 line
Thomas
#81 lore raw

2014-11-21 19:36, Thomas Monjalon:

Quoted 6 lines

2014-11-21 17:07, Doherty, Declan:

Quoted 4 lines

Hey Thomas, have you had a chance to have a look at this patchset, if you have any comments or issues can you let me know asap, as the patch sets for link bonding modes 4 & 5 are dependent on this set and I don't want to be blocking them from the next release candidate.

Quoted 7 lines

Declan, your patchset doesn't touch anything else than the bonding area (except socket_id parameter in testpmd), it is acked and it has a test report since today.
You are the author (and implicit maintainer) of bonding, so I consider I don't need to review this patchset.

Conclusion: yes, it should be applied shortly.

Actually no, checkpatch says this patchset is not ready. Some errors:
TYPO_SPELLING: 'interupt' may be misspelled - perhaps 'interrupt'?
TYPO_SPELLING: 'addres' may be misspelled - perhaps 'address'?
BRACES: braces {} are not necessary for single statement blocks
SPACING: space prohibited before semicolon
MISSING_SPACE: break quoted strings at a space character
TRAILING_SEMICOLON: macros should not use a trailing semicolon
SPACING: space prohibited after that open parenthesis '('

Please fix and send a v7.
Thanks

Signature · 1 line
Thomas
Tested-by
#82 lore raw
In reply to a message not in the archive

- Tested Commit: f7aaae2fe6f7f9a78eab7313d77e92b934693b5d
- OS: Fedora20 3.11.10-301.fc20.x86_64 and 3.16.6-200.fc20.x86_64
- GCC: gcc version 4.8.2
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection [8086:10fb]
- Default x86_64-native-linuxapp-gcc configuration
- Total 18 cases, 18 passed, 0 failed

TOPO:
* Connections ports between tester/ixia and DUT
- TESTER(Or IXIA)-------DUT
- portA------------------port0
- portB------------------port1
- portC------------------port2
- portD------------------port3
* Connections ports between tester/ixia and switch and DUT
- TESTER(Or IXIA)-------SWITCH
- SWITCH---------DUT
- TESTER(Or IXIA)----------------------DUT
- portA------------------switch

  -                        switch----------port0
  -                        switch----------port1
  -                        switch----------port2

- portB----------------------------------port3

Test Setup#1 for Functional test
================================

Tester has 4 ports(portA--portD), and DUT has 4 ports(port0--port3), then connect portA to port0, portB to port1, portC to port2, portD to port3.

Test Setup#2 for Functional test
================================

Tester has 2 ports(portA--portB), DUT has 4 ports(port0--port3), and a switch that supports IEEE 802.3ad Dynamic link aggregation, then connect port0-port2 to the switch for dynamic link aggregation, connect portA to aggregated interface on the switch, connect portB to port3.

- Case: Basic bonding--Create bonded devices and slaves
Description:
Use Setup#1.
Create bonded device and add some ports as salve of bonded device,
Then removed slaves or added slaves or change the bonding primary slave Or change bonding mode and so on.
Expected test result:
Verify the basic functions are normal.

- Case: Basic bonding--MAC Address Test
Description:
Use Setup#1.
Create bonded device and add some ports as slaves of bonded device,
Check that the changes of the bonded device and slave MAC
Expected test result:
Verify the behavior of bonded device and slave according to the mode.

- Case: Basic bonding--Device Promiscuous Mode Test
Description:
Use Setup#1.
Create bonded device and add some ports as slaves of bonded device,
Set promiscuous mode on or off, then send packets to the bonded device Or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves according to the mode.

- Case: Mode 0(Round Robin) TX/RX test
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring one slave link down
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, Bring the link on either port 0, 1 or 2 down. And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring all slave links down
Description:
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, Bring the links down on all bonded ports. And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 1(Active Backup) TX/RX Test
Description:
Use Setup#1.
Create bonded device with mode 1 and add 3 ports as slaves of bonded device,
Forward packets between bonded device and unbounded device, start to forward, And send packets to unbound device or slaves.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Change active slave, RX/TX test
Description:
Use Setup#1.
Continuing from previous test case.Change the active slave port from port0
to port1.Verify that the bonded device's MAC has changed to slave1's MAC.

testpmd> set bonding primary 1 4

Repeat the transmission and reception(TX/RX) test verify that data is now transmitted and received through the new active slave and no longer through port0
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Link up/down active eth dev Description:
Use Setup#1.

Bring link between port A and port0 down. If tester is ixia, can use IxExplorer to set the "Simulate Cable Disconnect" at the port property. Verify that the active slave has been changed from port0. Repeat the transmission and reception test verify that data is now transmitted and received through the new active slave and no longer through port0

Bring port0 to link down at the remote end.Verify the active slave has been changed from port0. send 100 packets to port3.

testpmd> show port stats 4----(Verify port3 have 100 rx packets,meanwhile
port4 have 100 tx packets,the current primary port have 100 tx packets,and port0 doesn`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Bring all slave links down
Description:
Use Setup#1.
Bring all slave ports of bonded port down.
Verify that bonded callback for link down is called and no active slaves. Verify that data cannot be sent or received through bonded port. Send 100 packets to port3 and verify that bonded port can't TX 100 packets.

Bring port 0-2 to link down at the remote end. Verify port4 has been link down and has no active slave. Send 100 rx packets to port3.

testpmd> show port stats 4----(Verify port3 have 100 rx packets,meanwhile
port4 doesn`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 2(Balance XOR) TX Load Balance test
Description:
Use Setup#1.
Bonded port will activate each slave eth dev based on the following hash function:

((dst_mac XOR src_mac) % (number of slave ports))

Send 300 packets from IXIA port D to non-bonded port(port3),and verify these packets will be forwarded to bonded device. The bonded device will transimit these packets to all slaves. Verify that each slave receive correct number of packets according to the policy. The total number of packets which received by slave should be equal as 300 packets.

Create 3 streams in the IXIA,which streams source MAC are 00:00:03:00:0F:00, 00:00:03:00:0F:01,00:00:03:00:0F:02 respectively (make sure generate different value by the policy ((dst_mac XOR src_mac) % (number of slave ports)) ) and dest MAC all is 90:E2:BA:4A:54:80(this value should been your unbonded port address). Respectively send 100 packets to port3 by the 3 streams.

testpmd> show port stats all----(Verify port3 have 300 rx packets, port4 have 300 tx packets,and port 0-2 have 100 tx packets respectively)

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) TX Load Balance Link down
Description:
Use Setup#1.
ring link down of one slave.
Send 300 packets from non-bonded port(port3), and verify these
packets will be forwarded to bonded device.
Verify that each active slave receive correct number of packets (according to the mode policy), and the down slave will not receive packets.
Link down slave 0 at the remote end.Create 3 streams in the IXIA like case13. Then respectively send 100 packets to port3 by the 3 streams.

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) Bring all slave links down Description:
Use Setup#1.
Bring all slave links down.
Verify that bonded callback for link down is called. Verify no packet can be sent.

Bring all slaves to link down at the remote end.Create 3 streams in the IXIA like case13.Then respectively send 100 packets to port3 by the 3 streams.

testpmd> show port info 4----(Verify bonding port has been linked down)
testpmd> show port stats all----(Verify port3 have 300 rx packets,meanwhile
port 0,1,2 and 4 don`t have any packet)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) Layer 3+4 forwarding
Description:
Use Setup#1.
Use "xmit_hash_policy()" to change to this forwarding mode
Create a stream of traffic which will exercise all slave ports using the transmit policy

((SRC_PORT XOR DST_PORT) XOR ((SRC_IP XOR DST_IP) AND 0xffff) % # of Slaves

Transmit data through bonded device, verify TX packet count for each slave port is as expected

Create 3 streams on a port which is mapped with unbonded port 3 at the IXIA end.
And set different IP by the transmit policy.Then send 100 packets on each stream.

testpmd> show port stats all----(Verify port3 have 300 rx packets,
meanwhile port4 have 300 rx packets, port 0-2 have 100 tx packets respectively)

Add Vlan tag in the previouse 3 streams. Everthing else remains the same. Then send 100 packets on each stream. Verify the packet statics is the same as above.

testpmd> show port stats all----(Verify port3
have 300 rx packets,meanwhile port4 have 300 rx packets,port 0-2 have 100 tx packets respecitvely)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 2(Balance XOR) RX test
Description:
Use Setup#1.
Send 100 packets to each bonded slaves(port0,1,2)
Verify that each slave receives 100 packets and the bonded device receive a total 300 packets. Verify that the bonded device forwards 300 packets to the non-bonded port(port4).

Send 100 packets to port0,1,2 respectively.

testpmd> show port stats all----(Verify port0,1,2 have 100 tx packets respectively
and port4 have 300 rx packets,and port3 have 300 tx packets)

Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 2.

- Case: Mode 3(Broadcast) TX/RX Test
Description:
Use Setup#1.
Add ports 0-2 as slave devices to the bonded port 4. Make all slaves
to be active slaves on bonded device.

RX: Send a packet stream(100 packets) from port A on the traffic
generator to be forwarded through the bonded port4 to port3.
Verify the sum of the packets transmitted from the traffic generator portA is equal the total received packets on port0, port4 and portD(Traffic generator).

testpmd> show port stats all---(Verify port0 receive 100 packets,
and port4 receive 100 packets, and port3 transmit 100 packets)

TX: Send a packet stream(100 packets) from portD on the traffic generator
to be forwarded through port3 to the bonded port4. Verify the sum of the packets(100packets) transmitted from the traffic generator port is equal the total received packets on port4, portA and transmitted to port0.

testpmd> show port stats all---(Verify port3 RX 100 packets,
and port0,1,2 TX 100 packets,port4 has 300 TX packets)
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

- Case: Mode 3(Broadcast) Bring one slave link down
Description:
Use Setup#1.
Bring one slave port link down. Send 100 packets through portD to port3,
then port3 forwards to bondede device(port4), verify that the bonded device
and other slaves TX the correct number of packets(100 packets for each port).
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

- Case: Mode 3(Broadcast) Bring all slave links down
Description:
Use Setup#1.
Bring all slave ports of bonded port down
Verify that bonded callback for link down is called Verify that data cannot be sent or received through bonded port.
Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 3.

Quoted 82 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Declan Doherty
Sent: Friday, November 07, 2014 8:23 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v6 0/8] link bonding

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a
build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_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.
- Rebased 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 software

v1:

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.

Declan Doherty (8):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions test app: adding support for generating variable sized packet
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   25 +-
 app/test/packet_burst_generator.h           |    6 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3347 ++++++++++++++-----
--------
 app/test/virtual_pmd.c                      |   96 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2715 insertions(+), 1959 deletions(-)

--
1.7.12.2

#83 lore raw

v7 cover link bonding

In reply to a message not in the archive

v7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Re-based to account for changes in master.
- Fix for rte_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 software

v1:

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.

Declan Doherty (7):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   11 +-
 app/test/packet_burst_generator.h           |   15 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3371 ++++++++++++++-------------
 app/test/virtual_pmd.c                      |   95 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 ++++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2719 insertions(+), 1973 deletions(-)
Signature · 1 line
1.7.4.1

A message that is not in the archive (sent off-list or not yet received): 1416832054-24086-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#85 lore raw

PATCH v7 1/7 bond: link status interrupt support

Adding 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
index d407e4f..1245c49 100644
@@ -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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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_interupt_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
index 75f5694..dd33119 100644
@@ -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
index 147028b..de0cd56 100644
@@ -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
#86 lore raw

PATCH v7 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
index de0cd56..f2fe930 100644
@@ -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
#87 lore raw

PATCH v7 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
index f2fe930..6e770af 100644
@@ -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
#88 lore raw

PATCH v7 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
index 017139b..b2824dc 100644
@@ -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
index fe992ac..f86589e 100644
@@ -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
index 766b6ac..3b5c911 100644
@@ -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
#89 lore raw

PATCH v7 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
index 4c3fc76..be12c13 100644
@@ -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
index 12adafa..8a4190b 100644
@@ -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
index 9cbfeac..5a3423c 100644
@@ -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
#90 lore raw

PATCH v7 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
index be12c13..af8f907 100644
@@ -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
index bd44a7f..d5b6951 100644
@@ -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
index 81d4be3..e7be98b 100644
@@ -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
index c0d0033..93fd3d4 100644
@@ -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
index 05a2b07..d8ce681 100644
@@ -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
#91 lore raw

PATCH v7 7/7 bond: unit test test macro refactor

In reply to a message not in the archive
---
 app/test/test_link_bonding.c | 2604 +++++++++++++++++-------------------------
 1 files changed, 1052 insertions(+), 1552 deletions(-)
app/test/test_link_bonding.c +1052 -1552
index f428193..206b10a 100644
@@ -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;
 }
 
@@ -1131,7 +992,7 @@ test_adding_slave_after_bonded_device_started(void)
 #define TEST_STATUS_INTERRUPT_SLAVE_COUNT	4
 #define TEST_LSC_WAIT_TIMEOUT_MS	500
 
-int test_lsc_interupt_count;
+int test_lsc_interrupt_count;
 
 
 static void
@@ -1139,7 +1000,7 @@ 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_interupt_count++;
+	test_lsc_interrupt_count++;
 
 	pthread_cond_signal(&cvar);
 	pthread_mutex_unlock(&mutex);
@@ -1161,12 +1022,12 @@ lsc_timeout(int wait_us)
 	ts.tv_nsec += wait_us * 1000;
 
 	pthread_mutex_lock(&mutex);
-	if (test_lsc_interupt_count < 1)
+	if (test_lsc_interrupt_count < 1)
 		retval = pthread_cond_timedwait(&cvar, &mutex, &ts);
 
 	pthread_mutex_unlock(&mutex);
 
-	if (retval == 0 && test_lsc_interupt_count < 1)
+	if (retval == 0 && test_lsc_interrupt_count < 1)
 		return -1;
 
 	return retval;
@@ -1179,11 +1040,12 @@ 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_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	/* register link status change interrupt callback */
 	rte_eth_dev_callback_register(test_params->bonded_port_id,
@@ -1206,7 +1068,7 @@ test_status_interrupt(void)
 	virtual_ethdev_simulate_link_status_interrupt(
 			test_params->slave_port_ids[2], 0);
 
-	TEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,
+	TEST_ASSERT_EQUAL(test_lsc_interrupt_count, 0,
 			"Received a link status change interrupt unexpectedly");
 
 	virtual_ethdev_simulate_link_status_interrupt(
@@ -1215,7 +1077,7 @@ test_status_interrupt(void)
 	TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) == 0,
 			"timed out waiting for interrupt");
 
-	TEST_ASSERT(test_lsc_interupt_count > 0,
+	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,
@@ -1226,7 +1088,7 @@ test_status_interrupt(void)
 			slave_count, 0);
 
 	/* bring one slave port up so link status will change */
-	test_lsc_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	virtual_ethdev_simulate_link_status_interrupt(
 			test_params->slave_port_ids[0], 1);
@@ -1235,12 +1097,12 @@ test_status_interrupt(void)
 			"timed out waiting for interrupt");
 
 	/* test that we have received another lsc interrupt */
-	TEST_ASSERT(test_lsc_interupt_count > 0,
+	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_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	virtual_ethdev_simulate_link_status_interrupt(
 			test_params->slave_port_ids[0], 1);
@@ -1248,7 +1110,7 @@ test_status_interrupt(void)
 	TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) != 0,
 			"received unexpected interrupt");
 
-	TEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,
+	TEST_ASSERT_EQUAL(test_lsc_interrupt_count, 0,
 			"Did not receive link status change interrupt");
 
 
@@ -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 */
@@ -2054,7 +1853,7 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void)
 			&test_params->bonded_port_id);
 
 	/* link status change callback for first slave link up */
-	test_lsc_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	virtual_ethdev_set_link_status(polling_test_slaves[0], 1);
 
@@ -2062,14 +1861,14 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void)
 
 
 	/* no link status change callback for second slave link up */
-	test_lsc_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	virtual_ethdev_set_link_status(polling_test_slaves[1], 1);
 
 	TEST_ASSERT_FAIL(lsc_timeout(15000), "unexpectedly succeeded");
 
 	/* link status change callback for both slave links down */
-	test_lsc_interupt_count = 0;
+	test_lsc_interrupt_count = 0;
 
 	virtual_ethdev_set_link_status(polling_test_slaves[0], 0);
 	virtual_ethdev_set_link_status(polling_test_slaves[1], 0);
@@ -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);
[… more lines in the raw message]

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.

#92 lore raw
In reply to a message not in the archive

Hi Declan,

There are still 2 kind of errors reported by checkpatch:
- 14 occurrences of this typo:
WARNING:TYPO_SPELLING: 'interupt' may be misspelled - perhaps 'interrupt'?
- 6 occurences of missing space:
WARNING:MISSING_SPACE: break quoted strings at a space character

Example:
#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);
You should put a space between "bonded" and "device".

Signature · 1 line
Thomas
#93 lore raw

Hey, sorry about that, I submitted the patchset without the typo fix. I'll resubmit the patchset now. What version of checkpatch are you using, I don't get any warning for the missing spaces for the version of the script with kernel 3.15 on Fedora

Thanks
Declan

Quoted 23 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, November 24, 2014 3:36 PM
To: Doherty, Declan
Cc: [email protected]
Subject: Re: [PATCH v7 0/7] link bonding

Hi Declan,

There are still 2 kind of errors reported by checkpatch:
- 14 occurrences of this typo:
WARNING:TYPO_SPELLING: 'interupt' may be misspelled - perhaps 'interrupt'?
- 6 occurences of missing space:
WARNING:MISSING_SPACE: break quoted strings at a space character

Example:
#2016: FILE: lib/librte_pmd_bond/rte_eth_bond_pmd.c:1420:

(quoted diff) +2 -0
+                               "LSC polling interval can be specified only once for bonded"
+                               "device %s\n", name);

You should put a space between "bonded" and "device".

--
Thomas

A message that is not in the archive (sent off-list or not yet received): 345C63BAECC1AD42A2EC8C63AFFC3ADC274244EC-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org

#95 lore raw

2014-11-24 16:24, Doherty, Declan:

Quoted 3 lines

Hey, sorry about that, I submitted the patchset without the typo fix. I'll resubmit the patchset now. What version of checkpatch are you using, I don't get any warning for the missing spaces for the version of the script with kernel 3.15 on Fedora

I use the last one (3.18-rc6).
There is now a check for common typos. It appears to be really convenient.

Signature · 1 line
Thomas
#96 lore raw

v8 cover link bonding

In reply to a message not in the archive

v8:
- Missing typo fix
- Missing whitespace

v7:
- Fixes for checkpatch issues and typo fixes
- Removed patch "test app: adding support for generating variable sized" as this was already committed in commit aca4360340f169dcc11b1a9be955b44de8b9f6eb

v6:
- Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
- Added details to testpmd user guide for new command to set link status polling interval.

v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Re-based to account for changes in master.
- Fix for rte_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 software

v1:

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.

Declan Doherty (7):
bond: link status interrupt support
bond: removing switch statement from rx burst method
bond: fix naming inconsistency in tx_burst_round_robin
bond: free mbufs if transmission fails in bonding tx_burst functions
testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
bond: lsc polling support
bond: unit test test macro refactor

 app/test-pmd/cmdline.c                      |   65 +-
 app/test-pmd/testpmd.c                      |    3 +-
 app/test-pmd/testpmd.h                      |    2 +-
 app/test/packet_burst_generator.c           |   11 +-
 app/test/packet_burst_generator.h           |   15 +-
 app/test/test.h                             |    7 +-
 app/test/test_link_bonding.c                | 3371 ++++++++++++++-------------
 app/test/virtual_pmd.c                      |   95 +-
 app/test/virtual_pmd.h                      |   53 +-
 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      |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c     |   28 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c      |  553 ++++--
 lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
 15 files changed, 2719 insertions(+), 1973 deletions(-)
Signature · 1 line
1.7.4.1

A message that is not in the archive (sent off-list or not yet received): 1416846822-26897-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org