4 * Copyright(c) 2010-2016 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.
37 #include <rte_malloc.h>
38 #include <rte_ethdev.h>
41 #include "rte_eth_bond.h"
42 #include "rte_eth_bond_private.h"
43 #include "rte_eth_bond_8023ad_private.h"
45 #define DEFAULT_POLLING_INTERVAL_10_MS (10)
47 const char pmd_bond_driver_name[] = "rte_bond_pmd";
50 check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev)
52 /* Check valid pointer */
53 if (eth_dev->data->drv_name == NULL)
56 /* return 0 if driver name matches */
57 return eth_dev->data->drv_name != pmd_bond_driver_name;
61 valid_bonded_port_id(uint8_t port_id)
63 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
64 return check_for_bonded_ethdev(&rte_eth_devices[port_id]);
68 valid_slave_port_id(uint8_t port_id)
70 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
72 /* Verify that port_id refers to a non bonded port */
73 if (check_for_bonded_ethdev(&rte_eth_devices[port_id]) == 0)
80 activate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
82 struct bond_dev_private *internals = eth_dev->data->dev_private;
83 uint8_t active_count = internals->active_slave_count;
85 if (internals->mode == BONDING_MODE_8023AD)
86 bond_mode_8023ad_activate_slave(eth_dev, port_id);
88 if (internals->mode == BONDING_MODE_TLB
89 || internals->mode == BONDING_MODE_ALB) {
91 internals->tlb_slaves_order[active_count] = port_id;
94 RTE_ASSERT(internals->active_slave_count <
95 (RTE_DIM(internals->active_slaves) - 1));
97 internals->active_slaves[internals->active_slave_count] = port_id;
98 internals->active_slave_count++;
100 if (internals->mode == BONDING_MODE_TLB)
101 bond_tlb_activate_slave(internals);
102 if (internals->mode == BONDING_MODE_ALB)
103 bond_mode_alb_client_list_upd(eth_dev);
107 deactivate_slave(struct rte_eth_dev *eth_dev, uint8_t port_id)
110 struct bond_dev_private *internals = eth_dev->data->dev_private;
111 uint8_t active_count = internals->active_slave_count;
113 if (internals->mode == BONDING_MODE_8023AD) {
114 bond_mode_8023ad_stop(eth_dev);
115 bond_mode_8023ad_deactivate_slave(eth_dev, port_id);
116 } else if (internals->mode == BONDING_MODE_TLB
117 || internals->mode == BONDING_MODE_ALB)
118 bond_tlb_disable(internals);
120 slave_pos = find_slave_by_id(internals->active_slaves, active_count,
123 /* If slave was not at the end of the list
124 * shift active slaves up active array list */
125 if (slave_pos < active_count) {
127 memmove(internals->active_slaves + slave_pos,
128 internals->active_slaves + slave_pos + 1,
129 (active_count - slave_pos) *
130 sizeof(internals->active_slaves[0]));
133 RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
134 internals->active_slave_count = active_count;
136 if (eth_dev->data->dev_started) {
137 if (internals->mode == BONDING_MODE_8023AD) {
138 bond_mode_8023ad_start(eth_dev);
139 } else if (internals->mode == BONDING_MODE_TLB) {
140 bond_tlb_enable(internals);
141 } else if (internals->mode == BONDING_MODE_ALB) {
142 bond_tlb_enable(internals);
143 bond_mode_alb_client_list_upd(eth_dev);
149 number_of_sockets(void)
153 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
155 for (i = 0; ((i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL)); i++) {
156 if (sockets < ms[i].socket_id)
157 sockets = ms[i].socket_id;
160 /* Number of sockets = maximum socket_id + 1 */
165 rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
167 struct bond_dev_private *internals = NULL;
168 struct rte_eth_dev *eth_dev = NULL;
170 /* now do all data allocation - for eth_dev structure, dummy pci driver
171 * and internal (private) data
175 RTE_BOND_LOG(ERR, "Invalid name specified");
179 if (socket_id >= number_of_sockets()) {
181 "Invalid socket id specified to create bonded device on.");
185 internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
186 if (internals == NULL) {
187 RTE_BOND_LOG(ERR, "Unable to malloc internals on socket");
191 /* reserve an ethdev entry */
192 eth_dev = rte_eth_dev_allocate(name, RTE_ETH_DEV_VIRTUAL);
193 if (eth_dev == NULL) {
194 RTE_BOND_LOG(ERR, "Unable to allocate rte_eth_dev");
198 eth_dev->data->dev_private = internals;
199 eth_dev->data->nb_rx_queues = (uint16_t)1;
200 eth_dev->data->nb_tx_queues = (uint16_t)1;
202 TAILQ_INIT(&(eth_dev->link_intr_cbs));
204 eth_dev->data->dev_link.link_status = ETH_LINK_DOWN;
206 eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
208 if (eth_dev->data->mac_addrs == NULL) {
209 RTE_BOND_LOG(ERR, "Unable to malloc mac_addrs");
213 eth_dev->data->dev_started = 0;
214 eth_dev->data->promiscuous = 0;
215 eth_dev->data->scattered_rx = 0;
216 eth_dev->data->all_multicast = 0;
218 eth_dev->dev_ops = &default_dev_ops;
219 eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
220 RTE_ETH_DEV_DETACHABLE;
221 eth_dev->driver = NULL;
222 eth_dev->data->kdrv = RTE_KDRV_NONE;
223 eth_dev->data->drv_name = pmd_bond_driver_name;
224 eth_dev->data->numa_node = socket_id;
226 rte_spinlock_init(&internals->lock);
228 internals->port_id = eth_dev->data->port_id;
229 internals->mode = BONDING_MODE_INVALID;
230 internals->current_primary_port = RTE_MAX_ETHPORTS + 1;
231 internals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;
232 internals->xmit_hash = xmit_l2_hash;
233 internals->user_defined_mac = 0;
234 internals->link_props_set = 0;
236 internals->link_status_polling_enabled = 0;
238 internals->link_status_polling_interval_ms = DEFAULT_POLLING_INTERVAL_10_MS;
239 internals->link_down_delay_ms = 0;
240 internals->link_up_delay_ms = 0;
242 internals->slave_count = 0;
243 internals->active_slave_count = 0;
244 internals->rx_offload_capa = 0;
245 internals->tx_offload_capa = 0;
247 /* Initially allow to choose any offload type */
248 internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
250 memset(internals->active_slaves, 0, sizeof(internals->active_slaves));
251 memset(internals->slaves, 0, sizeof(internals->slaves));
253 /* Set mode 4 default configuration */
254 bond_mode_8023ad_setup(eth_dev, NULL);
255 if (bond_ethdev_mode_set(eth_dev, mode)) {
256 RTE_BOND_LOG(ERR, "Failed to set bonded device %d mode too %d",
257 eth_dev->data->port_id, mode);
261 return eth_dev->data->port_id;
265 if (eth_dev != NULL) {
266 rte_free(eth_dev->data->mac_addrs);
267 rte_eth_dev_release_port(eth_dev);
273 rte_eth_bond_free(const char *name)
275 struct rte_eth_dev *eth_dev = NULL;
276 struct bond_dev_private *internals;
278 /* now free all data allocation - for eth_dev structure,
279 * dummy pci driver and internal (private) data
282 /* find an ethdev entry */
283 eth_dev = rte_eth_dev_allocated(name);
287 internals = eth_dev->data->dev_private;
288 if (internals->slave_count != 0)
291 if (eth_dev->data->dev_started == 1) {
292 bond_ethdev_stop(eth_dev);
293 bond_ethdev_close(eth_dev);
296 eth_dev->dev_ops = NULL;
297 eth_dev->rx_pkt_burst = NULL;
298 eth_dev->tx_pkt_burst = NULL;
300 rte_free(eth_dev->data->dev_private);
301 rte_free(eth_dev->data->mac_addrs);
303 rte_eth_dev_release_port(eth_dev);
309 __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
311 struct rte_eth_dev *bonded_eth_dev, *slave_eth_dev;
312 struct bond_dev_private *internals;
313 struct rte_eth_link link_props;
314 struct rte_eth_dev_info dev_info;
316 if (valid_slave_port_id(slave_port_id) != 0)
319 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
320 internals = bonded_eth_dev->data->dev_private;
322 slave_eth_dev = &rte_eth_devices[slave_port_id];
323 if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_BONDED_SLAVE) {
324 RTE_BOND_LOG(ERR, "Slave device is already a slave of a bonded device");
328 /* Add slave details to bonded device */
329 slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
330 slave_add(internals, slave_eth_dev);
332 rte_eth_dev_info_get(slave_port_id, &dev_info);
334 /* We need to store slaves reta_size to be able to synchronize RETA for all
335 * slave devices even if its sizes are different.
337 internals->slaves[internals->slave_count].reta_size = dev_info.reta_size;
339 if (internals->slave_count < 1) {
340 /* if MAC is not user defined then use MAC of first slave add to
342 if (!internals->user_defined_mac)
343 mac_address_set(bonded_eth_dev, slave_eth_dev->data->mac_addrs);
345 /* Inherit eth dev link properties from first slave */
346 link_properties_set(bonded_eth_dev,
347 &(slave_eth_dev->data->dev_link));
349 /* Make primary slave */
350 internals->primary_port = slave_port_id;
351 internals->current_primary_port = slave_port_id;
353 /* Inherit queues settings from first slave */
354 internals->nb_rx_queues = slave_eth_dev->data->nb_rx_queues;
355 internals->nb_tx_queues = slave_eth_dev->data->nb_tx_queues;
357 internals->reta_size = dev_info.reta_size;
359 /* Take the first dev's offload capabilities */
360 internals->rx_offload_capa = dev_info.rx_offload_capa;
361 internals->tx_offload_capa = dev_info.tx_offload_capa;
362 internals->flow_type_rss_offloads = dev_info.flow_type_rss_offloads;
365 /* Check slave link properties are supported if props are set,
366 * all slaves must be the same */
367 if (internals->link_props_set) {
368 if (link_properties_valid(&(bonded_eth_dev->data->dev_link),
369 &(slave_eth_dev->data->dev_link))) {
370 slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
372 "Slave port %d link speed/duplex not supported",
377 link_properties_set(bonded_eth_dev,
378 &(slave_eth_dev->data->dev_link));
380 internals->rx_offload_capa &= dev_info.rx_offload_capa;
381 internals->tx_offload_capa &= dev_info.tx_offload_capa;
382 internals->flow_type_rss_offloads &= dev_info.flow_type_rss_offloads;
384 /* RETA size is GCD of all slaves RETA sizes, so, if all sizes will be
385 * the power of 2, the lower one is GCD
387 if (internals->reta_size > dev_info.reta_size)
388 internals->reta_size = dev_info.reta_size;
392 bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &=
393 internals->flow_type_rss_offloads;
395 internals->slave_count++;
397 /* Update all slave devices MACs*/
398 mac_address_slaves_update(bonded_eth_dev);
400 if (bonded_eth_dev->data->dev_started) {
401 if (slave_configure(bonded_eth_dev, slave_eth_dev) != 0) {
402 slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
403 RTE_BOND_LOG(ERR, "rte_bond_slaves_configure: port=%d",
409 /* Register link status change callback with bonded device pointer as
411 rte_eth_dev_callback_register(slave_port_id, RTE_ETH_EVENT_INTR_LSC,
412 bond_ethdev_lsc_event_callback, &bonded_eth_dev->data->port_id);
414 /* If bonded device is started then we can add the slave to our active
416 if (bonded_eth_dev->data->dev_started) {
417 rte_eth_link_get_nowait(slave_port_id, &link_props);
419 if (link_props.link_status == ETH_LINK_UP) {
420 if (internals->active_slave_count == 0 &&
421 !internals->user_defined_primary_port)
422 bond_ethdev_primary_set(internals,
425 if (find_slave_by_id(internals->active_slaves,
426 internals->active_slave_count,
427 slave_port_id) == internals->active_slave_count)
428 activate_slave(bonded_eth_dev, slave_port_id);
436 rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id)
438 struct rte_eth_dev *bonded_eth_dev;
439 struct bond_dev_private *internals;
443 /* Verify that port id's are valid bonded and slave ports */
444 if (valid_bonded_port_id(bonded_port_id) != 0)
447 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
448 internals = bonded_eth_dev->data->dev_private;
450 rte_spinlock_lock(&internals->lock);
452 retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id);
454 rte_spinlock_unlock(&internals->lock);
460 __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)
462 struct rte_eth_dev *bonded_eth_dev;
463 struct bond_dev_private *internals;
464 struct rte_eth_dev *slave_eth_dev;
467 if (valid_slave_port_id(slave_port_id) != 0)
470 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
471 internals = bonded_eth_dev->data->dev_private;
473 /* first remove from active slave list */
474 slave_idx = find_slave_by_id(internals->active_slaves,
475 internals->active_slave_count, slave_port_id);
477 if (slave_idx < internals->active_slave_count)
478 deactivate_slave(bonded_eth_dev, slave_port_id);
481 /* now find in slave list */
482 for (i = 0; i < internals->slave_count; i++)
483 if (internals->slaves[i].port_id == slave_port_id) {
489 RTE_BOND_LOG(ERR, "Couldn't find slave in port list, slave count %d",
490 internals->slave_count);
494 /* Un-register link status change callback with bonded device pointer as
496 rte_eth_dev_callback_unregister(slave_port_id, RTE_ETH_EVENT_INTR_LSC,
497 bond_ethdev_lsc_event_callback,
498 &rte_eth_devices[bonded_port_id].data->port_id);
500 /* Restore original MAC address of slave device */
501 mac_address_set(&rte_eth_devices[slave_port_id],
502 &(internals->slaves[slave_idx].persisted_mac_addr));
504 slave_eth_dev = &rte_eth_devices[slave_port_id];
505 slave_remove(internals, slave_eth_dev);
506 slave_eth_dev->data->dev_flags &= (~RTE_ETH_DEV_BONDED_SLAVE);
508 /* first slave in the active list will be the primary by default,
509 * otherwise use first device in list */
510 if (internals->current_primary_port == slave_port_id) {
511 if (internals->active_slave_count > 0)
512 internals->current_primary_port = internals->active_slaves[0];
513 else if (internals->slave_count > 0)
514 internals->current_primary_port = internals->slaves[0].port_id;
516 internals->primary_port = 0;
519 if (internals->active_slave_count < 1) {
520 /* reset device link properties as no slaves are active */
521 link_properties_reset(&rte_eth_devices[bonded_port_id]);
523 /* if no slaves are any longer attached to bonded device and MAC is not
524 * user defined then clear MAC of bonded device as it will be reset
525 * when a new slave is added */
526 if (internals->slave_count < 1 && !internals->user_defined_mac)
527 memset(rte_eth_devices[bonded_port_id].data->mac_addrs, 0,
528 sizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs)));
530 if (internals->slave_count == 0) {
531 internals->rx_offload_capa = 0;
532 internals->tx_offload_capa = 0;
533 internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;
534 internals->reta_size = 0;
540 rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id)
542 struct rte_eth_dev *bonded_eth_dev;
543 struct bond_dev_private *internals;
546 if (valid_bonded_port_id(bonded_port_id) != 0)
549 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
550 internals = bonded_eth_dev->data->dev_private;
552 rte_spinlock_lock(&internals->lock);
554 retval = __eth_bond_slave_remove_lock_free(bonded_port_id, slave_port_id);
556 rte_spinlock_unlock(&internals->lock);
562 rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode)
564 if (valid_bonded_port_id(bonded_port_id) != 0)
567 return bond_ethdev_mode_set(&rte_eth_devices[bonded_port_id], mode);
571 rte_eth_bond_mode_get(uint8_t bonded_port_id)
573 struct bond_dev_private *internals;
575 if (valid_bonded_port_id(bonded_port_id) != 0)
578 internals = rte_eth_devices[bonded_port_id].data->dev_private;
580 return internals->mode;
584 rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id)
586 struct bond_dev_private *internals;
588 if (valid_bonded_port_id(bonded_port_id) != 0)
591 if (valid_slave_port_id(slave_port_id) != 0)
594 internals = rte_eth_devices[bonded_port_id].data->dev_private;
596 internals->user_defined_primary_port = 1;
597 internals->primary_port = slave_port_id;
599 bond_ethdev_primary_set(internals, slave_port_id);
605 rte_eth_bond_primary_get(uint8_t bonded_port_id)
607 struct bond_dev_private *internals;
609 if (valid_bonded_port_id(bonded_port_id) != 0)
612 internals = rte_eth_devices[bonded_port_id].data->dev_private;
614 if (internals->slave_count < 1)
617 return internals->current_primary_port;
621 rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len)
623 struct bond_dev_private *internals;
626 if (valid_bonded_port_id(bonded_port_id) != 0)
632 internals = rte_eth_devices[bonded_port_id].data->dev_private;
634 if (internals->slave_count > len)
637 for (i = 0; i < internals->slave_count; i++)
638 slaves[i] = internals->slaves[i].port_id;
640 return internals->slave_count;
644 rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],
647 struct bond_dev_private *internals;
649 if (valid_bonded_port_id(bonded_port_id) != 0)
655 internals = rte_eth_devices[bonded_port_id].data->dev_private;
657 if (internals->active_slave_count > len)
660 memcpy(slaves, internals->active_slaves, internals->active_slave_count);
662 return internals->active_slave_count;
666 rte_eth_bond_mac_address_set(uint8_t bonded_port_id,
667 struct ether_addr *mac_addr)
669 struct rte_eth_dev *bonded_eth_dev;
670 struct bond_dev_private *internals;
672 if (valid_bonded_port_id(bonded_port_id) != 0)
675 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
676 internals = bonded_eth_dev->data->dev_private;
678 /* Set MAC Address of Bonded Device */
679 if (mac_address_set(bonded_eth_dev, mac_addr))
682 internals->user_defined_mac = 1;
684 /* Update all slave devices MACs*/
685 if (internals->slave_count > 0)
686 return mac_address_slaves_update(bonded_eth_dev);
692 rte_eth_bond_mac_address_reset(uint8_t bonded_port_id)
694 struct rte_eth_dev *bonded_eth_dev;
695 struct bond_dev_private *internals;
697 if (valid_bonded_port_id(bonded_port_id) != 0)
700 bonded_eth_dev = &rte_eth_devices[bonded_port_id];
701 internals = bonded_eth_dev->data->dev_private;
703 internals->user_defined_mac = 0;
705 if (internals->slave_count > 0) {
706 /* Set MAC Address of Bonded Device */
707 if (mac_address_set(bonded_eth_dev,
708 &internals->slaves[internals->primary_port].persisted_mac_addr)
710 RTE_BOND_LOG(ERR, "Failed to set MAC address on bonded device");
713 /* Update all slave devices MAC addresses */
714 return mac_address_slaves_update(bonded_eth_dev);
716 /* No need to update anything as no slaves present */
721 rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy)
723 struct bond_dev_private *internals;
725 if (valid_bonded_port_id(bonded_port_id) != 0)
728 internals = rte_eth_devices[bonded_port_id].data->dev_private;
731 case BALANCE_XMIT_POLICY_LAYER2:
732 internals->balance_xmit_policy = policy;
733 internals->xmit_hash = xmit_l2_hash;
735 case BALANCE_XMIT_POLICY_LAYER23:
736 internals->balance_xmit_policy = policy;
737 internals->xmit_hash = xmit_l23_hash;
739 case BALANCE_XMIT_POLICY_LAYER34:
740 internals->balance_xmit_policy = policy;
741 internals->xmit_hash = xmit_l34_hash;
751 rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id)
753 struct bond_dev_private *internals;
755 if (valid_bonded_port_id(bonded_port_id) != 0)
758 internals = rte_eth_devices[bonded_port_id].data->dev_private;
760 return internals->balance_xmit_policy;
764 rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms)
766 struct bond_dev_private *internals;
768 if (valid_bonded_port_id(bonded_port_id) != 0)
771 internals = rte_eth_devices[bonded_port_id].data->dev_private;
772 internals->link_status_polling_interval_ms = internal_ms;
778 rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id)
780 struct bond_dev_private *internals;
782 if (valid_bonded_port_id(bonded_port_id) != 0)
785 internals = rte_eth_devices[bonded_port_id].data->dev_private;
787 return internals->link_status_polling_interval_ms;
791 rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
794 struct bond_dev_private *internals;
796 if (valid_bonded_port_id(bonded_port_id) != 0)
799 internals = rte_eth_devices[bonded_port_id].data->dev_private;
800 internals->link_down_delay_ms = delay_ms;
806 rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id)
808 struct bond_dev_private *internals;
810 if (valid_bonded_port_id(bonded_port_id) != 0)
813 internals = rte_eth_devices[bonded_port_id].data->dev_private;
815 return internals->link_down_delay_ms;
819 rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)
822 struct bond_dev_private *internals;
824 if (valid_bonded_port_id(bonded_port_id) != 0)
827 internals = rte_eth_devices[bonded_port_id].data->dev_private;
828 internals->link_up_delay_ms = delay_ms;
834 rte_eth_bond_link_up_prop_delay_get(uint8_t bonded_port_id)
836 struct bond_dev_private *internals;
838 if (valid_bonded_port_id(bonded_port_id) != 0)
841 internals = rte_eth_devices[bonded_port_id].data->dev_private;
843 return internals->link_up_delay_ms;