mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 23:11:16 +00:00
vm-virtio: Update backend feature set for vhost-user-net
Regarding vhost-user-net, there are features in avail_features and acked_features, like VIRTIO_NET_F_MAC which is required by driver and device to transfer mac address through config space, but not needed by backend, like ovs+dpdk, so it's necessary to adjust backend_features based on acked_features before calling set_features() API. This fix is to record backend_features in vhost-user-net to avoid requesting it twice. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
parent
b8622b5c69
commit
8c2a9a75ec
@ -33,6 +33,7 @@ pub struct Net {
|
|||||||
kill_evt: EventFd,
|
kill_evt: EventFd,
|
||||||
avail_features: u64,
|
avail_features: u64,
|
||||||
acked_features: u64,
|
acked_features: u64,
|
||||||
|
backend_features: u64,
|
||||||
config_space: Vec<u8>,
|
config_space: Vec<u8>,
|
||||||
queue_sizes: Vec<u16>,
|
queue_sizes: Vec<u16>,
|
||||||
}
|
}
|
||||||
@ -79,7 +80,7 @@ impl<'a> Net {
|
|||||||
.map_err(Error::VhostUserSetFeatures)?;
|
.map_err(Error::VhostUserSetFeatures)?;
|
||||||
|
|
||||||
let mut acked_features = 0;
|
let mut acked_features = 0;
|
||||||
if backend_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() != 0 {
|
if avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() != 0 {
|
||||||
acked_features |= VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
acked_features |= VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
||||||
vhost_user_net
|
vhost_user_net
|
||||||
.get_protocol_features()
|
.get_protocol_features()
|
||||||
@ -106,6 +107,7 @@ impl<'a> Net {
|
|||||||
kill_evt,
|
kill_evt,
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features,
|
acked_features,
|
||||||
|
backend_features,
|
||||||
config_space,
|
config_space,
|
||||||
queue_sizes: vec![vu_cfg.queue_size; vu_cfg.num_queues],
|
queue_sizes: vec![vu_cfg.queue_size; vu_cfg.num_queues],
|
||||||
})
|
})
|
||||||
@ -201,7 +203,7 @@ impl VirtioDevice for Net {
|
|||||||
&mem.read().unwrap(),
|
&mem.read().unwrap(),
|
||||||
queues,
|
queues,
|
||||||
queue_evts,
|
queue_evts,
|
||||||
self.acked_features,
|
self.acked_features & self.backend_features,
|
||||||
)
|
)
|
||||||
.map_err(ActivateError::VhostUserNetSetup)?;
|
.map_err(ActivateError::VhostUserNetSetup)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user