- u16 *queue;
-
- // Scrap all existing mappings for all interfaces/queues
- /* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
- vec_foreach (queue, vui->rx_queues)
- {
- rv = vnet_hw_interface_unassign_rx_thread (vnm, vui->hw_if_index,
- *queue);
- if (rv)
- vu_log_warn (vui, "unable to unassign interface %d, "
- "queue %d: rc=%d", vui->hw_if_index, *queue, rv);
- }
- vec_reset_length (vui->rx_queues);
- });
- /* *INDENT-ON* */
-
- // Create the rx_queues for all interfaces
- /* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
- for (qid = 0; qid < VHOST_VRING_MAX_N / 2; qid++)
- {
- txvq = &vui->vrings[VHOST_VRING_IDX_TX (qid)];
- if (txvq->started)
- {
- if (txvq->mode == VNET_HW_INTERFACE_RX_MODE_UNKNOWN)
- /* Set polling as the default */
- txvq->mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
- vec_add1 (vui->rx_queues, qid);
- }
- }
- });
- /* *INDENT-ON* */
-
- // Assign new mappings for all interfaces/queues
- /* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
- vnet_hw_interface_set_input_node (vnm, vui->hw_if_index,
- vhost_user_input_node.index);
- vec_foreach (queue, vui->rx_queues)
- {
- vnet_hw_interface_assign_rx_thread (vnm, vui->hw_if_index, *queue,
- ~0);
- txvq = &vui->vrings[VHOST_VRING_IDX_TX (*queue)];
- rv = vnet_hw_interface_set_rx_mode (vnm, vui->hw_if_index, *queue,
- txvq->mode);
- if (rv)
- vu_log_warn (vui, "unable to set rx mode for interface %d, "
- "queue %d: rc=%d", vui->hw_if_index, *queue, rv);
- }
- });
- /* *INDENT-ON* */
+ u32 q = qid >> 1;
+
+ ASSERT ((qid & 1) == 1); // should be odd
+ // Assign new queue mappings for the interface
+ vnet_hw_interface_set_input_node (vnm, vui->hw_if_index,
+ vhost_user_input_node.index);
+ vnet_hw_interface_assign_rx_thread (vnm, vui->hw_if_index, q, ~0);
+ if (txvq->mode == VNET_HW_INTERFACE_RX_MODE_UNKNOWN)
+ /* Set polling as the default */
+ txvq->mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ txvq->qid = q;
+ rv = vnet_hw_interface_set_rx_mode (vnm, vui->hw_if_index, q, txvq->mode);
+ if (rv)
+ vu_log_warn (vui, "unable to set rx mode for interface %d, "
+ "queue %d: rc=%d", vui->hw_if_index, q, rv);