[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL+tcoDNoZH_rnC9th8od-qu2QE8nWHgiWEATA8SVs_jc9rJnA@mail.gmail.com>
Date: Tue, 12 Aug 2025 06:57:32 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: przemyslaw.kitszel@...el.com, larysa.zaremba@...el.com,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, bjorn@...nel.org,
maciej.fijalkowski@...el.com, intel-wired-lan@...ts.osuosl.org,
netdev@...r.kernel.org, Jason Xing <kernelxing@...cent.com>
Subject: Re: [Intel-wired-lan] [PATCH v2 iwl-net] ixgbe: xsk: resolve the
negative overflow of budget in ixgbe_xmit_zc
On Tue, Aug 12, 2025 at 5:38 AM Tony Nguyen <anthony.l.nguyen@...el.com> wrote:
>
>
>
> On 8/10/2025 5:22 AM, Jason Xing wrote:
> > On Sat, Jul 26, 2025 at 3:04 PM Jason Xing <kerneljasonxing@...il.com> wrote:
> >>
> >> From: Jason Xing <kernelxing@...cent.com>
> >>
> >> Resolve the budget negative overflow which leads to returning true in
> >> ixgbe_xmit_zc even when the budget of descs are thoroughly consumed.
> >>
> >> Before this patch, when the budget is decreased to zero and finishes
> >> sending the last allowed desc in ixgbe_xmit_zc, it will always turn back
> >> and enter into the while() statement to see if it should keep processing
> >> packets, but in the meantime it unexpectedly decreases the value again to
> >> 'unsigned int (0--)', namely, UINT_MAX. Finally, the ixgbe_xmit_zc returns
> >> true, showing 'we complete cleaning the budget'. That also means
> >> 'clean_complete = true' in ixgbe_poll.
> >>
> >> The true theory behind this is if that budget number of descs are consumed,
> >> it implies that we might have more descs to be done. So we should return
> >> false in ixgbe_xmit_zc to tell napi poll to find another chance to start
> >> polling to handle the rest of descs. On the contrary, returning true here
> >> means job done and we know we finish all the possible descs this time and
> >> we don't intend to start a new napi poll.
> >>
> >> It is apparently against our expectations. Please also see how
> >> ixgbe_clean_tx_irq() handles the problem: it uses do..while() statement
> >> to make sure the budget can be decreased to zero at most and the negative
> >> overflow never happens.
> >>
> >> The patch adds 'likely' because we rarely would not hit the loop codition
> >> since the standard budget is 256.
> >>
> >> Fixes: 8221c5eba8c1 ("ixgbe: add AF_XDP zero-copy Tx support")
> >> Signed-off-by: Jason Xing <kernelxing@...cent.com>
> >> Reviewed-by: Larysa Zaremba <larysa.zaremba@...el.com>
> >
> > Hi Tony,
> >
> > Any update here? Thanks! I'm asking because I'm ready to send an afxdp
> > patch series based on the patch :)
>
> Hi Jason,
>
> I have this slated to be part of my next net series. I do already have
> this patch applied/staged on the Intel tree [1] (dev-queue branch). You
> can base it on that and send the changes now; I'll ensure that this
> patch is merged before sending the other series.
>
> Thanks,
> Tony
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git/
Great, thanks for the pointer!
Thanks,
Jason
Powered by blists - more mailing lists