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_PAYLOAD_SIZE (2048)
69 #define MBUF_SIZE (MBUF_PAYLOAD_SIZE + sizeof(struct rte_mbuf) + \
71 #define MBUF_CACHE_SIZE (250)
72 #define BURST_SIZE (32)
74 #define DEFAULT_MBUF_DATA_SIZE (2048)
75 #define TEST_RX_DESC_MAX (2048)
76 #define TEST_TX_DESC_MAX (2048)
77 #define MAX_PKT_BURST (32)
78 #define DEF_PKT_BURST (16)
80 #define BONDED_DEV_NAME ("unit_test_mode4_bond_dev")
82 #define SLAVE_DEV_NAME_FMT ("unit_test_mode4_slave_%d")
83 #define SLAVE_RX_QUEUE_FMT ("unit_test_mode4_slave_%d_rx")
84 #define SLAVE_TX_QUEUE_FMT ("unit_test_mode4_slave_%d_tx")
86 #define INVALID_SOCKET_ID (-1)
87 #define INVALID_PORT_ID (0xFF)
88 #define INVALID_BONDING_MODE (-1)
90 static const struct ether_addr slave_mac_default = {
91 { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 }
94 static const struct ether_addr parnter_mac_default = {
95 { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 }
98 static const struct ether_addr parnter_system = {
99 { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 }
102 static const struct ether_addr slow_protocol_mac_addr = {
103 { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 }
107 struct rte_ring *rx_queue;
108 struct rte_ring *tx_queue;
112 uint8_t lacp_parnter_state;
115 struct ether_vlan_hdr {
116 struct ether_hdr pkt_eth_hdr;
117 struct vlan_hdr vlan_hdr;
120 struct link_bonding_unittest_params {
121 uint8_t bonded_port_id;
122 struct slave_conf slave_ports[SLAVE_COUNT];
124 struct rte_mempool *mbuf_pool;
127 #define TEST_DEFAULT_SLAVE_COUNT RTE_DIM(test_params.slave_ports)
128 #define TEST_RX_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT
129 #define TEST_TX_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
130 #define TEST_MARKER_SLAVE_COUT TEST_DEFAULT_SLAVE_COUNT
131 #define TEST_EXPIRED_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
132 #define TEST_PROMISC_SLAVE_COUNT TEST_DEFAULT_SLAVE_COUNT
134 static struct link_bonding_unittest_params test_params = {
135 .bonded_port_id = INVALID_PORT_ID,
136 .slave_ports = { [0 ... SLAVE_COUNT - 1] = { .port_id = INVALID_PORT_ID} },
141 static struct rte_eth_conf default_pmd_conf = {
143 .mq_mode = ETH_MQ_RX_NONE,
144 .max_rx_pkt_len = ETHER_MAX_LEN,
146 .header_split = 0, /**< Header Split disabled */
147 .hw_ip_checksum = 0, /**< IP checksum offload enabled */
148 .hw_vlan_filter = 0, /**< VLAN filtering disabled */
149 .jumbo_frame = 0, /**< Jumbo Frame Support disabled */
150 .hw_strip_crc = 0, /**< CRC stripped by hardware */
153 .mq_mode = ETH_MQ_TX_NONE,
158 #define FOR_EACH(_i, _item, _array, _size) \
159 for (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++)
161 /* Macro for iterating over every port that can be used as a slave
163 * _i variable used as an index in test_params->slave_ports
164 * _slave pointer to &test_params->slave_ports[_idx]
166 #define FOR_EACH_PORT(_i, _port) \
167 FOR_EACH(_i, _port, test_params.slave_ports, \
168 RTE_DIM(test_params.slave_ports))
170 /* Macro for iterating over every port that can be used as a slave
171 * in this test and satisfy given condition.
173 * _i variable used as an index in test_params->slave_ports
174 * _slave pointer to &test_params->slave_ports[_idx]
175 * _condition condition that need to be checked
177 #define FOR_EACH_PORT_IF(_i, _port, _condition) FOR_EACH_PORT((_i), (_port)) \
180 /* Macro for iterating over every port that is currently a slave of a bonded
182 * _i variable used as an index in test_params->slave_ports
183 * _slave pointer to &test_params->slave_ports[_idx]
185 #define FOR_EACH_SLAVE(_i, _slave) \
186 FOR_EACH_PORT_IF(_i, _slave, (_slave)->bonded != 0)
189 * Returns packets from slaves TX queue.
192 * size size of buffer
193 * return number of packets or negative error number
196 slave_get_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size)
198 return rte_ring_dequeue_burst(slave->tx_queue, (void **)buf, size);
202 * Injects given packets into slaves RX queue.
205 * size number of packets to be injected
206 * return number of queued packets or negative error number
209 slave_put_pkts(struct slave_conf *slave, struct rte_mbuf **buf, uint16_t size)
211 return rte_ring_enqueue_burst(slave->rx_queue, (void **)buf, size);
215 bond_rx(struct rte_mbuf **buf, uint16_t size)
217 return rte_eth_rx_burst(test_params.bonded_port_id, 0, buf, size);
221 bond_tx(struct rte_mbuf **buf, uint16_t size)
223 return rte_eth_tx_burst(test_params.bonded_port_id, 0, buf, size);
227 free_pkts(struct rte_mbuf **pkts, uint16_t count)
231 for (i = 0; i < count; i++) {
233 rte_pktmbuf_free(pkts[i]);
238 configure_ethdev(uint8_t port_id, uint8_t start)
240 TEST_ASSERT(rte_eth_dev_configure(port_id, 1, 1, &default_pmd_conf) == 0,
241 "Failed to configure device %u", port_id);
243 TEST_ASSERT(rte_eth_rx_queue_setup(port_id, 0, RX_RING_SIZE,
244 rte_eth_dev_socket_id(port_id), NULL, test_params.mbuf_pool) == 0,
245 "Failed to setup rx queue.");
247 TEST_ASSERT(rte_eth_tx_queue_setup(port_id, 0, TX_RING_SIZE,
248 rte_eth_dev_socket_id(port_id), NULL) == 0,
249 "Failed to setup tx queue.");
252 TEST_ASSERT(rte_eth_dev_start(port_id) == 0,
253 "Failed to start device (%d).", port_id);
259 add_slave(struct slave_conf *slave, uint8_t start)
261 struct ether_addr addr, addr_check;
263 /* Some sanity check */
264 RTE_VERIFY(test_params.slave_ports <= slave &&
265 slave - test_params.slave_ports < (int)RTE_DIM(test_params.slave_ports));
266 RTE_VERIFY(slave->bonded == 0);
267 RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
269 ether_addr_copy(&slave_mac_default, &addr);
270 addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
272 rte_eth_dev_mac_addr_remove(slave->port_id, &addr);
274 TEST_ASSERT_SUCCESS(rte_eth_dev_mac_addr_add(slave->port_id, &addr, 0),
275 "Failed to set slave MAC address");
277 TEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bonded_port_id,
279 "Failed to add slave (idx=%u, id=%u) to bonding (id=%u)",
280 (uint8_t)(slave - test_params.slave_ports), slave->port_id,
281 test_params.bonded_port_id);
285 TEST_ASSERT_SUCCESS(rte_eth_dev_start(slave->port_id),
286 "Failed to start slave %u", slave->port_id);
289 rte_eth_macaddr_get(slave->port_id, &addr_check);
290 TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1,
291 "Slave MAC address is not as expected");
293 RTE_VERIFY(slave->lacp_parnter_state == 0);
298 remove_slave(struct slave_conf *slave)
300 ptrdiff_t slave_idx = slave - test_params.slave_ports;
302 RTE_VERIFY(test_params.slave_ports <= slave &&
303 slave_idx < (ptrdiff_t)RTE_DIM(test_params.slave_ports));
305 RTE_VERIFY(slave->bonded == 1);
306 RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
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_ring_count(slave->rx_queue), 0,
313 "Slave %u tx queue not empty while removing from bonding.",
316 TEST_ASSERT_EQUAL(rte_eth_bond_slave_remove(test_params.bonded_port_id,
318 "Failed to remove slave (idx=%u, id=%u) from bonding (id=%u)",
319 (uint8_t)slave_idx, slave->port_id,
320 test_params.bonded_port_id);
323 slave->lacp_parnter_state = 0;
328 initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t start)
332 RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
334 for (i = 0; i < slave_count; i++) {
335 TEST_ASSERT_SUCCESS(add_slave(&test_params.slave_ports[i], 1),
336 "Failed to add port %u to bonded device.\n",
337 test_params.slave_ports[i].port_id);
340 /* Reset mode 4 configuration */
341 rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
342 rte_eth_promiscuous_disable(test_params.bonded_port_id);
345 TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bonded_port_id),
346 "Failed to start bonded device");
352 remove_slaves_and_stop_bonded_device(void)
354 struct slave_conf *slave;
356 uint8_t slaves[RTE_MAX_ETHPORTS];
359 rte_eth_dev_stop(test_params.bonded_port_id);
361 FOR_EACH_SLAVE(i, slave)
364 retval = rte_eth_bond_slaves_get(test_params.bonded_port_id, slaves,
367 TEST_ASSERT_EQUAL(retval, 0,
368 "Expected bonded device %u have 0 slaves but returned %d.",
369 test_params.bonded_port_id, retval);
371 FOR_EACH_PORT(i, slave) {
372 rte_eth_dev_stop(slave->port_id);
374 TEST_ASSERT(slave->bonded == 0,
375 "Port id=%u is still marked as enslaved.", slave->port_id);
384 int retval, nb_mbuf_per_pool;
385 char name[RTE_ETH_NAME_MAX_LEN];
386 struct slave_conf *port;
387 const uint8_t socket_id = rte_socket_id();
390 if (test_params.mbuf_pool == NULL) {
391 nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST +
392 TEST_TX_DESC_MAX + MAX_PKT_BURST;
393 test_params.mbuf_pool = rte_mempool_create("TEST_MODE4",
394 nb_mbuf_per_pool, MBUF_SIZE, MBUF_CACHE_SIZE,
395 sizeof(struct rte_pktmbuf_pool_private),
396 rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL,
399 TEST_ASSERT(test_params.mbuf_pool != NULL,
400 "rte_mempool_create failed\n");
403 /* Create / initialize ring eth devs. */
404 FOR_EACH_PORT(i, port) {
405 port = &test_params.slave_ports[i];
407 if (port->rx_queue == NULL) {
408 retval = snprintf(name, RTE_DIM(name), SLAVE_RX_QUEUE_FMT, i);
409 TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long");
410 port->rx_queue = rte_ring_create(name, RX_RING_SIZE, socket_id, 0);
411 TEST_ASSERT(port->rx_queue != NULL,
412 "Failed to allocate rx ring '%s': %s", name,
413 rte_strerror(rte_errno));
416 if (port->tx_queue == NULL) {
417 retval = snprintf(name, RTE_DIM(name), SLAVE_TX_QUEUE_FMT, i);
418 TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long");
419 port->tx_queue = rte_ring_create(name, TX_RING_SIZE, socket_id, 0);
420 TEST_ASSERT_NOT_NULL(port->tx_queue,
421 "Failed to allocate tx ring '%s': %s", name,
422 rte_strerror(rte_errno));
425 if (port->port_id == INVALID_PORT_ID) {
426 retval = snprintf(name, RTE_DIM(name), SLAVE_DEV_NAME_FMT, i);
427 TEST_ASSERT(retval < (int)RTE_DIM(name) - 1, "Name too long");
428 retval = rte_eth_from_rings(name, &port->rx_queue, 1,
429 &port->tx_queue, 1, socket_id);
430 TEST_ASSERT(retval >= 0,
431 "Failed to create ring ethdev '%s'\n", name);
433 port->port_id = rte_eth_dev_count() - 1;
436 retval = configure_ethdev(port->port_id, 1);
437 TEST_ASSERT_SUCCESS(retval, "Failed to configure virtual ethdev %s\n",
441 if (test_params.bonded_port_id == INVALID_PORT_ID) {
442 retval = rte_eth_bond_create(BONDED_DEV_NAME, BONDING_MODE_8023AD,
445 TEST_ASSERT(retval >= 0, "Failed to create bonded ethdev %s",
448 test_params.bonded_port_id = retval;
449 TEST_ASSERT_SUCCESS(configure_ethdev(test_params.bonded_port_id, 0),
450 "Failed to configure bonded ethdev %s", BONDED_DEV_NAME);
451 } else if (rte_eth_bond_mode_get(test_params.bonded_port_id) !=
452 BONDING_MODE_8023AD) {
453 TEST_ASSERT(rte_eth_bond_mode_set(test_params.bonded_port_id,
454 BONDING_MODE_8023AD) == 0,
455 "Failed to set ethdev %d to mode %d",
456 test_params.bonded_port_id, BONDING_MODE_8023AD);
463 testsuite_teardown(void)
465 struct slave_conf *port;
469 * Any cleanup/reset state is done when particular test is
472 rte_eth_dev_stop(test_params.bonded_port_id);
474 FOR_EACH_PORT(i, port)
475 rte_eth_dev_stop(port->port_id);
481 * Check if given LACP packet. If it is, make make replay packet to force
483 * return 0 when pkt is LACP frame, 1 if it is not slow frame, 2 if it is slow
487 make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
489 struct ether_hdr *hdr;
490 struct slow_protocol_frame *slow_hdr;
494 hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
495 if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW))
498 slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
499 /* ignore packets of other types */
500 if (slow_hdr->slow_protocol.subtype != SLOW_SUBTYPE_LACP)
503 slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
505 /* Change source address to partner address */
506 ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
507 slow_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
509 lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
510 /* Save last received state */
511 slave->lacp_parnter_state = lacp->actor.state;
512 /* Change it into LACP replay by matching parameters. */
513 memcpy(&lacp->partner.port_params, &lacp->actor.port_params,
514 sizeof(struct port_params));
516 lacp->partner.state = lacp->actor.state;
518 ether_addr_copy(&parnter_system, &lacp->actor.port_params.system);
519 lacp->actor.state = STATE_LACP_ACTIVE |
520 STATE_SYNCHRONIZATION |
529 * Reads packets from given slave, search for LACP packet and reply them.
531 * Receives burst of packets from slave. Looks for LACP packet. Drops
532 * all other packets. Prepares response LACP and sends it back.
534 * return number of LACP received and replied, -1 on error.
537 bond_handshake_reply(struct slave_conf *slave)
540 struct rte_mbuf *rx_buf[MAX_PKT_BURST];
541 struct rte_mbuf *lacp_tx_buf[MAX_PKT_BURST];
542 uint16_t lacp_tx_buf_cnt = 0, i;
544 retval = slave_get_pkts(slave, rx_buf, RTE_DIM(rx_buf));
545 TEST_ASSERT(retval >= 0, "Getting slave %u packets failed.",
548 for (i = 0; i < (uint16_t)retval; i++) {
549 if (make_lacp_reply(slave, rx_buf[i]) == 0) {
550 /* reply with actor's LACP */
551 lacp_tx_buf[lacp_tx_buf_cnt++] = rx_buf[i];
553 rte_pktmbuf_free(rx_buf[i]);
556 if (lacp_tx_buf_cnt == 0)
559 retval = slave_put_pkts(slave, lacp_tx_buf, lacp_tx_buf_cnt);
560 if (retval <= lacp_tx_buf_cnt) {
561 /* retval might be negative */
562 for (i = RTE_MAX(0, retval); retval < lacp_tx_buf_cnt; retval++)
563 rte_pktmbuf_free(lacp_tx_buf[i]);
566 TEST_ASSERT_EQUAL(retval, lacp_tx_buf_cnt,
567 "Failed to equeue lacp packets into slave %u tx queue.",
570 return lacp_tx_buf_cnt;
574 * Function check if given slave tx queue contains packets that make mode 4
575 * handshake complete. It will drain slave queue.
576 * return 0 if handshake not completed, 1 if handshake was complete,
579 bond_handshake_done(struct slave_conf *slave)
581 const uint8_t expected_state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION |
582 STATE_AGGREGATION | STATE_COLLECTING | STATE_DISTRIBUTING;
584 return slave->lacp_parnter_state == expected_state;
588 bond_get_update_timeout_ms(void)
590 struct rte_eth_bond_8023ad_conf conf;
592 rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);
593 return conf.update_timeout_ms;
597 * Exchanges LACP packets with partner to achieve dynamic port configuration.
598 * return TEST_SUCCESS if initial handshake succeed, TEST_FAILED otherwise.
603 struct slave_conf *slave;
604 struct rte_mbuf *buf[MAX_PKT_BURST];
606 uint8_t all_slaves_done, i, j;
607 uint8_t status[RTE_DIM(test_params.slave_ports)] = { 0 };
608 const unsigned delay = bond_get_update_timeout_ms();
610 /* Exchange LACP frames */
612 for (i = 0; i < 30 && all_slaves_done == 0; ++i) {
616 FOR_EACH_SLAVE(j, slave) {
617 /* If response already send, skip slave */
621 if (bond_handshake_reply(slave) < 0) {
626 status[j] = bond_handshake_done(slave);
631 nb_pkts = bond_tx(NULL, 0);
632 TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets transmitted unexpectedly");
634 nb_pkts = bond_rx(buf, RTE_DIM(buf));
635 free_pkts(buf, nb_pkts);
636 TEST_ASSERT_EQUAL(nb_pkts, 0, "Packets received unexpectedly");
638 /* If response didn't send - report failure */
639 TEST_ASSERT_EQUAL(all_slaves_done, 1, "Bond handshake failed\n");
641 /* If flags doesn't match - report failure */
642 return all_slaves_done = 1 ? TEST_SUCCESS : TEST_FAILED;
645 #define TEST_LACP_SLAVE_COUT RTE_DIM(test_params.slave_ports)
647 test_mode4_lacp(void)
651 retval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 1);
652 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
654 /* Test LACP handshake function */
655 retval = bond_handshake();
656 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
658 retval = remove_slaves_and_stop_bonded_device();
659 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
665 generate_packets(struct ether_addr *src_mac,
666 struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf)
668 uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN;
669 uint8_t vlan_enable = 0;
670 uint16_t vlan_id = 0;
671 uint8_t ip4_type = 1; /* 0 - ipv6 */
673 uint16_t src_port = 10, dst_port = 20;
675 uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) };
676 uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) };
678 struct ether_hdr pkt_eth_hdr;
679 struct udp_hdr pkt_udp_hdr;
687 initialize_eth_header(&pkt_eth_hdr, src_mac, dst_mac, ip4_type,
688 vlan_enable, vlan_id);
691 initialize_ipv4_header(&pkt_ip_hdr.v4, ip_src[3], ip_dst[3], pktlen);
693 initialize_ipv6_header(&pkt_ip_hdr.v6, (uint8_t *)ip_src,
694 (uint8_t *)&ip_dst, pktlen);
696 initialize_udp_header(&pkt_udp_hdr, src_port, dst_port, 16);
698 retval = generate_packet_burst(test_params.mbuf_pool, buf,
699 &pkt_eth_hdr, vlan_enable, &pkt_ip_hdr, 1, &pkt_udp_hdr,
702 if (retval > 0 && retval != count)
703 free_pkts(&buf[count - retval], retval);
705 TEST_ASSERT_EQUAL(retval, count, "Failed to generate %u packets",
712 generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac,
713 struct ether_addr *dst_mac, uint16_t count)
715 struct rte_mbuf *pkts[MAX_PKT_BURST];
718 retval = generate_packets(src_mac, dst_mac, count, pkts);
719 if (retval != (int)count)
722 retval = slave_put_pkts(slave, pkts, count);
723 if (retval > 0 && retval != count)
724 free_pkts(&pkts[retval], count - retval);
726 TEST_ASSERT_EQUAL(retval, count,
727 "Failed to enqueue packets into slave %u RX queue", slave->port_id);
735 struct slave_conf *slave;
738 uint16_t expected_pkts_cnt;
739 struct rte_mbuf *pkts[MAX_PKT_BURST];
743 struct ether_hdr *hdr;
745 struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } };
746 struct ether_addr dst_mac;
747 struct ether_addr bonded_mac;
749 retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 1);
750 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
752 retval = bond_handshake();
753 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
755 rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
756 ether_addr_copy(&bonded_mac, &dst_mac);
758 /* Assert that dst address is not bonding address */
759 dst_mac.addr_bytes[0]++;
761 /* First try with promiscuous mode enabled.
762 * Add 2 packets to each slave. First with bonding MAC address, second with
763 * different. Check if we received all of them. */
764 rte_eth_promiscuous_enable(test_params.bonded_port_id);
766 expected_pkts_cnt = 0;
767 FOR_EACH_SLAVE(i, slave) {
768 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
769 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
772 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
773 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
776 /* Expect 2 packets per slave */
777 expected_pkts_cnt += 2;
780 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
783 if (retval == expected_pkts_cnt) {
784 int cnt[2] = { 0, 0 };
786 for (i = 0; i < expected_pkts_cnt; i++) {
787 hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *);
788 cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++;
791 free_pkts(pkts, expected_pkts_cnt);
793 /* For division by 2 expected_pkts_cnt must be even */
794 RTE_VERIFY((expected_pkts_cnt & 1) == 0);
795 TEST_ASSERT(cnt[0] == expected_pkts_cnt / 2 &&
796 cnt[1] == expected_pkts_cnt / 2,
797 "Expected %u packets with the same MAC and %u with different but "
798 "got %u with the same and %u with diffrent MAC",
799 expected_pkts_cnt / 2, expected_pkts_cnt / 2, cnt[1], cnt[0]);
800 } else if (retval > 0)
801 free_pkts(pkts, retval);
803 TEST_ASSERT_EQUAL(retval, expected_pkts_cnt,
804 "Expected %u packets but received only %d", expected_pkts_cnt, retval);
806 /* Now, disable promiscuous mode. When promiscuous mode is disabled we
807 * expect to receive only packets that are directed to bonding port. */
808 rte_eth_promiscuous_disable(test_params.bonded_port_id);
810 expected_pkts_cnt = 0;
811 FOR_EACH_SLAVE(i, slave) {
812 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
813 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
816 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
817 TEST_ASSERT_SUCCESS(retval, "Failed to enqueue packets to slave %u",
820 /* Expect only one packet per slave */
821 expected_pkts_cnt += 1;
824 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
827 if (retval == expected_pkts_cnt) {
830 for (i = 0; i < expected_pkts_cnt; i++) {
831 hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *);
832 eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac);
835 free_pkts(pkts, expected_pkts_cnt);
836 TEST_ASSERT_EQUAL(eq_cnt, expected_pkts_cnt, "Packet address mismatch");
837 } else if (retval > 0)
838 free_pkts(pkts, retval);
840 TEST_ASSERT_EQUAL(retval, expected_pkts_cnt,
841 "Expected %u packets but received only %d", expected_pkts_cnt, retval);
843 /* Link down test: simulate link down for first slave. */
844 delay = bond_get_update_timeout_ms();
846 uint8_t slave_down_id = INVALID_PORT_ID;
848 /* Find first slave and make link down on it*/
849 FOR_EACH_SLAVE(i, slave) {
850 rte_eth_dev_set_link_down(slave->port_id);
851 slave_down_id = slave->port_id;
855 RTE_VERIFY(slave_down_id != INVALID_PORT_ID);
857 /* Give some time to rearrange bonding */
858 for (i = 0; i < 3; i++) {
863 TEST_ASSERT_SUCCESS(bond_handshake(), "Handshake after link down failed");
865 /* Put packet to each slave */
866 FOR_EACH_SLAVE(i, slave) {
869 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
870 retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
871 TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
873 src_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
874 retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
875 TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
877 retval = bond_rx(pkts, RTE_DIM(pkts));
881 free_pkts(pkts, retval);
883 while (rte_ring_dequeue(slave->rx_queue, (void **)&pkt) == 0)
884 rte_pktmbuf_free(pkt);
886 if (slave_down_id == slave->port_id)
887 TEST_ASSERT_EQUAL(retval, 0, "Packets received unexpectedly.");
889 TEST_ASSERT_NOT_EQUAL(retval, 0,
890 "Expected to receive some packets on slave %u.",
892 rte_eth_dev_start(slave->port_id);
894 for (j = 0; j < 5; j++) {
895 TEST_ASSERT(bond_handshake_reply(slave) >= 0,
896 "Handshake after link up");
898 if (bond_handshake_done(slave) == 1)
902 TEST_ASSERT(j < 5, "Failed to agregate slave after link up");
905 remove_slaves_and_stop_bonded_device();
910 test_mode4_tx_burst(void)
912 struct slave_conf *slave;
915 uint16_t exp_pkts_cnt, pkts_cnt = 0;
916 struct rte_mbuf *pkts[MAX_PKT_BURST];
920 struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } };
921 struct ether_addr bonded_mac;
923 retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 1);
924 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
926 retval = bond_handshake();
927 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
929 rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
932 for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
933 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
934 retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
937 free_pkts(pkts, pkts_cnt);
939 TEST_ASSERT_EQUAL(retval, 1, "Failed to generate packet %u", pkts_cnt);
941 exp_pkts_cnt = pkts_cnt;
943 /* Transmit packets on bonded device */
944 retval = bond_tx(pkts, pkts_cnt);
945 if (retval > 0 && retval < pkts_cnt)
946 free_pkts(&pkts[retval], pkts_cnt - retval);
948 TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed");
950 /* Check if packets were transmitted properly. Every slave should have
951 * at least one packet, and sum must match. Under normal operation
952 * there should be no LACP nor MARKER frames. */
954 FOR_EACH_SLAVE(i, slave) {
955 uint16_t normal_cnt, slow_cnt;
957 retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts));
961 for (j = 0; j < retval; j++) {
962 if (make_lacp_reply(slave, pkts[j]) == 1)
968 free_pkts(pkts, normal_cnt + slow_cnt);
969 TEST_ASSERT_EQUAL(slow_cnt, 0,
970 "slave %u unexpectedly transmitted %d SLOW packets", slave->port_id,
973 TEST_ASSERT_NOT_EQUAL(normal_cnt, 0,
974 "slave %u did not transmitted any packets", slave->port_id);
976 pkts_cnt += normal_cnt;
979 TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt,
980 "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt);
983 * simulate link down for first slave. */
984 delay = bond_get_update_timeout_ms();
986 uint8_t slave_down_id = INVALID_PORT_ID;
988 FOR_EACH_SLAVE(i, slave) {
989 rte_eth_dev_set_link_down(slave->port_id);
990 slave_down_id = slave->port_id;
994 RTE_VERIFY(slave_down_id != INVALID_PORT_ID);
996 /* Give some time to rearrange bonding. */
997 for (i = 0; i < 3; i++) {
1002 TEST_ASSERT_SUCCESS(bond_handshake(), "Handshake after link down failed");
1004 /* Prepare burst. */
1005 for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
1006 dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
1007 retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
1010 free_pkts(pkts, pkts_cnt);
1012 TEST_ASSERT_EQUAL(retval, 1, "Failed to generate test packet %u",
1015 exp_pkts_cnt = pkts_cnt;
1017 /* Transmit packets on bonded device. */
1018 retval = bond_tx(pkts, pkts_cnt);
1019 if (retval > 0 && retval < pkts_cnt)
1020 free_pkts(&pkts[retval], pkts_cnt - retval);
1022 TEST_ASSERT_EQUAL(retval, pkts_cnt, "TX on bonded device failed");
1024 /* Check if packets was transmitted properly. Every slave should have
1025 * at least one packet, and sum must match. Under normal operation
1026 * there should be no LACP nor MARKER frames. */
1028 FOR_EACH_SLAVE(i, slave) {
1029 uint16_t normal_cnt, slow_cnt;
1031 retval = slave_get_pkts(slave, pkts, RTE_DIM(pkts));
1035 for (j = 0; j < retval; j++) {
1036 if (make_lacp_reply(slave, pkts[j]) == 1)
1042 free_pkts(pkts, normal_cnt + slow_cnt);
1044 if (slave_down_id == slave->port_id) {
1045 TEST_ASSERT_EQUAL(normal_cnt + slow_cnt, 0,
1046 "slave %u enexpectedly transmitted %u packets",
1047 normal_cnt + slow_cnt, slave->port_id);
1049 TEST_ASSERT_EQUAL(slow_cnt, 0,
1050 "slave %u unexpectedly transmitted %d SLOW packets",
1051 slave->port_id, slow_cnt);
1053 TEST_ASSERT_NOT_EQUAL(normal_cnt, 0,
1054 "slave %u did not transmitted any packets", slave->port_id);
1057 pkts_cnt += normal_cnt;
1060 TEST_ASSERT_EQUAL(exp_pkts_cnt, pkts_cnt,
1061 "Expected %u packets but transmitted only %d", exp_pkts_cnt, pkts_cnt);
1063 return remove_slaves_and_stop_bonded_device();
1067 init_marker(struct rte_mbuf *pkt, struct slave_conf *slave)
1069 struct marker_header *marker_hdr = rte_pktmbuf_mtod(pkt,
1070 struct marker_header *);
1072 /* Copy multicast destination address */
1073 ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr);
1075 /* Init source address */
1076 ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
1077 marker_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN-1] = slave->port_id;
1079 marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW);
1081 marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER;
1082 marker_hdr->marker.version_number = 1;
1083 marker_hdr->marker.tlv_type_marker = MARKER_TLV_TYPE_INFO;
1084 marker_hdr->marker.info_length =
1085 offsetof(struct marker, reserved_90) -
1086 offsetof(struct marker, requester_port);
1087 RTE_VERIFY(marker_hdr->marker.info_length == 16);
1088 marker_hdr->marker.requester_port = slave->port_id + 1;
1089 marker_hdr->marker.tlv_type_terminator = TLV_TYPE_TERMINATOR_INFORMATION;
1090 marker_hdr->marker.terminator_length = 0;
1094 test_mode4_marker(void)
1096 struct slave_conf *slave;
1097 struct rte_mbuf *pkts[MAX_PKT_BURST];
1098 struct rte_mbuf *marker_pkt;
1099 struct marker_header *marker_hdr;
1105 const uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
1107 retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 1);
1108 TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device");
1110 /* Test LACP handshake function */
1111 retval = bond_handshake();
1112 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
1114 delay = bond_get_update_timeout_ms();
1115 FOR_EACH_SLAVE(i, slave) {
1116 marker_pkt = rte_pktmbuf_alloc(test_params.mbuf_pool);
1117 TEST_ASSERT_NOT_NULL(marker_pkt, "Failed to allocate marker packet");
1118 init_marker(marker_pkt, slave);
1120 retval = slave_put_pkts(slave, &marker_pkt, 1);
1122 rte_pktmbuf_free(marker_pkt);
1124 TEST_ASSERT_EQUAL(retval, 1,
1125 "Failed to send marker packet to slave %u", slave->port_id);
1127 for (j = 0; j < 20; ++j) {
1128 rte_delay_ms(delay);
1129 retval = rte_eth_rx_burst(test_params.bonded_port_id, 0, pkts,
1133 free_pkts(pkts, retval);
1135 TEST_ASSERT_EQUAL(retval, 0, "Received packets unexpectedly");
1137 retval = rte_eth_tx_burst(test_params.bonded_port_id, 0, NULL, 0);
1138 TEST_ASSERT_EQUAL(retval, 0,
1139 "Requested TX of 0 packets but %d transmitted", retval);
1141 /* Check if LACP packet was send by state machines
1142 First and only packet must be a maker response */
1143 retval = slave_get_pkts(slave, pkts, MAX_PKT_BURST);
1147 free_pkts(pkts, retval);
1149 TEST_ASSERT_EQUAL(retval, 1, "failed to get slave packets");
1152 marker_hdr = rte_pktmbuf_mtod(pkts[0], struct marker_header *);
1153 /* Check if it's slow packet*/
1154 if (marker_hdr->eth_hdr.ether_type != ethtype_slow_be)
1156 /* Check if it's marker packet */
1157 else if (marker_hdr->marker.subtype != SLOW_SUBTYPE_MARKER)
1159 else if (marker_hdr->marker.tlv_type_marker != MARKER_TLV_TYPE_RESP)
1162 free_pkts(pkts, nb_pkts);
1164 TEST_ASSERT_NOT_EQUAL(retval, -1, "Unexpected protocol type");
1165 TEST_ASSERT_NOT_EQUAL(retval, -2, "Unexpected sub protocol type");
1166 TEST_ASSERT_NOT_EQUAL(retval, -3, "Unexpected marker type");
1170 TEST_ASSERT(j < 20, "Marker response not found");
1173 retval = remove_slaves_and_stop_bonded_device();
1174 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
1176 return TEST_SUCCESS;
1180 test_mode4_expired(void)
1182 struct slave_conf *slave, *exp_slave = NULL;
1183 struct rte_mbuf *pkts[MAX_PKT_BURST];
1190 struct rte_eth_bond_8023ad_conf conf;
1192 retval = initialize_bonded_device_with_slaves(TEST_EXPIRED_SLAVE_COUNT, 1);
1193 /* Set custom timeouts to make test last shorter. */
1194 rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);
1195 conf.fast_periodic_ms = 100;
1196 conf.slow_periodic_ms = 600;
1197 conf.short_timeout_ms = 300;
1198 conf.long_timeout_ms = 900;
1199 conf.aggregate_wait_timeout_ms = 200;
1200 conf.tx_period_ms = 100;
1201 old_delay = conf.update_timeout_ms;
1202 conf.update_timeout_ms = 10;
1203 rte_eth_bond_8023ad_setup(test_params.bonded_port_id, &conf);
1205 /* Wait for new settings to be applied. */
1206 for (i = 0; i < old_delay/conf.update_timeout_ms * 2; i++) {
1207 FOR_EACH_SLAVE(j, slave)
1208 bond_handshake_reply(slave);
1210 rte_delay_ms(conf.update_timeout_ms);
1213 retval = bond_handshake();
1214 TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
1216 /* Find first slave */
1217 FOR_EACH_SLAVE(i, slave) {
1222 RTE_VERIFY(exp_slave != NULL);
1224 /* When one of partners do not send or respond to LACP frame in
1225 * conf.long_timeout_ms time, internal state machines should detect this
1226 * and transit to expired state. */
1227 for (j = 0; j < conf.long_timeout_ms/conf.update_timeout_ms + 2; j++) {
1228 rte_delay_ms(conf.update_timeout_ms);
1230 retval = bond_tx(NULL, 0);
1231 TEST_ASSERT_EQUAL(retval, 0, "Unexpectedly received %d packets",
1234 FOR_EACH_SLAVE(i, slave) {
1235 retval = bond_handshake_reply(slave);
1236 TEST_ASSERT(retval >= 0, "Handshake failed");
1238 /* Remove replay for slave that supose to be expired. */
1239 if (slave == exp_slave) {
1240 while (rte_ring_count(slave->rx_queue) > 0) {
1243 rte_ring_dequeue(slave->rx_queue, &pkt);
1244 rte_pktmbuf_free(pkt);
1249 retval = bond_rx(pkts, RTE_DIM(pkts));
1251 free_pkts(pkts, retval);
1253 TEST_ASSERT_EQUAL(retval, 0, "Unexpectedly received %d packets",
1257 /* After test only expected slave should be in EXPIRED state */
1258 FOR_EACH_SLAVE(i, slave) {
1259 if (slave == exp_slave)
1260 TEST_ASSERT(slave->lacp_parnter_state & STATE_EXPIRED,
1261 "Slave %u should be in expired.", slave->port_id);
1263 TEST_ASSERT_EQUAL(bond_handshake_done(slave), 1,
1264 "Slave %u should be operational.", slave->port_id);
1267 retval = remove_slaves_and_stop_bonded_device();
1268 TEST_ASSERT_SUCCESS(retval, "Test cleanup failed.");
1270 return TEST_SUCCESS;
1274 check_environment(void)
1276 struct slave_conf *port;
1277 uint8_t i, env_state;
1278 uint8_t slaves[RTE_DIM(test_params.slave_ports)];
1282 FOR_EACH_PORT(i, port) {
1283 if (rte_ring_count(port->rx_queue) != 0)
1286 if (rte_ring_count(port->tx_queue) != 0)
1289 if (port->bonded != 0)
1292 if (port->lacp_parnter_state != 0)
1299 slaves_count = rte_eth_bond_slaves_get(test_params.bonded_port_id,
1300 slaves, RTE_DIM(slaves));
1302 if (slaves_count != 0)
1305 TEST_ASSERT_EQUAL(env_state, 0,
1306 "Environment not clean (port %u):%s%s%s%s%s",
1308 env_state & 0x01 ? " slave rx queue not clean" : "",
1309 env_state & 0x02 ? " slave tx queue not clean" : "",
1310 env_state & 0x04 ? " port marked as enslaved" : "",
1311 env_state & 0x80 ? " slave state is not reset" : "",
1312 env_state & 0x10 ? " slave count not equal 0" : ".");
1315 return TEST_SUCCESS;
1319 test_mode4_executor(int (*test_func)(void))
1321 struct slave_conf *port;
1326 /* Check if environment is clean. Fail to launch a test if there was
1327 * a critical error before that prevented to reset environment. */
1328 TEST_ASSERT_SUCCESS(check_environment(),
1329 "Refusing to launch test in dirty environment.");
1331 RTE_VERIFY(test_func != NULL);
1332 test_result = (*test_func)();
1334 /* If test succeed check if environment wast left in good condition. */
1335 if (test_result == TEST_SUCCESS)
1336 test_result = check_environment();
1338 /* Reset environment in case test failed to do that. */
1339 if (test_result != TEST_SUCCESS) {
1340 TEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(),
1341 "Failed to stop bonded device");
1343 FOR_EACH_PORT(i, port) {
1344 while (rte_ring_count(port->rx_queue) != 0) {
1345 if (rte_ring_dequeue(port->rx_queue, &pkt) == 0)
1346 rte_pktmbuf_free(pkt);
1349 while (rte_ring_count(port->tx_queue) != 0) {
1350 if (rte_ring_dequeue(port->tx_queue, &pkt) == 0)
1351 rte_pktmbuf_free(pkt);
1360 test_mode4_lacp_wrapper(void)
1362 return test_mode4_executor(&test_mode4_lacp);
1366 test_mode4_marker_wrapper(void)
1368 return test_mode4_executor(&test_mode4_marker);
1372 test_mode4_rx_wrapper(void)
1374 return test_mode4_executor(&test_mode4_rx);
1378 test_mode4_tx_burst_wrapper(void)
1380 return test_mode4_executor(&test_mode4_tx_burst);
1384 test_mode4_expired_wrapper(void)
1386 return test_mode4_executor(&test_mode4_expired);
1389 static struct unit_test_suite link_bonding_mode4_test_suite = {
1390 .suite_name = "Link Bonding mode 4 Unit Test Suite",
1391 .setup = test_setup,
1392 .teardown = testsuite_teardown,
1393 .unit_test_cases = {
1394 TEST_CASE_NAMED("test_mode4_lacp", test_mode4_lacp_wrapper),
1395 TEST_CASE_NAMED("test_mode4_rx", test_mode4_rx_wrapper),
1396 TEST_CASE_NAMED("test_mode4_tx_burst", test_mode4_tx_burst_wrapper),
1397 TEST_CASE_NAMED("test_mode4_marker", test_mode4_marker_wrapper),
1398 TEST_CASE_NAMED("test_mode4_expired", test_mode4_expired_wrapper),
1399 { NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */
1404 test_link_bonding_mode4(void)
1406 return unit_test_suite_runner(&link_bonding_mode4_test_suite);
1409 static struct test_command link_bonding_cmd = {
1410 .command = "link_bonding_mode4_autotest",
1411 .callback = test_link_bonding_mode4,
1414 REGISTER_TEST_COMMAND(link_bonding_cmd);