RE: [RESEND v1 net-next 3/5] net: stmmac: introduce MSI Interrupt routines for mac, safety, RX & TX

From: Voon, Weifeng
Date: Wed Mar 24 2021 - 04:44:54 EST


> On Tue, 16 Mar 2021 20:18:21 +0800 Voon Weifeng wrote:
> > From: Ong Boon Leong <boon.leong.ong@xxxxxxxxx>
> >
> > Now we introduce MSI interrupt service routines and hook these
> > routines up if stmmac_open() sees valid irq line being requested:-
> >
> > stmmac_mac_interrupt() :- MAC (dev->irq), WOL (wol_irq), LPI (lpi_irq)
> > stmmac_safety_interrupt() :- Safety Feat Correctible Error (sfty_ce_irq)
> > & Uncorrectible Error (sfty_ue_irq)
> > stmmac_msi_intr_rx() :- For all RX MSI irq (rx_irq)
> > stmmac_msi_intr_tx() :- For all TX MSI irq (tx_irq)
>
> Do you split RX and TX irqs out on purpose? Most commonly one queue pair
> maps to one CPU, so using single IRQ for Rx and Tx results in fewer IRQs
> being triggered and better system performance.

Yes, the RX and TX irqs are split out on purpose as the hardware is designed
to have independent MSI vector. You can refer the 4th patch in the this patchset.
https://patchwork.kernel.org/project/netdevbpf/patch/20210316121823.18659-5-weifeng.voon@xxxxxxxxx/
This design also gives us the flexibility to group RX/TX MSI vectors to specific CPU freely.

Weifeng


> > Each of IRQs will have its unique name so that we can differentiate
> > them easily under /proc/interrupts.
> >
> > Signed-off-by: Ong Boon Leong <boon.leong.ong@xxxxxxxxx>
> > Signed-off-by: Voon Weifeng <weifeng.voon@xxxxxxxxx>
>
> > +static int stmmac_request_irq(struct net_device *dev)
>
> This function is a one huge if statement, please factor out both sides into
> separate subfunctions.

Noted. Will do.

>
> > + netdev_info(priv->dev, "PASS: requesting IRQs\n");
>
> Does the user really need to know interrupts were requested on every probe?

Will remove.

>
> > + return ret;
>
> return 0; ?

Good catch, will fix.

>
> > +irq_error:
> > + stmmac_free_irq(dev, irq_err, irq_idx);
> > + return ret;
> > +}