From: Jason Xing <kerneljasonxing@gmail.com>
To: edumazet@google.com, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, rostedt@goodmis.org,
kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
kerneljasonxing@gmail.com, Jason Xing <kernelxing@tencent.com>
Subject: [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report()
Date: Sun, 10 Mar 2024 20:14:05 +0800 [thread overview]
Message-ID: <20240310121406.17422-3-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20240310121406.17422-1-kerneljasonxing@gmail.com>
From: Jason Xing <kernelxing@tencent.com>
As the title said, use the macro directly like the patch[1] did
to avoid those duplications. No functional change.
[1]
commit 6a6b0b9914e7 ("tcp: Avoid preprocessor directives in tracepoint macro args")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
include/trace/events/sock.h | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index fd206a6ab5b8..4397f7bfa406 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -10,6 +10,7 @@
#include <linux/tracepoint.h>
#include <linux/ipv6.h>
#include <linux/tcp.h>
+#include <trace/events/net_probe_common.h>
#define family_names \
EM(AF_INET) \
@@ -223,7 +224,6 @@ TRACE_EVENT(inet_sk_error_report,
TP_fast_assign(
const struct inet_sock *inet = inet_sk(sk);
- struct in6_addr *pin6;
__be32 *p32;
__entry->error = sk->sk_err;
@@ -238,20 +238,8 @@ TRACE_EVENT(inet_sk_error_report,
p32 = (__be32 *) __entry->daddr;
*p32 = inet->inet_daddr;
-#if IS_ENABLED(CONFIG_IPV6)
- if (sk->sk_family == AF_INET6) {
- pin6 = (struct in6_addr *)__entry->saddr_v6;
- *pin6 = sk->sk_v6_rcv_saddr;
- pin6 = (struct in6_addr *)__entry->daddr_v6;
- *pin6 = sk->sk_v6_daddr;
- } else
-#endif
- {
- pin6 = (struct in6_addr *)__entry->saddr_v6;
- ipv6_addr_set_v4mapped(inet->inet_saddr, pin6);
- pin6 = (struct in6_addr *)__entry->daddr_v6;
- ipv6_addr_set_v4mapped(inet->inet_daddr, pin6);
- }
+ TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr,
+ sk->sk_v6_rcv_saddr, sk->sk_v6_daddr);
),
TP_printk("family=%s protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c error=%d",
--
2.37.3
next prev parent reply other threads:[~2024-03-10 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-10 12:14 [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro Jason Xing
2024-03-10 12:14 ` [PATCH net-next 1/3] trace: move to TP_STORE_ADDRS related macro to net_probe_common.h Jason Xing
2024-03-10 12:14 ` Jason Xing [this message]
2024-03-10 12:14 ` [PATCH net-next 3/3] trace: use TP_STORE_ADDRS() macro in inet_sock_set_state() Jason Xing
2024-03-11 23:21 ` [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro Jakub Kicinski
2024-03-25 3:43 Jason Xing
2024-03-25 3:43 ` [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report() Jason Xing
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=20240310121406.17422-3-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--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).