[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <66bb5e1dbf778_6ef1329466@willemb.c.googlers.com.notmuch>
Date: Tue, 13 Aug 2024 09:22:37 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jason Wang <jasowang@...hat.com>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: ayaka <ayaka@...lik.info>,
netdev@...r.kernel.org,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: tuntap: add ioctl() TUNGETQUEUEINDX to fetch queue
index
Jason Wang wrote:
> On Tue, Aug 13, 2024 at 1:11 AM Willem de Bruijn
> <willemdebruijn.kernel@...il.com> wrote:
> >
> > Jason Wang wrote:
> > > On Fri, Aug 9, 2024 at 10:55 PM Willem de Bruijn
> > > <willemdebruijn.kernel@...il.com> wrote:
> > > >
> > > > ayaka wrote:
> > > > >
> > > > > Sent from my iPad
> > > >
> > > > Try to avoid ^^^
> > > >
> > >
> > > [...]
> > >
> > > > > 2. Does such a hash operation happen to every packet passing through?
> > > >
> > > > For packets with a local socket, the computation is cached in the
> > > > socket.
> > > >
> > > > For these tunnel packets, see tun_automq_select_queue. Specifically,
> > > > the call to __skb_get_hash_symmetric.
> > > >
> > > > I'm actually not entirely sure why tun has this, rather than defer
> > > > to netdev_pick_tx, which call skb_tx_hash.
> > >
> > > Not sure I get the question, but it needs to use a consistent hash to
> > > match the flows stored before.
> >
> > This is a bit tangential to Randy's original thread, but I would like
> > to understand this part a bit better, if you don't mind.
>
> Comments are more than welcomed. The code is written more than 10
> years, it should have something that can be improved.
>
> >
> > Tun automq calls __skb_get_hash_symmetric instead of the
> > non-symmetrical skb_get_hash of netdev_pick_tx. That makes sense.
> >
> > Also, netdev_pick_tx tries other things first, like XPS.
>
> Right, using XPS may conflict with the user expected behaviour (e.g
> the automatic steering has been documented in the virtio spec, though
> it's best effort somehow).
>
> >
> > Why does automq have to be stateful, keeping a table. Rather than
> > always computing symmetrical_hash % reciprocal_scale(txq, numqueues)
> > directly, as is does when the flow is not found?
> >
> > Just curious, thanks.
>
> You are right, I think we can avoid the hash calculation and depend on
> the fallback in netdev_pick_tx().
>
> Have put this in my backlog.
Great. Thanks for taking a look at that Jason.
It may very well be that standard netdev_pick_tx does not conform to
the virtio spec behavior. But if it does, nice simplification.
If we have to create a variant that takes a bool skip_xps, that's
totally worth it.
Powered by blists - more mailing lists