+ vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
+ virtio_vring_t *vring;
+ vif->packet_coalesce = 1;
+ vec_foreach (vring, vif->txq_vrings)
+ {
+ gro_flow_table_init (&vring->flow_table,
+ vif->type & (VIRTIO_IF_TYPE_TAP |
+ VIRTIO_IF_TYPE_PCI), hw->tx_node_index);
+ }
+}
+
+clib_error_t *
+virtio_set_packet_buffering (virtio_if_t * vif, u16 buffering_size)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
+ virtio_vring_t *vring;
+ clib_error_t *error = 0;
+ vif->packet_buffering = 1;
+
+ vec_foreach (vring, vif->txq_vrings)
+ {
+ if ((error =
+ virtio_vring_buffering_init (&vring->buffering, hw->tx_node_index,
+ buffering_size)))
+ {
+ break;
+ }
+ }
+
+ return error;
+}
+
+static void
+virtio_vring_fill (vlib_main_t *vm, virtio_if_t *vif, virtio_vring_t *vring)
+{
+ if (vif->is_packed)
+ virtio_refill_vring_packed (vm, vif, vif->type, vring,
+ vif->virtio_net_hdr_sz,
+ virtio_input_node.index);
+ else
+ virtio_refill_vring_split (vm, vif, vif->type, vring,
+ vif->virtio_net_hdr_sz,
+ virtio_input_node.index);
+}
+
+void
+virtio_vring_set_rx_queues (vlib_main_t *vm, virtio_if_t *vif)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ virtio_vring_t *vring;
+ u32 i = 0;
+
+ vnet_hw_if_set_input_node (vnm, vif->hw_if_index, virtio_input_node.index);
+
+ vec_foreach (vring, vif->rxq_vrings)
+ {
+ vring->queue_index = vnet_hw_if_register_rx_queue (
+ vnm, vif->hw_if_index, RX_QUEUE_ACCESS (vring->queue_id),
+ VNET_HW_IF_RXQ_THREAD_ANY);
+ vring->buffer_pool_index = vlib_buffer_pool_get_default_for_numa (
+ vm, vnet_hw_if_get_rx_queue_numa_node (vnm, vring->queue_index));
+ if (vif->type == VIRTIO_IF_TYPE_TAP || vif->type == VIRTIO_IF_TYPE_TUN)
+ {
+
+ clib_file_t f = {
+ .read_function = call_read_ready,
+ .flags = UNIX_FILE_EVENT_EDGE_TRIGGERED,
+ .file_descriptor = vring->call_fd,
+ .private_data = vring->queue_index,
+ .description = format (0, "%U vring %u", format_virtio_device_name,
+ vif->dev_instance, vring->queue_id),
+ };
+
+ vring->call_file_index = clib_file_add (&file_main, &f);
+ vnet_hw_if_set_rx_queue_file_index (vnm, vring->queue_index,
+ vring->call_file_index);
+ }
+ else if ((vif->type == VIRTIO_IF_TYPE_PCI) && (vif->support_int_mode) &&
+ (vif->msix_enabled == VIRTIO_MSIX_ENABLED))
+ {
+ u32 file_index;
+ file_index =
+ vlib_pci_get_msix_file_index (vm, vif->pci_dev_handle, i + 1);
+ vnet_hw_if_set_rx_queue_file_index (vnm, vring->queue_index,
+ file_index);
+ i++;
+ }
+ vnet_hw_if_set_rx_queue_mode (vnm, vring->queue_index,
+ VNET_HW_IF_RX_MODE_POLLING);
+ vring->mode = VNET_HW_IF_RX_MODE_POLLING;
+ virtio_vring_fill (vm, vif, vring);
+ }
+ vnet_hw_if_update_runtime_data (vnm, vif->hw_if_index);