Re: [PATCH net-next v3] net: xsk: introduce XDP_MAX_TX_BUDGET set/getsockopt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 19, 2025 at 11:09 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Thu, 19 Jun 2025 17:04:40 +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;
> >               }
> > @@ -779,7 +778,7 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs,
> >  static int __xsk_generic_xmit(struct sock *sk)
> >  {
> >       struct xdp_sock *xs = xdp_sk(sk);
> > -     u32 max_batch = TX_BATCH_SIZE;
> > +     u32 max_budget = READ_ONCE(xs->max_tx_budget);
>
> Hm, maybe a question to Stan / Willem & other XSK experts but are these
> two max values / code paths really related? Question 2 -- is generic
> XSK a legit optimization target, legit enough to add uAPI?

I'm not an expert but my take is:
#1, I don't see the correlation actually while I don't see any reason
to use the different values for both of them.
#2, These two definitions are improvement points because whether to do
the real send is driven by calling sendto(). Enlarging a little bit of
this value could save many times of calling sendto(). As for the uAPI,
I don't know if it's worth it, sorry. If not, the previous version 2
patch (regarding per-netns policy) will be revived.

So I will leave those two questions to XSK experts as well.

>
> Jason, I think some additions to Documentation/ and quantification of
> the benefits would be needed as well.

Got it.

#1 Documentation. I would add one small section 'XDP_MAX_TX_BUDGET
setsockopt' in Documentation/networking/af_xdp.rst.

#2 quantification
It's really hard to do so mainly because of various stacks implemented
in the user-space. AF_XDP is providing a fundamental mechanism only
and its upper layer is prosperous.

Thanks,
Jason

> --
> pw-bot: cr





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux