git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/dpaa2: support Rx buffer size
[dpdk.git]
/
drivers
/
net
/
virtio
/
virtio_pci_ethdev.c
diff --git
a/drivers/net/virtio/virtio_pci_ethdev.c
b/drivers/net/virtio/virtio_pci_ethdev.c
index
8793bf7
..
4083853
100644
(file)
--- a/
drivers/net/virtio/virtio_pci_ethdev.c
+++ b/
drivers/net/virtio/virtio_pci_ethdev.c
@@
-19,6
+19,7
@@
#include <rte_dev.h>
#include <rte_kvargs.h>
#include <rte_dev.h>
#include <rte_kvargs.h>
+#include "virtio.h"
#include "virtio_ethdev.h"
#include "virtio_pci.h"
#include "virtio_logs.h"
#include "virtio_ethdev.h"
#include "virtio_pci.h"
#include "virtio_logs.h"
@@
-39,9
+40,11
@@
static const struct rte_pci_id pci_id_virtio_map[] = {
* could have the PCI initiated correctly.
*/
static int
* could have the PCI initiated correctly.
*/
static int
-virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_
hw *hw
)
+virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_
pci_dev *dev
)
{
{
- if (hw->bus_type == VIRTIO_BUS_PCI_MODERN) {
+ struct virtio_hw *hw = &dev->hw;
+
+ if (dev->modern) {
/*
* We don't have to re-parse the PCI config space, since
* rte_pci_map_device() makes sure the mapped address
/*
* We don't have to re-parse the PCI config space, since
* rte_pci_map_device() makes sure the mapped address
@@
-57,8
+60,8
@@
virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
PMD_INIT_LOG(DEBUG, "failed to map pci device!");
return -1;
}
PMD_INIT_LOG(DEBUG, "failed to map pci device!");
return -1;
}
- } else
if (hw->bus_type == VIRTIO_BUS_PCI_LEGACY)
{
- if (
rte_pci_ioport_map(pci_dev, 0, VTPCI_IO(hw)
) < 0)
+ } else {
+ if (
vtpci_legacy_ioport_map(hw
) < 0)
return -1;
}
return -1;
}
@@
-74,13
+77,21
@@
eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
int ret;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
int ret;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
+ hw->port_id = eth_dev->data->port_id;
+ VTPCI_DEV(hw) = pci_dev;
+ ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to init PCI device\n");
return -1;
}
} else {
if (ret) {
PMD_INIT_LOG(ERR, "Failed to init PCI device\n");
return -1;
}
} else {
- ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
+ VTPCI_DEV(hw) = pci_dev;
+ if (dev->modern)
+ VIRTIO_OPS(hw) = &modern_ops;
+ else
+ VIRTIO_OPS(hw) = &legacy_ops;
+
+ ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), dev);
if (ret < 0) {
PMD_INIT_LOG(ERR, "Failed to remap PCI device\n");
return -1;
if (ret < 0) {
PMD_INIT_LOG(ERR, "Failed to remap PCI device\n");
return -1;
@@
-101,8
+112,8
@@
eth_virtio_pci_init(struct rte_eth_dev *eth_dev)
err_unmap:
rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
err_unmap:
rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
- if (
hw->bus_type == VIRTIO_BUS_PCI_LEGACY
)
-
rte_pci_ioport_unmap(VTPCI_IO(hw)
);
+ if (
!dev->modern
)
+
vtpci_legacy_ioport_unmap(hw
);
return ret;
}
return ret;
}