{
if (!rte_eth_dev_is_valid_port(port_id))
return -1;
- return rte_eth_devices[port_id].pci_dev->numa_node;
+ return rte_eth_devices[port_id].data->numa_node;
}
uint8_t
static int
rte_eth_dev_is_detachable(uint8_t port_id)
{
- uint32_t drv_flags;
+ uint32_t dev_flags;
if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return -EINVAL;
}
- if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) {
- switch (rte_eth_devices[port_id].pci_dev->kdrv) {
- case RTE_KDRV_IGB_UIO:
- case RTE_KDRV_UIO_GENERIC:
- case RTE_KDRV_NIC_UIO:
- break;
- case RTE_KDRV_VFIO:
- default:
- return -ENOTSUP;
- }
+ switch (rte_eth_devices[port_id].data->kdrv) {
+ case RTE_KDRV_IGB_UIO:
+ case RTE_KDRV_UIO_GENERIC:
+ case RTE_KDRV_NIC_UIO:
+ case RTE_KDRV_NONE:
+ break;
+ case RTE_KDRV_VFIO:
+ default:
+ return -ENOTSUP;
}
-
- drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
- return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+ dev_flags = rte_eth_devices[port_id].data->dev_flags;
+ return !(dev_flags & RTE_ETH_DEV_DETACHABLE);
}
/* attach the new physical device, then store port_id of the device */
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+ if (dev->data->rx_queue_state[rx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
+ PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+ " already started\n",
+ rx_queue_id, port_id);
+ return 0;
+ }
+
return dev->dev_ops->rx_queue_start(dev, rx_queue_id);
}
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+ if (dev->data->rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
+ PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+ " already stopped\n",
+ rx_queue_id, port_id);
+ return 0;
+ }
+
return dev->dev_ops->rx_queue_stop(dev, rx_queue_id);
}
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+ if (dev->data->tx_queue_state[tx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
+ PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+ " already started\n",
+ tx_queue_id, port_id);
+ return 0;
+ }
+
return dev->dev_ops->tx_queue_start(dev, tx_queue_id);
}
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+ if (dev->data->tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
+ PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+ " already stopped\n",
+ tx_queue_id, port_id);
+ return 0;
+ }
+
return dev->dev_ops->tx_queue_stop(dev, tx_queue_id);
}
* If link state interrupt is enabled, check that the
* device supports it.
*/
- if (dev_conf->intr_conf.lsc == 1) {
- const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
-
- if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
+ if ((dev_conf->intr_conf.lsc == 1) &&
+ (!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
PMD_DEBUG_TRACE("driver %s does not support lsc\n",
- pci_drv->name);
+ dev->data->drv_name);
return -EINVAL;
- }
}
/*
rte_eth_dev_config_restore(port_id);
- if (dev->data->dev_conf.intr_conf.lsc != 0) {
+ if (dev->data->dev_conf.intr_conf.lsc == 0) {
FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
(*dev->dev_ops->link_update)(dev, 0);
}
dev = &rte_eth_devices[port_id];
/* Return generic statistics */
- count = RTE_NB_STATS;
+ count = RTE_NB_STATS + (dev->data->nb_rx_queues * RTE_NB_RXQ_STATS) +
+ (dev->data->nb_tx_queues * RTE_NB_TXQ_STATS);
/* implemented by the driver */
if (dev->dev_ops->xstats_get != NULL) {
if (xcount < 0)
return xcount;
- } else {
- count += dev->data->nb_rx_queues * RTE_NB_RXQ_STATS;
- count += dev->data->nb_tx_queues * RTE_NB_TXQ_STATS;
}
if (n < count + xcount)
xstats[count++].value = val;
}
- /* if xstats_get() is implemented by the PMD, the Q stats are done */
- if (dev->dev_ops->xstats_get != NULL)
- return count + xcount;
-
/* per-rxq stats */
for (q = 0; q < dev->data->nb_rx_queues; q++) {
for (i = 0; i < RTE_NB_RXQ_STATS; i++) {
FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = dev->pci_dev;
- if (dev->driver)
- dev_info->driver_name = dev->driver->pci_drv.name;
+ dev_info->driver_name = dev->data->drv_name;
}
void
return 0;
}
+const struct rte_memzone *
+rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
+ uint16_t queue_id, size_t size, unsigned align,
+ int socket_id)
+{
+ char z_name[RTE_MEMZONE_NAMESIZE];
+ const struct rte_memzone *mz;
+
+ snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
+ dev->driver->pci_drv.name, ring_name,
+ dev->data->port_id, queue_id);
+
+ mz = rte_memzone_lookup(z_name);
+ if (mz)
+ return mz;
+
+ if (is_xen_dom0_supported())
+ return rte_memzone_reserve_bounded(z_name, size, socket_id,
+ 0, align, RTE_PGSIZE_2M);
+ else
+ return rte_memzone_reserve_aligned(z_name, size, socket_id,
+ 0, align);
+}
+
int
rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
int epfd, int op, void *data)
if ((eth_dev == NULL) || (pci_dev == NULL)) {
PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
eth_dev, pci_dev);
+ return;
}
eth_dev->data->dev_flags = 0;