With all the previous prepare works, we are just one step away from
the final ABI refactoring. That is, to change current API to let them
stick to vid instead of the old virtio_net dev.

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
Tested-by: Rich Lane <rich.lane at bigswitch.com>
Acked-by: Rich Lane <rich.lane at bigswitch.com>
---

v2: update release note

v3: - bump the ABI version to 3.
    - remove "struct virtio_net *dev" field in vhost example
---
 doc/guides/rel_notes/release_16_07.rst        |  9 ++++-
 drivers/net/vhost/rte_eth_vhost.c             | 47 +++++++++------------------
 examples/vhost/main.c                         | 25 +++++++-------
 examples/vhost/main.h                         |  2 --
 lib/librte_vhost/Makefile                     |  2 +-
 lib/librte_vhost/rte_virtio_net.h             | 18 +++++-----
 lib/librte_vhost/vhost_rxtx.c                 | 15 +++++++--
 lib/librte_vhost/vhost_user/virtio-net-user.c | 14 ++++----
 lib/librte_vhost/virtio-net.c                 | 17 ++++++----
 9 files changed, 77 insertions(+), 72 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_07.rst 
b/doc/guides/rel_notes/release_16_07.rst
index 7b602b7..8dbcf8a 100644
--- a/doc/guides/rel_notes/release_16_07.rst
+++ b/doc/guides/rel_notes/release_16_07.rst
@@ -118,6 +118,10 @@ API Changes

 * ``rte_vring_available_entries`` is renamed to ``rte_vhost_avail_entries``.

+* All existing vhost APIs and callbacks with ``virtio_net`` struct pointer
+  as the parameter have been changed due to the ABI refactoring mentioned
+  below: it's replaced by ``int vid``.
+

 ABI Changes
 -----------
@@ -129,6 +133,9 @@ ABI Changes
 * The ``rte_port_source_params`` structure has new fields to support PCAP file.
   It was already in release 16.04 with ``RTE_NEXT_ABI`` flag.

+* vhost ABI refactoring has been made: ``virtio_net`` structure is never
+  exported to application any more. Instead, a handle, ``vid``, has been
+  used to represent this structure internally.

 Shared Library Versions
 -----------------------
@@ -165,7 +172,7 @@ The libraries prepended with a plus sign were incremented 
in this version.
      librte_sched.so.1
      librte_table.so.2
      librte_timer.so.1
-     librte_vhost.so.2
+   + librte_vhost.so.3


 Tested Platforms
diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index de0f25e..56c1c36 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -71,9 +71,9 @@ static struct ether_addr base_eth_addr = {
 };

 struct vhost_queue {
+       int vid;
        rte_atomic32_t allow_queuing;
        rte_atomic32_t while_queuing;
-       struct virtio_net *device;
        struct pmd_internal *internal;
        struct rte_mempool *mb_pool;
        uint8_t port;
@@ -139,7 +139,7 @@ eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t 
nb_bufs)
                goto out;

        /* Dequeue packets from guest TX queue */
-       nb_rx = rte_vhost_dequeue_burst(r->device,
+       nb_rx = rte_vhost_dequeue_burst(r->vid,
                        r->virtqueue_id, r->mb_pool, bufs, nb_bufs);

        r->rx_pkts += nb_rx;
@@ -170,7 +170,7 @@ eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t 
nb_bufs)
                goto out;

        /* Enqueue packets to guest RX queue */
-       nb_tx = rte_vhost_enqueue_burst(r->device,
+       nb_tx = rte_vhost_enqueue_burst(r->vid,
                        r->virtqueue_id, bufs, nb_bufs);

        r->tx_pkts += nb_tx;
@@ -222,7 +222,7 @@ find_internal_resource(char *ifname)
 }

 static int
-new_device(struct virtio_net *dev)
+new_device(int vid)
 {
        struct rte_eth_dev *eth_dev;
        struct internal_list *list;
@@ -234,12 +234,7 @@ new_device(struct virtio_net *dev)
        int newnode;
 #endif

-       if (dev == NULL) {
-               RTE_LOG(INFO, PMD, "Invalid argument\n");
-               return -1;
-       }
-
-       rte_vhost_get_ifname(dev->vid, ifname, sizeof(ifname));
+       rte_vhost_get_ifname(vid, ifname, sizeof(ifname));
        list = find_internal_resource(ifname);
        if (list == NULL) {
                RTE_LOG(INFO, PMD, "Invalid device name: %s\n", ifname);
@@ -250,7 +245,7 @@ new_device(struct virtio_net *dev)
        internal = eth_dev->data->dev_private;

 #ifdef RTE_LIBRTE_VHOST_NUMA
-       newnode = rte_vhost_get_numa_node(dev->vid);
+       newnode = rte_vhost_get_numa_node(vid);
        if (newnode > 0)
                eth_dev->data->numa_node = newnode;
 #endif
@@ -259,7 +254,7 @@ new_device(struct virtio_net *dev)
                vq = eth_dev->data->rx_queues[i];
                if (vq == NULL)
                        continue;
-               vq->device = dev;
+               vq->vid = vid;
                vq->internal = internal;
                vq->port = eth_dev->data->port_id;
        }
@@ -267,13 +262,13 @@ new_device(struct virtio_net *dev)
                vq = eth_dev->data->tx_queues[i];
                if (vq == NULL)
                        continue;
-               vq->device = dev;
+               vq->vid = vid;
                vq->internal = internal;
                vq->port = eth_dev->data->port_id;
        }

-       for (i = 0; i < rte_vhost_get_queue_num(dev->vid) * VIRTIO_QNUM; i++)
-               rte_vhost_enable_guest_notification(dev, i, 0);
+       for (i = 0; i < rte_vhost_get_queue_num(vid) * VIRTIO_QNUM; i++)
+               rte_vhost_enable_guest_notification(vid, i, 0);

        eth_dev->data->dev_link.link_status = ETH_LINK_UP;

@@ -298,7 +293,7 @@ new_device(struct virtio_net *dev)
 }

 static void
-destroy_device(volatile struct virtio_net *dev)
+destroy_device(int vid)
 {
        struct rte_eth_dev *eth_dev;
        struct vhost_queue *vq;
@@ -306,12 +301,7 @@ destroy_device(volatile struct virtio_net *dev)
        char ifname[PATH_MAX];
        unsigned i;

-       if (dev == NULL) {
-               RTE_LOG(INFO, PMD, "Invalid argument\n");
-               return;
-       }
-
-       rte_vhost_get_ifname(dev->vid, ifname, sizeof(ifname));
+       rte_vhost_get_ifname(vid, ifname, sizeof(ifname));
        list = find_internal_resource(ifname);
        if (list == NULL) {
                RTE_LOG(ERR, PMD, "Invalid interface name: %s\n", ifname);
@@ -343,13 +333,13 @@ destroy_device(volatile struct virtio_net *dev)
                vq = eth_dev->data->rx_queues[i];
                if (vq == NULL)
                        continue;
-               vq->device = NULL;
+               vq->vid = -1;
        }
        for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
                vq = eth_dev->data->tx_queues[i];
                if (vq == NULL)
                        continue;
-               vq->device = NULL;
+               vq->vid = -1;
        }

        RTE_LOG(INFO, PMD, "Connection closed\n");
@@ -358,19 +348,14 @@ destroy_device(volatile struct virtio_net *dev)
 }

 static int
-vring_state_changed(struct virtio_net *dev, uint16_t vring, int enable)
+vring_state_changed(int vid, uint16_t vring, int enable)
 {
        struct rte_vhost_vring_state *state;
        struct rte_eth_dev *eth_dev;
        struct internal_list *list;
        char ifname[PATH_MAX];

-       if (dev == NULL) {
-               RTE_LOG(ERR, PMD, "Invalid argument\n");
-               return -1;
-       }
-
-       rte_vhost_get_ifname(dev->vid, ifname, sizeof(ifname));
+       rte_vhost_get_ifname(vid, ifname, sizeof(ifname));
        list = find_internal_resource(ifname);
        if (list == NULL) {
                RTE_LOG(ERR, PMD, "Invalid interface name: %s\n", ifname);
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 9b74a16..c854660 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -795,7 +795,7 @@ virtio_xmit(struct vhost_dev *dst_vdev, struct vhost_dev 
*src_vdev,
 {
        uint16_t ret;

-       ret = rte_vhost_enqueue_burst(dst_vdev->dev, VIRTIO_RXQ, &m, 1);
+       ret = rte_vhost_enqueue_burst(dst_vdev->vid, VIRTIO_RXQ, &m, 1);
        if (enable_stats) {
                rte_atomic64_inc(&dst_vdev->stats.rx_total_atomic);
                rte_atomic64_add(&dst_vdev->stats.rx_atomic, ret);
@@ -1041,7 +1041,6 @@ static inline void __attribute__((always_inline))
 drain_eth_rx(struct vhost_dev *vdev)
 {
        uint16_t rx_count, enqueue_count;
-       struct virtio_net *dev = vdev->dev;
        struct rte_mbuf *pkts[MAX_PKT_BURST];

        rx_count = rte_eth_rx_burst(ports[0], vdev->vmdq_rx_q,
@@ -1055,19 +1054,19 @@ drain_eth_rx(struct vhost_dev *vdev)
         * to diminish packet loss.
         */
        if (enable_retry &&
-           unlikely(rx_count > rte_vhost_avail_entries(dev->vid,
+           unlikely(rx_count > rte_vhost_avail_entries(vdev->vid,
                        VIRTIO_RXQ))) {
                uint32_t retry;

                for (retry = 0; retry < burst_rx_retry_num; retry++) {
                        rte_delay_us(burst_rx_delay_time);
-                       if (rx_count <= rte_vhost_avail_entries(dev->vid,
+                       if (rx_count <= rte_vhost_avail_entries(vdev->vid,
                                        VIRTIO_RXQ))
                                break;
                }
        }

-       enqueue_count = rte_vhost_enqueue_burst(dev, VIRTIO_RXQ,
+       enqueue_count = rte_vhost_enqueue_burst(vdev->vid, VIRTIO_RXQ,
                                                pkts, rx_count);
        if (enable_stats) {
                rte_atomic64_add(&vdev->stats.rx_total_atomic, rx_count);
@@ -1084,7 +1083,7 @@ drain_virtio_tx(struct vhost_dev *vdev)
        uint16_t count;
        uint16_t i;

-       count = rte_vhost_dequeue_burst(vdev->dev, VIRTIO_TXQ, mbuf_pool,
+       count = rte_vhost_dequeue_burst(vdev->vid, VIRTIO_TXQ, mbuf_pool,
                                        pkts, MAX_PKT_BURST);

        /* setup VMDq for the first packet */
@@ -1171,13 +1170,13 @@ switch_worker(void *arg __rte_unused)
  * of dev->remove=1 which can cause an infinite loop in the rte_pause loop.
  */
 static void
-destroy_device (volatile struct virtio_net *dev)
+destroy_device(int vid)
 {
        struct vhost_dev *vdev = NULL;
        int lcore;

        TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) {
-               if (vdev->vid == dev->vid)
+               if (vdev->vid == vid)
                        break;
        }
        if (!vdev)
@@ -1221,12 +1220,11 @@ destroy_device (volatile struct virtio_net *dev)
  * and the allocated to a specific data core.
  */
 static int
-new_device (struct virtio_net *dev)
+new_device(int vid)
 {
        int lcore, core_add = 0;
        uint32_t device_num_min = num_devices;
        struct vhost_dev *vdev;
-       int vid = dev->vid;

        vdev = rte_zmalloc("vhost device", sizeof(*vdev), RTE_CACHE_LINE_SIZE);
        if (vdev == NULL) {
@@ -1235,7 +1233,6 @@ new_device (struct virtio_net *dev)
                        vid);
                return -1;
        }
-       vdev->dev = dev;
        vdev->vid = vid;

        TAILQ_INSERT_TAIL(&vhost_dev_list, vdev, global_vdev_entry);
@@ -1259,8 +1256,8 @@ new_device (struct virtio_net *dev)
        lcore_info[vdev->coreid].device_num++;

        /* Disable notifications. */
-       rte_vhost_enable_guest_notification(dev, VIRTIO_RXQ, 0);
-       rte_vhost_enable_guest_notification(dev, VIRTIO_TXQ, 0);
+       rte_vhost_enable_guest_notification(vid, VIRTIO_RXQ, 0);
+       rte_vhost_enable_guest_notification(vid, VIRTIO_TXQ, 0);

        RTE_LOG(INFO, VHOST_DATA,
                "(%d) device has been added to data core %d\n",
@@ -1316,7 +1313,7 @@ print_stats(void)
                                "RX total:              %" PRIu64 "\n"
                                "RX dropped:            %" PRIu64 "\n"
                                "RX successful:         %" PRIu64 "\n",
-                               vdev->dev->vid,
+                               vdev->vid,
                                tx_total, tx_dropped, tx,
                                rx_total, rx_dropped, rx);
                }
diff --git a/examples/vhost/main.h b/examples/vhost/main.h
index e99c436..6bb42e8 100644
--- a/examples/vhost/main.h
+++ b/examples/vhost/main.h
@@ -49,8 +49,6 @@ struct device_statistics {
 };

 struct vhost_dev {
-       /**< Pointer to device created by vhost lib. */
-       struct virtio_net      *dev;
        /**< Number of memory regions for gpa to hpa translation. */
        uint32_t nregions_hpa;
        /**< Device MAC address (Obtained on first TX packet). */
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index e33ff53..7ef8d34 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -36,7 +36,7 @@ LIB = librte_vhost.a

 EXPORT_MAP := rte_vhost_version.map

-LIBABIVER := 2
+LIBABIVER := 3

 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),y)
diff --git a/lib/librte_vhost/rte_virtio_net.h 
b/lib/librte_vhost/rte_virtio_net.h
index 0427461..370345e 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -178,10 +178,10 @@ struct virtio_memory {
  *
  */
 struct virtio_net_device_ops {
-       int (*new_device)(struct virtio_net *); /**< Add device. */
-       void (*destroy_device)(volatile struct virtio_net *);   /**< Remove 
device. */
+       int (*new_device)(int vid);             /**< Add device. */
+       void (*destroy_device)(int vid);        /**< Remove device. */

-       int (*vring_state_changed)(struct virtio_net *dev, uint16_t queue_id, 
int enable);      /**< triggered when a vring is enabled or disabled */
+       int (*vring_state_changed)(int vid, uint16_t queue_id, int enable);     
/**< triggered when a vring is enabled or disabled */
 };

 /**
@@ -220,7 +220,7 @@ int rte_vhost_feature_enable(uint64_t feature_mask);
 /* Returns currently supported vhost features */
 uint64_t rte_vhost_feature_get(void);

-int rte_vhost_enable_guest_notification(struct virtio_net *dev, uint16_t 
queue_id, int enable);
+int rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int 
enable);

 /* Register vhost driver. dev_name could be different for multiple instance 
support. */
 int rte_vhost_driver_register(const char *dev_name);
@@ -291,8 +291,8 @@ uint16_t rte_vhost_avail_entries(int vid, uint16_t 
queue_id);
  * be received from the physical port or from another virtual device. A packet
  * count is returned to indicate the number of packets that were succesfully
  * added to the RX queue.
- * @param dev
- *  virtio-net device
+ * @param vid
+ *  virtio-net device ID
  * @param queue_id
  *  virtio queue index in mq case
  * @param pkts
@@ -302,14 +302,14 @@ uint16_t rte_vhost_avail_entries(int vid, uint16_t 
queue_id);
  * @return
  *  num of packets enqueued
  */
-uint16_t rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id,
+uint16_t rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
        struct rte_mbuf **pkts, uint16_t count);

 /**
  * This function gets guest buffers from the virtio device TX virtqueue,
  * construct host mbufs, copies guest buffer content to host mbufs and
  * store them in pkts to be processed.
- * @param dev
+ * @param vid
  *  virtio-net device
  * @param queue_id
  *  virtio queue index in mq case
@@ -322,7 +322,7 @@ uint16_t rte_vhost_enqueue_burst(struct virtio_net *dev, 
uint16_t queue_id,
  * @return
  *  num of packets dequeued
  */
-uint16_t rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,
+uint16_t rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
        struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count);

 #endif /* _VIRTIO_NET_H_ */
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 8d87508..08cab08 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -46,6 +46,7 @@
 #include <rte_arp.h>

 #include "vhost-net.h"
+#include "virtio-net.h"

 #define MAX_PKT_BURST 32
 #define VHOST_LOG_PAGE 4096
@@ -587,9 +588,14 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,
 }

 uint16_t
-rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id,
+rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
        struct rte_mbuf **pkts, uint16_t count)
 {
+       struct virtio_net *dev = get_device(vid);
+
+       if (!dev)
+               return 0;
+
        if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF))
                return virtio_dev_merge_rx(dev, queue_id, pkts, count);
        else
@@ -815,9 +821,10 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
 }

 uint16_t
-rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,
+rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
        struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count)
 {
+       struct virtio_net *dev;
        struct rte_mbuf *rarp_mbuf = NULL;
        struct vhost_virtqueue *vq;
        uint32_t desc_indexes[MAX_PKT_BURST];
@@ -826,6 +833,10 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t 
queue_id,
        uint16_t free_entries;
        uint16_t avail_idx;

+       dev = get_device(vid);
+       if (!dev)
+               return 0;
+
        if (unlikely(!is_valid_virt_queue_idx(queue_id, 1, dev->virt_qp_nb))) {
                RTE_LOG(ERR, VHOST_DATA, "(%d) %s: invalid virtqueue idx %d.\n",
                        dev->vid, __func__, queue_id);
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c 
b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 9385af1..7fa69a7 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -117,7 +117,7 @@ user_set_mem_table(int vid, struct VhostUserMsg *pmsg)
        /* Remove from the data plane. */
        if (dev->flags & VIRTIO_DEV_RUNNING) {
                dev->flags &= ~VIRTIO_DEV_RUNNING;
-               notify_ops->destroy_device(dev);
+               notify_ops->destroy_device(vid);
        }

        if (dev->mem) {
@@ -279,6 +279,9 @@ user_set_vring_kick(int vid, struct VhostUserMsg *pmsg)
        struct vhost_vring_file file;
        struct virtio_net *dev = get_device(vid);

+       if (!dev)
+               return;
+
        file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
        if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)
                file.fd = VIRTIO_INVALID_EVENTFD;
@@ -289,7 +292,7 @@ user_set_vring_kick(int vid, struct VhostUserMsg *pmsg)
        vhost_set_vring_kick(vid, &file);

        if (virtio_is_ready(dev) && !(dev->flags & VIRTIO_DEV_RUNNING)) {
-               if (notify_ops->new_device(dev) == 0)
+               if (notify_ops->new_device(vid) == 0)
                        dev->flags |= VIRTIO_DEV_RUNNING;
        }
 }
@@ -307,7 +310,7 @@ user_get_vring_base(int vid,
                return -1;
        /* We have to stop the queue (virtio) if it is running. */
        if (dev->flags & VIRTIO_DEV_RUNNING)
-               notify_ops->destroy_device(dev);
+               notify_ops->destroy_device(vid);

        /* Here we are safe to get the last used index */
        vhost_get_vring_base(vid, state->index, state);
@@ -342,9 +345,8 @@ user_set_vring_enable(int vid,
                "set queue enable: %d to qp idx: %d\n",
                enable, state->index);

-       if (notify_ops->vring_state_changed) {
-               notify_ops->vring_state_changed(dev, state->index, enable);
-       }
+       if (notify_ops->vring_state_changed)
+               notify_ops->vring_state_changed(vid, state->index, enable);

        dev->virtqueue[state->index]->enabled = enable;

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 115eba4..ea216c0 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -296,7 +296,7 @@ vhost_destroy_device(int vid)

        if (dev->flags & VIRTIO_DEV_RUNNING) {
                dev->flags &= ~VIRTIO_DEV_RUNNING;
-               notify_ops->destroy_device(dev);
+               notify_ops->destroy_device(vid);
        }

        cleanup_device(dev, 1);
@@ -354,7 +354,7 @@ vhost_reset_owner(int vid)

        if (dev->flags & VIRTIO_DEV_RUNNING) {
                dev->flags &= ~VIRTIO_DEV_RUNNING;
-               notify_ops->destroy_device(dev);
+               notify_ops->destroy_device(vid);
        }

        cleanup_device(dev, 0);
@@ -718,13 +718,13 @@ vhost_set_backend(int vid, struct vhost_vring_file *file)
        if (!(dev->flags & VIRTIO_DEV_RUNNING)) {
                if (dev->virtqueue[VIRTIO_TXQ]->backend != VIRTIO_DEV_STOPPED &&
                    dev->virtqueue[VIRTIO_RXQ]->backend != VIRTIO_DEV_STOPPED) {
-                       if (notify_ops->new_device(dev) < 0)
+                       if (notify_ops->new_device(vid) < 0)
                                return -1;
                        dev->flags |= VIRTIO_DEV_RUNNING;
                }
        } else if (file->fd == VIRTIO_DEV_STOPPED) {
                dev->flags &= ~VIRTIO_DEV_RUNNING;
-               notify_ops->destroy_device(dev);
+               notify_ops->destroy_device(vid);
        }

        return 0;
@@ -800,9 +800,14 @@ rte_vhost_avail_entries(int vid, uint16_t queue_id)
        return *(volatile uint16_t *)&vq->avail->idx - vq->last_used_idx_res;
 }

-int rte_vhost_enable_guest_notification(struct virtio_net *dev,
-       uint16_t queue_id, int enable)
+int
+rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int enable)
 {
+       struct virtio_net *dev = get_device(vid);
+
+       if (dev == NULL)
+               return -1;
+
        if (enable) {
                RTE_LOG(ERR, VHOST_CONFIG,
                        "guest notification isn't supported.\n");
-- 
1.9.0

Reply via email to