Netdev List
 help / color / mirror / Atom feed
From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: "Jakub Kicinski" <kuba@kernel.org>, <daniel.zahka@gmail.com>,
	<willemdebruijn.kernel@gmail.com>
Cc: <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: Sun, 23 Aug 2026 11:31:03 -0400	[thread overview]
Message-ID: <DKWFJ9D12OPD.2ZLQHDM0276G4@gmail.com> (raw)
In-Reply-To: <20260822225524.2328465-2-kuba@kernel.org>

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.

> +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?

>  struct psp_assoc {
>  	struct psp_dev *psd;
>  
> @@ -159,6 +233,23 @@ struct psp_assoc {
>  	u8 generation;
>  	u8 version;
>  	u8 peer_tx;
> +	/* enum psp_assoc_flags. Written under psd->lock, additionally read
> +	 * on the Tx fast path without it. A snapshot of the device config
> +	 * taken when the association was created, so that the header size,
> +	 * and with it the MSS, cannot change under an established
> +	 * connection.
> +	 */
> +	u8 flags;
> +
> +	/* Queue IDs for the VC, ours and the peer's. @vc_loc is refreshed
> +	 * from the Tx queue selection and goes out as the cookie's request,
> +	 * @vc_rem is learned from the peer's requests and goes back out as
> +	 * the destination. Both are PSP_VC_QID_NONE until something is
> +	 * learned. Written without the socket lock, always use
> +	 * READ_ONCE()/WRITE_ONCE().
> +	 */
> +	u16 vc_loc;
> +	u16 vc_rem;
>  

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".

  reply	other threads:[~2026-08-23 15:31 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 [this message]
2026-08-24 15:01     ` Jakub Kicinski
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=DKWFJ9D12OPD.2ZLQHDM0276G4@gmail.com \
    --to=daniel.zahka@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --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