#include <rte_mbuf.h>
#include <rte_malloc.h>
-#include <rte_ethdev_driver.h>
-#include <rte_ethdev_vdev.h>
+#include <ethdev_driver.h>
+#include <ethdev_vdev.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#include <rte_ip.h>
struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
internals = bd_rx_q->dev_private;
slave_count = internals->active_slave_count;
- active_slave = internals->active_slave;
+ active_slave = bd_rx_q->active_slave;
for (i = 0; i < slave_count && nb_pkts; i++) {
uint16_t num_rx_slave;
active_slave = 0;
}
- if (++internals->active_slave >= slave_count)
- internals->active_slave = 0;
+ if (++bd_rx_q->active_slave >= slave_count)
+ bd_rx_q->active_slave = 0;
return num_rx_total;
}
memcpy(slaves, internals->active_slaves,
sizeof(internals->active_slaves[0]) * slave_count);
- idx = internals->active_slave;
+ idx = bd_rx_q->active_slave;
if (idx >= slave_count) {
- internals->active_slave = 0;
+ bd_rx_q->active_slave = 0;
idx = 0;
}
for (i = 0; i < slave_count && num_rx_total < nb_pkts; i++) {
idx = 0;
}
- if (++internals->active_slave >= slave_count)
- internals->active_slave = 0;
+ if (++bd_rx_q->active_slave >= slave_count)
+ bd_rx_q->active_slave = 0;
return num_rx_total;
}
static uint16_t
bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
{
- struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue;
- struct bond_dev_private *internals = bd_tx_q->dev_private;
+ struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
+ struct bond_dev_private *internals = bd_rx_q->dev_private;
struct rte_ether_hdr *eth_h;
uint16_t ether_type, offset;
uint16_t nb_recv_pkts;
struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
/* Stop slave */
- rte_eth_dev_stop(slave_eth_dev->data->port_id);
+ errval = rte_eth_dev_stop(slave_eth_dev->data->port_id);
+ if (errval != 0)
+ RTE_BOND_LOG(ERR, "rte_eth_dev_stop: port %u, err (%d)",
+ slave_eth_dev->data->port_id, errval);
/* Enable interrupts on slave device if supported */
if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
slave_eth_dev->data->dev_conf.rxmode.offloads &=
~DEV_RX_OFFLOAD_VLAN_FILTER;
+ slave_eth_dev->data->dev_conf.rxmode.max_rx_pkt_len =
+ bonded_eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
+
+ if (bonded_eth_dev->data->dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_JUMBO_FRAME)
+ slave_eth_dev->data->dev_conf.rxmode.offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
+ else
+ slave_eth_dev->data->dev_conf.rxmode.offloads &=
+ ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+
nb_rx_queues = bonded_eth_dev->data->nb_rx_queues;
nb_tx_queues = bonded_eth_dev->data->nb_tx_queues;
}
}
-void
+int
bond_ethdev_stop(struct rte_eth_dev *eth_dev)
{
struct bond_dev_private *internals = eth_dev->data->dev_private;
uint16_t i;
+ int ret;
if (internals->mode == BONDING_MODE_8023AD) {
struct port *port;
internals->active_slave_count, slave_id) !=
internals->active_slave_count) {
internals->slaves[i].last_link_status = 0;
- rte_eth_dev_stop(slave_id);
+ ret = rte_eth_dev_stop(slave_id);
+ if (ret != 0) {
+ RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
+ slave_id);
+ return ret;
+ }
deactivate_slave(eth_dev, slave_id);
}
}
+
+ return 0;
}
int
while (internals->slave_count != skipped) {
uint16_t port_id = internals->slaves[skipped].port_id;
- rte_eth_dev_stop(port_id);
+ if (rte_eth_dev_stop(port_id) != 0) {
+ RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
+ port_id);
+ skipped++;
+ }
if (rte_eth_bond_slave_remove(bond_port_id, port_id) != 0) {
RTE_BOND_LOG(ERR,
*/
rte_mempool_free(internals->mode6.mempool);
- dev->dev_ops = NULL;
- dev->rx_pkt_burst = NULL;
- dev->tx_pkt_burst = NULL;
-
return 0;
}
}
static int
-bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused,
- enum rte_filter_type type, enum rte_filter_op op, void *arg)
+bond_flow_ops_get(struct rte_eth_dev *dev __rte_unused,
+ const struct rte_flow_ops **ops)
{
- if (type == RTE_ETH_FILTER_GENERIC && op == RTE_ETH_FILTER_GET) {
- *(const void **)arg = &bond_flow_ops;
- return 0;
- }
- return -ENOTSUP;
+ *ops = &bond_flow_ops;
+ return 0;
}
static int
.mac_addr_set = bond_ethdev_mac_address_set,
.mac_addr_add = bond_ethdev_mac_addr_add,
.mac_addr_remove = bond_ethdev_mac_addr_remove,
- .filter_ctrl = bond_filter_ctrl
+ .flow_ops_get = bond_flow_ops_get
};
static int
}
internals = eth_dev->data->dev_private;
- eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
eth_dev->data->nb_rx_queues = (uint16_t)1;
eth_dev->data->nb_tx_queues = (uint16_t)1;
}
eth_dev->dev_ops = &default_dev_ops;
- eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC;
+ eth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |
+ RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
rte_spinlock_init(&internals->lock);
rte_spinlock_init(&internals->lsc_lock);
struct rte_eth_dev *eth_dev;
struct bond_dev_private *internals;
const char *name;
+ int ret = 0;
if (!dev)
return -EINVAL;
return -EBUSY;
if (eth_dev->data->dev_started == 1) {
- bond_ethdev_stop(eth_dev);
+ ret = bond_ethdev_stop(eth_dev);
bond_ethdev_close(eth_dev);
}
rte_eth_dev_release_port(eth_dev);
- return 0;
+ return ret;
}
/* this part will resolve the slave portids after all the other pdev and vdev