+
+ vnet_device_queue_update (vnm, rt);
+
+ if (vec_len (rt->devices_and_queues) == 0)
+ vlib_node_set_state (vm, hw->input_node_index, VLIB_NODE_STATE_DISABLED);
+
+ return 0;
+}
+
+
+int
+vnet_device_input_set_mode (vnet_main_t * vnm, u32 hw_if_index, u16 queue_id,
+ vnet_device_input_mode_t mode)
+{
+ vlib_main_t *vm;
+ uword thread_index;
+ vnet_device_and_queue_t *dq;
+ vlib_node_state_t enabled_node_state;
+ ASSERT (mode < VNET_DEVICE_INPUT_N_MODES);
+ vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
+ vnet_device_input_runtime_t *rt;
+ int is_polling = 0;
+
+ if (hw->input_node_thread_index_by_queue == 0)
+ return VNET_API_ERROR_INVALID_INTERFACE;
+
+ thread_index = hw->input_node_thread_index_by_queue[queue_id];
+ vm = vlib_mains[thread_index];
+
+ rt = vlib_node_get_runtime_data (vm, hw->input_node_index);
+
+ vec_foreach (dq, rt->devices_and_queues)
+ {
+ if (dq->hw_if_index == hw_if_index && dq->queue_id == queue_id)
+ dq->mode = mode;
+ if (dq->mode == VNET_DEVICE_INPUT_MODE_POLLING)
+ is_polling = 1;
+ }
+
+ if (is_polling)
+ enabled_node_state = VLIB_NODE_STATE_POLLING;
+ else
+ enabled_node_state = VLIB_NODE_STATE_INTERRUPT;
+
+ if (rt->enabled_node_state != enabled_node_state)
+ {
+ rt->enabled_node_state = enabled_node_state;
+ if (vlib_node_get_state (vm, hw->input_node_index) !=
+ VLIB_NODE_STATE_DISABLED)
+ vlib_node_set_state (vm, hw->input_node_index, enabled_node_state);
+ }