mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
virtio-devices: net: Simplify activate function
Move the if-let for the taps later which makes the earlier activation code identical to other devices. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
31d7712878
commit
56f03db69c
@ -388,11 +388,9 @@ impl VirtioDevice for Net {
|
|||||||
})?;
|
})?;
|
||||||
self.pause_evt = Some(self_pause_evt);
|
self.pause_evt = Some(self_pause_evt);
|
||||||
|
|
||||||
if let Some(mut taps) = self.taps.clone() {
|
|
||||||
// Save the interrupt EventFD as we need to return it on reset
|
// Save the interrupt EventFD as we need to return it on reset
|
||||||
// but clone it to pass into the thread.
|
// but clone it to pass into the thread.
|
||||||
self.interrupt_cb = Some(interrupt_cb.clone());
|
self.interrupt_cb = Some(interrupt_cb.clone());
|
||||||
|
|
||||||
let mut tmp_queue_evts: Vec<EventFd> = Vec::new();
|
let mut tmp_queue_evts: Vec<EventFd> = Vec::new();
|
||||||
for queue_evt in queue_evts.iter() {
|
for queue_evt in queue_evts.iter() {
|
||||||
// Save the queue EventFD as we need to return it on reset
|
// Save the queue EventFD as we need to return it on reset
|
||||||
@ -404,6 +402,7 @@ impl VirtioDevice for Net {
|
|||||||
}
|
}
|
||||||
self.queue_evts = Some(tmp_queue_evts);
|
self.queue_evts = Some(tmp_queue_evts);
|
||||||
|
|
||||||
|
if let Some(mut taps) = self.taps.clone() {
|
||||||
let queue_num = queues.len();
|
let queue_num = queues.len();
|
||||||
if self.common.feature_acked(VIRTIO_NET_F_CTRL_VQ.into()) && queue_num % 2 != 0 {
|
if self.common.feature_acked(VIRTIO_NET_F_CTRL_VQ.into()) && queue_num % 2 != 0 {
|
||||||
let cvq_queue = queues.remove(queue_num - 1);
|
let cvq_queue = queues.remove(queue_num - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user