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:
Rob Bradford 2020-09-03 16:39:13 +01:00
parent 31d7712878
commit 56f03db69c

View File

@ -388,11 +388,9 @@ impl VirtioDevice for Net {
})?;
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
// but clone it to pass into the thread.
self.interrupt_cb = Some(interrupt_cb.clone());
let mut tmp_queue_evts: Vec<EventFd> = Vec::new();
for queue_evt in queue_evts.iter() {
// 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);
if let Some(mut taps) = self.taps.clone() {
let queue_num = queues.len();
if self.common.feature_acked(VIRTIO_NET_F_CTRL_VQ.into()) && queue_num % 2 != 0 {
let cvq_queue = queues.remove(queue_num - 1);