vhost: get negotiated protocol features
authorKeiichi Watanabe <keiichiw@chromium.org>
Mon, 22 Mar 2021 07:22:56 +0000 (16:22 +0900)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 31 Mar 2021 06:15:14 +0000 (08:15 +0200)
Add rte_vhost_get_negotiated_protocol_features, which returns a set of
enabled protocol features.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/rte_vhost.h
lib/librte_vhost/version.map
lib/librte_vhost/vhost.c

index 010f160..d0a8ae3 100644 (file)
@@ -567,6 +567,21 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num);
  */
 int rte_vhost_get_negotiated_features(int vid, uint64_t *features);
 
+/**
+ * Get the protocol feature bits after negotiation
+ *
+ * @param vid
+ *  Vhost device ID
+ * @param protocol_features
+ *  A pointer to store the queried protocol feature bits
+ * @return
+ *  0 on success, -1 on failure
+ */
+__rte_experimental
+int
+rte_vhost_get_negotiated_protocol_features(int vid,
+                                          uint64_t *protocol_features);
+
 /* Register callbacks. */
 int rte_vhost_driver_callback_register(const char *path,
        struct vhost_device_ops const * const ops);
index 9183d6f..9103a23 100644 (file)
@@ -76,4 +76,7 @@ EXPERIMENTAL {
        rte_vhost_async_channel_unregister;
        rte_vhost_submit_enqueue_burst;
        rte_vhost_poll_enqueue_completed;
+
+       # added in 21.05
+       rte_vhost_get_negotiated_protocol_features;
 };
index 04d63b2..c9d1371 100644 (file)
@@ -885,6 +885,20 @@ rte_vhost_get_negotiated_features(int vid, uint64_t *features)
        return 0;
 }
 
+int
+rte_vhost_get_negotiated_protocol_features(int vid,
+                                          uint64_t *protocol_features)
+{
+       struct virtio_net *dev;
+
+       dev = get_device(vid);
+       if (dev == NULL || protocol_features == NULL)
+               return -1;
+
+       *protocol_features = dev->protocol_features;
+       return 0;
+}
+
 int
 rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem)
 {