/* Increment reference count on mbufs */
for (i = 0; i < nb_pkts; i++)
- rte_mbuf_refcnt_update(bufs[i], num_of_slaves - 1);
+ rte_pktmbuf_refcnt_update(bufs[i], num_of_slaves - 1);
/* Transmit burst on each active slave */
for (i = 0; i < num_of_slaves; i++) {
slave_configure(struct rte_eth_dev *bonded_eth_dev,
struct rte_eth_dev *slave_eth_dev)
{
- struct bond_rx_queue *bd_rx_q;
- struct bond_tx_queue *bd_tx_q;
uint16_t nb_rx_queues;
uint16_t nb_tx_queues;
int errval;
- uint16_t q_id;
- struct rte_flow_error flow_error;
struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
slave_eth_dev->data->port_id, errval);
return errval;
}
+ return 0;
+}
+
+int
+slave_start(struct rte_eth_dev *bonded_eth_dev,
+ struct rte_eth_dev *slave_eth_dev)
+{
+ int errval = 0;
+ struct bond_rx_queue *bd_rx_q;
+ struct bond_tx_queue *bd_tx_q;
+ uint16_t q_id;
+ struct rte_flow_error flow_error;
+ struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
/* Setup Rx Queues */
for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
return errval;
}
- if (internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id] != NULL)
- rte_flow_destroy(slave_eth_dev->data->port_id,
+ if (internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id] != NULL) {
+ errval = rte_flow_destroy(slave_eth_dev->data->port_id,
internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
&flow_error);
+ RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_destroy: port=%d, err (%d)",
+ slave_eth_dev->data->port_id, errval);
+ }
errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
slave_eth_dev->data->port_id);
internals->slaves[i].port_id);
goto out_err;
}
+ if (slave_start(eth_dev, slave_ethdev) != 0) {
+ RTE_BOND_LOG(ERR,
+ "bonded port (%d) failed to start slave device (%d)",
+ eth_dev->data->port_id,
+ internals->slaves[i].port_id);
+ goto out_err;
+ }
/* We will need to poll for link status if any slave doesn't
* support interrupts
*/
*/
rte_mempool_free(internals->mode6.mempool);
- if (internals->kvlist != NULL)
- rte_kvargs_free(internals->kvlist);
+ rte_kvargs_free(internals->kvlist);
return 0;
}
return ret;
}
+static int
+bond_ethdev_promiscuous_update(struct rte_eth_dev *dev)
+{
+ struct bond_dev_private *internals = dev->data->dev_private;
+ uint16_t port_id = internals->current_primary_port;
+
+ switch (internals->mode) {
+ case BONDING_MODE_ROUND_ROBIN:
+ case BONDING_MODE_BALANCE:
+ case BONDING_MODE_BROADCAST:
+ case BONDING_MODE_8023AD:
+ /* As promiscuous mode is propagated to all slaves for these
+ * mode, no need to update for bonding device.
+ */
+ break;
+ case BONDING_MODE_ACTIVE_BACKUP:
+ case BONDING_MODE_TLB:
+ case BONDING_MODE_ALB:
+ default:
+ /* As promiscuous mode is propagated only to primary slave
+ * for these mode. When active/standby switchover, promiscuous
+ * mode should be set to new primary slave according to bonding
+ * device.
+ */
+ if (rte_eth_promiscuous_get(internals->port_id) == 1)
+ rte_eth_promiscuous_enable(port_id);
+ else
+ rte_eth_promiscuous_disable(port_id);
+ }
+
+ return 0;
+}
+
static int
bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev)
{
return ret;
}
+static int
+bond_ethdev_allmulticast_update(struct rte_eth_dev *dev)
+{
+ struct bond_dev_private *internals = dev->data->dev_private;
+ uint16_t port_id = internals->current_primary_port;
+
+ switch (internals->mode) {
+ case BONDING_MODE_ROUND_ROBIN:
+ case BONDING_MODE_BALANCE:
+ case BONDING_MODE_BROADCAST:
+ case BONDING_MODE_8023AD:
+ /* As allmulticast mode is propagated to all slaves for these
+ * mode, no need to update for bonding device.
+ */
+ break;
+ case BONDING_MODE_ACTIVE_BACKUP:
+ case BONDING_MODE_TLB:
+ case BONDING_MODE_ALB:
+ default:
+ /* As allmulticast mode is propagated only to primary slave
+ * for these mode. When active/standby switchover, allmulticast
+ * mode should be set to new primary slave according to bonding
+ * device.
+ */
+ if (rte_eth_allmulticast_get(internals->port_id) == 1)
+ rte_eth_allmulticast_enable(port_id);
+ else
+ rte_eth_allmulticast_disable(port_id);
+ }
+
+ return 0;
+}
+
static void
bond_ethdev_delayed_lsc_propagation(void *arg)
{
lsc_flag = 1;
mac_address_slaves_update(bonded_eth_dev);
+ bond_ethdev_promiscuous_update(bonded_eth_dev);
+ bond_ethdev_allmulticast_update(bonded_eth_dev);
}
activate_slave(bonded_eth_dev, port_id);
else
internals->current_primary_port = internals->primary_port;
mac_address_slaves_update(bonded_eth_dev);
+ bond_ethdev_promiscuous_update(bonded_eth_dev);
+ bond_ethdev_allmulticast_update(bonded_eth_dev);
}
}
kvlist = rte_kvargs_parse(rte_vdev_device_args(dev),
pmd_bond_init_valid_arguments);
- if (kvlist == NULL)
+ if (kvlist == NULL) {
+ RTE_BOND_LOG(ERR, "Invalid args in %s", rte_vdev_device_args(dev));
return -1;
+ }
/* Parse link bonding mode */
if (rte_kvargs_count(kvlist, PMD_BOND_MODE_KVARG) == 1) {
internals->rss_key_len);
} else {
if (internals->rss_key_len > sizeof(default_rss_key)) {
- RTE_BOND_LOG(ERR,
- "There is no suitable default hash key");
- return -EINVAL;
+ /*
+ * If the rss_key includes standard_rss_key and
+ * extended_hash_key, the rss key length will be
+ * larger than default rss key length, so it should
+ * re-calculate the hash key.
+ */
+ for (i = 0; i < internals->rss_key_len; i++)
+ internals->rss_key[i] = (uint8_t)rte_rand();
+ } else {
+ memcpy(internals->rss_key, default_rss_key,
+ internals->rss_key_len);
}
-
- memcpy(internals->rss_key, default_rss_key,
- internals->rss_key_len);
}
for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
return -1;
}
+ /* configure slaves so we can pass mtu setting */
+ for (i = 0; i < internals->slave_count; i++) {
+ struct rte_eth_dev *slave_ethdev =
+ &(rte_eth_devices[internals->slaves[i].port_id]);
+ if (slave_configure(dev, slave_ethdev) != 0) {
+ RTE_BOND_LOG(ERR,
+ "bonded port (%d) failed to configure slave device (%d)",
+ dev->data->port_id,
+ internals->slaves[i].port_id);
+ return -1;
+ }
+ }
return 0;
}