4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #include <rte_cycles.h>
42 #include <sys/queue.h>
44 #include <rte_byteorder.h>
45 #include <rte_common.h>
46 #include <rte_debug.h>
47 #include <rte_ethdev.h>
49 #include <rte_lcore.h>
50 #include <rte_memory.h>
52 #include <rte_string_fns.h>
54 #include <rte_eth_ring.h>
55 #include <rte_errno.h>
56 #include <rte_eth_bond.h>
57 #include <rte_eth_bond_8023ad.h>
59 #include "packet_burst_generator.h"
63 #define SLAVE_COUNT (4)
65 #define RX_RING_SIZE 128
66 #define TX_RING_SIZE 512
68 #define MBUF_CACHE_SIZE (250)
69 #define BURST_SIZE (32)
71 #define TEST_RX_DESC_MAX (2048)
72 #define TEST_TX_DESC_MAX (2048)
73 #define MAX_PKT_BURST (32)
74 #define DEF_PKT_BURST (16)
76 #define BONDED_DEV_NAME ("unit_test_mode4_bond_dev")
78 #define SLAVE_DEV_NAME_FMT ("unit_test_mode4_slave_%d")
79 #define SLAVE_RX_QUEUE_FMT ("unit_test_mode4_slave_%d_rx")
80 #define SLAVE_TX_QUEUE_FMT ("unit_test_mode4_slave_%d_tx")
82 #define INVALID_SOCKET_ID (-1)
83 #define INVALID_PORT_ID (0xFF)
84 #define INVALID_BONDING_MODE (-1)
86 static const struct ether_addr slave_mac_default = {
87 { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 }
90 static const struct ether_addr parnter_mac_default = {
91 { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 }
94 static const struct ether_addr parnter_system = {
95 { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 }
98 static const struct ether_addr slow_protocol_mac_addr = {
99 { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 }
103 struct rte_ring *rx_queue;
104 struct rte_ring *tx_queue;
108 uint8_t lacp_parnter_state;
111 struct ether_vlan_hdr {
112 struct ether_hdr pkt_eth_hdr;
113 struct vlan_hdr vlan_hdr;
116 struct link_bonding_unittest_params {
117 uint8_t bonded_port_id;
118 struct slave_conf slave_ports[SLAVE_COUNT];
120 struct rte_mempool *mbuf_pool;
123 #define TEST_DEFAULT_SLAVE_COUNT RTE_DIM(test_params.slave_ports)
124 #define TEST_RX_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT
125 #define TEST_TX_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
126 #define TEST_MARKER_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT
127 #define TEST_EXPIRED_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
128 #define TEST_PROMISC_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
130 static struct link_bonding_unittest_params test_params = {
131 .bonded_port_id = INVALID_PORT_ID,
132 .slave_ports = { [0 ... SLAVE_COUNT - 1] = { .port_id = INVALID_PORT_ID} },
137 static struct rte_eth_conf default_pmd_conf = {
139 .mq_mode = ETH_MQ_RX_NONE,
140 .max_rx_pkt_len = ETHER_MAX_LEN,
142 .header_split = 0, /**< Header Split disabled */
143 .hw_ip_checksum = 0, /**< IP checksum offload enabled */
144 .hw_vlan_filter = 0, /**< VLAN filtering disabled */
145 .jumbo_frame = 0, /**< Jumbo Frame Support disabled */
146 .hw_strip_crc = 0, /**< CRC stripped by hardware */
149 .mq_mode = ETH_MQ_TX_NONE,
154 #define FOR_EACH(_i, _item, _array, _size) \
155 for (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++)
157 /* Macro for iterating over every port that can be used as a slave
159 * _i variable used as an index in test_params->slave_ports
160 * _slave pointer to &test_params->slave_ports[_idx]
162 #define FOR_EACH_PORT(_i, _port) \
163 FOR_EACH(_i, _port, test_params.slave_ports, \
164 RTE_DIM(test_params.slave_ports))
166 /* Macro for iterating over every port that can be used as a slave
167 * in this test and satisfy given condition.
169 * _i variable used as an index in test_params->slave_ports
170 * _slave pointer to &test_params->slave_ports[_idx]
171 * _condition condition that need to be checked
173 #define FOR_EACH_PORT_IF(_i, _port, _condition) FOR_EACH_PORT((_i), (_port)) \
176 /* Macro for iterating over every port that is currently a slave of a bonded
178 * _i variable used as an index in test_params->slave_ports
179 * _slave pointer to &test_params->slave_ports[_idx]
181 #define FOR_EACH_SLAVE(_i, _slave) \
182 FOR_EACH_PORT_IF(_i, _slave, (_slave)->bonded != 0)
185 * Returns packets from slaves TX queue.
188 * size size of buffer
189 * return number of packets or negative error number
192 slave_get_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size)
194 return rte_ring_dequeue_burst(slave->tx_queue, (void **)buf, size);
198 * Injects given packets into slaves RX queue.
201 * size number of packets to be injected
202 * return number of queued packets or negative error number
205 slave_put_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size)
207 return rte_ring_enqueue_burst(slave->rx_queue, (void **)buf, size);
211 bond_rx(struct rte_mbuf **buf, uint16_t size)
213 return rte_eth_rx_burst(test_params.bonded_port_id, 0, buf, size);
217 bond_tx(struct rte_mbuf **buf, uint16_t size)
219 return rte_eth_tx_burst(test_params.bonded_port_id, 0, buf, size);
223 free_pkts(struct rte_mbuf **pkts, uint16_t count)
227 for (i = 0; i < count; i++) {
229 rte_pktmbuf_free(pkts[i]);
234 configure_ethdev(uint8_t port_id, uint8_t start)
236 TEST_ASSERT(rte_eth_dev_configure(port_id, 1, 1, &default_pmd_conf) == 0,
237 "Failed to configure device %u", port_id);
239 TEST_ASSERT(rte_eth_rx_queue_setup(port_id, 0, RX_RING_SIZE,
240 rte_eth_dev_socket_id(port_id), NULL, test_params.mbuf_pool) == 0,
241 "Failed to setup rx queue.");
243 TEST_ASSERT(rte_eth_tx_queue_setup(port_id, 0, TX_RING_SIZE,
244 rte_eth_dev_socket_id(port_id), NULL) == 0,
245 "Failed to setup tx queue.");
248 TEST_ASSERT(rte_eth_dev_start(port_id) == 0,
249 "Failed to start device (%d).", port_id);
255 add_slave(struct slave_conf *slave, uint8_t start)
257 struct ether_addr addr, addr_check;
259 /* Some sanity check */
260 RTE_VERIFY(test_params.slave_ports <= slave &&
261 slave - test_params.slave_ports < (int)RTE_DIM(test_params.slave_ports));
262 RTE_VERIFY(slave->bonded == 0);
263 RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
265 ether_addr_copy(&slave_mac_default, &addr);
266 addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
268 rte_eth_dev_mac_addr_remove(slave->port_id, &addr);
270 TEST_ASSERT_SUCCESS(rte_eth_dev_mac_addr_add(slave->port_id, &addr, 0),
271 "Failed to set slave MAC address");
273 TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bonded_port_id,
275 "Failed to add slave (idx=%u, id=%u) to bonding (id=%u)",
276 (uint8_t)(slave - test_params.slave_ports), slave->port_id,
277 test_params.bonded_port_id);
281 TEST_ASSERT_SUCCESS(rte_eth_dev_start(slave->port_id),
282 "Failed to start slave %u", slave->port_id);
285 rte_eth_macaddr_get(slave->port_id, &addr_check);
286 TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1,
287 "Slave MAC address is not as expected");
289 RTE_VERIFY(slave->lacp_parnter_state == 0);
294 remove_slave(struct slave_conf *slave)
296 ptrdiff_t slave_idx = slave - test_params.slave_ports;
298 RTE_VERIFY(test_params.slave_ports <= slave &&
299 slave_idx < (ptrdiff_t)RTE_DIM(test_params.slave_ports));
301 RTE_VERIFY(slave->bonded == 1);
302 RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
304 TEST_ASSERT_EQUAL(rte_ring_count(slave->rx_queue), 0,
305 "Slave %u tx queue not empty while removing from bonding.",
308 TEST_ASSERT_EQUAL(rte_ring_count(slave->rx_queue), 0,
309 "Slave %u tx queue not empty while removing from bonding.",
312 TEST_ASSERT_EQUAL(rte_eth_bond_slave_remove(test_params.bonded_port_id,
314 "Failed to remove slave (idx=%u, id=%u) from bonding (id=%u)",
315 (uint8_t)slave_idx, slave->port_id,
316 test_params.bonded_port_id);
319 slave->lacp_parnter_state = 0;
324 initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t start)
328 RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
330 for (i = 0; i < slave_count; i++) {
331 TEST_ASSERT_SUCCESS(add_slave(&test_params.slave_ports[i], 1),
332 "Failed to add port %u to bonded device.\n",
333 test_params.slave_ports[i].port_id);
336 /* Reset mode 4 configuration */
337 rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
338 rte_eth_promiscuous_disable(test_params.bonded_port_id);
341 TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bonded_port_id),
342 "Failed to start bonded device");
348 remove_slaves_and_stop_bonded_device(void)
350 struct slave_conf *slave;
352 uint8_t slaves[RTE_MAX_ETHPORTS];
355 rte_eth_dev_stop(test_params.bonded_port_id);
357 FOR_EACH_SLAVE(i, slave)
360 retval = rte_eth_bond_slaves_get(test_params.bonded_port_id, slaves,
363 TEST_ASSERT_EQUAL(retval, 0,
364 "Expected bonded device %u have 0 slaves but returned %d.",
365 test_params.bonded_port_id, retval);
367 FOR_EACH_PORT(i, slave) {
368 rte_eth_dev_stop(slave->port_id);
370 TEST_ASSERT(slave->bonded == 0,
371 "Port id=%u is still marked as enslaved.", slave->port_id);
380 int retval, nb_mbuf_per_pool;
381 char name[RTE_ETH_NAME_MAX_LEN];
382 struct slave_conf *port;
383 const uint8_t socket_id = rte_socket_id();
386 if (test_params.mbuf_pool == NULL) {
387 nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST +
388 TEST_TX_DESC_MAX + MAX_PKT_BURST;
389 test_params.mbuf_pool = rte_pktmbuf_pool_create("TEST_MODE4",
390 nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0,
391 RTE_MBUF_DEFAULT_BUF_SIZE, socket_id);
393 TEST_ASSERT(test_params.mbuf_pool != NULL,
394 "rte_mempool_create failed\n");
397 /* Create / initialize ring eth devs. */
398 FOR_EACH_PORT(i, port) {
399 port = &test_params.slave_ports[i];
401 if (port->rx_queue == NULL) {
402 retval = snprintf(name, RTE_DIM(name), SLAVE_RX_QUEUE_FMT, i);
403 TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long");
404 port->rx_queue = rte_ring_create(name, RX_RING_SIZE, socket_id, 0);
405 TEST_ASSERT(port->rx_queue != NULL,
406 "Failed to allocate rx ring '%s': %s", name,
407 rte_strerror(rte_errno));
410 if (port->tx_queue == NULL) {
411 retval = snprintf(name, RTE_DIM(name), SLAVE_TX_QUEUE_FMT, i);
412 TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long");
413 port->tx_queue = rte_ring_create(name, TX_RING_SIZE, socket_id, 0);
414 TEST_ASSERT_NOT_NULL(port->tx_queue,
415 "Failed to allocate tx ring '%s': %s", name,
416 rte_strerror(rte_errno));
419 if (port->port_id == INVALID_PORT_ID) {
420 retval = snprintf(name, RTE_DIM(name), SLAVE_DEV_NAME_FMT, i);
421 TEST_ASSERT(retval < (int)RTE_DIM(name) - 1, "Name too long");
422 retval = rte_eth_from_rings(name, &port->rx_queue, 1,
423 &port->tx_queue, 1, socket_id);
424 TEST_ASSERT(retval >= 0,
425 "Failed to create ring ethdev '%s'\n", name);
427 port->port_id = rte_eth_dev_count() - 1;
430 retval = configure_ethdev(port->port_id, 1);
431 TEST_ASSERT_SUCCESS(retval, "Failed to configure virtual ethdev %s\n",
435 if (test_params.bonded_port_id == INVALID_PORT_ID) {
436 retval = rte_eth_bond_create(BONDED_DEV_NAME, BONDING_MODE_8023AD,
439 TEST_ASSERT(retval >= 0, "Failed to create bonded ethdev %s",
442 test_params.bonded_port_id = retval;
443 TEST_ASSERT_SUCCESS(configure_ethdev(test_params.bonded_port_id, 0),
444 "Failed to configure bonded ethdev %s", BONDED_DEV_NAME);
445 } else if (rte_eth_bond_mode_get(test_params.bonded_port_id) !=
446 BONDING_MODE_8023AD) {
447 TEST_ASSERT(rte_eth_bond_mode_set(test_params.bonded_port_id,
448 BONDING_MODE_8023AD) == 0,
449 "Failed to set ethdev %d to mode %d",
450 test_params.bonded_port_id, BONDING_MODE_8023AD);
457 testsuite_teardown(void)
459 struct slave_conf *port;
463 * Any cleanup/reset state is done when particular test is
466 rte_eth_dev_stop(test_params.bonded_port_id);
468 FOR_EACH_PORT(i, port)
469 rte_eth_dev_stop(port->port_id);
473 * Check if given LACP packet. If it is, make make replay packet to force
475 * return 0 when pkt is LACP frame, 1 if it is not slow frame, 2 if it is slow
479 make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
481 struct ether_hdr *hdr;
482 struct slow_protocol_frame *slow_hdr;
486 hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
487 if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW))
490 slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
491 /* ignore packets of other types */
492 if (slow_hdr->slow_protocol.subtype != SLOW_SUBTYPE_LACP)
495 slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
497 /* Change source address to partner address */
498 ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
499 slow_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
501 lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
502 /* Save last received state */
503 slave->lacp_parnter_state = lacp->actor.state;
504 /* Change it into LACP replay by matching parameters. */
505 memcpy(&lacp->partner.port_params, &lacp->actor.port_params,
506 sizeof(struct port_params));
508 lacp->partner.state = lacp->actor.state;
510 ether_addr_copy(&parnter_system, &lacp->actor.port_params.system);
511 lacp->actor.state = STATE_LACP_ACTIVE |
512 STATE_SYNCHRONIZATION |
521 * Reads packets from given slave, search for LACP packet and reply them.
523 * Receives burst of packets from slave. Looks for LACP packet. Drops
524 * all other packets. Prepares response LACP and sends it back.
526 * return number of LACP received and replied, -1 on error.
529 bond_handshake_reply(struct slave_conf *slave)
532 struct rte_mbuf *rx_buf[MAX_PKT_BURST];
533 struct rte_mbuf *lacp_tx_buf[MAX_PKT_BURST];
534 uint16_t lacp_tx_buf_cnt = 0, i;
536 retval = slave_get_pkts(slave, rx_buf, RTE_DIM(rx_buf));
537 TEST_ASSERT(retval >= 0, "Getting slave %u packets failed.",
540 for (i = 0; i < (uint16_t)retval; i++) {
541 if (make_lacp_reply(slave, rx_buf[i]) == 0) {
542 /* reply with actor's LACP */
543 lacp_tx_buf[lacp_tx_buf_cnt++] = rx_buf[i];
545 rte_pktmbuf_free(rx_buf[i]);
548 if (lacp_tx_buf_cnt == 0)
551 retval = slave_put_pkts(slave, lacp_tx_buf, lacp_tx_buf_cnt);
552 if (retval <= lacp_tx_buf_cnt) {
553 /* retval might be negative */
554 for (i = RTE_MAX(0, retval); retval < lacp_tx_buf_cnt; retval++)
555 rte_pktmbuf_free(lacp_tx_buf[i]);
558 TEST_ASSERT_EQUAL(retval, lacp_tx_buf_cnt,
559 "Failed to equeue lacp packets into slave %u tx queue.",
562 return lacp_tx_buf_cnt;
566 * Function check if given slave tx queue contains packets that make mode 4
567 * handshake complete. It will drain slave queue.
568 * return 0 if handshake not completed, 1 if handshake was complete,
571 bond_handshake_done(struct slave_conf *slave)
573 const uint8_t expected_state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION |
574 STATE_AGGREGATION | STATE_COLLECTING | STATE_DISTRIBUTING;
576 return slave->lacp_parnter_state == expected_state;
580 bond_get_update_timeout_ms(void)
582 struct rte_eth_bond_8023ad_conf conf;
584 rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);
585 return conf.update_timeout_ms;
589 * Exchanges LACP packets with partner to achieve dynamic port configuration.
590 * return TEST_SUCCESS if initial handshake succeed, TEST_FAILED otherwise.
595 struct slave_conf *slave;
596 struct rte_mbuf *buf[MAX_PKT_BURST];
598 uint8_t all_slaves_done, i, j;
599 uint8_t status[RTE_DIM(test_params.slave_ports)] = { 0 };
600 const unsigned delay = bond_get_update_timeout_ms();
602 /* Exchange LACP frames */
604 for (i = 0; i < 30 && all_slaves_done == 0; ++i) {
608 FOR_EACH_SLAVE(j, slave) {
609 /* If response already send, skip slave */
613 if (bond_handshake_reply(slave) < 0) {
618 status[j] = bond_handshake_done(slave);
623 nb_pkts = bond_tx(NULL, 0);
624 TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets transmitted unexpectedly");
626 nb_pkts = bond_rx(buf, RTE_DIM(buf));
627 free_pkts(buf, nb_pkts);
628 TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets received unexpectedly");
630 /* If response didn't send - report failure */
631 TEST_ASSERT_EQUAL(all_slaves_done, 1, "Bond handshake failed\n");
633 /* If flags doesn't match - report failure */
634 return all_slaves_done = 1 ? TEST_SUCCESS : TEST_FAILED;
637 #define TEST_LACP_SLAVE_COUT RTE_DIM(test_params.slave_ports)
639 test_mode4_lacp(void)
643 retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 1);
644 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
646 /* Test LACP handshake function */
647 retval = bond_handshake();
648 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
650 retval = remove_slaves_and_stop_bonded_device();
651 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
657 generate_packets(struct ether_addr *src_mac,
658 struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf)
660 uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN;
661 uint8_t vlan_enable = 0;
662 uint16_t vlan_id = 0;
663 uint8_t ip4_type = 1; /* 0 - ipv6 */
665 uint16_t src_port = 10, dst_port = 20;
667 uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) };
668 uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) };
670 struct ether_hdr pkt_eth_hdr;
671 struct udp_hdr pkt_udp_hdr;
679 initialize_eth_header(&pkt_eth_hdr, src_mac, dst_mac, ip4_type,
680 vlan_enable, vlan_id);
683 initialize_ipv4_header(&pkt_ip_hdr.v4, ip_src[3], ip_dst[3], pktlen);
685 initialize_ipv6_header(&pkt_ip_hdr.v6, (uint8_t *)ip_src,
686 (uint8_t *)&ip_dst, pktlen);
688 initialize_udp_header(&pkt_udp_hdr, src_port, dst_port, 16);
690 retval = generate_packet_burst(test_params.mbuf_pool, buf,
691 &pkt_eth_hdr, vlan_enable, &pkt_ip_hdr, 1, &pkt_udp_hdr,
694 if (retval > 0 && retval != count)
695 free_pkts(&buf[count - retval], retval);
697 TEST_ASSERT_EQUAL(retval, count, "Failed to generate %u packets",
704 generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac,
705 struct ether_addr *dst_mac, uint16_t count)
707 struct rte_mbuf *pkts[MAX_PKT_BURST];
710 retval = generate_packets(src_mac, dst_mac, count, pkts);
711 if (retval != (int)count)
714 retval = slave_put_pkts(slave, pkts, count);
715 if (retval > 0 && retval != count)
716 free_pkts(&pkts[retval], count - retval);
718 TEST_ASSERT_EQUAL(retval, count,
719 "Failed to enqueue packets into slave %u RX queue", slave->port_id);
727 struct slave_conf *slave;
730 uint16_t expected_pkts_cnt;
731 struct rte_mbuf *pkts[MAX_PKT_BURST];
735 struct ether_hdr *hdr;
737 struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } };
738 struct ether_addr dst_mac;
739 struct ether_addr bonded_mac;
741 retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 1);
742 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
744 retval = bond_handshake();
745 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
747 rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
748 ether_addr_copy(&bonded_mac, &dst_mac);
750 /* Assert that dst address is not bonding address. Do not set the
751 * least significant bit of the zero byte as this would create a
754 dst_mac.addr_bytes[0] += 2;
756 /* First try with promiscuous mode enabled.
757 * Add 2 packets to each slave. First with bonding MAC address, second with
758 * different. Check if we received all of them. */
759 rte_eth_promiscuous_enable(test_params.bonded_port_id);
761 expected_pkts_cnt = 0;
762 FOR_EACH_SLAVE(i, slave) {
763 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
764 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
767 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
768 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
771 /* Expect 2 packets per slave */
772 expected_pkts_cnt += 2;
775 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
778 if (retval == expected_pkts_cnt) {
779 int cnt[2] = { 0, 0 };
781 for (i = 0; i < expected_pkts_cnt; i++) {
782 hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *);
783 cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++;
786 free_pkts(pkts, expected_pkts_cnt);
788 /* For division by 2 expected_pkts_cnt must be even */
789 RTE_VERIFY((expected_pkts_cnt & 1) == 0);
790 TEST_ASSERT(cnt[0] == expected_pkts_cnt / 2 &&
791 cnt[1] == expected_pkts_cnt / 2,
792 "Expected %u packets with the same MAC and %u with different but "
793 "got %u with the same and %u with diffrent MAC",
794 expected_pkts_cnt / 2, expected_pkts_cnt / 2, cnt[1], cnt[0]);
795 } else if (retval > 0)
796 free_pkts(pkts, retval);
798 TEST_ASSERT_EQUAL(retval, expected_pkts_cnt,
799 "Expected %u packets but received only %d", expected_pkts_cnt, retval);
801 /* Now, disable promiscuous mode. When promiscuous mode is disabled we
802 * expect to receive only packets that are directed to bonding port. */
803 rte_eth_promiscuous_disable(test_params.bonded_port_id);
805 expected_pkts_cnt = 0;
806 FOR_EACH_SLAVE(i, slave) {
807 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
808 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
811 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
812 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
815 /* Expect only one packet per slave */
816 expected_pkts_cnt += 1;
819 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
822 if (retval == expected_pkts_cnt) {
825 for (i = 0; i < expected_pkts_cnt; i++) {
826 hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *);
827 eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac);
830 free_pkts(pkts, expected_pkts_cnt);
831 TEST_ASSERT_EQUAL(eq_cnt, expected_pkts_cnt, "Packet address mismatch");
832 } else if (retval > 0)
833 free_pkts(pkts, retval);
835 TEST_ASSERT_EQUAL(retval, expected_pkts_cnt,
836 "Expected %u packets but received only %d", expected_pkts_cnt, retval);
838 /* Link down test: simulate link down for first slave. */
839 delay = bond_get_update_timeout_ms();
841 uint8_t slave_down_id = INVALID_PORT_ID;
843 /* Find first slave and make link down on it*/
844 FOR_EACH_SLAVE(i, slave) {
845 rte_eth_dev_set_link_down(slave->port_id);
846 slave_down_id = slave->port_id;
850 RTE_VERIFY(slave_down_id != INVALID_PORT_ID);
852 /* Give some time to rearrange bonding */
853 for (i = 0; i < 3; i++) {
858 TEST_ASSERT_SUCCESS(bond_handshake(), "Handshake after link down failed");
860 /* Put packet to each slave */
861 FOR_EACH_SLAVE(i, slave) {
864 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
865 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
866 TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
868 src_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
869 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
870 TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
872 retval = bond_rx(pkts, RTE_DIM(pkts));
876 free_pkts(pkts, retval);
878 while (rte_ring_dequeue(slave->rx_queue, (void **)&pkt) == 0)
879 rte_pktmbuf_free(pkt);
881 if (slave_down_id == slave->port_id)
882 TEST_ASSERT_EQUAL(retval, 0, "Packets received unexpectedly.");
884 TEST_ASSERT_NOT_EQUAL(retval, 0,
885 "Expected to receive some packets on slave %u.",
887 rte_eth_dev_start(slave->port_id);
889 for (j = 0; j < 5; j++) {
890 TEST_ASSERT(bond_handshake_reply(slave) >= 0,
891 "Handshake after link up");
893 if (bond_handshake_done(slave) == 1)
897 TEST_ASSERT(j < 5, "Failed to agregate slave after link up");
900 remove_slaves_and_stop_bonded_device();
905 test_mode4_tx_burst(void)
907 struct slave_conf *slave;
910 uint16_t exp_pkts_cnt, pkts_cnt = 0;
911 struct rte_mbuf *pkts[MAX_PKT_BURST];
915 struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } };
916 struct ether_addr bonded_mac;
918 retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 1);
919 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
921 retval = bond_handshake();
922 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
924 rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
927 for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
928 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
929 retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
932 free_pkts(pkts, pkts_cnt);
934 TEST_ASSERT_EQUAL(retval, 1, "Failed to generate packet %u", pkts_cnt);
936 exp_pkts_cnt = pkts_cnt;
938 /* Transmit packets on bonded device */
939 retval = bond_tx(pkts, pkts_cnt);
940 if (retval > 0 && retval < pkts_cnt)
941 free_pkts(&pkts[retval], pkts_cnt - retval);
943 TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed");
945 /* Check if packets were transmitted properly. Every slave should have
946 * at least one packet, and sum must match. Under normal operation
947 * there should be no LACP nor MARKER frames. */
949 FOR_EACH_SLAVE(i, slave) {
950 uint16_t normal_cnt, slow_cnt;
952 retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts));
956 for (j = 0; j < retval; j++) {
957 if (make_lacp_reply(slave, pkts[j]) == 1)
963 free_pkts(pkts, normal_cnt + slow_cnt);
964 TEST_ASSERT_EQUAL(slow_cnt, 0,
965 "slave %u unexpectedly transmitted %d SLOW packets", slave->port_id,
968 TEST_ASSERT_NOT_EQUAL(normal_cnt, 0,
969 "slave %u did not transmitted any packets", slave->port_id);
971 pkts_cnt += normal_cnt;
974 TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt,
975 "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt);
978 * simulate link down for first slave. */
979 delay = bond_get_update_timeout_ms();
981 uint8_t slave_down_id = INVALID_PORT_ID;
983 FOR_EACH_SLAVE(i, slave) {
984 rte_eth_dev_set_link_down(slave->port_id);
985 slave_down_id = slave->port_id;
989 RTE_VERIFY(slave_down_id != INVALID_PORT_ID);
991 /* Give some time to rearrange bonding. */
992 for (i = 0; i < 3; i++) {
997 TEST_ASSERT_SUCCESS(bond_handshake(), "Handshake after link down failed");
1000 for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
1001 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
1002 retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
1005 free_pkts(pkts, pkts_cnt);
1007 TEST_ASSERT_EQUAL(retval, 1, "Failed to generate test packet %u",
1010 exp_pkts_cnt = pkts_cnt;
1012 /* Transmit packets on bonded device. */
1013 retval = bond_tx(pkts, pkts_cnt);
1014 if (retval > 0 && retval < pkts_cnt)
1015 free_pkts(&pkts[retval], pkts_cnt - retval);
1017 TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed");
1019 /* Check if packets was transmitted properly. Every slave should have
1020 * at least one packet, and sum must match. Under normal operation
1021 * there should be no LACP nor MARKER frames. */
1023 FOR_EACH_SLAVE(i, slave) {
1024 uint16_t normal_cnt, slow_cnt;
1026 retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts));
1030 for (j = 0; j < retval; j++) {
1031 if (make_lacp_reply(slave, pkts[j]) == 1)
1037 free_pkts(pkts, normal_cnt + slow_cnt);
1039 if (slave_down_id == slave->port_id) {
1040 TEST_ASSERT_EQUAL(normal_cnt + slow_cnt, 0,
1041 "slave %u enexpectedly transmitted %u packets",
1042 normal_cnt + slow_cnt, slave->port_id);
1044 TEST_ASSERT_EQUAL(slow_cnt, 0,
1045 "slave %u unexpectedly transmitted %d SLOW packets",
1046 slave->port_id, slow_cnt);
1048 TEST_ASSERT_NOT_EQUAL(normal_cnt, 0,
1049 "slave %u did not transmitted any packets", slave->port_id);
1052 pkts_cnt += normal_cnt;
1055 TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt,
1056 "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt);
1058 return remove_slaves_and_stop_bonded_device();
1062 init_marker(struct rte_mbuf *pkt, struct slave_conf *slave)
1064 struct marker_header *marker_hdr = rte_pktmbuf_mtod(pkt,
1065 struct marker_header *);
1067 /* Copy multicast destination address */
1068 ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr);
1070 /* Init source address */
1071 ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
1072 marker_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN-1] = slave->port_id;
1074 marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW);
1076 marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER;
1077 marker_hdr->marker.version_number = 1;
1078 marker_hdr->marker.tlv_type_marker = MARKER_TLV_TYPE_INFO;
1079 marker_hdr->marker.info_length =
1080 offsetof(struct marker, reserved_90) -
1081 offsetof(struct marker, requester_port);
1082 RTE_VERIFY(marker_hdr->marker.info_length == 16);
1083 marker_hdr->marker.requester_port = slave->port_id + 1;
1084 marker_hdr->marker.tlv_type_terminator = TLV_TYPE_TERMINATOR_INFORMATION;
1085 marker_hdr->marker.terminator_length = 0;
1089 test_mode4_marker(void)
1091 struct slave_conf *slave;
1092 struct rte_mbuf *pkts[MAX_PKT_BURST];
1093 struct rte_mbuf *marker_pkt;
1094 struct marker_header *marker_hdr;
1100 const uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
1102 retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 1);
1103 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
1105 /* Test LACP handshake function */
1106 retval = bond_handshake();
1107 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
1109 delay = bond_get_update_timeout_ms();
1110 FOR_EACH_SLAVE(i, slave) {
1111 marker_pkt = rte_pktmbuf_alloc(test_params.mbuf_pool);
1112 TEST_ASSERT_NOT_NULL(marker_pkt, "Failed to allocate marker packet");
1113 init_marker(marker_pkt, slave);
1115 retval = slave_put_pkts(slave, &marker_pkt, 1);
1117 rte_pktmbuf_free(marker_pkt);
1119 TEST_ASSERT_EQUAL(retval, 1,
1120 "Failed to send marker packet to slave %u", slave->port_id);
1122 for (j = 0; j < 20; ++j) {
1123 rte_delay_ms(delay);
1124 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
1128 free_pkts(pkts, retval);
1130 TEST_ASSERT_EQUAL(retval, 0, "Received packets unexpectedly");
1132 retval = rte_eth_tx_burst(test_params.bonded_port_id, 0, NULL, 0);
1133 TEST_ASSERT_EQUAL(retval, 0,
1134 "Requested TX of 0 packets but %d transmitted", retval);
1136 /* Check if LACP packet was send by state machines
1137 First and only packet must be a maker response */
1138 retval = slave_get_pkts(slave, pkts, MAX_PKT_BURST);
1142 free_pkts(pkts, retval);
1144 TEST_ASSERT_EQUAL(retval, 1, "failed to get slave packets");
1147 marker_hdr = rte_pktmbuf_mtod(pkts[0], struct marker_header *);
1148 /* Check if it's slow packet*/
1149 if (marker_hdr->eth_hdr.ether_type != ethtype_slow_be)
1151 /* Check if it's marker packet */
1152 else if (marker_hdr->marker.subtype != SLOW_SUBTYPE_MARKER)
1154 else if (marker_hdr->marker.tlv_type_marker != MARKER_TLV_TYPE_RESP)
1157 free_pkts(pkts, nb_pkts);
1159 TEST_ASSERT_NOT_EQUAL(retval, -1, "Unexpected protocol type");
1160 TEST_ASSERT_NOT_EQUAL(retval, -2, "Unexpected sub protocol type");
1161 TEST_ASSERT_NOT_EQUAL(retval, -3, "Unexpected marker type");
1165 TEST_ASSERT(j < 20, "Marker response not found");
1168 retval = remove_slaves_and_stop_bonded_device();
1169 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
1171 return TEST_SUCCESS;
1175 test_mode4_expired(void)
1177 struct slave_conf *slave, *exp_slave = NULL;
1178 struct rte_mbuf *pkts[MAX_PKT_BURST];
1185 struct rte_eth_bond_8023ad_conf conf;
1187 retval = initialize_bonded_device_with_slaves(TEST_EXPIRED_SLAVE_COUNT, 1);
1188 /* Set custom timeouts to make test last shorter. */
1189 rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);
1190 conf.fast_periodic_ms = 100;
1191 conf.slow_periodic_ms = 600;
1192 conf.short_timeout_ms = 300;
1193 conf.long_timeout_ms = 900;
1194 conf.aggregate_wait_timeout_ms = 200;
1195 conf.tx_period_ms = 100;
1196 old_delay = conf.update_timeout_ms;
1197 conf.update_timeout_ms = 10;
1198 rte_eth_bond_8023ad_setup(test_params.bonded_port_id, &conf);
1200 /* Wait for new settings to be applied. */
1201 for (i = 0; i < old_delay/conf.update_timeout_ms * 2; i++) {
1202 FOR_EACH_SLAVE(j, slave)
1203 bond_handshake_reply(slave);
1205 rte_delay_ms(conf.update_timeout_ms);
1208 retval = bond_handshake();
1209 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
1211 /* Find first slave */
1212 FOR_EACH_SLAVE(i, slave) {
1217 RTE_VERIFY(exp_slave != NULL);
1219 /* When one of partners do not send or respond to LACP frame in
1220 * conf.long_timeout_ms time, internal state machines should detect this
1221 * and transit to expired state. */
1222 for (j = 0; j < conf.long_timeout_ms/conf.update_timeout_ms + 2; j++) {
1223 rte_delay_ms(conf.update_timeout_ms);
1225 retval = bond_tx(NULL, 0);
1226 TEST_ASSERT_EQUAL(retval, 0, "Unexpectedly received %d packets",
1229 FOR_EACH_SLAVE(i, slave) {
1230 retval = bond_handshake_reply(slave);
1231 TEST_ASSERT(retval >= 0, "Handshake failed");
1233 /* Remove replay for slave that supose to be expired. */
1234 if (slave == exp_slave) {
1235 while (rte_ring_count(slave->rx_queue) > 0) {
1238 rte_ring_dequeue(slave->rx_queue, &pkt);
1239 rte_pktmbuf_free(pkt);
1244 retval = bond_rx(pkts, RTE_DIM(pkts));
1246 free_pkts(pkts, retval);
1248 TEST_ASSERT_EQUAL(retval, 0, "Unexpectedly received %d packets",
1252 /* After test only expected slave should be in EXPIRED state */
1253 FOR_EACH_SLAVE(i, slave) {
1254 if (slave == exp_slave)
1255 TEST_ASSERT(slave->lacp_parnter_state & STATE_EXPIRED,
1256 "Slave %u should be in expired.", slave->port_id);
1258 TEST_ASSERT_EQUAL(bond_handshake_done(slave), 1,
1259 "Slave %u should be operational.", slave->port_id);
1262 retval = remove_slaves_and_stop_bonded_device();
1263 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
1265 return TEST_SUCCESS;
1269 check_environment(void)
1271 struct slave_conf *port;
1272 uint8_t i, env_state;
1273 uint8_t slaves[RTE_DIM(test_params.slave_ports)];
1277 FOR_EACH_PORT(i, port) {
1278 if (rte_ring_count(port->rx_queue) != 0)
1281 if (rte_ring_count(port->tx_queue) != 0)
1284 if (port->bonded != 0)
1287 if (port->lacp_parnter_state != 0)
1294 slaves_count = rte_eth_bond_slaves_get(test_params.bonded_port_id,
1295 slaves, RTE_DIM(slaves));
1297 if (slaves_count != 0)
1300 TEST_ASSERT_EQUAL(env_state, 0,
1301 "Environment not clean (port %u):%s%s%s%s%s",
1303 env_state & 0x01 ? " slave rx queue not clean" : "",
1304 env_state & 0x02 ? " slave tx queue not clean" : "",
1305 env_state & 0x04 ? " port marked as enslaved" : "",
1306 env_state & 0x80 ? " slave state is not reset" : "",
1307 env_state & 0x10 ? " slave count not equal 0" : ".");
1310 return TEST_SUCCESS;
1314 test_mode4_executor(int (*test_func)(void))
1316 struct slave_conf *port;
1321 /* Check if environment is clean. Fail to launch a test if there was
1322 * a critical error before that prevented to reset environment. */
1323 TEST_ASSERT_SUCCESS(check_environment(),
1324 "Refusing to launch test in dirty environment.");
1326 RTE_VERIFY(test_func != NULL);
1327 test_result = (*test_func)();
1329 /* If test succeed check if environment wast left in good condition. */
1330 if (test_result == TEST_SUCCESS)
1331 test_result = check_environment();
1333 /* Reset environment in case test failed to do that. */
1334 if (test_result != TEST_SUCCESS) {
1335 TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(),
1336 "Failed to stop bonded device");
1338 FOR_EACH_PORT(i, port) {
1339 while (rte_ring_count(port->rx_queue) != 0) {
1340 if (rte_ring_dequeue(port->rx_queue, &pkt) == 0)
1341 rte_pktmbuf_free(pkt);
1344 while (rte_ring_count(port->tx_queue) != 0) {
1345 if (rte_ring_dequeue(port->tx_queue, &pkt) == 0)
1346 rte_pktmbuf_free(pkt);
1355 test_mode4_lacp_wrapper(void)
1357 return test_mode4_executor(&test_mode4_lacp);
1361 test_mode4_marker_wrapper(void)
1363 return test_mode4_executor(&test_mode4_marker);
1367 test_mode4_rx_wrapper(void)
1369 return test_mode4_executor(&test_mode4_rx);
1373 test_mode4_tx_burst_wrapper(void)
1375 return test_mode4_executor(&test_mode4_tx_burst);
1379 test_mode4_expired_wrapper(void)
1381 return test_mode4_executor(&test_mode4_expired);
1384 static struct unit_test_suite link_bonding_mode4_test_suite = {
1385 .suite_name = "Link Bonding mode 4 Unit Test Suite",
1386 .setup = test_setup,
1387 .teardown = testsuite_teardown,
1388 .unit_test_cases = {
1389 TEST_CASE_NAMED("test_mode4_lacp", test_mode4_lacp_wrapper),
1390 TEST_CASE_NAMED("test_mode4_rx", test_mode4_rx_wrapper),
1391 TEST_CASE_NAMED("test_mode4_tx_burst", test_mode4_tx_burst_wrapper),
1392 TEST_CASE_NAMED("test_mode4_marker", test_mode4_marker_wrapper),
1393 TEST_CASE_NAMED("test_mode4_expired", test_mode4_expired_wrapper),
1395 TEST_CASES_END() /**< NULL terminate unit test array */
1400 test_link_bonding_mode4(void)
1402 return unit_test_suite_runner(&link_bonding_mode4_test_suite);
1405 static struct test_command link_bonding_cmd = {
1406 .command = "link_bonding_mode4_autotest",
1407 .callback = test_link_bonding_mode4,
1410 REGISTER_TEST_COMMAND(link_bonding_cmd);