[dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd
Tested-by: Jiajia, SunX - 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 4 cases, 4 passed, 0 failed TOPO: Setup#1 * Connections ports between tester/ixia and DUT - TESTER(Or IXIA)---DUT - portA--port0 - portB--port1 - portC--port2 - portD--port3 Test Case1: Mode 5(Transmit load balance) basic test Use Setup#1 Create bonded device. Add first slave - port 0. Verify default bonded device has default mode 5. Verify bonded device MAC address is that of primary slave. Add another slaves port 1 and 2 to the bonded device. Verify that their MAC are different. Bring the primary slave down. Verify if bonding interface reconfigured itself. The next port (in this scenario port 1) should became a primary one but the MAC should not be changed - should still be the MAC of port 0. Bring a slave of bonding device down. Verify if bonding interface reconfigured itself. Bring the portA, portB and portC down. Verify the bonded device will link down. Set bonded device promiscuous mode to be off. Verify only the promiscuous state of primary interface will be off. Test Case2: Mode 5(Transmit load balance) TX/RX test Use Setup#1 Create a bonded device(port4 in this scenario). Add port 0-2 as slaves of bonding port4. Make packets to transmit between port3 and port4. Then start to forward streams. TX: Prepare a packet stream which will send packets in 5 minutes. Send this stream from portD to port3. Verify that port3 will receive all packets---no missed packets and no error packets. Port 0-2 transmitting packets will be represented as packet0, packet1 and packet2 respectively and their average packets will be represented as mean. Then verify port 0-2 will meet the situation: mean = (packet0 + packet1 + packet2)/3, packet0, packet1 and packet2 will be higher than 90% of mean and lower than 110% of mean. Then the test of port0, port1 and port2 balancing are finished positive. RX: A continuation of TX testing setup. Prepare 3 packet streams and each stream has 100 packets. Respectively, send these streams from portA, portB and portC. Verify only the primary slave port0 will receive 100 packets, and port3 will transmit 100 packets. Test Case3: Mode 5(Transmit load balance) Bring one slave link down Use Setup#1 Create a bonded device(port4 in this scenario). Add port0, port1 and port2 as slaves of bonding port4. Make packets to transmit between port3 and port4. Then start to forward streams. TX: Prepare a packet stream which will send packets in 5 minutes. Bringing port0 link down in the remote end. Send this stream from portD to port3. After the time of 5 minutes is out, verify that port3 will receive all packets---no missed packets and no error packets. Port 1-2 transmitting packets will be represented as packet1 and packet2 respectively and their average packets will be represented as mean. Then verify port1 and port2 will meet the situation: mean = (packet1 + packet2)/2, packet1 and packet2 will be higher than 90% of mean and lower than 110% of mean. Then the test of port1 and port2 balancing are finished positive. RX: Prepare 3 packet streams and each stream has 100 packets. Respectively, send these streams from portA, portB and portC. Verify the primary port(port0 this scenario) will receive 100 packets, and port1 and port2 will receive nothing, and port3 will transmit 100 packets. Test Case4: Mode 5(Transmit load balance) Bring all slaves link down = Use Setup#1 First, set the same setup as case 30. Second, bring all slaves link down. TX: Prepare 1 packet stream which will have 300 packets. Send this stream from portD to port3. Verify port0, port1 and port2 will transmit nothing. RX: Prepare 3 packet streams and each stream has 100 packets. Respectively, send these streams from portA, portB and portC. Verify port0, port1 and port2 will receive nothing. > -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Doherty, Declan > Sent: Tuesday, October 07, 2014 4:20 PM > To: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd > > > > > -Original Message- > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Daniel Mrzyglod > > Sent: Friday, September 26, 2014 4:41 PM > > To
[dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Daniel Mrzyglod > Sent: Friday, September 26, 2014 4:41 PM > To: dev at dpdk.org > Subject: [dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd > > > Signed-off-by: Daniel Mrzyglod > --- > app/test/test_link_bonding.c | 501 > +++- > app/test/virtual_pmd.c |6 +- > app/test/virtual_pmd.h |7 + > lib/librte_pmd_bond/rte_eth_bond.h | 23 ++ > lib/librte_pmd_bond/rte_eth_bond_args.c|1 + > lib/librte_pmd_bond/rte_eth_bond_pmd.c | 161 - > lib/librte_pmd_bond/rte_eth_bond_private.h |3 +- > 7 files changed, 696 insertions(+), 6 deletions(-) > > diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c > index c4fcaf7..77f791f 100644 > --- a/app/test/test_link_bonding.c > +++ b/app/test/test_link_bonding.c > @@ -41,7 +41,7 @@ > #include > #include > #include > - > +#include > #include > #include > #include > @@ -3845,6 +3845,500 @@ testsuite_teardown(void) > return remove_slaves_and_stop_bonded_device(); > } > > +#define NINETY_PERCENT_NUMERAL 90 > +#define ONE_HUNDRED_PERCENT_DENOMINATOR 100 > +#define ONE_HUNDRED_PERCENT_AND_TEN_NUMERAL 110 > +static int > +test_tlb_tx_burst(void) > +{ > + int i, burst_size, nb_tx; > + uint64_t nb_tx2 = 0; > + struct rte_mbuf *pkt_burst[MAX_PKT_BURST]; > + struct rte_eth_stats port_stats[32]; > + uint64_t sum_ports_opackets = 0, all_bond_opackets = 0, > all_bond_obytes = 0; > + uint16_t pktlen; > + > + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves > + > (BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 1, 3, 1), > + "Failed to initialise bonded device"); > + > + burst_size = 20 * test_params->bonded_slave_count; > + > + TEST_ASSERT(burst_size < MAX_PKT_BURST, > + "Burst size specified is greater than supported.\n"); > + > + > + /* Generate 40 test bursts in 2s of packets to transmit */ > + for (i = 0; i < 40; i++) { > + /*test two types of mac src own(bonding) and others */ > + if (i % 2 == 0) { > + initialize_eth_header(test_params->pkt_eth_hdr, > + (struct ether_addr *)src_mac, (struct > ether_addr *)dst_mac_0, 0, 0); > + } else { > + initialize_eth_header(test_params->pkt_eth_hdr, > + (struct ether_addr *)test_params- > >default_slave_mac, > + (struct ether_addr *)dst_mac_0, 0, 0); > + } > + pktlen = initialize_udp_header(test_params->pkt_udp_hdr, > src_port, > + dst_port_0, 16); > + pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, > src_addr, > + dst_addr_0, pktlen); > + generate_packet_burst(test_params->mbuf_pool, pkt_burst, > + test_params->pkt_eth_hdr, 0, test_params- > >pkt_ipv4_hdr, > + 1, test_params->pkt_udp_hdr, burst_size, 60, 1); > + /* Send burst on bonded port */ > + nb_tx = rte_eth_tx_burst(test_params->bonded_port_id, 0, > pkt_burst, > + burst_size); > + nb_tx2 += nb_tx; > + > + TEST_ASSERT_EQUAL(nb_tx, burst_size, > + "number of packet not equal burst size"); > + > + rte_delay_us(5); > + } > + > + > + /* Verify bonded port tx stats */ > + rte_eth_stats_get(test_params->bonded_port_id, _stats[0]); > + > + all_bond_opackets = port_stats[0].opackets; > + all_bond_obytes = port_stats[0].obytes; > + > + TEST_ASSERT_EQUAL(port_stats[0].opackets, (uint64_t)nb_tx2, > + "Bonded Port (%d) opackets value (%u) not as expected > (%d)\n", > + test_params->bonded_port_id, (unsigned > int)port_stats[0].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], > _stats[i]); > + sum_ports_opackets += port_stats[i].opackets; > + } > + > + TEST_ASSERT_EQUAL(sum_ports_opackets, (uint64_t)all_bond_opackets, > + "Total p
[dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd
Add this Release note This patch set adds support of mode 5 to link bonding pmd This patchset depend on Declan Doherty patch set: http://dpdk.org/ml/archives/dev/2014-September/005641.html v2 change: Add Unit Tests Modification that updates obytes structure in virtualpmd driver. change internals->slaves[i].last_obytes to have proper values. Update codebase to Declan's patches. v1 change Add support for mode 5 (Transmit load balancing) into pmd driver > -Original Message- > From: Mrzyglod, DanielX T > Sent: Friday, September 26, 2014 5:41 PM > To: dev at dpdk.org > Cc: Mrzyglod, DanielX T > Subject: [PATCH v2] ADD mode 5(tlb) to link bonding pmd > > > Signed-off-by: Daniel Mrzyglod > --- > app/test/test_link_bonding.c | 501 > +++- > app/test/virtual_pmd.c |6 +- > app/test/virtual_pmd.h |7 + > lib/librte_pmd_bond/rte_eth_bond.h | 23 ++ > lib/librte_pmd_bond/rte_eth_bond_args.c|1 + > lib/librte_pmd_bond/rte_eth_bond_pmd.c | 161 - > lib/librte_pmd_bond/rte_eth_bond_private.h |3 +- > 7 files changed, 696 insertions(+), 6 deletions(-) > > diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c > index c4fcaf7..77f791f 100644 > --- a/app/test/test_link_bonding.c > +++ b/app/test/test_link_bonding.c > @@ -41,7 +41,7 @@ > #include > #include > #include > - > +#include > #include > #include > #include > @@ -3845,6 +3845,500 @@ testsuite_teardown(void) > return remove_slaves_and_stop_bonded_device(); > } > > +#define NINETY_PERCENT_NUMERAL 90 > +#define ONE_HUNDRED_PERCENT_DENOMINATOR 100 > +#define ONE_HUNDRED_PERCENT_AND_TEN_NUMERAL 110 > +static int > +test_tlb_tx_burst(void) > +{ > + int i, burst_size, nb_tx; > + uint64_t nb_tx2 = 0; > + struct rte_mbuf *pkt_burst[MAX_PKT_BURST]; > + struct rte_eth_stats port_stats[32]; > + uint64_t sum_ports_opackets = 0, all_bond_opackets = 0, > all_bond_obytes = 0; > + uint16_t pktlen; > + > + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves > + > (BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 1, 3, 1), > + "Failed to initialise bonded device"); > + > + burst_size = 20 * test_params->bonded_slave_count; > + > + TEST_ASSERT(burst_size < MAX_PKT_BURST, > + "Burst size specified is greater than supported.\n"); > + > + > + /* Generate 40 test bursts in 2s of packets to transmit */ > + for (i = 0; i < 40; i++) { > + /*test two types of mac src own(bonding) and others */ > + if (i % 2 == 0) { > + initialize_eth_header(test_params->pkt_eth_hdr, > + (struct ether_addr *)src_mac, (struct > ether_addr *)dst_mac_0, 0, 0); > + } else { > + initialize_eth_header(test_params->pkt_eth_hdr, > + (struct ether_addr *)test_params- > >default_slave_mac, > + (struct ether_addr *)dst_mac_0, 0, 0); > + } > + pktlen = initialize_udp_header(test_params->pkt_udp_hdr, > src_port, > + dst_port_0, 16); > + pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, > src_addr, > + dst_addr_0, pktlen); > + generate_packet_burst(test_params->mbuf_pool, pkt_burst, > + test_params->pkt_eth_hdr, 0, test_params- > >pkt_ipv4_hdr, > + 1, test_params->pkt_udp_hdr, burst_size, 60, > 1); > + /* Send burst on bonded port */ > + nb_tx = rte_eth_tx_burst(test_params->bonded_port_id, 0, > pkt_burst, > + burst_size); > + nb_tx2 += nb_tx; > + > + TEST_ASSERT_EQUAL(nb_tx, burst_size, > + "number of packet not equal burst size"); > + > + rte_delay_us(5); > + } > + > + > + /* Verify bonded port tx stats */ > + rte_eth_stats_get(test_params->bonded_port_id, _stats[0]); > + > + all_bond_opackets = port_stats[0].opackets; > + all_bond_obytes = port_stats[0].obytes; > + > + TEST_ASSERT_EQUAL(port_stats[0].opackets, (uint64_t)nb_tx2, > + "Bonded Port (%d) opackets value (%u) not as expected > (%d)\n", > + test_params->bonded_port_id, (unsigned > int)port_stats[0].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], > _stats[i]); > + sum_ports_opackets += port_stats[i].opackets; > + } > + > + TEST_ASSERT_EQUAL(sum_ports_opackets, > (uint64_t)all_bond_opackets, > + "Total packets sent by slaves is not equalto packets >
[dpdk-dev] [PATCH v2] ADD mode 5(tlb) to link bonding pmd
Signed-off-by: Daniel Mrzyglod --- app/test/test_link_bonding.c | 501 +++- app/test/virtual_pmd.c |6 +- app/test/virtual_pmd.h |7 + lib/librte_pmd_bond/rte_eth_bond.h | 23 ++ lib/librte_pmd_bond/rte_eth_bond_args.c|1 + lib/librte_pmd_bond/rte_eth_bond_pmd.c | 161 - lib/librte_pmd_bond/rte_eth_bond_private.h |3 +- 7 files changed, 696 insertions(+), 6 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index c4fcaf7..77f791f 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -41,7 +41,7 @@ #include #include #include - +#include #include #include #include @@ -3845,6 +3845,500 @@ testsuite_teardown(void) return remove_slaves_and_stop_bonded_device(); } +#define NINETY_PERCENT_NUMERAL 90 +#define ONE_HUNDRED_PERCENT_DENOMINATOR 100 +#define ONE_HUNDRED_PERCENT_AND_TEN_NUMERAL 110 +static int +test_tlb_tx_burst(void) +{ + int i, burst_size, nb_tx; + uint64_t nb_tx2 = 0; + struct rte_mbuf *pkt_burst[MAX_PKT_BURST]; + struct rte_eth_stats port_stats[32]; + uint64_t sum_ports_opackets = 0, all_bond_opackets = 0, all_bond_obytes = 0; + uint16_t pktlen; + + TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves + (BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING, 1, 3, 1), + "Failed to initialise bonded device"); + + burst_size = 20 * test_params->bonded_slave_count; + + TEST_ASSERT(burst_size < MAX_PKT_BURST, + "Burst size specified is greater than supported.\n"); + + + /* Generate 40 test bursts in 2s of packets to transmit */ + for (i = 0; i < 40; i++) { + /*test two types of mac src own(bonding) and others */ + if (i % 2 == 0) { + initialize_eth_header(test_params->pkt_eth_hdr, + (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, 0, 0); + } else { + initialize_eth_header(test_params->pkt_eth_hdr, + (struct ether_addr *)test_params->default_slave_mac, + (struct ether_addr *)dst_mac_0, 0, 0); + } + pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, + dst_port_0, 16); + pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, + dst_addr_0, pktlen); + generate_packet_burst(test_params->mbuf_pool, pkt_burst, + test_params->pkt_eth_hdr, 0, test_params->pkt_ipv4_hdr, + 1, test_params->pkt_udp_hdr, burst_size, 60, 1); + /* Send burst on bonded port */ + nb_tx = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkt_burst, + burst_size); + nb_tx2 += nb_tx; + + TEST_ASSERT_EQUAL(nb_tx, burst_size, + "number of packet not equal burst size"); + + rte_delay_us(5); + } + + + /* Verify bonded port tx stats */ + rte_eth_stats_get(test_params->bonded_port_id, _stats[0]); + + all_bond_opackets = port_stats[0].opackets; + all_bond_obytes = port_stats[0].obytes; + + TEST_ASSERT_EQUAL(port_stats[0].opackets, (uint64_t)nb_tx2, + "Bonded Port (%d) opackets value (%u) not as expected (%d)\n", + test_params->bonded_port_id, (unsigned int)port_stats[0].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], _stats[i]); + sum_ports_opackets += port_stats[i].opackets; + } + + TEST_ASSERT_EQUAL(sum_ports_opackets, (uint64_t)all_bond_opackets, + "Total packets sent by slaves is not equalto packets sent by bond interface"); + + for (i = 0; i < test_params->bonded_slave_count; i++) { + printf("port stats:%"PRIu64"\n", port_stats[i].opackets); + /* distribution of packets on each slave within +/- 10% of the expected value. */ + TEST_ASSERT(port_stats[i].obytes >= ((all_bond_obytes*NINETY_PERCENT_NUMERAL)/ + (test_params->bonded_slave_count*ONE_HUNDRED_PERCENT_DENOMINATOR)) && + port_stats[i].obytes <= ((all_bond_obytes*ONE_HUNDRED_PERCENT_AND_TEN_NUMERAL) / + (test_params->bonded_slave_count*ONE_HUNDRED_PERCENT_DENOMINATOR)), + "Distribution is not even");