netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jason Xing <kerneljasonxing@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>, <bjorn@kernel.org>,
	<magnus.karlsson@intel.com>, <jonathan.lemon@gmail.com>,
	<sdf@fomichev.me>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<hawk@kernel.org>, <john.fastabend@gmail.com>, <joe@dama.to>,
	<willemdebruijn.kernel@gmail.com>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>, Jason Xing <kernelxing@tencent.com>
Subject: Re: [PATCH net-next v4] net: xsk: introduce XDP_MAX_TX_BUDGET setsockopt
Date: Wed, 25 Jun 2025 14:21:14 +0200	[thread overview]
Message-ID: <aFvpumY2VrER7gDj@boxer> (raw)
In-Reply-To: <CAL+tcoBQvDJO8n7npQjzKBd6HEZ8KhE08g4hRhqokU-bpTe6tw@mail.gmail.com>

On Wed, Jun 25, 2025 at 08:19:01AM +0800, Jason Xing wrote:
> On Wed, Jun 25, 2025 at 7:31 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Mon, 23 Jun 2025 10:13:45 +0800 Jason Xing wrote:
> > > @@ -424,7 +421,9 @@ bool xsk_tx_peek_desc(struct xsk_buff_pool *pool, struct xdp_desc *desc)
> > >       rcu_read_lock();
> > >  again:
> > >       list_for_each_entry_rcu(xs, &pool->xsk_tx_list, tx_list) {
> > > -             if (xs->tx_budget_spent >= MAX_PER_SOCKET_BUDGET) {
> > > +             int max_budget = READ_ONCE(xs->max_tx_budget);
> > > +
> > > +             if (xs->tx_budget_spent >= max_budget) {
> > >                       budget_exhausted = true;
> > >                       continue;
> > >               }
> >
> > I still think you're mixing two very different things. In the generic
> > xmit path the value you're changing is a budget. But xsk_tx_peek_desc()
> > *does not* exit after the "per socket budget" gets spent. The per
> > socket budget only controls how many frames we pick from a single sock
> > before we move to the next. But if we run out of budget on all sockets
> > we give every socket a full budget again and start from the first one

On point. Thanks Jakub! Let's stick to generic xmit budget.

> 
> Ah, my fault. Thanks for reminding me. I missed the 'refilling budget'
> process...
> For the record:
> xsk_tx_peek_desc()
>     -> xs->tx_budget_spent = 0;
> 
> > again.
> >
> > For the ZC case the true budget is set by the driver's NAPI loop.
> 
> True.
> 
> I will remove this one.
> 
> Thanks,
> Jason
> 
> > --
> > pw-bot: cr

      reply	other threads:[~2025-06-25 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23  2:13 [PATCH net-next v4] net: xsk: introduce XDP_MAX_TX_BUDGET setsockopt Jason Xing
2025-06-24 23:31 ` Jakub Kicinski
2025-06-25  0:19   ` Jason Xing
2025-06-25 12:21     ` Maciej Fijalkowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFvpumY2VrER7gDj@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=joe@dama.to \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=kernelxing@tencent.com \
    --cc=kuba@kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).