diff mbox

[dpdk-dev,v2,5/6] bond: modify TLB unit tests

Message ID 1423840570-6452-6-git-send-email-michalx.k.jastrzebski@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Michal Jastrzebski Feb. 13, 2015, 3:16 p.m. UTC
This patch modify mode older name from 
BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING to BONDING_MODE_TLB
that was used in unittests.
It also changes 

Signed-off-by: Daniel Mrzyglod  <danielx.t.mrzyglod@intel.com>
---
 app/test/test_link_bonding.c            |   27 ++++++++++++++-------------
 lib/librte_pmd_bond/rte_eth_bond.h      |    2 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c  |    8 ++++----
 lib/librte_pmd_bond/rte_eth_bond_args.c |    2 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c  |   12 ++++++------
 5 files changed, 26 insertions(+), 25 deletions(-)
diff mbox

Patch

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 579ebbf..dd6e357 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -4053,7 +4053,7 @@  test_tlb_tx_burst(void)
 	uint64_t floor_obytes = 0, ceiling_obytes = 0;
 
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves
-			(BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 1, 3, 1),
+			(BONDING_MODE_TLB, 1, 3, 1),
 			"Failed to initialise bonded device");
 
 	burst_size = 20 * test_params->bonded_slave_count;
@@ -4153,7 +4153,7 @@  test_tlb_rx_burst(void)
 
 	/* Initialize bonded device with 4 slaves in transmit load balancing mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
-			BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING,
+			BONDING_MODE_TLB,
 			TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT, 1, 1),
 			"Failed to initialize bonded device");
 
@@ -4231,7 +4231,7 @@  test_tlb_verify_promiscuous_enable_disable(void)
 
 	/* Initialize bonded device with 4 slaves in transmit load balancing mode */
 	TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
-			BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 0, 4, 1),
+			BONDING_MODE_TLB, 0, 4, 1),
 			"Failed to initialize bonded device");
 
 	primary_port = rte_eth_bond_primary_get(test_params->bonded_port_id);
@@ -4289,7 +4289,7 @@  test_tlb_verify_mac_assignment(void)
 
 	/* Initialize bonded device with 2 slaves in active backup mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
-			BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 0, 2, 1),
+			BONDING_MODE_TLB, 0, 2, 1),
 			"Failed to initialize bonded device");
 
 	/* Verify that bonded MACs is that of first slave and that the other slave
@@ -4409,7 +4409,7 @@  test_tlb_verify_slave_link_status_change_failover(void)
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
-			BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 0,
+			BONDING_MODE_TLB, 0,
 			TEST_ADAPTIVE_TRANSMIT_LOAD_BALANCING_RX_BURST_SLAVE_COUNT, 1),
 			"Failed to initialize bonded device with slaves");
 
@@ -4472,20 +4472,21 @@  test_tlb_verify_slave_link_status_change_failover(void)
 		rte_delay_us(11000);
 	}
 
-	rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats);
-	TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0,
-			"(%d) port_stats.opackets not as expected\n",
-			test_params->slave_port_ids[2]);
-
 	rte_eth_stats_get(test_params->slave_port_ids[0], &port_stats);
 	TEST_ASSERT_EQUAL(port_stats.opackets, (int8_t)0,
-			"(%d) port_stats.opackets not as expected\n",
-			test_params->slave_port_ids[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);
 	TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0,
+					"(%d) port_stats.opackets not as expected\n",
+					test_params->slave_port_ids[1]);
+
+
+	rte_eth_stats_get(test_params->slave_port_ids[2], &port_stats);
+	TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0,
 			"(%d) port_stats.opackets not as expected\n",
-			test_params->slave_port_ids[1]);
+			test_params->slave_port_ids[2]);
 
 	rte_eth_stats_get(test_params->slave_port_ids[3], &port_stats);
 	TEST_ASSERT_NOT_EQUAL(port_stats.opackets, (int8_t)0,
diff --git a/lib/librte_pmd_bond/rte_eth_bond.h b/lib/librte_pmd_bond/rte_eth_bond.h
index 13581cb..4117a70 100644
--- a/lib/librte_pmd_bond/rte_eth_bond.h
+++ b/lib/librte_pmd_bond/rte_eth_bond.h
@@ -96,7 +96,7 @@  extern "C" {
  * to rx_burst should be at least 2 times the slave count size.
  *
  */
-#define BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING	(5)
+#define BONDING_MODE_TLB	(5)
 /**< Adaptive TLB (Mode 5)
  * This mode provides an adaptive transmit load balancing. It dynamically
  * changes the transmitting slave, according to the computed load. Statistics
diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
index cbfd185..a5f2c26 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_api.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
@@ -116,7 +116,7 @@  activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
 	if (internals->mode == BONDING_MODE_8023AD)
 		bond_mode_8023ad_activate_slave(eth_dev, port_id);
 
-	if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING
+	if (internals->mode == BONDING_MODE_TLB
 			|| internals->mode == BONDING_MODE_ALB) {
 
 		internals->tlb_slaves_order[active_count] = port_id;
@@ -128,7 +128,7 @@  activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
 	internals->active_slaves[internals->active_slave_count] = port_id;
 	internals->active_slave_count++;
 
-	if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING)
+	if (internals->mode == BONDING_MODE_TLB)
 		bond_tlb_activate_slave(internals);
 	if (internals->mode == BONDING_MODE_ALB)
 		bond_mode_alb_client_list_upd(eth_dev);
@@ -144,7 +144,7 @@  deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
 	if (internals->mode == BONDING_MODE_8023AD) {
 		bond_mode_8023ad_stop(eth_dev);
 		bond_mode_8023ad_deactivate_slave(eth_dev, port_id);
-	} else if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING
+	} else if (internals->mode == BONDING_MODE_TLB
 			|| internals->mode == BONDING_MODE_ALB)
 		bond_tlb_disable(internals);
 
@@ -167,7 +167,7 @@  deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
 	if (eth_dev->data->dev_started) {
 	   if (internals->mode == BONDING_MODE_8023AD) {
 			   bond_mode_8023ad_start(eth_dev);
-	   } else if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING) {
+	   } else if (internals->mode == BONDING_MODE_TLB) {
 			   bond_tlb_enable(internals);
 	   } else if (internals->mode == BONDING_MODE_ALB) {
 			   bond_tlb_enable(internals);
diff --git a/lib/librte_pmd_bond/rte_eth_bond_args.c b/lib/librte_pmd_bond/rte_eth_bond_args.c
index a3f7f55..0801cb5 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_args.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_args.c
@@ -174,7 +174,7 @@  bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused,
 	case BONDING_MODE_BROADCAST:
 #endif
 	case BONDING_MODE_8023AD:
-	case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING:
+	case BONDING_MODE_TLB:
 	case BONDING_MODE_ALB:
 		return 0;
 	default:
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index f469b5c..a473e5d 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -1225,7 +1225,7 @@  mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)
 		bond_mode_8023ad_mac_address_update(bonded_eth_dev);
 		break;
 	case BONDING_MODE_ACTIVE_BACKUP:
-	case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING:
+	case BONDING_MODE_TLB:
 	case BONDING_MODE_ALB:
 	default:
 		for (i = 0; i < internals->slave_count; i++) {
@@ -1288,7 +1288,7 @@  bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int mode)
 				"Using mode 4, it is necessary to do TX burst and RX burst "
 				"at least every 100ms.");
 		break;
-	case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING:
+	case BONDING_MODE_TLB:
 		eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_tlb;
 		eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;
 		break;
@@ -1514,7 +1514,7 @@  bond_ethdev_start(struct rte_eth_dev *eth_dev)
 	if (internals->mode == BONDING_MODE_8023AD)
 		bond_mode_8023ad_start(eth_dev);
 
-	if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING ||
+	if (internals->mode == BONDING_MODE_TLB ||
 			internals->mode == BONDING_MODE_ALB)
 		bond_tlb_enable(internals);
 
@@ -1547,7 +1547,7 @@  bond_ethdev_stop(struct rte_eth_dev *eth_dev)
 		}
 	}
 
-	if (internals->mode == BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING ||
+	if (internals->mode == BONDING_MODE_TLB ||
 			internals->mode == BONDING_MODE_ALB) {
 		bond_tlb_disable(internals);
 		for (i = 0; i < internals->active_slave_count; i++)
@@ -1807,7 +1807,7 @@  bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
-	case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING:
+	case BONDING_MODE_TLB:
 	case BONDING_MODE_ALB:
 	default:
 		rte_eth_promiscuous_enable(internals->current_primary_port);
@@ -1837,7 +1837,7 @@  bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
-	case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING:
+	case BONDING_MODE_TLB:
 	case BONDING_MODE_ALB:
 	default:
 		rte_eth_promiscuous_disable(internals->current_primary_port);