diff mbox series

[4/7] vDPA/ifcvf: implement shared irq handlers for vqs

Message ID 20220110051851.84807-5-lingshan.zhu@intel.com (mailing list archive)
State Superseded
Headers show
Series Supoort shared irq for virtqueues | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Zhu, Lingshan Jan. 10, 2022, 5:18 a.m. UTC
It has observed that a device may fail to alloc enough vectors on
some platforms, e.g., requires 16 vectors, but only 2 or 4 vector
slots allocated. The virt queues have to share a vector/irq under
such circumstances.

This irq handlers has to kick every queue because it is not
possible to tell which queue triggers the interrupt.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Michael S. Tsirkin Jan. 10, 2022, 6:10 a.m. UTC | #1
On Mon, Jan 10, 2022 at 01:18:48PM +0800, Zhu Lingshan wrote:
> It has observed that a device may fail to alloc enough vectors on
> some platforms, e.g., requires 16 vectors, but only 2 or 4 vector
> slots allocated. The virt queues have to share a vector/irq under
> such circumstances.
> 
> This irq handlers has to kick every queue because it is not
> possible to tell which queue triggers the interrupt.
> 
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 64fc78eaa1a9..19e1d1cd71a3 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -37,6 +37,21 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> +static irqreturn_t ifcvf_shared_intr_handler(int irq, void *arg)
> +{
> +	struct ifcvf_hw *vf = arg;
> +	struct vring_info *vring;
> +	int i;
> +
> +	for (i = 0; i < vf->nr_vring; i++) {
> +		vring = &vf->vring[i];
> +		if (vring->cb.callback)
> +			vf->vring->cb.callback(vring->cb.private);
> +	}
> +
> +	return IRQ_HANDLED;
> +}
> +
>  static void ifcvf_free_irq_vectors(void *data)
>  {
>  	pci_free_irq_vectors(data);


A static function with no caller. surprised gcc does not warn.

> -- 
> 2.27.0
diff mbox series

Patch

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index 64fc78eaa1a9..19e1d1cd71a3 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -37,6 +37,21 @@  static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t ifcvf_shared_intr_handler(int irq, void *arg)
+{
+	struct ifcvf_hw *vf = arg;
+	struct vring_info *vring;
+	int i;
+
+	for (i = 0; i < vf->nr_vring; i++) {
+		vring = &vf->vring[i];
+		if (vring->cb.callback)
+			vf->vring->cb.callback(vring->cb.private);
+	}
+
+	return IRQ_HANDLED;
+}
+
 static void ifcvf_free_irq_vectors(void *data)
 {
 	pci_free_irq_vectors(data);