diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/memif/memif.c | 2 | ||||
-rw-r--r-- | src/vnet/devices/devices.c | 3 | ||||
-rw-r--r-- | src/vnet/interface.c | 1 | ||||
-rw-r--r-- | src/vnet/interface.h | 2 | ||||
-rw-r--r-- | src/vnet/interface_cli.c | 18 |
5 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index ec67023b673..fffb94c952b 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -222,7 +222,7 @@ memif_connect (memif_if_t * mif) } vnet_hw_interface_assign_rx_thread (vnm, mif->hw_if_index, i, ~0); rv = vnet_hw_interface_set_rx_mode (vnm, mif->hw_if_index, i, - VNET_HW_INTERFACE_RX_MODE_INTERRUPT); + VNET_HW_INTERFACE_RX_MODE_DEFAULT); if (rv) clib_warning ("Warning: unable to set rx mode for interface %d queue %d: " diff --git a/src/vnet/devices/devices.c b/src/vnet/devices/devices.c index e3311c43632..f64c6e0dea5 100644 --- a/src/vnet/devices/devices.c +++ b/src/vnet/devices/devices.c @@ -245,6 +245,9 @@ vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index, vnet_device_input_runtime_t *rt; int is_polling = 0; + if (mode == VNET_HW_INTERFACE_RX_MODE_DEFAULT) + mode = hw->default_rx_mode; + if (hw->input_node_thread_index_by_queue == 0 || hw->rx_mode_by_queue == 0) return VNET_API_ERROR_INVALID_INTERFACE; diff --git a/src/vnet/interface.c b/src/vnet/interface.c index e9042ae8580..1370d048b0b 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -706,6 +706,7 @@ vnet_register_interface (vnet_main_t * vnm, hw_index = hw - im->hw_interfaces; hw->hw_if_index = hw_index; + hw->default_rx_mode = VNET_HW_INTERFACE_RX_MODE_POLLING; if (dev_class->format_device_name) hw->name = format (0, "%U", dev_class->format_device_name, dev_instance); diff --git a/src/vnet/interface.h b/src/vnet/interface.h index 095fe9617e2..d684e356ca4 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -54,6 +54,7 @@ typedef enum VNET_HW_INTERFACE_RX_MODE_POLLING, VNET_HW_INTERFACE_RX_MODE_INTERRUPT, VNET_HW_INTERFACE_RX_MODE_ADAPTIVE, + VNET_HW_INTERFACE_RX_MODE_DEFAULT, VNET_HW_INTERFACE_NUM_RX_MODES, } vnet_hw_interface_rx_mode; @@ -492,6 +493,7 @@ typedef struct vnet_hw_interface_t /* vnet_hw_interface_rx_mode by queue */ u8 *rx_mode_by_queue; + vnet_hw_interface_rx_mode default_rx_mode; /* device input device_and_queue runtime index */ uword *dq_runtime_index_by_queue; diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index d37c78942c9..bf2873acbe9 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -1186,6 +1186,9 @@ set_hw_interface_rx_mode (vnet_main_t * vnm, u32 hw_if_index, vnet_hw_interface_rx_mode old_mode; int rv; + if (mode == VNET_HW_INTERFACE_RX_MODE_DEFAULT) + mode = hw->default_rx_mode; + rv = vnet_hw_interface_get_rx_mode (vnm, hw_if_index, queue_id, &old_mode); switch (rv) { @@ -1272,12 +1275,15 @@ set_interface_rx_mode (vlib_main_t * vm, unformat_input_t * input, hw = vnet_get_hw_interface (vnm, hw_if_index); if (queue_id == ~0) - for (i = 0; i < vec_len (hw->dq_runtime_index_by_queue); i++) - { - error = set_hw_interface_rx_mode (vnm, hw_if_index, i, mode); - if (error) - break; - } + { + for (i = 0; i < vec_len (hw->dq_runtime_index_by_queue); i++) + { + error = set_hw_interface_rx_mode (vnm, hw_if_index, i, mode); + if (error) + break; + } + hw->default_rx_mode = mode; + } else error = set_hw_interface_rx_mode (vnm, hw_if_index, queue_id, mode); |