From: Jakub Kicinski <kuba@kernel.org>
To: 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,
Jakub Kicinski <kuba@kernel.org>
Subject: [RFC net-next 2/6] netdevsim: support PSP VC based queue steering
Date: Sat, 22 Aug 2026 15:55:20 -0700 [thread overview]
Message-ID: <20260822225524.2328465-3-kuba@kernel.org> (raw)
In-Reply-To: <20260822225524.2328465-1-kuba@kernel.org>
Gives the PSP steering selftest something to run against without
hardware. nsim_start_xmit() already mirrors the Tx queue index onto Rx,
so all the cookie does is override that choice.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/netdevsim/netdevsim.h | 4 ++--
drivers/net/netdevsim/netdev.c | 5 +++--
drivers/net/netdevsim/psp.c | 26 ++++++++++++++++++++++++--
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 55aec41237b9..3b1c52e43d46 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -453,13 +453,13 @@ void nsim_psp_uninit(struct netdevsim *ns);
void nsim_psp_handle_ext(struct sk_buff *skb, struct skb_ext *psp_ext);
enum skb_drop_reason
nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
- struct netdevsim *peer_ns, struct skb_ext **psp_ext);
+ struct netdevsim *peer_ns, struct skb_ext **psp_ext, int *rxq);
#else
static inline int nsim_psp_init(struct netdevsim *ns) { return 0; }
static inline void nsim_psp_uninit(struct netdevsim *ns) {}
static inline enum skb_drop_reason
nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
- struct netdevsim *peer_ns, struct skb_ext **psp_ext)
+ struct netdevsim *peer_ns, struct skb_ext **psp_ext, int *rxq)
{
return 0;
}
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index b4a99f3ceac6..04e416d1a377 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -147,11 +147,12 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
peer_dev = peer_ns->netdev;
}
- dr = nsim_do_psp(skb, ns, peer_ns, &psp_ext);
+ rxq = skb_get_queue_mapping(skb);
+
+ dr = nsim_do_psp(skb, ns, peer_ns, &psp_ext, &rxq);
if (dr)
goto out_drop_free;
- rxq = skb_get_queue_mapping(skb);
if (rxq >= peer_dev->num_rx_queues)
rxq = rxq % peer_dev->num_rx_queues;
rq = peer_ns->rq[rxq];
diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c
index 32d95205a8cc..5aa5078889eb 100644
--- a/drivers/net/netdevsim/psp.c
+++ b/drivers/net/netdevsim/psp.c
@@ -14,9 +14,26 @@ void nsim_psp_handle_ext(struct sk_buff *skb, struct skb_ext *psp_ext)
__skb_ext_set(skb, SKB_EXT_PSP, psp_ext);
}
+/* Pick the Rx queue for a decapsulated frame. Devices which support
+ * PSP_VC_STEER_RX match the destination queue ID carried in the
+ * cookie ahead of consulting the RSS table.
+ */
+static int nsim_psp_steer(struct netdevsim *peer_ns, struct sk_buff *skb,
+ int rxq)
+{
+ struct net_device *dev = peer_ns->netdev;
+ struct psp_skb_ext *pse;
+
+ pse = skb_ext_find(skb, SKB_EXT_PSP);
+ if (!pse || pse->vc_dst >= dev->real_num_rx_queues)
+ return rxq;
+
+ return pse->vc_dst;
+}
+
enum skb_drop_reason
nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
- struct netdevsim *peer_ns, struct skb_ext **psp_ext)
+ struct netdevsim *peer_ns, struct skb_ext **psp_ext, int *rxq)
{
enum skb_drop_reason rc = 0;
struct psp_dev *peer_psd;
@@ -44,7 +61,8 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
}
net = sock_net(skb->sk);
- if (!psp_dev_encapsulate(net, skb, pas->tx.spi, pas->version, 0, 0)) {
+ if (!psp_dev_encapsulate(net, skb, pas->tx.spi, pas->version, 0,
+ psp_assoc_vc_tx_get(pas))) {
rc = SKB_DROP_REASON_PSP_OUTPUT;
goto out_unlock;
}
@@ -73,6 +91,9 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
goto out_unlock;
}
+ if (peer_psd->config.vc_steer & (1 << PSP_VC_STEER_RX))
+ *rxq = nsim_psp_steer(peer_ns, skb, *rxq);
+
*psp_ext = skb->extensions;
refcount_inc(&(*psp_ext)->refcnt);
skb->decrypted = 1;
@@ -216,6 +237,7 @@ static struct psp_dev_caps nsim_psp_caps = {
1 << PSP_VERSION_HDR0_AES_GCM_256 |
1 << PSP_VERSION_HDR0_AES_GMAC_256,
.assoc_drv_spc = sizeof(void *),
+ .vc_steer = true,
};
static void __nsim_psp_uninit(struct netdevsim *ns, bool teardown)
--
2.55.0
next prev parent reply other threads:[~2026-08-22 22:55 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
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 ` Jakub Kicinski [this message]
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=20260822225524.2328465-3-kuba@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.