Re: [PATCH net-next] tg3: Link IRQs to NAPI instances

From: Michael Chan
Date: Thu Sep 12 2024 - 14:29:39 EST


On Thu, Sep 12, 2024 at 11:13 AM Joe Damato <jdamato@xxxxxxxxxx> wrote:
>
> On Thu, Sep 12, 2024 at 11:04:02AM -0700, Michael Chan wrote:
> > Looks good, but why not just add netif_napi_set_irq() to the existing
> > loop in tg3_napi_init()? It will reduce the lines of code a bit.
> > Thanks.
>
> I made a separate function because:
> - tg3_napi_init would need two calls (once for i=0, and once in
> the loop), and
> - tg3_napi_init and tg3_napi_enable are separated in the driver,
> so I figured I'd separate the IRQ linking, too.
>

tg3_napi_enable() needs to be separated because it is called in
multiple places and tg3_napi_init() is only called once.

Even with 2 calls in tg3_napi_init(), I think it will still reduce the
lines of code. Or we can do this to do everything in the loop:

for (i = 0; i < tp->irq_cnt; i++) {
netif_napi_add(tp->dev, &tp->napi[i].napi, i ? tg3_poll_msix :
tg3_poll);
netif_set_napi_irq(...);
}

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature