uint16_t default_slave = 0;
uint8_t mode_count_id, mode_band_id;
struct rte_eth_link link_info;
+ int ret;
slaves = internals->active_slaves;
slaves_count = internals->active_slave_count;
if (agg->aggregator_port_id != slaves[i])
continue;
+ ret = rte_eth_link_get_nowait(slaves[i], &link_info);
+ if (ret < 0) {
+ RTE_BOND_LOG(ERR,
+ "Slave (port %u) link get failed: %s\n",
+ slaves[i], rte_strerror(-ret));
+ continue;
+ }
agg_count[agg->aggregator_port_id] += 1;
- rte_eth_link_get_nowait(slaves[i], &link_info);
agg_bandwidth[agg->aggregator_port_id] += link_info.link_speed;
/* Actors system ID is not checked since all slave device have the same
/* Update link status on each port */
for (i = 0; i < internals->active_slave_count; i++) {
uint16_t key;
+ int ret;
slave_id = internals->active_slaves[i];
- rte_eth_link_get_nowait(slave_id, &link_info);
- rte_eth_macaddr_get(slave_id, &slave_addr);
+ ret = rte_eth_link_get_nowait(slave_id, &link_info);
+ if (ret < 0) {
+ RTE_BOND_LOG(ERR,
+ "Slave (port %u) link get failed: %s\n",
+ slave_id, rte_strerror(-ret));
+ }
- if (link_info.link_status != 0) {
+ if (ret >= 0 && link_info.link_status != 0) {
key = link_speed_key(link_info.link_speed) << 1;
if (link_info.link_duplex == ETH_LINK_FULL_DUPLEX)
key |= BOND_LINK_FULL_DUPLEX_KEY;
- } else
+ } else {
key = 0;
+ }
+ rte_eth_macaddr_get(slave_id, &slave_addr);
port = &bond_mode_8023ad_ports[slave_id];
key = rte_cpu_to_be_16(key);
}
}
- /* Add slave details to bonded device */
- slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
-
/* Update all slave devices MACs */
mac_address_slaves_update(bonded_eth_dev);
/* If bonded device is started then we can add the slave to our active
* slave array */
if (bonded_eth_dev->data->dev_started) {
- rte_eth_link_get_nowait(slave_port_id, &link_props);
+ ret = rte_eth_link_get_nowait(slave_port_id, &link_props);
+ if (ret < 0) {
+ rte_eth_dev_callback_unregister(slave_port_id,
+ RTE_ETH_EVENT_INTR_LSC,
+ bond_ethdev_lsc_event_callback,
+ &bonded_eth_dev->data->port_id);
+ internals->slave_count--;
+ RTE_BOND_LOG(ERR,
+ "Slave (port %u) link get failed: %s\n",
+ slave_port_id, rte_strerror(-ret));
+ return -1;
+ }
if (link_props.link_status == ETH_LINK_UP) {
if (internals->active_slave_count == 0 &&
}
}
+ /* Add slave details to bonded device */
+ slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
+
slave_vlan_filter_set(bonded_port_id, slave_port_id);
return 0;
struct bwg_slave *bwg_slave)
{
struct rte_eth_link link_status;
+ int ret;
- rte_eth_link_get_nowait(port_id, &link_status);
+ ret = rte_eth_link_get_nowait(port_id, &link_status);
+ if (ret < 0) {
+ RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s",
+ port_id, rte_strerror(-ret));
+ return;
+ }
uint64_t link_bwg = link_status.link_speed * 1000000ULL / 8;
if (link_bwg == 0)
return;
struct bond_dev_private *bond_ctx;
struct rte_eth_link slave_link;
+ bool one_link_update_succeeded;
uint32_t idx;
+ int ret;
bond_ctx = ethdev->data->dev_private;
* greater than this are attempted
*/
for (idx = 0; idx < bond_ctx->active_slave_count; idx++) {
- link_update(bond_ctx->active_slaves[idx], &slave_link);
+ ret = link_update(bond_ctx->active_slaves[idx],
+ &slave_link);
+ if (ret < 0) {
+ ethdev->data->dev_link.link_speed =
+ ETH_SPEED_NUM_NONE;
+ RTE_BOND_LOG(ERR,
+ "Slave (port %u) link get failed: %s",
+ bond_ctx->active_slaves[idx],
+ rte_strerror(-ret));
+ return 0;
+ }
if (slave_link.link_speed <
ethdev->data->dev_link.link_speed)
break;
case BONDING_MODE_ACTIVE_BACKUP:
/* Current primary slave */
- link_update(bond_ctx->current_primary_port, &slave_link);
+ ret = link_update(bond_ctx->current_primary_port, &slave_link);
+ if (ret < 0) {
+ RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s",
+ bond_ctx->current_primary_port,
+ rte_strerror(-ret));
+ return 0;
+ }
ethdev->data->dev_link.link_speed = slave_link.link_speed;
break;
* of all the slaves
*/
ethdev->data->dev_link.link_speed = ETH_SPEED_NUM_NONE;
+ one_link_update_succeeded = false;
for (idx = 0; idx < bond_ctx->active_slave_count; idx++) {
- link_update(bond_ctx->active_slaves[idx], &slave_link);
+ ret = link_update(bond_ctx->active_slaves[idx],
+ &slave_link);
+ if (ret < 0) {
+ RTE_BOND_LOG(ERR,
+ "Slave (port %u) link get failed: %s",
+ bond_ctx->active_slaves[idx],
+ rte_strerror(-ret));
+ continue;
+ }
+ one_link_update_succeeded = true;
ethdev->data->dev_link.link_speed +=
slave_link.link_speed;
}
+
+ if (!one_link_update_succeeded) {
+ RTE_BOND_LOG(ERR, "All slaves link get failed");
+ return 0;
+ }
}
struct bond_dev_private *internals;
struct rte_eth_link link;
int rc = -1;
+ int ret;
uint8_t lsc_flag = 0;
int valid_slave = 0;
active_pos = find_slave_by_id(internals->active_slaves,
internals->active_slave_count, port_id);
- rte_eth_link_get_nowait(port_id, &link);
- if (link.link_status) {
+ ret = rte_eth_link_get_nowait(port_id, &link);
+ if (ret < 0)
+ RTE_BOND_LOG(ERR, "Slave (port %u) link get failed", port_id);
+
+ if (ret == 0 && link.link_status) {
if (active_pos < internals->active_slave_count)
goto link_update;