do_eth_dev_ring_create(const char *name,
struct rte_ring * const rx_queues[], const unsigned nb_rx_queues,
struct rte_ring *const tx_queues[], const unsigned nb_tx_queues,
- const unsigned numa_node, enum dev_action action)
+ const unsigned int numa_node, enum dev_action action,
+ struct rte_eth_dev **eth_dev_p)
{
struct rte_eth_dev_data *data = NULL;
struct pmd_internals *internals = NULL;
eth_dev->rx_pkt_burst = eth_ring_rx;
eth_dev->tx_pkt_burst = eth_ring_tx;
+ *eth_dev_p = eth_dev;
+
return data->port_id;
error:
const unsigned nb_tx_queues,
const unsigned numa_node)
{
+ struct rte_eth_dev *eth_dev = NULL;
+
/* do some parameter checking */
if (rx_queues == NULL && nb_rx_queues > 0) {
rte_errno = EINVAL;
}
return do_eth_dev_ring_create(name, rx_queues, nb_rx_queues,
- tx_queues, nb_tx_queues, numa_node, DEV_ATTACH);
+ tx_queues, nb_tx_queues, numa_node, DEV_ATTACH,
+ ð_dev);
}
int
static int
eth_dev_ring_create(const char *name, const unsigned numa_node,
- enum dev_action action)
+ enum dev_action action, struct rte_eth_dev **eth_dev)
{
/* rx and tx are so-called from point of view of first port.
* They are inverted from the point of view of second port
}
if (do_eth_dev_ring_create(name, rxtx, num_rings, rxtx, num_rings,
- numa_node, action) < 0)
+ numa_node, action, eth_dev) < 0)
return -1;
return 0;
struct rte_kvargs *kvlist = NULL;
int ret = 0;
struct node_action_list *info = NULL;
+ struct rte_eth_dev *eth_dev = NULL;
name = rte_vdev_device_name(dev);
params = rte_vdev_device_args(dev);
RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
if (params == NULL || params[0] == '\0') {
- ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+ ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE,
+ ð_dev);
if (ret == -1) {
RTE_LOG(INFO, PMD,
"Attach to pmd_ring for %s\n", name);
ret = eth_dev_ring_create(name, rte_socket_id(),
- DEV_ATTACH);
+ DEV_ATTACH, ð_dev);
}
}
else {
RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
" rings-backed ethernet device\n");
ret = eth_dev_ring_create(name, rte_socket_id(),
- DEV_CREATE);
+ DEV_CREATE, ð_dev);
if (ret == -1) {
RTE_LOG(INFO, PMD,
"Attach to pmd_ring for %s\n",
name);
ret = eth_dev_ring_create(name, rte_socket_id(),
- DEV_ATTACH);
+ DEV_ATTACH, ð_dev);
}
return ret;
} else {
for (info->count = 0; info->count < info->total; info->count++) {
ret = eth_dev_ring_create(info->list[info->count].name,
info->list[info->count].node,
- info->list[info->count].action);
+ info->list[info->count].action,
+ ð_dev);
if ((ret == -1) &&
(info->list[info->count].action == DEV_CREATE)) {
RTE_LOG(INFO, PMD,
name);
ret = eth_dev_ring_create(name,
info->list[info->count].node,
- DEV_ATTACH);
+ DEV_ATTACH,
+ ð_dev);
}
}
}
}
+ if (eth_dev)
+ eth_dev->device = &dev->device;
+
out_free:
rte_kvargs_free(kvlist);
rte_free(info);