======================================================================================
Network Bonding tests for Round Robin, Broadcast, Active backup and Balance XOR mode
======================================================================================

Supported Platforms:DPAA1,DPAA2

The purpose of this write-up is to show the steps for testing different bonding modes on DPAA1/DPAA2 platforms.

Basic Procedure
======================================

Running the dpdk-testpmd file on DPAA1
---------------------------------------
	1. fmc -x
	2. fmc -c /usr/local/dpdk/dpaa/usdpaa_config_ls1046.xml -p /usr/local/dpdk/dpaa/usdpaa_policy_hash_ipv4_1queue.xml -a
	3. ./dpdk-testpmd -c f -n 1 -- -i

Running the dpdk-testpmd file on DPAA2
--------------------------------------
	1. source /usr/local/dpdk/dpaa2/dynamic_dpl.sh dpmac.1 dpmac.2 dpmac.3 dpmac.4
	2. ./dpdk-testpmd -c f -n 1 -- -i

In the following tests, Ports 0,1 and 2 act as slaves to the bonded port 4. The traffic is transmitted from port 3 to the bundled port 4 in which the distribution to individual slaves is done according to the mode being tested.

Below are the steps to test Mode 0 (Round Robin) :

Test case 1: Mode 0 (Round Robin) Test
-------------------------------------------------------------
testpmd> create bonded device 0 0  #To create a bonded device in mode 0 on socket 0.Bonded port (here 4) is created after this command.
testpmd> add bonding slave 0 4	   #To add Ethernet device (port 0) to a Link Bonding device (port 4)
testpmd> add bonding slave 1 4
testpmd> add bonding slave 2 4
testpmd> set portlist 3,4          #To change the port forwarding by setting port 3 and 4 only as active ports
testpmd> port start all            #Start all ports
testpmd> start                     #Start packet forwarding with current configuration
testpmd> show port stats all
testpmd> stop
testpmd> quit

Below are the steps to test Mode 1 (Active backup) :

Test case 1: Mode 1 (Active Backup) Test
-------------------------------------------------------------
testpmd> create bonded device 1 0
testpmd> add bonding slave 0 4
testpmd> add bonding slave 1 4
testpmd> add bonding slave 2 4
testpmd> set portlist 3,4
testpmd> port start all
testpmd> start
testpmd> show port stats all
testpmd> stop
testpmd> quit


Below are the steps to test Mode 2 (Balance XOR) :

Test case 2: Mode 2: (Balance XOR) Test
-------------------------------------------------------------
testpmd> create bonded device 2 0
testpmd> add bonding slave 0 4
testpmd> add bonding slave 1 4
testpmd> add bonding slave 2 4
testpmd> set portlist 3,4
testpmd> port start all
testpmd> start
testpmd> show port stats all
testpmd> stop
testpmd> quit


Below are the steps to test Mode 3 (Broadcast):

Test case 3: Mode 3: (Broadcast) Test
-------------------------------------------------------------
testpmd> create bonded device 3 0
testpmd> add bonding slave 0 4
testpmd> add bonding slave 1 4
testpmd> add bonding slave 2 4
testpmd> set portlist 3,4
testpmd> port start all
testpmd> start
testpmd> show port stats all
testpmd> stop
testpmd> quit


Below are the steps to test Mode 4 LACP (Link Aggregation Control Protocol): (ONLY FOR DPAA2)

SETUP:
===========================================================================================

In the below commands three ports of 2 boards are connected back to back to initiate the LACP flow.

	1. Set the environment variable:
		export DPAA2_FLOW_CONTROL_MISS_FLOW=0
	2. Execute the dpdk-testpmd file:
		./dpdk-testpmd -c f -n 1 -- -i --rxq=2 --txq=2
	3. Set rxonly packet forwarding mode on board 1 using:
		testpmd> set fwd rxonly
	4. Set txonly packet forwarding mode on board 2 using:
		testpmd> set fwd txonly
	5. Execute the below commands on both the boards.

In the following test port 0,1 and 2 act as slaves to the bonded port 3.

Test case 4: Mode 4: (LACP) Test
-------------------------------------------------------------
testpmd> create bonded device 4 0
testpmd> add bonding slave 0 3
testpmd> add bonding slave 1 3
testpmd> add bonding slave 2 3
testpmd> set bonding lacp dedicated_queues 3 enable
testpmd> set allmulti all on
testpmd> set promisc all on
testpmd> port start all
testpmd> start
testpmd> show port stats all
testpmd> stop
testpmd> quit


Note:
These are some of the testpmd runtime functions that can be helpful.

testpmd> show port info <port_id|all>
testpmd> show port xstats  <port_id|all>
testpmd> clear port stats  <port_id|all>
testpmd> show bonding config <portid>

For example, to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) in balance mode with a transmission policy of layer 2+3:

testpmd> show bonding config 9
     Bonding mode: 2
     Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
     Slaves (3): [1 3 4]
     Active Slaves (3): [1 3 4]
     Primary: [3]
