From: Daniel Zahka <daniel.zahka@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Donald Hunter <donald.hunter@gmail.com>,
Boris Pismenny <borisp@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Shuah Khan <shuah@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
Daniel Zahka <daniel.zahka@gmail.com>
Subject: [PATCH net-next 6/9] psp: add core tracked stats for deferred key deletion
Date: Wed, 04 Feb 2026 07:20:10 -0800 [thread overview]
Message-ID: <20260204-psp-v1-6-5f034e2dfa36@gmail.com> (raw)
In-Reply-To: <20260204-psp-v1-0-5f034e2dfa36@gmail.com>
It is useful to keep track of two stats related to deferred key
deletion:
- tx_key_cnt: the number of outstanding tx keys from the hw's
perspective
- grace_periods: the number of grace periods that core has retired for
this dev.
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
Documentation/netlink/specs/psp.yaml | 14 ++++++++++++++
include/net/psp/types.h | 4 ++++
include/uapi/linux/psp.h | 2 ++
net/psp/psp_main.c | 1 +
net/psp/psp_nl.c | 3 +++
net/psp/psp_sock.c | 9 ++++++++-
6 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/Documentation/netlink/specs/psp.yaml b/Documentation/netlink/specs/psp.yaml
index f3a57782d2cf..efaf3f61e37a 100644
--- a/Documentation/netlink/specs/psp.yaml
+++ b/Documentation/netlink/specs/psp.yaml
@@ -153,6 +153,18 @@ attribute-sets:
doc: |
Number of PSP packets for transmission with errors.
Device statistic (from the PSP spec).
+ -
+ name: tx-key-cnt
+ type: sint
+ doc: |
+ Current number of TX keys installed on the device.
+ Kernel statistic.
+ -
+ name: grace-periods
+ type: uint
+ doc: |
+ Number of TX key deletion grace periods completed.
+ Kernel statistic.
operations:
list:
@@ -267,6 +279,8 @@ operations:
- dev-id
- key-rotations
- stale-events
+ - tx-key-cnt
+ - grace-periods
pre: psp-device-get-locked
post: psp-device-unlock
dump:
diff --git a/include/net/psp/types.h b/include/net/psp/types.h
index 280c7fdc713c..d790efd9d4bc 100644
--- a/include/net/psp/types.h
+++ b/include/net/psp/types.h
@@ -67,6 +67,8 @@ struct psp_dev_config {
* @stats: statistics maintained by the core
* @stats.rotations: See stats attr key-rotations
* @stats.stales: See stats attr stale-events
+ * @stats.tx_key_cnt: See stats attr tx-key-cnt
+ * @stats.grace_periods: See stats attr grace-periods
*
* @rcu: RCU head for freeing the structure
*/
@@ -98,6 +100,8 @@ struct psp_dev {
struct {
unsigned long rotations;
unsigned long stales;
+ long tx_key_cnt;
+ unsigned long grace_periods;
} stats;
struct rcu_head rcu;
diff --git a/include/uapi/linux/psp.h b/include/uapi/linux/psp.h
index a3a336488dc3..208ab60e2c88 100644
--- a/include/uapi/linux/psp.h
+++ b/include/uapi/linux/psp.h
@@ -58,6 +58,8 @@ enum {
PSP_A_STATS_TX_PACKETS,
PSP_A_STATS_TX_BYTES,
PSP_A_STATS_TX_ERROR,
+ PSP_A_STATS_TX_KEY_CNT,
+ PSP_A_STATS_GRACE_PERIODS,
__PSP_A_STATS_MAX,
PSP_A_STATS_MAX = (__PSP_A_STATS_MAX - 1)
diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
index 2fb886edc384..4a7b2ffa718e 100644
--- a/net/psp/psp_main.c
+++ b/net/psp/psp_main.c
@@ -215,6 +215,7 @@ static void psp_tx_del_work_fn(struct work_struct *work)
}
psd->tx_grace_active = false;
+ psd->stats.grace_periods++;
}
start_grace:
diff --git a/net/psp/psp_nl.c b/net/psp/psp_nl.c
index a540a1e77694..f0006d2e85c8 100644
--- a/net/psp/psp_nl.c
+++ b/net/psp/psp_nl.c
@@ -526,6 +526,9 @@ psp_nl_stats_fill(struct psp_dev *psd, struct sk_buff *rsp,
nla_put_uint(rsp, PSP_A_STATS_KEY_ROTATIONS,
psd->stats.rotations) ||
nla_put_uint(rsp, PSP_A_STATS_STALE_EVENTS, psd->stats.stales) ||
+ nla_put_sint(rsp, PSP_A_STATS_TX_KEY_CNT, psd->stats.tx_key_cnt) ||
+ nla_put_uint(rsp, PSP_A_STATS_GRACE_PERIODS,
+ psd->stats.grace_periods) ||
nla_put_uint(rsp, PSP_A_STATS_RX_PACKETS, stats.rx_packets) ||
nla_put_uint(rsp, PSP_A_STATS_RX_BYTES, stats.rx_bytes) ||
nla_put_uint(rsp, PSP_A_STATS_RX_AUTH_FAIL, stats.rx_auth_fail) ||
diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
index d038da122ebb..bf6d089657b6 100644
--- a/net/psp/psp_sock.c
+++ b/net/psp/psp_sock.c
@@ -80,12 +80,19 @@ static struct psp_assoc *psp_assoc_dummy(struct psp_assoc *pas)
static int psp_dev_tx_key_add(struct psp_dev *psd, struct psp_assoc *pas,
struct netlink_ext_ack *extack)
{
- return psd->ops->tx_key_add(psd, pas, extack);
+ int rc;
+
+ rc = psd->ops->tx_key_add(psd, pas, extack);
+ if (!rc)
+ psd->stats.tx_key_cnt++;
+
+ return rc;
}
void psp_dev_tx_key_del(struct psp_dev *psd, struct psp_assoc *pas)
{
psd->ops->tx_key_del(psd, pas);
+ psd->stats.tx_key_cnt--;
}
static bool psp_dev_needs_defer(struct psp_dev *psd)
--
2.47.3
next prev parent reply other threads:[~2026-02-04 15:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 15:20 [PATCH net-next 0/9] psp: support rekeying psp protected tcp connections Daniel Zahka
2026-02-04 15:20 ` [PATCH net-next 1/9] psp: support rx rekey operation Daniel Zahka
2026-02-07 4:24 ` Jakub Kicinski
2026-02-07 4:32 ` [net-next,1/9] " Jakub Kicinski
2026-02-04 15:20 ` [PATCH net-next 2/9] psp: move code from psp_sock_assoc_set_tx() into helper functions Daniel Zahka
2026-02-04 20:46 ` Willem de Bruijn
2026-02-04 15:20 ` [PATCH net-next 3/9] psp: support tx rekey operation Daniel Zahka
2026-02-04 15:20 ` [PATCH net-next 4/9] psp: refactor psp_dev_tx_key_del() Daniel Zahka
2026-02-04 20:46 ` Willem de Bruijn
2026-02-04 15:20 ` [PATCH net-next 5/9] psp: add driver api for deferred tx key deletion Daniel Zahka
2026-02-04 15:20 ` Daniel Zahka [this message]
2026-02-04 15:20 ` [PATCH net-next 7/9] mlx5: psp: implement " Daniel Zahka
2026-02-07 4:30 ` Jakub Kicinski
2026-02-07 4:32 ` [net-next,7/9] " Jakub Kicinski
2026-02-04 15:20 ` [PATCH net-next 8/9] selftests: drv-net: psp: lift psp connection setup out of _data_basic_send() testcase Daniel Zahka
2026-02-04 20:49 ` Willem de Bruijn
2026-02-04 15:20 ` [PATCH net-next 9/9] selftests: drv-net: psp: add tests for rekeying connections Daniel Zahka
2026-02-04 20:45 ` [PATCH net-next 0/9] psp: support rekeying psp protected tcp connections Willem de Bruijn
2026-02-04 21:43 ` Daniel Zahka
2026-02-07 4:18 ` Jakub Kicinski
2026-02-07 4:21 ` Jakub Kicinski
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=20260204-psp-v1-6-5f034e2dfa36@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=shuah@kernel.org \
--cc=tariqt@nvidia.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