vhost: allow to enable or disable features
Signed-off-by: Huawei Xie <huawei.xie@intel.com> Acked-by: Changchun Ouyang <changchun.ouyang@intel.com> [Thomas: split patch]
This commit is contained in:
parent
7202b0a824
commit
9eed6bfd2e
@ -148,6 +148,21 @@ gpa_to_vva(struct virtio_net *dev, uint64_t guest_pa)
|
||||
return vhost_va;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable features in feature_mask. Returns 0 on success.
|
||||
*/
|
||||
int rte_vhost_feature_disable(uint64_t feature_mask);
|
||||
|
||||
/**
|
||||
* Enable features in feature_mask. Returns 0 on success.
|
||||
*/
|
||||
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);
|
||||
|
||||
/* Register vhost driver. dev_name could be different for multiple instance support. */
|
||||
int rte_vhost_driver_register(const char *dev_name);
|
||||
|
||||
|
@ -960,6 +960,37 @@ get_virtio_net_callbacks(void)
|
||||
return &vhost_device_ops;
|
||||
}
|
||||
|
||||
int rte_vhost_enable_guest_notification(struct virtio_net *dev, uint16_t queue_id, int enable)
|
||||
{
|
||||
if (enable) {
|
||||
RTE_LOG(ERR, VHOST_CONFIG, "guest notification isn't supported.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
dev->virtqueue[queue_id]->used->flags = enable ? 0 : VRING_USED_F_NO_NOTIFY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t rte_vhost_feature_get(void)
|
||||
{
|
||||
return VHOST_FEATURES;
|
||||
}
|
||||
|
||||
int rte_vhost_feature_disable(uint64_t feature_mask)
|
||||
{
|
||||
VHOST_FEATURES = VHOST_FEATURES & ~feature_mask;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rte_vhost_feature_enable(uint64_t feature_mask)
|
||||
{
|
||||
if ((feature_mask & VHOST_SUPPORTED_FEATURES) == feature_mask) {
|
||||
VHOST_FEATURES = VHOST_FEATURES | feature_mask;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register ops so that we can add/remove device to data core.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user