From patchwork Sun Mar 10 12:14:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13588068 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 071D320DCB; Sun, 10 Mar 2024 12:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072865; cv=none; b=KMIjRGL8t70UfjY017hmFvfk3CgoxAiesAm5QV14LDV+U3a8jYE9ie7U62BDuiNb8L4dSiUEJBM5abSBe4tt9yEyshaKDOe5vZ3jRyvKXGQTG8gLHUYC8JFmNWxJBfyuFIkWf9KtEDIiXwiX3VwG5shwTDmwv2NxxgWRj5CuYCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072865; c=relaxed/simple; bh=zdcY5soF9BXG2lTs8P71BAAJR2cSoF7tMC4SEYlkG9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j1QdnLKiXniAW5KUZBI9O4jz8O3FaaDajAtgktYfiEt9e2VfiFnEZ2oNdGxm2pWSZoLyYAaFbWK94dcxVhV+qIPuuESHnvkM6UFcqVXb4n/UtpqQCcYT66VTJHfB5+PoSqMiu3Mp7lYnREItEanZxl2Z77uFen76ShrIFaINsGI= 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=XJMNfdS6; arc=none smtp.client-ip=209.85.215.177 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="XJMNfdS6" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5dca1efad59so2761130a12.2; Sun, 10 Mar 2024 05:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710072857; x=1710677657; 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=XJMNfdS6/M439o+Eo2IuxVByXZZG4ENEJphuita+5GbUkCeZYJQTwxmen2R9kwcgdx rDoIYTM+6orJHt32my3coyMSUa3rpmvbPb78+mkkPGhBz1VGgGo7nHwntjCluDeGC+A+ mc/GI8zIsnAZGPK7lXiYWYA4nVemDFv6Hk7XL8hsSipZyUtRijPEnEUCmIvpqwgf8Usb eUtwKTobX4bDg61QXyiez+pwt0b+mwhWGS/Pz+on+v1haDeBnAqjkS50KT2CdCx67zis Fb6fcHYC/z9oHu5fFgjXNK4kgkogD4k6ix/jF7Td5K4FV7GaGIRjQQEYPkhjkgJFslGY 9DOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710072857; x=1710677657; 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=uTpIX+TASq1wgHtajrzNOdHiyAQ4JA9aA1Xy9jB2dtGs/KfevzljET463cWFIaryOk yi661yIzaDQNF5T3ngedLOCc+kxC4YDNYzLVImpimKQh1uWBBOvJiCQSTJ3rHh0w3zu6 fwupJ2nsHg/UCNdOfp0qT+rboUGDYsQNed45+R933TOWSyNIlCyWpWJR3sU5v6xGu12h KR+JPYOb2KSP+6ekjhVPwD3KX2yGNam7Xqa1O6d40FhYJ5strCEFXjCIirmhfUKjjQmV /PTVvugVxp0QyV51rqg2XDwLDiyE4+nAZ6KEfGMZTPOMA5Zssel+pjaz+Tf4QvDyLWc7 P9Rg== X-Forwarded-Encrypted: i=1; AJvYcCU0M4D6CXm/RFi6WwW0Dj8Qbi6lA1mQcGvko7/e6f6uYtzbHflv1wN358zORuYfUtcyJUOHJvP94a/WkPMmTCqQ8m2USIFolg67bXGGvyPQTu5m X-Gm-Message-State: AOJu0Yxun0BSTlbHTIdQztDzc6oJ5GuOOQr5lF54DJSMK1LgjmZPXdFN ESCMj3kU8EHRVoIMZ55zQX/WrNSOD+z9O82bacDMmopRe8kDugn7 X-Google-Smtp-Source: AGHT+IE9gyTLI3hvSucH9kpqweThamKgZPjO4tOuwfpZ4AbBG3yg8/bS/6e7WVieZUDfPxK+pYqBqA== X-Received: by 2002:a05:6a00:a13:b0:6e6:1f10:9ead with SMTP id p19-20020a056a000a1300b006e61f109eadmr4107503pfh.27.1710072856599; Sun, 10 Mar 2024 05:14:16 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([114.253.38.90]) by smtp.gmail.com with ESMTPSA id y30-20020aa793de000000b006e5a99942c6sm2485330pff.88.2024.03.10.05.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 05:14:16 -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: Sun, 10 Mar 2024 20:14:04 +0800 Message-Id: <20240310121406.17422-2-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240310121406.17422-1-kerneljasonxing@gmail.com> References: <20240310121406.17422-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 Sun Mar 10 12:14:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13588067 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 CE19E22323; Sun, 10 Mar 2024 12:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072864; cv=none; b=nXflJsTkk4/iM+aAr8Ywt9xcsOAmRMbLTgFwgWNXlpUCoRg18WKf163VLJA4h/kI4skaNzDVOuQARXUrV/n6rMzs0Mm3NngZE3rSJjLF4Svv/RbJbVT8+s9thmDmZGYTVFTJxUnkWZrRYyQmIWuIQKfhs1qpyWhwozkhh2F4Cjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072864; c=relaxed/simple; bh=5+1pMvjbrz7ZOsXjHVDdej8UfRovESGp7iTDJGatsJA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rgAHPBmt+41521jt0WMf2pqPY9ytoNsaxMJvtJ05+8OqtzSROEnQQYwq7Gd53xEgopb9vEc+KciP8COGzMYWQMU/Via9w6bAY4rwfl5FlYRFirHOQYGyafJLqlHvvZcyeQPnDeez5kTZDfrIzlcOtI5Z5MTIJ6SJcorlCflKsyY= 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=bpnlrMNW; arc=none smtp.client-ip=209.85.210.179 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="bpnlrMNW" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6e6872ce492so461336b3a.2; Sun, 10 Mar 2024 05:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710072860; x=1710677660; 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=bpnlrMNWS0K74hQstEmvHoxglIyPRvlM437msZ641BD8Q625GNRzc6Isu7kdmex8oo 2AeNfDr5XN56PNqqT3IzLoICVg/w/XHf7jZYQM+K+Xxm2xOqqWnzUv4hA2TMewFcWaM8 t2LCZHrqj94ZNlStDzAvjZ67A7dQtZzIcYH2MdwHK3NDgtTbCF0dEjmUhptL2Ur3DJUR xPxTTSvXu2A1nF3jzUoCHMJuFFhn6/jc7i4u7bj6r13ouvX7JrNNp8wTh8uFZPAYZzGS NjY2papvA8XcrXw9hVR+iijtNBXGoaPEWzFHiN+9kHL/IqyXMG0rsuObu0vv3FZMbeZk 8UkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710072860; x=1710677660; 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=Led4f1T0J8prLiph+DsOV5/DMs2FLzGqohrai2mV/wl35fIM2EBbG/L8DAOUSjTh/J fMw5nO7ji/gvTOVoSw+UMCcxNyhpdaIzz8csxbSzxfL4Esz9c+7KGU/jRS0N7jjjRbgJ HIR7mw5tzo+WVHjFFOXqaJ8ktmML2winJxPTaXDrIZt/TS05D7I5VgZdJ6wWQJCoXEOV iktHreTjPqOJWczZ9M4FghbFFtXj0GiLbkLqc5BsaKq+44Mri1WY6I4el/8LTAzBcwGf +qJ9eMiX89lgLSvLP3yzRC/0Z6Dqrgmj6HWgMXpvMX85n0v6aY4Zfs1hRN08UzHazJzi jcqA== X-Forwarded-Encrypted: i=1; AJvYcCXfCPnnz85e6UkUMqeDG0x+QbMGM4SmkfOoZEeJDlxl57WrE/dBsUmwHrp6tKnktg2gJ0SNEG5ETtoT+ArnmSSJD4XbUrkhmP5DoCHS83LQpvqo X-Gm-Message-State: AOJu0Yyxt9iE0rdQS18DSyWJ5Pp/vAQa31lWcqPajcjRUwn+cyf26Df2 /8kXSBi3FTcQ2BGRhC71adHvBEFYP0a2k1wmf4b0PoM/dPM//1O4 X-Google-Smtp-Source: AGHT+IEliJ9WoaUNhHucP4o/94ZvdGirYfiSJEdJlm5LR16oyWlSegfIrLq8PJIGExR7o09SIjApbg== X-Received: by 2002:a05:6a20:932f:b0:1a1:4957:ec19 with SMTP id r47-20020a056a20932f00b001a14957ec19mr1487965pzh.62.1710072859902; Sun, 10 Mar 2024 05:14:19 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([114.253.38.90]) by smtp.gmail.com with ESMTPSA id y30-20020aa793de000000b006e5a99942c6sm2485330pff.88.2024.03.10.05.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 05:14:19 -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: Sun, 10 Mar 2024 20:14:05 +0800 Message-Id: <20240310121406.17422-3-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240310121406.17422-1-kerneljasonxing@gmail.com> References: <20240310121406.17422-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 Sun Mar 10 12:14:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13588069 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 8390A20335; Sun, 10 Mar 2024 12:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072866; cv=none; b=EIFXG4AURD9XIkxG3fbWuNX1fKa/0OHPBphceusxeHWnjxoHo4tBLOEqJewuntmAEky/nwMMiw2DlTRKBaieAI6Kg46T7auL2zedIXsZnDN2LCQKNdnB0kORs1gpc3OHB0WgtTb0OJpA2iy3/Z7cr7nTjz8+Mr8n+WKkAfv9sNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710072866; c=relaxed/simple; bh=HBFH2KOlP2HSSSU1VXasxhtjODXxUMZmoTi8xeyxyHA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n80FonI+E1DrLrzinhZhysKHkdjPTEU1Iz2q9TIEQIJJQ7MSq353Zaz6lwAyFLZ7Mdb5G9Puq1Q9oEVYv1smFyLckT2ZaFvOfzNqCp+cv+1dGKRujSIcv5JjHSUJy6BWTgW0jHVWDROxeuobbJD2q/fAIWAeQq5sSCCVCjcV150= 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=IsjvSd13; arc=none smtp.client-ip=209.85.215.177 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="IsjvSd13" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5ce07cf1e5dso2928890a12.2; Sun, 10 Mar 2024 05:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710072863; x=1710677663; 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=IsjvSd13YcKmBjVETrWntfhy9UbZYYMMMLIxvX56HkOjBeotIz7AcQ/QPKuBNmJV5E qivpvO1VVBF/NNkfDLcL6lqQtBi+q+GKZHWxT4uBNsRJYi4gj2cDDBzn249d6OPuqCka pzJgZ94KK/xEfGtjjX1glRjf8PivB9DtdXvmL6Un4tozCdQRqUBAi8ZMfvvtCa2r/t1e cewWj6Qt1kATkq94/doBBrJlXcydhcmizhTuS/1Re7byBeOKHq28ag7wLAldAuwGOEEX l+2nfRmaIvH+plX4vBsJTge0UJign61NRLWdOitwX22F4YxhfIL7k6JdsdcFi7rGoUlp 0cPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710072863; x=1710677663; 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=GswnuHd572i30yuFGANGZ7kjDr9yvx783y8Dppb94RryijZWPS3S7hS+DH4TJR/yf8 QGCqXswC1Ukf9cKSrr53WaE6giW91DAqiJbL+wNpmbJavgZwC4vkYOJRZuX2qQqS/eIc U/rMJWB9BGEDTNOhEhbaTiwk6Ft2IO/qvY4NpMjVXUvrSUGtOVKEbtVDFzb1rBRQy8TY Fp59drxKyfLkcOFzXNeHredo1H0cOKZ8lmRqqjWdCDRy/j1pULogktO+8olIP9ZKaOfF JEAu4XqwOTtCm9hlRXHwN/MePbywFde+zlU3uVCCfbs4ItalCohmf5Jo66ICmErcZbAI vweg== X-Forwarded-Encrypted: i=1; AJvYcCXpEFhVPFXhkfZdu2ruivrXCVSVOSMLCBjnU0C0iZPZdid9OXtSNde7kcQsCotnHxPafv30e7nOB3r6W4fV+Pia9hL2+8LUdnoie5hFZBN+b8sk X-Gm-Message-State: AOJu0YwL4zhY1CEAXAEenMCFmLS1x9gUe+fzr+SFP93eOxuXRVpiwbmM 5BAZSwR50944jx+166w7yS0yxQyRaDOiLhwP6TQkl3txY2T+0x5/ X-Google-Smtp-Source: AGHT+IGhuVnLsiaSde8+4+zCnc9ivPFUP0bbOFza29osma/R+lhSX/EGf4YEy2PXyceUXQo8Fpqq1g== X-Received: by 2002:a05:6a20:2447:b0:1a1:4e02:e54c with SMTP id t7-20020a056a20244700b001a14e02e54cmr2244148pzc.14.1710072863138; Sun, 10 Mar 2024 05:14:23 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([114.253.38.90]) by smtp.gmail.com with ESMTPSA id y30-20020aa793de000000b006e5a99942c6sm2485330pff.88.2024.03.10.05.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 05:14:22 -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: Sun, 10 Mar 2024 20:14:06 +0800 Message-Id: <20240310121406.17422-4-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240310121406.17422-1-kerneljasonxing@gmail.com> References: <20240310121406.17422-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",