From: Daniel Zahka <daniel.zahka@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 6/6] netdevsim: psp: count rx authentication and length errors
Date: Fri, 08 May 2026 07:53:49 -0700 [thread overview]
Message-ID: <20260508-nsim-psp-crypto-v1-6-4b50ed09b794@gmail.com> (raw)
In-Reply-To: <20260508-nsim-psp-crypto-v1-0-4b50ed09b794@gmail.com>
Now that netdevsim does psp parsing and aes-gcm decryption in rx, we
can report authentication and length errors in the psp stats api.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
---
drivers/net/netdevsim/netdevsim.h | 2 ++
drivers/net/netdevsim/psp.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 112fe1ee10bc..5f0f638ee893 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -118,6 +118,8 @@ struct netdevsim {
struct {
u64_stats_t rx_packets;
u64_stats_t rx_bytes;
+ u64_stats_t rx_auth_fail;
+ u64_stats_t rx_error;
u64_stats_t tx_packets;
u64_stats_t tx_bytes;
struct u64_stats_sync syncp;
diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c
index 4945973d523d..053c01cc310d 100644
--- a/drivers/net/netdevsim/psp.c
+++ b/drivers/net/netdevsim/psp.c
@@ -207,8 +207,12 @@ bool nsim_psp_handle_rx(struct netdevsim *ns, struct sk_buff *skb)
psp_off = l3_hlen + sizeof(struct udphdr);
payload_len = skb->len - psp_off - PSP_HDR_SIZE - PSP_TRL_SIZE;
- if (payload_len < 0)
+ if (payload_len < 0) {
+ u64_stats_update_begin(&ns->psp.syncp);
+ u64_stats_inc(&ns->psp.rx_error);
+ u64_stats_update_end(&ns->psp.syncp);
goto drop;
+ }
if (FIELD_GET(PSPHDR_CRYPT_OFFSET, psph->crypt_offset))
goto drop;
@@ -238,6 +242,9 @@ bool nsim_psp_handle_rx(struct netdevsim *ns, struct sk_buff *skb)
payload_len, (u8 *)psph, PSP_HDR_SIZE,
iv, authtag)) {
memzero_explicit(&ctx, sizeof(ctx));
+ u64_stats_update_begin(&ns->psp.syncp);
+ u64_stats_inc(&ns->psp.rx_auth_fail);
+ u64_stats_update_end(&ns->psp.syncp);
goto drop;
}
memzero_explicit(&ctx, sizeof(ctx));
@@ -346,6 +353,8 @@ static void nsim_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
start = u64_stats_fetch_begin(&ns->psp.syncp);
stats->rx_bytes = u64_stats_read(&ns->psp.rx_bytes);
stats->rx_packets = u64_stats_read(&ns->psp.rx_packets);
+ stats->rx_auth_fail = u64_stats_read(&ns->psp.rx_auth_fail);
+ stats->rx_error = u64_stats_read(&ns->psp.rx_error);
stats->tx_bytes = u64_stats_read(&ns->psp.tx_bytes);
stats->tx_packets = u64_stats_read(&ns->psp.tx_packets);
} while (u64_stats_fetch_retry(&ns->psp.syncp, start));
--
2.52.0
next prev parent reply other threads:[~2026-05-08 14:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 14:53 [PATCH net-next 0/6] netdevsim: psp: implement real crypto operations from the PSP spec Daniel Zahka
2026-05-08 14:53 ` [PATCH net-next 1/6] netdevsim: psp: reset spi on key rotation and check for exhaustion on alloc Daniel Zahka
2026-05-11 16:53 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 2/6] netdevsim: psp: remove unnecessary UDP checksum computation Daniel Zahka
2026-05-11 17:01 ` Willem de Bruijn
2026-05-11 17:46 ` Daniel Zahka
2026-05-11 19:01 ` Willem de Bruijn
2026-05-11 19:43 ` Daniel Zahka
2026-05-08 14:53 ` [PATCH net-next 3/6] netdevsim: psp: move rx processing into nsim_poll() Daniel Zahka
2026-05-11 20:03 ` Willem de Bruijn
2026-05-12 0:25 ` Daniel Zahka
2026-05-12 0:51 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 4/6] netdevsim: psp: implement kdf from psp spec Daniel Zahka
2026-05-11 19:49 ` Willem de Bruijn
2026-05-11 23:55 ` Daniel Zahka
2026-05-12 0:48 ` Willem de Bruijn
2026-05-08 14:53 ` [PATCH net-next 5/6] netdevsim: psp: add real aes-gcm encryption and decryption Daniel Zahka
2026-05-11 20:10 ` Willem de Bruijn
2026-05-08 14:53 ` Daniel Zahka [this message]
2026-05-11 20:19 ` [PATCH net-next 6/6] netdevsim: psp: count rx authentication and length errors 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=20260508-nsim-psp-crypto-v1-6-4b50ed09b794@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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