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 <keiichiw@chromium.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Keiichi Watanabe 2021-03-22 16:22:56 +09:00 committed by Chenbo Xia
parent af4844503e
commit 790b1c3171
3 changed files with 32 additions and 0 deletions

View 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);

View 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;
};

View 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)
{