Re: [PATCH V11 net-next 07/10] net: hibmcge: Implement rx_poll function to receive packets

From: Joe Damato
Date: Wed Oct 09 2024 - 17:42:35 EST


On Wed, Oct 09, 2024 at 02:35:58PM -0700, Joe Damato wrote:
> On Tue, Oct 08, 2024 at 10:23:55AM +0800, Jijie Shao wrote:
> > Implement rx_poll function to read the rx descriptor after
> > receiving the rx interrupt. Adjust the skb based on the
> > descriptor to complete the reception of the packet.
> >
> > Signed-off-by: Jijie Shao <shaojijie@xxxxxxxxxx>
>
> [...]
>
> > +
> > +static int hbg_napi_rx_poll(struct napi_struct *napi, int budget)
> > +{
>
> [...]
>
> > +
> > + if (likely(packet_done < budget &&
> > + napi_complete_done(napi, packet_done)))
> > + hbg_hw_irq_enable(priv, HBG_INT_MSK_RX_B, true);
>
> I am not sure this is correct.
>
> napi_complete_done might return false if napi_defer_hard_irqs is
> being used [1].
>
> In that case you'd probably want to avoid re-enabling IRQs even
> though (packet_done < budget) is true.

Err, sorry. I read the code wrong. The implementation you have looks
right to me, my mistake.