X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbonding%2Frte_eth_bond_8023ad.c;h=67ca0730fa7373a80c8c4e1c5e987f44a46335b1;hb=42c40f8902f7d9cf5a51c1ec0e1bfff515b50561;hp=badcd109ae68ccd3ae72f1b0ad1cc923971e6153;hpb=b28f28ae80e5c9aac28fbc3bf0842f22dc020f31;p=dpdk.git diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index badcd109ae..67ca0730fa 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -356,16 +356,28 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, timer_set(&port->current_while_timer, timeout); ACTOR_STATE_CLR(port, EXPIRED); + SM_FLAG_CLR(port, EXPIRED); return; /* No state change */ } /* If CURRENT state timer is not running (stopped or expired) * transit to EXPIRED state from DISABLED or CURRENT */ if (!timer_is_running(&port->current_while_timer)) { - ACTOR_STATE_SET(port, EXPIRED); - PARTNER_STATE_CLR(port, SYNCHRONIZATION); - PARTNER_STATE_SET(port, LACP_SHORT_TIMEOUT); - timer_set(&port->current_while_timer, internals->mode4.short_timeout); + if (SM_FLAG(port, EXPIRED)) { + port->selected = UNSELECTED; + memcpy(&port->partner, &port->partner_admin, + sizeof(struct port_params)); + record_default(port); + ACTOR_STATE_CLR(port, EXPIRED); + timer_cancel(&port->current_while_timer); + } else { + SM_FLAG_SET(port, EXPIRED); + ACTOR_STATE_SET(port, EXPIRED); + PARTNER_STATE_CLR(port, SYNCHRONIZATION); + PARTNER_STATE_SET(port, LACP_SHORT_TIMEOUT); + timer_set(&port->current_while_timer, + internals->mode4.short_timeout); + } } } @@ -673,9 +685,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0}; uint64_t agg_count[RTE_MAX_ETHPORTS] = {0}; uint16_t default_slave = 0; - uint16_t mode_count_id; - uint16_t mode_band_id; struct rte_eth_link link_info; + uint16_t agg_new_idx = 0; int ret; slaves = internals->active_slaves; @@ -696,8 +707,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) slaves[i], rte_strerror(-ret)); continue; } - agg_count[agg->aggregator_port_id] += 1; - agg_bandwidth[agg->aggregator_port_id] += link_info.link_speed; + agg_count[i] += 1; + agg_bandwidth[i] += link_info.link_speed; /* Actors system ID is not checked since all slave device have the same * ID (MAC address). */ @@ -718,22 +729,22 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) switch (internals->mode4.agg_selection) { case AGG_COUNT: - mode_count_id = max_index(agg_count, slaves_count); - new_agg_id = mode_count_id; + agg_new_idx = max_index(agg_count, slaves_count); + new_agg_id = slaves[agg_new_idx]; break; case AGG_BANDWIDTH: - mode_band_id = max_index(agg_bandwidth, slaves_count); - new_agg_id = mode_band_id; + agg_new_idx = max_index(agg_bandwidth, slaves_count); + new_agg_id = slaves[agg_new_idx]; break; case AGG_STABLE: if (default_slave == slaves_count) - new_agg_id = slave_id; + new_agg_id = slaves[slave_id]; else new_agg_id = slaves[default_slave]; break; default: if (default_slave == slaves_count) - new_agg_id = slave_id; + new_agg_id = slaves[slave_id]; else new_agg_id = slaves[default_slave]; break; @@ -799,7 +810,8 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP); partner = &lacp->lacpdu.partner; - if (rte_is_same_ether_addr(&partner->port_params.system, + if (rte_is_zero_ether_addr(&partner->port_params.system) || + rte_is_same_ether_addr(&partner->port_params.system, &internals->mode4.mac_addr)) { /* This LACP frame is sending to the bonding port * so pass it to rx_machine. @@ -1021,6 +1033,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, port->actor.port_number = rte_cpu_to_be_16(slave_id + 1); memcpy(&port->partner, &initial, sizeof(struct port_params)); + memcpy(&port->partner_admin, &initial, sizeof(struct port_params)); /* default states */ port->actor_state = STATE_AGGREGATION | STATE_LACP_ACTIVE | STATE_DEFAULTED; @@ -1044,7 +1057,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, RTE_ASSERT(port->tx_ring == NULL); socket_id = rte_eth_dev_socket_id(slave_id); - if (socket_id == (int)LCORE_ID_ANY) + if (socket_id == -1) socket_id = rte_socket_id(); element_size = sizeof(struct slow_protocol_frame) + @@ -1387,11 +1400,12 @@ rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id, struct bond_dev_private *internals; struct mode8023ad_private *mode4; + if (valid_bonded_port_id(port_id) != 0) + return -EINVAL; + bond_dev = &rte_eth_devices[port_id]; internals = bond_dev->data->dev_private; - if (valid_bonded_port_id(port_id) != 0) - return -EINVAL; if (internals->mode != 4) return -EINVAL; @@ -1408,11 +1422,12 @@ int rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id) struct bond_dev_private *internals; struct mode8023ad_private *mode4; + if (valid_bonded_port_id(port_id) != 0) + return -EINVAL; + bond_dev = &rte_eth_devices[port_id]; internals = bond_dev->data->dev_private; - if (valid_bonded_port_id(port_id) != 0) - return -EINVAL; if (internals->mode != 4) return -EINVAL; mode4 = &internals->mode4; @@ -1665,12 +1680,14 @@ int rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port) { int retval = 0; - struct rte_eth_dev *dev = &rte_eth_devices[port]; - struct bond_dev_private *internals = (struct bond_dev_private *) - dev->data->dev_private; + struct rte_eth_dev *dev; + struct bond_dev_private *internals; - if (check_for_bonded_ethdev(dev) != 0) - return -1; + if (valid_bonded_port_id(port) != 0) + return -EINVAL; + + dev = &rte_eth_devices[port]; + internals = dev->data->dev_private; if (bond_8023ad_slow_pkt_hw_filter_supported(port) != 0) return -1; @@ -1689,12 +1706,14 @@ int rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) { int retval = 0; - struct rte_eth_dev *dev = &rte_eth_devices[port]; - struct bond_dev_private *internals = (struct bond_dev_private *) - dev->data->dev_private; + struct rte_eth_dev *dev; + struct bond_dev_private *internals; - if (check_for_bonded_ethdev(dev) != 0) - return -1; + if (valid_bonded_port_id(port) != 0) + return -EINVAL; + + dev = &rte_eth_devices[port]; + internals = dev->data->dev_private; /* Device must be stopped to set up slow queue */ if (dev->data->dev_started)