From 27ba5008a16eddccc0b285272de7f89fd0aa3a24 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Tue, 17 Nov 2020 13:30:44 -0800 Subject: vhost: Add event index for interrupt notification to driver VPP only supports a poor man's approach for interrupt notification to the driver. It uses a simple binary flag for "interrupt needed" or "interrupt not needed". Most drivers support more sophisticated event index already. This feature is to add the long due missing feature and make it configurable, off by default. Type: feature Signed-off-by: Steven Luong Change-Id: I68dab7dd07045cafb49af97b7f70db9b8131ae03 --- src/vnet/devices/virtio/vhost_user_input.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/vnet/devices/virtio/vhost_user_input.c') diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c index 53230a61bc7..7ea70c629f8 100644 --- a/src/vnet/devices/virtio/vhost_user_input.c +++ b/src/vnet/devices/virtio/vhost_user_input.c @@ -320,16 +320,17 @@ vhost_user_handle_rx_offload (vlib_buffer_t * b0, u8 * b0_data, } static_always_inline void -vhost_user_input_do_interrupt (vlib_main_t * vm, vhost_user_vring_t * txvq, +vhost_user_input_do_interrupt (vlib_main_t * vm, vhost_user_intf_t * vui, + vhost_user_vring_t * txvq, vhost_user_vring_t * rxvq) { f64 now = vlib_time_now (vm); if ((txvq->n_since_last_int) && (txvq->int_deadline < now)) - vhost_user_send_call (vm, txvq); + vhost_user_send_call (vm, vui, txvq); if ((rxvq->n_since_last_int) && (rxvq->int_deadline < now)) - vhost_user_send_call (vm, rxvq); + vhost_user_send_call (vm, vui, rxvq); } static_always_inline void @@ -400,7 +401,7 @@ vhost_user_if_input (vlib_main_t * vm, { /* do we have pending interrupts ? */ vhost_user_vring_t *rxvq = &vui->vrings[VHOST_VRING_IDX_RX (qid)]; - vhost_user_input_do_interrupt (vm, txvq, rxvq); + vhost_user_input_do_interrupt (vm, vui, txvq, rxvq); } /* @@ -742,7 +743,7 @@ stop: txvq->n_since_last_int += n_rx_packets; if (txvq->n_since_last_int > vum->coalesce_frames) - vhost_user_send_call (vm, txvq); + vhost_user_send_call (vm, vui, txvq); } /* increase rx counters */ @@ -1116,7 +1117,7 @@ vhost_user_if_input_packed (vlib_main_t * vm, vhost_user_main_t * vum, /* do we have pending interrupts ? */ vhost_user_vring_t *rxvq = &vui->vrings[VHOST_VRING_IDX_RX (qid)]; - vhost_user_input_do_interrupt (vm, txvq, rxvq); + vhost_user_input_do_interrupt (vm, vui, txvq, rxvq); /* * For adaptive mode, it is optimized to reduce interrupts. @@ -1389,7 +1390,7 @@ vhost_user_if_input_packed (vlib_main_t * vm, vhost_user_main_t * vum, { txvq->n_since_last_int += n_rx_packets; if (txvq->n_since_last_int > vum->coalesce_frames) - vhost_user_send_call (vm, txvq); + vhost_user_send_call (vm, vui, txvq); } /* increase rx counters */ -- cgit 1.2.3-korg