* [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro
@ 2024-03-10 12:14 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
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Jason Xing @ 2024-03-10 12:14 UTC (permalink / raw
To: edumazet, mhiramat, mathieu.desnoyers, rostedt, kuba, pabeni,
davem
Cc: netdev, linux-trace-kernel, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Using the macro for other tracepoints use to be more concise.
No functional change.
Jason Xing (3):
trace: move to TP_STORE_ADDRS related macro to net_probe_common.h
trace: use TP_STORE_ADDRS() macro in inet_sk_error_report()
trace: use TP_STORE_ADDRS() macro in inet_sock_set_state()
include/trace/events/net_probe_common.h | 29 ++++++++++++++++++++
include/trace/events/sock.h | 35 ++++---------------------
include/trace/events/tcp.h | 29 --------------------
3 files changed, 34 insertions(+), 59 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/3] trace: move to TP_STORE_ADDRS related macro to net_probe_common.h
2024-03-10 12:14 [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro Jason Xing
@ 2024-03-10 12:14 ` Jason Xing
2024-03-10 12:14 ` [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report() Jason Xing
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jason Xing @ 2024-03-10 12:14 UTC (permalink / raw
To: edumazet, mhiramat, mathieu.desnoyers, rostedt, kuba, pabeni,
davem
Cc: netdev, linux-trace-kernel, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Put the macro into another standalone file for better extension.
Some tracepoints can use this common part in the future.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
include/trace/events/net_probe_common.h | 29 +++++++++++++++++++++++++
include/trace/events/tcp.h | 29 -------------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/include/trace/events/net_probe_common.h b/include/trace/events/net_probe_common.h
index 3930119cab08..b1f9a4d3ee13 100644
--- a/include/trace/events/net_probe_common.h
+++ b/include/trace/events/net_probe_common.h
@@ -41,4 +41,33 @@
#endif
+#define TP_STORE_V4MAPPED(__entry, saddr, daddr) \
+ do { \
+ struct in6_addr *pin6; \
+ \
+ pin6 = (struct in6_addr *)__entry->saddr_v6; \
+ ipv6_addr_set_v4mapped(saddr, pin6); \
+ pin6 = (struct in6_addr *)__entry->daddr_v6; \
+ ipv6_addr_set_v4mapped(daddr, pin6); \
+ } while (0)
+
+#if IS_ENABLED(CONFIG_IPV6)
+#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \
+ do { \
+ if (sk->sk_family == AF_INET6) { \
+ struct in6_addr *pin6; \
+ \
+ pin6 = (struct in6_addr *)__entry->saddr_v6; \
+ *pin6 = saddr6; \
+ pin6 = (struct in6_addr *)__entry->daddr_v6; \
+ *pin6 = daddr6; \
+ } else { \
+ TP_STORE_V4MAPPED(__entry, saddr, daddr); \
+ } \
+ } while (0)
+#else
+#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \
+ TP_STORE_V4MAPPED(__entry, saddr, daddr)
+#endif
+
#endif
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 699dafd204ea..3c08a0846c47 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -12,35 +12,6 @@
#include <net/tcp.h>
#include <linux/sock_diag.h>
-#define TP_STORE_V4MAPPED(__entry, saddr, daddr) \
- do { \
- struct in6_addr *pin6; \
- \
- pin6 = (struct in6_addr *)__entry->saddr_v6; \
- ipv6_addr_set_v4mapped(saddr, pin6); \
- pin6 = (struct in6_addr *)__entry->daddr_v6; \
- ipv6_addr_set_v4mapped(daddr, pin6); \
- } while (0)
-
-#if IS_ENABLED(CONFIG_IPV6)
-#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \
- do { \
- if (sk->sk_family == AF_INET6) { \
- struct in6_addr *pin6; \
- \
- pin6 = (struct in6_addr *)__entry->saddr_v6; \
- *pin6 = saddr6; \
- pin6 = (struct in6_addr *)__entry->daddr_v6; \
- *pin6 = daddr6; \
- } else { \
- TP_STORE_V4MAPPED(__entry, saddr, daddr); \
- } \
- } while (0)
-#else
-#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \
- TP_STORE_V4MAPPED(__entry, saddr, daddr)
-#endif
-
/*
* tcp event with arguments sk and skb
*
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report()
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
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
3 siblings, 0 replies; 6+ messages in thread
From: Jason Xing @ 2024-03-10 12:14 UTC (permalink / raw
To: edumazet, mhiramat, mathieu.desnoyers, rostedt, kuba, pabeni,
davem
Cc: netdev, linux-trace-kernel, kerneljasonxing, Jason Xing
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/3] trace: use TP_STORE_ADDRS() macro in inet_sock_set_state()
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 ` [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report() Jason Xing
@ 2024-03-10 12:14 ` Jason Xing
2024-03-11 23:21 ` [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro Jakub Kicinski
3 siblings, 0 replies; 6+ messages in thread
From: Jason Xing @ 2024-03-10 12:14 UTC (permalink / raw
To: edumazet, mhiramat, mathieu.desnoyers, rostedt, kuba, pabeni,
davem
Cc: netdev, linux-trace-kernel, kerneljasonxing, Jason Xing
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 | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h
index 4397f7bfa406..0d1c5ce4e6a6 100644
--- a/include/trace/events/sock.h
+++ b/include/trace/events/sock.h
@@ -160,7 +160,6 @@ TRACE_EVENT(inet_sock_set_state,
TP_fast_assign(
const struct inet_sock *inet = inet_sk(sk);
- struct in6_addr *pin6;
__be32 *p32;
__entry->skaddr = sk;
@@ -178,20 +177,8 @@ TRACE_EVENT(inet_sock_set_state,
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 oldstate=%s newstate=%s",
--
2.37.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro
2024-03-10 12:14 [PATCH net-next 0/3] trace: use TP_STORE_ADDRS macro Jason Xing
` (2 preceding siblings ...)
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 ` Jakub Kicinski
3 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2024-03-11 23:21 UTC (permalink / raw
To: Jason Xing
Cc: edumazet, mhiramat, mathieu.desnoyers, rostedt, pabeni, davem,
netdev, linux-trace-kernel, Jason Xing
On Sun, 10 Mar 2024 20:14:03 +0800 Jason Xing wrote:
> Using the macro for other tracepoints use to be more concise.
> No functional change.
The merge window for 6.9 has started and we try not to apply patches
to net-next during the merge window. Please repost in 2 weeks, once
Linus has tagged v6.9-rc1.
--
pw-bot: defer
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report()
2024-03-25 3:43 Jason Xing
@ 2024-03-25 3:43 ` Jason Xing
0 siblings, 0 replies; 6+ messages in thread
From: Jason Xing @ 2024-03-25 3:43 UTC (permalink / raw
To: edumazet, mhiramat, mathieu.desnoyers, rostedt, kuba, pabeni,
davem
Cc: netdev, linux-trace-kernel, kerneljasonxing, Jason Xing
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-25 3:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report() Jason Xing
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
-- strict thread matches above, loose matches on Subject: below --
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
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 read-only IMAP folder(s) and NNTP newsgroup(s).