Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Daniel Zahka" <daniel.zahka@gmail.com>
Cc: <willemdebruijn.kernel@gmail.com>, <edumazet@google.com>,
	<cratiu@nvidia.com>, <borisp@nvidia.com>, <kuniyu@google.com>,
	<netdev@vger.kernel.org>
Subject: Re: [RFC net-next 1/6] psp: steer Rx queues with the virtualization cookie
Date: Mon, 24 Aug 2026 08:01:22 -0700	[thread overview]
Message-ID: <20260824080122.17be0e16@kernel.org> (raw)
In-Reply-To: <DKWFJ9D12OPD.2ZLQHDM0276G4@gmail.com>

On Sun, 23 Aug 2026 11:31:03 -0400 Daniel Zahka wrote:
> On Sat Aug 22, 2026 at 6:55 PM EDT, Jakub Kicinski wrote:
> > @@ -72,6 +90,27 @@ name: psp
> >            Present when in associated namespace, absent when in primary/host
> >            namespace.
> >          type: flag
> > +      -
> > +        name: vc-steer-cap
> > +        doc: |
> > +          Device can steer received traffic on the PSP virtualization
> > +          cookie (VC). The VC is split into a 32b reserved part, a 16b
> > +          queue ID the sender is asking the peer to send to, and a 16b
> > +          queue ID granting the peer's own request. Steering installs low
> > +          priority rules matching the latter, which win over the RSS table
> > +          result. Only needed for the rx direction; granting a peer's
> > +          request is just header generation and needs no device support.
> > +        type: flag
> > +      -
> > +        name: vc-steer-ena
> > +        doc: |
> > +          Directions taking part in VC based queue steering. Leave the
> > +          attribute out of a dev-set request to keep the current setting.
> > +          Applies to associations created from then on, existing ones keep
> > +          the setting they were created with.
> > +        type: u32
> > +        enum: vc-steer
> > +        enum-as-flags: true
> >    
> 
> Should vc-steer-ena be a connection level setting? Maybe it could go
> into rx-assoc. The way it's implemented here, the state is already per
> assoc.

That's what I started with but then given the security implications
of the current simple design I could not think of a reason do configure
this connection by connection. Besides the SW stack responsible for
security is likely somewhat orthogonal to steering configuration. 
Should have put this in the cover letter as well.

> > +Every driver has to carry the cookie, not just those which advertise
> > +``vc-steer-cap`` - granting a peer's request needs no help from the
> > +device, so the ``tx`` direction of ``vc-steer-ena`` may be turned on
> > +anywhere. Drivers must ask ``psp_assoc_vc_tx_get()`` for the cookie to
> > +place in the Tx header, and report the queue IDs a received cookie held
> > +in ``psp_skb_ext.vc_req`` and ``vc_dst`` (``psp_dev_rcv()`` does this for
> > +drivers which let the core strip the headers). Reporting is what allows
> > +the core to grant the peer's request. The steering itself is only
> > +expected of drivers which advertise ``vc-steer-cap``.
> > +
> > +When VC steering is enabled GRO implementations are allowed to ignore
> > +changes in the cookie for transport mode PSP.
> > +  
> 
> Makes sense. Do we would need to update __psp_skb_coalesce_diff() here
> then for the sw gro?

Ack.

> Unrelated, but this reminds me: some of the other fields here:
> generation, spi, peer_tx, have some reads/writes that probably require
> READ/WRITE_ONCE() and maybe deserve a similar comment here... Probably
> all bugs that I introduced :/
> 
> >  /* Encapsulate a TCP packet with PSP by adding the UDP+PSP headers and filling
> > - * them in.
> > + * them in. @vc is the virtualization cookie to place in the header, 0 for
> > + * a header with no optional fields.
> >   */
> >  bool psp_dev_encapsulate(struct net *net, struct sk_buff *skb, __be32 spi,
> > -			 u8 ver, __be16 sport)
> > +			 u8 ver, __be16 sport, u64 vc)
> >  {
> >  	u32 network_len = skb_network_header_len(skb);
> >  	u32 ethr_len = skb_mac_header_len(skb);
> >  	u32 bufflen = ethr_len + network_len;
> > +	u32 encap_len = PSP_ENCAP_HLEN;
> >  
> >  	if (skb->protocol != htons(ETH_P_IP) &&
> >  	    skb->protocol != htons(ETH_P_IPV6))
> >  		return false;
> >  
> > -	if (skb_cow_head(skb, PSP_ENCAP_HLEN))
> > +	if (vc)
> > +		encap_len += PSP_VC_SIZE;
> > +  
> 
> I suppose vc of 0 is probably valid. We might need something else to
> disambiguate "not present".

Ah, good point. We should probably encode the queue as idx+1,
I was going back and forth on this. Doesn't feel super clean but
it solves a bunch of corner cases, so the benefits probably outweigh
the slightly confusing indexing.

  reply	other threads:[~2026-08-24 15:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 22:55 [RFC net-next 0/6] psp: use virt cookie as Rx steering hint Jakub Kicinski
2026-08-22 22:55 ` [RFC net-next 1/6] psp: steer Rx queues with the virtualization cookie Jakub Kicinski
2026-08-23 15:31   ` Daniel Zahka
2026-08-24 15:01     ` Jakub Kicinski [this message]
2026-08-24 15:09       ` Cosmin Ratiu
2026-08-24 15:19         ` Jakub Kicinski
2026-08-23 18:18   ` Willem de Bruijn
2026-08-22 22:55 ` [RFC net-next 2/6] netdevsim: support PSP VC based queue steering Jakub Kicinski
2026-08-22 22:55 ` [RFC net-next 3/6] selftests: drv-net: psp: move the PSP test plumbing into psp_lib.py Jakub Kicinski
2026-08-22 22:55 ` [RFC net-next 4/6] selftests: drv-net: psp_steer: test PSP VC based queue steering Jakub Kicinski
2026-08-22 22:55 ` [RFC net-next 5/6] selftests: drv-net: psp_steer: test where PSP steering sits in the Rx pipeline Jakub Kicinski
2026-08-22 22:55 ` [RFC net-next 6/6] selftests: drv-net: psp_steer: cover corner cases and races Jakub Kicinski
2026-08-23 17:48 ` [RFC net-next 0/6] psp: use virt cookie as Rx steering hint Willem de Bruijn
2026-08-24 15:05   ` Cosmin Ratiu
2026-08-25  9:52     ` Cosmin Ratiu
2026-08-25 18:55       ` Jakub Kicinski
2026-08-24 15:11   ` Jakub Kicinski
2026-08-24 18:04     ` Willem de Bruijn

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=20260824080122.17be0e16@kernel.org \
    --to=kuba@kernel.org \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=daniel.zahka@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --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