From: Keiichi Watanabe Date: Mon, 22 Mar 2021 07:22:56 +0000 (+0900) Subject: vhost: get negotiated protocol features X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=790b1c3171110df4a70b1903a30bae90c57dec57;p=dpdk.git vhost: get negotiated protocol features Add rte_vhost_get_negotiated_protocol_features, which returns a set of enabled protocol features. Signed-off-by: Keiichi Watanabe Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h index 010f160869..d0a8ae31f2 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 9183d6f2fc..9103a23cd4 100644 --- a/lib/librte_vhost/version.map +++ b/lib/librte_vhost/version.map @@ -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; }; diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 04d63b2f02..c9d1371e45 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -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) {