diff options
Diffstat (limited to 'src/vnet/devices')
-rw-r--r-- | src/vnet/devices/virtio/pci.c | 31 | ||||
-rw-r--r-- | src/vnet/devices/virtio/virtio.c | 1 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c index cb177b3e469..85e6abdbbe5 100644 --- a/src/vnet/devices/virtio/pci.c +++ b/src/vnet/devices/virtio/pci.c @@ -1498,9 +1498,17 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args) "error encountered during packet buffering init"); goto error; } + /* + * packet buffering flag needs to be set 1 before calling the + * virtio_pre_input_node_enable but after the successful initialization + * of buffering queues above. + * Packet buffering flag set to 0 if there will be any error during + * buffering initialization. + */ + vif->packet_buffering = 1; + virtio_pre_input_node_enable (vm, vif); } - virtio_pre_input_node_enable (vm, vif); virtio_vring_set_rx_queues (vm, vif); virtio_vring_set_tx_queues (vm, vif); @@ -1542,17 +1550,19 @@ virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * vif) vlib_pci_intr_disable (vm, vif->pci_dev_handle); - for (i = 0; i < vif->max_queue_pairs; i++) + if (vif->virtio_pci_func) { - vif->virtio_pci_func->del_queue (vm, vif, RX_QUEUE (i)); - vif->virtio_pci_func->del_queue (vm, vif, TX_QUEUE (i)); - } + for (i = 0; i < vif->max_queue_pairs; i++) + { + vif->virtio_pci_func->del_queue (vm, vif, RX_QUEUE (i)); + vif->virtio_pci_func->del_queue (vm, vif, TX_QUEUE (i)); + } - if (vif->features & VIRTIO_FEATURE (VIRTIO_NET_F_CTRL_VQ)) - vif->virtio_pci_func->del_queue (vm, vif, vif->max_queue_pairs * 2); + if (vif->features & VIRTIO_FEATURE (VIRTIO_NET_F_CTRL_VQ)) + vif->virtio_pci_func->del_queue (vm, vif, vif->max_queue_pairs * 2); - if (vif->virtio_pci_func) - vif->virtio_pci_func->device_reset (vm, vif); + vif->virtio_pci_func->device_reset (vm, vif); + } if (vif->hw_if_index) { @@ -1573,7 +1583,8 @@ virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * vif) vlib_physmem_free (vm, vring->desc); } - virtio_pre_input_node_disable (vm, vif); + if (vif->packet_buffering) + virtio_pre_input_node_disable (vm, vif); vec_foreach_index (i, vif->txq_vrings) { diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c index 33af8b8c455..2d393656b39 100644 --- a/src/vnet/devices/virtio/virtio.c +++ b/src/vnet/devices/virtio/virtio.c @@ -207,7 +207,6 @@ virtio_set_packet_buffering (virtio_if_t * vif, u16 buffering_size) vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index); vnet_virtio_vring_t *vring; clib_error_t *error = 0; - vif->packet_buffering = 1; vec_foreach (vring, vif->txq_vrings) { |