From patchwork Mon Mar 25 03:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13601411 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 945BD187872; Mon, 25 Mar 2024 03:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338245; cv=none; b=p1DQIa0+bFSxIGP1dm4st8Y1m6n5DcZV1tJD4ACsuEzwI70bsMNxLDWwIolSE7F8relGAuQoZc4DaawDB5OBbI4fq8KY+mWuwKOK9QLjzU9JqOEk+S8P9FG4h+Mc88EbOYNDVqrd/XNoxxWsBlN5TiJnC/JOYJVYsPMNO5le5kw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338245; c=relaxed/simple; bh=zdcY5soF9BXG2lTs8P71BAAJR2cSoF7tMC4SEYlkG9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jdsVWX2gSSEoo++dPWiChn7NmYXGkBtN90mlQ7Az7Ks/GoYNPJ+IBNBoMFen0XzoUfzKgU5nkxgIOparU9SRPiBjiz5JGrV2ynC7DN8vqQHNMXZcLKQwVf3PPbhf3k12Jh9dbNkfyKFjkpIBTw79ToGcYSv6Wd/zEIQNShsfazM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f7HwJLgp; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f7HwJLgp" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e6ee9e3cffso2603094b3a.1; Sun, 24 Mar 2024 20:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711338243; x=1711943043; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xqoWsOzzwSicKy0P4YX659czjlZonHpQhh++FcV33Zc=; b=f7HwJLgpEkZnjH6Xf1MM1jvzttNloJVA+qthIeUmF1NO2W1gsuACotfhTXUIifO7TY zHvzefI8Dj6vXoO/Lgd9NwRK5/uhW97TLuSyI8V+Ha2mndcJ5j0Skhe33pj70qkT9ecn NKSqbzBq+iUHUOUJiELH571Y7lGDq88ZFJxrwP2aH7W7sLTAkClm2PAc5mskcsPIN5oF VwVW43a+UWsb7AwAueyz+A2PVYQXV4/CJumVk1SqW1ZoKZ9i1nnpsDefXnZpISZMAj1c xK1BX6QTcC8dGFtn+vcIIZo7LOS7VIGem3SvkaM2bvMAM5WYP9i3z4YLSHdpsHEphrqI t/iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711338243; x=1711943043; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xqoWsOzzwSicKy0P4YX659czjlZonHpQhh++FcV33Zc=; b=rW81FQMKDS8zfb/XhMr5BOXYDav3Mh7pm5qygz+elHjMZZs2LeKrSpUmQuWkum/fMw Khc97EZC5RdzJ9jz4eSy4tJtaPVrxa7qCuMt3/WL7kpap2SsDZXsJddVvGgwgZm8pqdt HYLu64Ksjn16j+tKHPz+qnBWhtptQKBTXjQtr4NiVuuuJJNRRt5Heri+OqlWlL29r6LJ 37uDJjhZD/ILQrYCg941j+zfiQ2L77yYVD/jXoeuPZor8g5yKo7c/b/JPVo5PCkmtNvL e6iACZ3d0wn40NRh07dgoZr9/ClIoHra/1mekEvpnenu5tPDxXv2275Tp4D/MlFbgqHK EyAw== X-Forwarded-Encrypted: i=1; AJvYcCX5V8wVv5bpNa5B65gnOl0eMwPwBY34rNjyUslmgOsLaq4znH0WtOQ7QahZmc7EQ8RQzE/IjbdNuoZT3jU1Qh2AVVHGQv6bFpCSVC/v1hcdoIuL X-Gm-Message-State: AOJu0YwW2sB/l9r6Sz/ZRyJtUyi/Xki9oxM+SPzUHTpZH92Hq9j6WDp7 pfxlyEBlDS9YaHoZWfETOIdFfGdA5ojuLIg0H0Uniff+KqArmawHKUQ3Ux63 X-Google-Smtp-Source: AGHT+IF2VV2YJlij1DrYmlsAl41QH/8CeXSo/eILZA1VGJV70d076KHfUFCWFIBWcNaWlVu/fybr8w== X-Received: by 2002:a05:6a00:14c6:b0:6ea:74d4:a00d with SMTP id w6-20020a056a0014c600b006ea74d4a00dmr7504774pfu.5.1711338242856; Sun, 24 Mar 2024 20:44:02 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id fk26-20020a056a003a9a00b006e6bf17ba8asm3300045pfb.65.2024.03.24.20.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 20:44:02 -0700 (PDT) From: Jason Xing 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 Subject: [PATCH net-next 1/3] trace: move to TP_STORE_ADDRS related macro to net_probe_common.h Date: Mon, 25 Mar 2024 11:43:45 +0800 Message-Id: <20240325034347.19522-2-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240325034347.19522-1-kerneljasonxing@gmail.com> References: <20240325034347.19522-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing 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 --- 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 #include -#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 * From patchwork Mon Mar 25 03:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13601414 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1168D1FDB20; Mon, 25 Mar 2024 03:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338248; cv=none; b=VFb1gryV8ltd6ZeskCWvyJ9l+avb3VsGRdJDGaAp+CPdyx1ElFOGcp1vX5L8pNsZZBgPuT3hcNTrBjGnAqi4AQx5L6mC6JeP3T5S9zCPDx3dzsLlLNVEEYiFKPaRwQ/Rdpb5Ig7lSj+1EGE9qBk/9JACm+EI+0Xu8PNtJO7fpA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338248; c=relaxed/simple; bh=5+1pMvjbrz7ZOsXjHVDdej8UfRovESGp7iTDJGatsJA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IAXA6NuKd4fZh41c60iChZ0gIp8u1kXN1pc9dNih+Inq3/w4vgjF5UgR65b/VFR2Y6gdV/VFeSM0EVg/Zb9iVnXWOdkCNs+x8lPR1wixyU0JThUks7oRqLAeBdenMjb0d+vOxvdTvg/rTgEfP+RTeUt/XTMQ0UkNo3Yj13mEirM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hrdllWo1; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hrdllWo1" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c36f882372so2519801b6e.2; Sun, 24 Mar 2024 20:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711338246; x=1711943046; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tTvkjhPD1k4Pbk0uH4ni89jBweJPfN7+Q3IAMHIKBKw=; b=hrdllWo1eLoAmOSnEkPVZbzaAXDQ6uoByfNeJEUFqtGEpCKeWSvPGb7mYLsD+qsPG7 zRHR1wIJ/P55HkeTrHqkWvtGiPDNmpXiPlj/0LOI+0LtsLbVIcNxAw1qzUbp1sm02dY5 aWCHcepVXG0RPEE/USU846dB3oQrZIpD+ALPZcAnpAlZ6R++2Wz3989JP+vL5kQCYhij 3//cRt4Q0KRVqVXL2kEQe//xgJTmmIlCEwextmLeI9qBSOx+ofTGhrmQUI7WF/0FJMOh E7UMU2hqKSL4lJ9yd2UCVUcEOP1Ht762Cj21VE4O75seJIx0DBpM9i+dfdFtL1DZUELQ 0Kxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711338246; x=1711943046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tTvkjhPD1k4Pbk0uH4ni89jBweJPfN7+Q3IAMHIKBKw=; b=PaLce8fhJcJuw0N51mV4PXPsDtrJ6rIzBmBP4noxYaQEIIgrcwxcJHwQNfSfwYffD8 PzQN7Q5cGxUbjTm2FAHsbiK/qUwusN1xISekDFoxSlt7hqm46lzhq+uRw8+0Zas70Rd7 1tmA/P/3gfXs8LK1JD8dw2qH8cs25pBxHz5Gl0U3b8jJo/eb/aERWKD6bLjif6RMjL/U RCHneHJ25b9nW3gFcRBgAviUnhcRRJwwroa2TcH0aN9AoUdkL4pqxHYpV/mZmGkjmFtN 4CBibVVcPkBGo3Gi39K2jrUctRi8tbm77KnO0lugahO/TjTzXi8zJNZpVMWZ/3HEpfbN an+Q== X-Forwarded-Encrypted: i=1; AJvYcCWqwTUsGRaJy+ArXFH5z+jvXsb4IqZBoQsPqr+B8yBZCvO9D+fy9qI0w0EcNUYXwyCoNjv1LjxCQlkO9YY+rCYXXxUuFiYzv75siG/t3lc4RbFL X-Gm-Message-State: AOJu0Yzb/mhgmkeumOuAGOsKOpjI2RVxB4GcNADvUI/lqF020lezXRl7 McEoh8cuiQ45R0MBNQ29aIfuOtH6/WV0aEKIlY3xqE9FbGbmGgXa X-Google-Smtp-Source: AGHT+IFE88Y01NDpyVnM9dbh09BbehN1C5NKgLuXhQ9nGEMmc/K/v1PhQStdgVBSr4Ah5YC75wymGw== X-Received: by 2002:a05:6808:b25:b0:3c3:5a02:43e9 with SMTP id t5-20020a0568080b2500b003c35a0243e9mr6634361oij.26.1711338246145; Sun, 24 Mar 2024 20:44:06 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id fk26-20020a056a003a9a00b006e6bf17ba8asm3300045pfb.65.2024.03.24.20.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 20:44:05 -0700 (PDT) From: Jason Xing 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 Subject: [PATCH net-next 2/3] trace: use TP_STORE_ADDRS() macro in inet_sk_error_report() Date: Mon, 25 Mar 2024 11:43:46 +0800 Message-Id: <20240325034347.19522-3-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240325034347.19522-1-kerneljasonxing@gmail.com> References: <20240325034347.19522-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing 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 --- 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 #include #include +#include #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", From patchwork Mon Mar 25 03:43:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13601412 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54B622317E2; Mon, 25 Mar 2024 03:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338252; cv=none; b=VL3Fv+eYR9RnOSlPmPr3lwmH2lbRvQUGD0E+ZEtUQ1IQ1vdkhfg2xyc6ytWoAPwCFk+CEpjW8Q/mVy7dUqoUgnKbcQmuxJIrJrvYn5scEZlbsJ2HhCNUg4Km778PvgeCa4Bi2/+8dgjv1CJfspAI44PKgQH2Kv6L+I2moae52Gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338252; c=relaxed/simple; bh=HBFH2KOlP2HSSSU1VXasxhtjODXxUMZmoTi8xeyxyHA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xz3XZKPmPAr8zPyEut+iMMeVyjqc3UudzBt5MXjPVBF5XDVBaxvJiIRT10BcCHrwrzpq0wrD9LEpHwKtI2/7GeiwWmIe+5g1eKNLgQarAvnWEvpde4j3VujtH3CzBDl7QJiarmsMis2abjhlTuNHIycHvBOGkfV1q/nS/Mj6M2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V+kFxnev; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V+kFxnev" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c3ceeb2d04so225731b6e.1; Sun, 24 Mar 2024 20:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711338249; x=1711943049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kxa+WSij7JIs5xDL7CTBVLsNlWQfBNLOi+KNiX5iofA=; b=V+kFxnevAy+zjPsTNMoZ38haKZqkvrM+WhU7pFw+AVMoMUSYqS+RBAEFPcDZCeSuNQ U+rWDYNKN/ihr1C0vEtW+IZ5HGyJaUb0sJ57eMMh8v2UhCKunu36b4GSEDLnrTT2S0uB KCuI3fmqUGKuogz1sgs2d8WE87hipQR5oBEo2Bb5GhrldF0MMHQGSDzHdnQpJsOQxDdh 9ZD6EbB8o0a/U33ArdnJMVg/LIXaDiLqT2zFYOA+cvBNeFTlk1l94WD2VfDjQA5j2YKG ijXW5ZA1yLbjxJj3tLccL8+7XrPPCFyj0KFgPV6ssux4vqZrTW9Sq5Ts5yaxOlLDRlDY YX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711338249; x=1711943049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kxa+WSij7JIs5xDL7CTBVLsNlWQfBNLOi+KNiX5iofA=; b=bMAaGu3P25+yn20SEOdPjB4sAiLhxuqcb/L4KaQkTRprlhebaIIJOw6T8AnN+6qnqh 7twqe9tlziUHziDkFWFMgh4M7yqO2J9zhSsrh11LKoF7EMtzKE7LPcO8CpmcL6gXqnpW 3/sVmcdsvuoAz/a9o+8wdTQs9/vx3jHzmGpyHPJbvW54ifnRQa5DsajETFDAFkcuguoW lrP7rqUszXqRpjkdHDx37yJj/jGIpWLqwDmuwxL8F/tuJ/325shqaMDYUln50jtzZhxd vK3aIzVla8WGwWZhBbQMMxKkQn2yilvEEGqdh5rlEWpqqg13klLBm94FIT53D3ksCmZw /s+A== X-Forwarded-Encrypted: i=1; AJvYcCWR9qJr5/VWlFrpftX/3Kz8rB+okS6WTrlqPJZhdd6FWw/H6/CXyzoHeZTz7njqxdYAG+kEXMD9OdAIMMWzfWBkd5NB4DKUNUzljA8BAEEVjU9k X-Gm-Message-State: AOJu0YzLmMpDN1ZyHAD6DhcMfbWwdBAgmP/A04jhbfnik/Eie0j7pKBu /nlHRrEmcMm4kGLA2bAEWDAK+1EPWhB0dYftpQOTBAyiId6Bh8ju X-Google-Smtp-Source: AGHT+IHUyOOuhWoYDVL1CO50oMAW/4u/8jHC208YNu/haaOWLs1xLeksht3KRVWWw8j44CE9LgsgYQ== X-Received: by 2002:a05:6808:640e:b0:3c3:c251:58ee with SMTP id fg14-20020a056808640e00b003c3c25158eemr7259805oib.4.1711338249456; Sun, 24 Mar 2024 20:44:09 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.20]) by smtp.gmail.com with ESMTPSA id fk26-20020a056a003a9a00b006e6bf17ba8asm3300045pfb.65.2024.03.24.20.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 20:44:08 -0700 (PDT) From: Jason Xing 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 Subject: [PATCH net-next 3/3] trace: use TP_STORE_ADDRS() macro in inet_sock_set_state() Date: Mon, 25 Mar 2024 11:43:47 +0800 Message-Id: <20240325034347.19522-4-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240325034347.19522-1-kerneljasonxing@gmail.com> References: <20240325034347.19522-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing 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 --- 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",