diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2021-12-13 18:32:42 +0000 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2021-12-14 13:45:21 +0000 |
commit | b7e4e6d1d24685cec2b1b8c72998661ae237fe94 (patch) | |
tree | 01149cbf3e751a3215161da9b7945b09b573ac0c /src/vnet/devices/virtio/device.c | |
parent | 2e5921b08b167793eacf3085a98344ad00afb5ac (diff) |
virtio: integrate with new tx infra
Type: improvement
Change-Id: I337ec63d0868f665329d68eadf1744e080b73a0d
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r-- | src/vnet/devices/virtio/device.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index ac9be6b02ae..8eeeb0d2c74 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -800,6 +800,7 @@ virtio_interface_tx_packed_gso_inline (vlib_main_t *vm, vring->avail_wrap_counter ^= 1; } } + virtio_txq_clear_scheduled (vring); } while (n_left && used < sz) @@ -940,6 +941,7 @@ virtio_interface_tx_split_gso_inline (vlib_main_t *vm, n_buffers_left--; free_desc_count -= n_added; } + virtio_txq_clear_scheduled (vring); } while (n_left && free_desc_count) @@ -1031,7 +1033,8 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm, virtio_main_t *nm = &virtio_main; vnet_interface_output_runtime_t *rund = (void *) node->runtime_data; virtio_if_t *vif = pool_elt_at_index (nm->interfaces, rund->dev_instance); - u16 qid = vm->thread_index % vif->num_txqs; + vnet_hw_if_tx_frame_t *tf = vlib_frame_scalar_args (frame); + u16 qid = tf->queue_id; virtio_vring_t *vring = vec_elt_at_index (vif->txq_vrings, qid); u16 n_left = frame->n_vectors; u32 *buffers = vlib_frame_vector_args (frame); @@ -1039,13 +1042,15 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm, int packed = vif->is_packed; u16 n_vectors = frame->n_vectors; - clib_spinlock_lock_if_init (&vring->lockp); + if (tf->shared_queue) + clib_spinlock_lock (&vring->lockp); if (vif->packet_coalesce) { n_vectors = n_left = vnet_gro_inline (vm, vring->flow_table, buffers, n_left, to); buffers = to; + virtio_txq_clear_scheduled (vring); } u16 retry_count = 2; @@ -1089,7 +1094,8 @@ retry: &buffers[n_vectors - n_left], n_left, VIRTIO_TX_ERROR_NO_FREE_SLOTS); - clib_spinlock_unlock_if_init (&vring->lockp); + if (tf->shared_queue) + clib_spinlock_unlock (&vring->lockp); return frame->n_vectors - n_left; } @@ -1142,7 +1148,6 @@ static clib_error_t * virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid, vnet_hw_if_rx_mode mode) { - vlib_main_t *vm = vnm->vlib_main; virtio_main_t *mm = &virtio_main; vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index); virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance); @@ -1155,30 +1160,9 @@ virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid, } if (mode == VNET_HW_IF_RX_MODE_POLLING) - { - if (vif->packet_coalesce || vif->packet_buffering) - { - if (mm->interrupt_queues_count > 0) - mm->interrupt_queues_count--; - if (mm->interrupt_queues_count == 0) - vlib_process_signal_event (vm, - virtio_send_interrupt_node.index, - VIRTIO_EVENT_STOP_TIMER, 0); - } virtio_set_rx_polling (vif, rx_vring); - } else - { - if (vif->packet_coalesce || vif->packet_buffering) - { - mm->interrupt_queues_count++; - if (mm->interrupt_queues_count == 1) - vlib_process_signal_event (vm, - virtio_send_interrupt_node.index, - VIRTIO_EVENT_START_TIMER, 0); - } virtio_set_rx_interrupt (vif, rx_vring); - } rx_vring->mode = mode; |