From: Daniel Zahka <daniel.zahka@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 4/4] netdevsim: psp: drop tx key ops
Date: Thu, 03 Sep 2026 18:34:02 -0700 [thread overview]
Message-ID: <20260903-psp-prep-v1-4-d47e9c4c375d@gmail.com> (raw)
In-Reply-To: <20260903-psp-prep-v1-0-d47e9c4c375d@gmail.com>
netdevsim has no SADB. The usage of psp_assoc_drv_data() was always
obsolete given psp_validate_xmit(), so we can remove nsim_assoc_add()
and nsim_assoc_del(). netdevsim::assoc_cnt can also be removed. PSP core
can track the balance of tx_key_add vs tx_key_del calls in a future
change.
Delete psp_assoc_drv_data() because there are no more callers left in
the tree. mlx5 accesses pas->drv_data directly.
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
drivers/net/netdevsim/netdevsim.h | 1 -
drivers/net/netdevsim/psp.c | 33 ---------------------------------
include/net/psp/functions.h | 5 -----
3 files changed, 39 deletions(-)
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 55aec41237b9..181b6baaba7a 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -122,7 +122,6 @@ struct netdevsim {
struct dentry *rereg;
struct mutex rereg_lock;
u32 spi;
- u32 assoc_cnt;
} psp;
struct nsim_bus_dev *nsim_bus_dev;
diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c
index 6b3532b5e360..b7452c49b581 100644
--- a/drivers/net/netdevsim/psp.c
+++ b/drivers/net/netdevsim/psp.c
@@ -23,7 +23,6 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
struct psp_assoc *pas;
struct net *net;
int psp_len;
- void **ptr;
rcu_read_lock();
pas = psp_skb_get_assoc_rcu(skb);
@@ -37,12 +36,6 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
goto out_unlock;
}
- ptr = psp_assoc_drv_data(pas);
- if (*ptr != ns) {
- rc = SKB_DROP_REASON_PSP_OUTPUT;
- goto out_unlock;
- }
-
net = sock_net(skb->sk);
if (!psp_dev_encapsulate(net, skb, pas->tx.spi, pas->version, 0)) {
rc = SKB_DROP_REASON_PSP_OUTPUT;
@@ -149,19 +142,6 @@ nsim_rx_spi_alloc(struct psp_dev *psd, u32 version,
return 0;
}
-static int nsim_assoc_add(struct psp_dev *psd, struct psp_assoc *pas,
- struct netlink_ext_ack *extack)
-{
- struct netdevsim *ns = psd->drv_priv;
- void **ptr = psp_assoc_drv_data(pas);
-
- /* Copy drv_priv from psd to assoc */
- *ptr = psd->drv_priv;
- ns->psp.assoc_cnt++;
-
- return 0;
-}
-
static int nsim_key_rotate(struct psp_dev *psd, struct netlink_ext_ack *extack)
{
struct netdevsim *ns = psd->drv_priv;
@@ -177,15 +157,6 @@ static int nsim_key_rotate(struct psp_dev *psd, struct netlink_ext_ack *extack)
return 0;
}
-static void nsim_assoc_del(struct psp_dev *psd, struct psp_assoc *pas)
-{
- struct netdevsim *ns = psd->drv_priv;
- void **ptr = psp_assoc_drv_data(pas);
-
- *ptr = NULL;
- ns->psp.assoc_cnt--;
-}
-
static void nsim_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
{
struct netdevsim *ns = psd->drv_priv;
@@ -204,8 +175,6 @@ static void nsim_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
static struct psp_dev_ops nsim_psp_ops = {
.set_config = nsim_psp_set_config,
.rx_spi_alloc = nsim_rx_spi_alloc,
- .tx_key_add = nsim_assoc_add,
- .tx_key_del = nsim_assoc_del,
.key_rotate = nsim_key_rotate,
.get_stats = nsim_get_stats,
};
@@ -215,7 +184,6 @@ static struct psp_dev_caps nsim_psp_caps = {
1 << PSP_VERSION_HDR0_AES_GMAC_128 |
1 << PSP_VERSION_HDR0_AES_GCM_256 |
1 << PSP_VERSION_HDR0_AES_GMAC_256,
- .assoc_drv_spc = sizeof(void *),
};
static void __nsim_psp_uninit(struct netdevsim *ns, bool teardown)
@@ -230,7 +198,6 @@ static void __nsim_psp_uninit(struct netdevsim *ns, bool teardown)
synchronize_rcu();
psp_dev_unregister(psd);
}
- WARN_ON(ns->psp.assoc_cnt);
}
void nsim_psp_uninit(struct netdevsim *ns)
diff --git a/include/net/psp/functions.h b/include/net/psp/functions.h
index c5c23a54774e..b23c30898389 100644
--- a/include/net/psp/functions.h
+++ b/include/net/psp/functions.h
@@ -24,11 +24,6 @@ int psp_dev_rcv(struct sk_buff *skb, u16 dev_id, u8 generation, bool strip_icv);
/* Kernel-facing API */
void psp_assoc_put(struct psp_assoc *pas);
-static inline void *psp_assoc_drv_data(struct psp_assoc *pas)
-{
- return pas->drv_data;
-}
-
#if IS_ENABLED(CONFIG_INET_PSP)
unsigned int psp_key_size(u32 version);
void psp_sk_assoc_free(struct sock *sk);
--
2.52.0
prev parent reply other threads:[~2026-09-04 1:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 1:33 [PATCH net-next 0/4] psp: make tx key ops optional for drivers Daniel Zahka
2026-09-04 1:33 ` [PATCH net-next 1/4] psp: refactor psp_dev_tx_key_del() Daniel Zahka
2026-09-04 1:34 ` [PATCH net-next 2/4] psp: move code from psp_sock_assoc_set_tx() into helper functions Daniel Zahka
2026-09-04 1:34 ` [PATCH net-next 3/4] psp: allow drivers to omit tx key add/del ops Daniel Zahka
2026-09-04 1:34 ` Daniel Zahka [this message]
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=20260903-psp-prep-v1-4-d47e9c4c375d@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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