summaryrefslogtreecommitdiffstats
path: root/src/plugins/avf
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-07-25 00:32:44 +0200
committerDamjan Marion <dmarion@me.com>2018-07-26 07:19:56 +0000
commit351b3a0c3ee735c5f759ce3fef7951d0a2e5b34a (patch)
treeeee4cfc353b54b343622d1bcc2d536fbec075c4b /src/plugins/avf
parent3451d98550228b9742e8ff4577dd4a1ee6791efc (diff)
avf: fix interrupt mode
- assign rx thread on interface create, not on admin up - keep interrupts unmasked all the time as they are needed for writeback - forward interrupt to graph dispatcher only if queue is in the interrupt mode Change-Id: I5cc5afe24960143bef08f12d59fbd80ae0c6ccf8 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/avf')
-rw-r--r--src/plugins/avf/avf.h1
-rw-r--r--src/plugins/avf/device.c26
2 files changed, 25 insertions, 2 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 14d78195f76..d8c64737c32 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -85,6 +85,7 @@ typedef struct
avf_rx_desc_t *descs;
u32 *bufs;
u16 n_enqueued;
+ u8 int_mode;
} avf_rxq_t;
typedef struct
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 0e9a8bfe517..83a3d9cdb10 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -737,6 +737,7 @@ avf_device_init (vlib_main_t * vm, avf_device_t * ad,
return error;
avf_irq_0_enable (ad);
+ avf_irq_n_enable (ad, 0);
if ((error = avf_op_add_eth_addr (vm, ad, 1, ad->hwaddr)))
return error;
@@ -983,6 +984,7 @@ avf_irq_n_handler (vlib_pci_dev_handle_t h, u16 line)
avf_main_t *am = &avf_main;
uword pd = vlib_pci_get_private_data (h);
avf_device_t *ad = pool_elt_at_index (am->devices, pd);
+ u16 qid;
if (ad->flags & AVF_DEVICE_F_ELOG)
{
@@ -1004,7 +1006,9 @@ avf_irq_n_handler (vlib_pci_dev_handle_t h, u16 line)
ed->line = line;
}
- vnet_device_input_set_interrupt_pending (vnm, ad->hw_if_index, 0);
+ qid = line - 1;
+ if (vec_len (ad->rxqs) > qid && ad->rxqs[qid].int_mode != 0)
+ vnet_device_input_set_interrupt_pending (vnm, ad->hw_if_index, qid);
avf_irq_n_enable (ad, 0);
}
@@ -1177,6 +1181,7 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
vnet_hw_interface_set_input_node (vnm, ad->hw_if_index,
avf_input_node.index);
+ vnet_hw_interface_assign_rx_thread (vnm, ad->hw_if_index, 0, ~0);
if (pool_elts (am->devices) == 1)
vlib_process_signal_event (vm, avf_process_node.index,
@@ -1208,7 +1213,6 @@ avf_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
vnet_hw_interface_set_flags (vnm, ad->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
ad->flags |= AVF_DEVICE_F_ADMIN_UP;
- vnet_hw_interface_assign_rx_thread (vnm, ad->hw_if_index, 0, ~0);
}
else
{
@@ -1218,6 +1222,23 @@ avf_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
return 0;
}
+static clib_error_t *
+avf_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
+ vnet_hw_interface_rx_mode mode)
+{
+ avf_main_t *am = &avf_main;
+ vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
+ avf_device_t *ad = pool_elt_at_index (am->devices, hw->dev_instance);
+ avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, qid);
+
+ if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ rxq->int_mode = 0;
+ else
+ rxq->int_mode = 1;
+
+ return 0;
+}
+
/* *INDENT-OFF* */
VNET_DEVICE_CLASS (avf_device_class,) =
{
@@ -1226,6 +1247,7 @@ VNET_DEVICE_CLASS (avf_device_class,) =
.format_device = format_avf_device,
.format_device_name = format_avf_device_name,
.admin_up_down_function = avf_interface_admin_up_down,
+ .rx_mode_change_function = avf_interface_rx_mode_change,
};
/* *INDENT-ON* */