diff options
Diffstat (limited to 'drivers/net/vhost')
-rw-r--r-- | drivers/net/vhost/Makefile | 5 | ||||
-rw-r--r-- | drivers/net/vhost/rte_eth_vhost.c | 28 | ||||
-rw-r--r-- | drivers/net/vhost/rte_eth_vhost.h | 4 |
3 files changed, 27 insertions, 10 deletions
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile index 3ba8ad64..c411745b 100644 --- a/drivers/net/vhost/Makefile +++ b/drivers/net/vhost/Makefile @@ -37,13 +37,16 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_vhost.a LDLIBS += -lpthread +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_vhost +LDLIBS += -lrte_bus_vdev CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) EXPORT_MAP := rte_pmd_vhost_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 0dac5e60..2536ee4a 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -39,7 +39,7 @@ #include <rte_ethdev_vdev.h> #include <rte_malloc.h> #include <rte_memcpy.h> -#include <rte_vdev.h> +#include <rte_bus_vdev.h> #include <rte_kvargs.h> #include <rte_vhost.h> #include <rte_spinlock.h> @@ -52,6 +52,7 @@ enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; #define ETH_VHOST_QUEUES_ARG "queues" #define ETH_VHOST_CLIENT_ARG "client" #define ETH_VHOST_DEQUEUE_ZERO_COPY "dequeue-zero-copy" +#define ETH_VHOST_IOMMU_SUPPORT "iommu-support" #define VHOST_MAX_PKT_BURST 32 static const char *valid_arguments[] = { @@ -59,6 +60,7 @@ static const char *valid_arguments[] = { ETH_VHOST_QUEUES_ARG, ETH_VHOST_CLIENT_ARG, ETH_VHOST_DEQUEUE_ZERO_COPY, + ETH_VHOST_IOMMU_SUPPORT, NULL }; @@ -105,7 +107,7 @@ struct vhost_queue { rte_atomic32_t while_queuing; struct pmd_internal *internal; struct rte_mempool *mb_pool; - uint8_t port; + uint16_t port; uint16_t virtqueue_id; struct vhost_stats stats; }; @@ -705,7 +707,7 @@ static struct vhost_device_ops vhost_ops = { }; int -rte_eth_vhost_get_queue_event(uint8_t port_id, +rte_eth_vhost_get_queue_event(uint16_t port_id, struct rte_eth_vhost_queue_event *event) { struct rte_vhost_vring_state *state; @@ -742,7 +744,7 @@ rte_eth_vhost_get_queue_event(uint8_t port_id, } int -rte_eth_vhost_get_vid_from_port_id(uint8_t port_id) +rte_eth_vhost_get_vid_from_port_id(uint16_t port_id) { struct internal_list *list; struct rte_eth_dev *eth_dev; @@ -890,7 +892,7 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->min_rx_bufsize = 0; } -static void +static int eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { unsigned i; @@ -928,6 +930,8 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->oerrors = tx_missed_total; stats->ibytes = rx_total_bytes; stats->obytes = tx_total_bytes; + + return 0; } static void @@ -1084,8 +1088,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, internal->max_queues = queues; data->dev_link = pmd_link; data->mac_addrs = eth_addr; - data->dev_flags = - RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC; + data->dev_flags = RTE_ETH_DEV_INTR_LSC; eth_dev->dev_ops = &ops; @@ -1163,6 +1166,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) uint64_t flags = 0; int client_mode = 0; int dequeue_zero_copy = 0; + int iommu_support = 0; RTE_LOG(INFO, PMD, "Initializing pmd_vhost for %s\n", rte_vdev_device_name(dev)); @@ -1210,6 +1214,16 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY; } + if (rte_kvargs_count(kvlist, ETH_VHOST_IOMMU_SUPPORT) == 1) { + ret = rte_kvargs_process(kvlist, ETH_VHOST_IOMMU_SUPPORT, + &open_int, &iommu_support); + if (ret < 0) + goto out_free; + + if (iommu_support) + flags |= RTE_VHOST_USER_IOMMU_SUPPORT; + } + if (dev->device.numa_node == SOCKET_ID_ANY) dev->device.numa_node = rte_socket_id(); diff --git a/drivers/net/vhost/rte_eth_vhost.h b/drivers/net/vhost/rte_eth_vhost.h index 39ca7719..948f3c81 100644 --- a/drivers/net/vhost/rte_eth_vhost.h +++ b/drivers/net/vhost/rte_eth_vhost.h @@ -69,7 +69,7 @@ struct rte_eth_vhost_queue_event { * - On success, zero. * - On failure, a negative value. */ -int rte_eth_vhost_get_queue_event(uint8_t port_id, +int rte_eth_vhost_get_queue_event(uint16_t port_id, struct rte_eth_vhost_queue_event *event); /** @@ -79,7 +79,7 @@ int rte_eth_vhost_get_queue_event(uint8_t port_id, * - On success, the 'vid' associated with 'port_id'. * - On failure, a negative value. */ -int rte_eth_vhost_get_vid_from_port_id(uint8_t port_id); +int rte_eth_vhost_get_vid_from_port_id(uint16_t port_id); #ifdef __cplusplus } |