summaryrefslogtreecommitdiff
path: root/include/trace/events/sock.h
diff options
context:
space:
mode:
authorJason Xing <kernelxing@tencent.com>2024-03-25 06:43:47 +0300
committerPaolo Abeni <pabeni@redhat.com>2024-03-26 13:12:06 +0300
commit646700ce23f4a3f5e967c394d74ed4ea8998b2af (patch)
tree7f8e7e9164ccebd3ebd61b206f45d98a08db552d /include/trace/events/sock.h
parenta24c855a5ef2cd07dece2ccf131c4f40986c584d (diff)
downloadlinux-646700ce23f4a3f5e967c394d74ed4ea8998b2af.tar.xz
trace: use TP_STORE_ADDRS() macro in inet_sock_set_state()
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> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/trace/events/sock.h')
-rw-r--r--include/trace/events/sock.h17
1 files 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",