From: Dmitry Safonov via B4 Relay <devnull+0x7f454c46.gmail.com@kernel.org>
To: Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: Mohammad Nassiri <mnassiri@ciena.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Dmitry Safonov <0x7f454c46@gmail.com>
Subject: [PATCH net-next v4 2/6] net/tcp: Add a helper tcp_ao_hdr_maclen()
Date: Fri, 07 Jun 2024 00:25:56 +0100 [thread overview]
Message-ID: <20240607-tcp_ao-tracepoints-v4-2-88dc245c1f39@gmail.com> (raw)
In-Reply-To: <20240607-tcp_ao-tracepoints-v4-0-88dc245c1f39@gmail.com>
From: Dmitry Safonov <0x7f454c46@gmail.com>
It's going to be used more in TCP-AO tracepoints.
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
---
include/net/tcp_ao.h | 5 +++++
net/ipv4/tcp_ao.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/net/tcp_ao.h b/include/net/tcp_ao.h
index 5d8e9ed2c005..198e02004ad2 100644
--- a/include/net/tcp_ao.h
+++ b/include/net/tcp_ao.h
@@ -19,6 +19,11 @@ struct tcp_ao_hdr {
u8 rnext_keyid;
};
+static inline u8 tcp_ao_hdr_maclen(const struct tcp_ao_hdr *aoh)
+{
+ return aoh->length - sizeof(struct tcp_ao_hdr);
+}
+
struct tcp_ao_counters {
atomic64_t pkt_good;
atomic64_t pkt_bad;
diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
index 37c42b63ff99..50ae43c92829 100644
--- a/net/ipv4/tcp_ao.c
+++ b/net/ipv4/tcp_ao.c
@@ -884,8 +884,8 @@ tcp_ao_verify_hash(const struct sock *sk, const struct sk_buff *skb,
const struct tcp_ao_hdr *aoh, struct tcp_ao_key *key,
u8 *traffic_key, u8 *phash, u32 sne, int l3index)
{
- u8 maclen = aoh->length - sizeof(struct tcp_ao_hdr);
const struct tcphdr *th = tcp_hdr(skb);
+ u8 maclen = tcp_ao_hdr_maclen(aoh);
void *hash_buf = NULL;
if (maclen != tcp_ao_maclen(key)) {
--
2.42.0
next prev parent reply other threads:[~2024-06-06 23:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 23:25 [PATCH net-next v4 0/6] net/tcp: TCP-AO and TCP-MD5 tracepoints Dmitry Safonov via B4 Relay
2024-06-06 23:25 ` [PATCH net-next v4 1/6] net/tcp: Use static_branch_tcp_{md5,ao} to drop ifdefs Dmitry Safonov via B4 Relay
2024-06-06 23:25 ` Dmitry Safonov via B4 Relay [this message]
2024-06-06 23:25 ` [PATCH net-next v4 3/6] net/tcp: Move tcp_inbound_hash() from headers Dmitry Safonov via B4 Relay
2024-06-06 23:25 ` [PATCH net-next v4 4/6] net/tcp: Add tcp-md5 and tcp-ao tracepoints Dmitry Safonov via B4 Relay
2024-06-06 23:25 ` [PATCH net-next v4 5/6] net/tcp: Remove tcp_hash_fail() Dmitry Safonov via B4 Relay
2024-06-06 23:26 ` [PATCH net-next v4 6/6] Documentation/tcp-ao: Add a few lines on tracepoints Dmitry Safonov via B4 Relay
2024-06-12 5:40 ` [PATCH net-next v4 0/6] net/tcp: TCP-AO and TCP-MD5 tracepoints patchwork-bot+netdevbpf
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=20240607-tcp_ao-tracepoints-v4-2-88dc245c1f39@gmail.com \
--to=devnull+0x7f454c46.gmail.com@kernel.org \
--cc=0x7f454c46@gmail.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mnassiri@ciena.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
/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;
as well as URLs for NNTP newsgroup(s).