[dpdk-dev] [PATCH v2 1/2] vhost: Add API to get negotiated protocol features
Keiichi Watanabe
keiichiw at chromium.org
Mon Mar 22 08:22:56 CET 2021
Add rte_vhost_get_negotiated_protocol_features, which returns a set of
enabled protocol features.
Signed-off-by: Keiichi Watanabe <keiichiw at chromium.org>
---
lib/librte_vhost/rte_vhost.h | 15 +++++++++++++++
lib/librte_vhost/version.map | 1 +
lib/librte_vhost/vhost.c | 14 ++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 010f16086..d0a8ae31f 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -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);
diff --git a/lib/librte_vhost/version.map b/lib/librte_vhost/version.map
index 9183d6f2f..95c4c0990 100644
--- a/lib/librte_vhost/version.map
+++ b/lib/librte_vhost/version.map
@@ -63,6 +63,7 @@ EXPERIMENTAL {
rte_vhost_va_from_guest_pa;
rte_vhost_extern_callback_register;
rte_vhost_driver_set_protocol_features;
+ rte_vhost_get_negotiated_protocol_features;
rte_vhost_set_inflight_desc_split;
rte_vhost_set_inflight_desc_packed;
rte_vhost_set_last_inflight_io_split;
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index b83cf639e..c43248e4b 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -868,6 +868,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)
{
--
2.31.0.rc2.261.g7f71774620-goog
More information about the dev
mailing list