diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-10-30 15:00:04 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-12-17 17:51:04 +0000 |
commit | edf3b4b04cc02707cf8aafe8fafe1296904a8b66 (patch) | |
tree | 14adb7e292480fb619f2c20a58bfd03b1fae79a2 /src/vnet/devices | |
parent | d1b9e706841150d0da042a05aab51f19fa804192 (diff) |
virtio: fix the tx queue thread binding
Type: fix
Change-Id: Ibbe7e20aebc9153ceba07e048dc0eaa45193f4ea
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices')
-rw-r--r-- | src/vnet/devices/virtio/pci.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c index 925c6f5cb87..ab21147aca9 100644 --- a/src/vnet/devices/virtio/pci.c +++ b/src/vnet/devices/virtio/pci.c @@ -657,7 +657,6 @@ clib_error_t * virtio_pci_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 queue_num) { clib_error_t *error = 0; - vlib_thread_main_t *vtm = vlib_get_thread_main (); u16 queue_size = 0; virtio_vring_t *vring; struct vring vr; @@ -679,8 +678,6 @@ virtio_pci_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 queue_num) if (queue_num % 2) { - if (TX_QUEUE_ACCESS (queue_num) > vtm->n_vlib_mains) - return error; vec_validate_aligned (vif->txq_vrings, TX_QUEUE_ACCESS (queue_num), CLIB_CACHE_LINE_BYTES); vring = vec_elt_at_index (vif->txq_vrings, TX_QUEUE_ACCESS (queue_num)); @@ -918,6 +915,7 @@ virtio_pci_device_init (vlib_main_t * vm, virtio_if_t * vif, virtio_pci_create_if_args_t * args) { clib_error_t *error = 0; + vlib_thread_main_t *vtm = vlib_get_thread_main (); u8 status = 0; if ((error = virtio_pci_read_caps (vm, vif))) @@ -983,6 +981,22 @@ virtio_pci_device_init (vlib_main_t * vm, virtio_if_t * vif, vif->num_rxqs++; } + if (i >= vtm->n_vlib_mains) + { + /* + * There is 1:1 mapping between tx queue and vpp worker thread. + * tx queue 0 is bind with thread index 0, tx queue 1 on thread + * index 1 and so on. + * Multiple worker threads can poll same tx queue when number of + * workers are more than tx queues. In this case, 1:N mapping + * between tx queue and vpp worker thread. + */ + virtio_log_debug (vif, "%s %u, %s", "tx-queue: number", + TX_QUEUE (i), + "no VPP worker thread is available"); + continue; + } + if ((error = virtio_pci_vring_init (vm, vif, TX_QUEUE (i)))) { virtio_log_warning (vif, "%s (%u) %s", "error in txq-queue", |