Re: [PATCH net-next 1/2] net: renesas: rswitch: use per-port irq handlers
From: Geert Uytterhoeven
Date: Fri Dec 20 2024 - 03:00:06 EST
Hi Nikita,
CC devicetree
Thanks for your patch!
On Fri, Dec 20, 2024 at 5:17 AM Nikita Yushchenko
<nikita.yoush@xxxxxxxxxxxxxxxxxx> wrote:
> Instead of handling all possible data interrupts in the same handler,
> switch to per-port handlers.
>
> This significantly simplifies handling: when the same interrupt is used
> for several ports, system calls all handlers, and each handler only has
> to check interrupts for one port's tx and rx queues.
>
> But it is not required to use the same interrupt for all ports - GWCA
> provides 8 data interrupts and allows arbitrary per-queue assignment
> of those. Support that by reading interrupt index for each port from
> optional 'irq-index' device tree property.
Sorry, but I can't find where this property is documented?
> With per-port interrupts it becomes possible to configure affinity such
> that traffic coming from different ports is serviced simultaneously on
> different CPUs.
>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@xxxxxxxxxxxxxxxxxx>
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -1906,6 +1841,34 @@ static void rswitch_etha_init(struct rswitch_private *priv, unsigned int index)
> etha->psmcs = clk_get_rate(priv->clk) / 100000 / (25 * 2) - 1;
> }
>
> +static int rswitch_port_get_irq(struct rswitch_device *rdev)
> +{
> + unsigned int irq_index;
> + char *name;
> + int err;
> +
> + err = of_property_read_u32(rdev->np_port, "irq-index", &irq_index);
> + if (err == 0) {
> + if (irq_index < GWCA_NUM_IRQS)
> + rdev->irq_index = irq_index;
> + else
> + dev_warn(&rdev->priv->pdev->dev,
> + "%pOF: irq-index out of range\n",
> + rdev->np_port);
> + }
> +
> + name = kasprintf(GFP_KERNEL, GWCA_IRQ_RESOURCE_NAME, rdev->irq_index);
> + if (!name)
> + return -ENOMEM;
> + err = platform_get_irq_byname(rdev->priv->pdev, name);
> + kfree(name);
> + if (err < 0)
> + return err;
> + rdev->irq = err;
> +
> + return 0;
> +}
> +
> static int rswitch_device_alloc(struct rswitch_private *priv, unsigned int index)
> {
> struct platform_device *pdev = priv->pdev;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds