18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
38c2ecf20Sopenharmony_ci#define TRACE_SYSTEM dccp
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#if !defined(_TRACE_DCCP_H) || defined(TRACE_HEADER_MULTI_READ)
68c2ecf20Sopenharmony_ci#define _TRACE_DCCP_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <net/sock.h>
98c2ecf20Sopenharmony_ci#include "dccp.h"
108c2ecf20Sopenharmony_ci#include "ccids/ccid3.h"
118c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
128c2ecf20Sopenharmony_ci#include <trace/events/net_probe_common.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciTRACE_EVENT(dccp_probe,
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	TP_PROTO(struct sock *sk, size_t size),
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	TP_ARGS(sk, size),
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
218c2ecf20Sopenharmony_ci		/* sockaddr_in6 is always bigger than sockaddr_in */
228c2ecf20Sopenharmony_ci		__array(__u8, saddr, sizeof(struct sockaddr_in6))
238c2ecf20Sopenharmony_ci		__array(__u8, daddr, sizeof(struct sockaddr_in6))
248c2ecf20Sopenharmony_ci		__field(__u16, sport)
258c2ecf20Sopenharmony_ci		__field(__u16, dport)
268c2ecf20Sopenharmony_ci		__field(__u16, size)
278c2ecf20Sopenharmony_ci		__field(__u16, tx_s)
288c2ecf20Sopenharmony_ci		__field(__u32, tx_rtt)
298c2ecf20Sopenharmony_ci		__field(__u32, tx_p)
308c2ecf20Sopenharmony_ci		__field(__u32, tx_x_calc)
318c2ecf20Sopenharmony_ci		__field(__u64, tx_x_recv)
328c2ecf20Sopenharmony_ci		__field(__u64, tx_x)
338c2ecf20Sopenharmony_ci		__field(__u32, tx_t_ipi)
348c2ecf20Sopenharmony_ci	),
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	TP_fast_assign(
378c2ecf20Sopenharmony_ci		const struct inet_sock *inet = inet_sk(sk);
388c2ecf20Sopenharmony_ci		struct ccid3_hc_tx_sock *hc = NULL;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci		if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3)
418c2ecf20Sopenharmony_ci			hc = ccid3_hc_tx_sk(sk);
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci		memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
448c2ecf20Sopenharmony_ci		memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci		TP_STORE_ADDR_PORTS(__entry, inet, sk);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci		/* For filtering use */
498c2ecf20Sopenharmony_ci		__entry->sport = ntohs(inet->inet_sport);
508c2ecf20Sopenharmony_ci		__entry->dport = ntohs(inet->inet_dport);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci		__entry->size = size;
538c2ecf20Sopenharmony_ci		if (hc) {
548c2ecf20Sopenharmony_ci			__entry->tx_s = hc->tx_s;
558c2ecf20Sopenharmony_ci			__entry->tx_rtt = hc->tx_rtt;
568c2ecf20Sopenharmony_ci			__entry->tx_p = hc->tx_p;
578c2ecf20Sopenharmony_ci			__entry->tx_x_calc = hc->tx_x_calc;
588c2ecf20Sopenharmony_ci			__entry->tx_x_recv = hc->tx_x_recv >> 6;
598c2ecf20Sopenharmony_ci			__entry->tx_x = hc->tx_x >> 6;
608c2ecf20Sopenharmony_ci			__entry->tx_t_ipi = hc->tx_t_ipi;
618c2ecf20Sopenharmony_ci		} else {
628c2ecf20Sopenharmony_ci			__entry->tx_s = 0;
638c2ecf20Sopenharmony_ci			memset(&__entry->tx_rtt, 0, (void *)&__entry->tx_t_ipi -
648c2ecf20Sopenharmony_ci			       (void *)&__entry->tx_rtt +
658c2ecf20Sopenharmony_ci			       sizeof(__entry->tx_t_ipi));
668c2ecf20Sopenharmony_ci		}
678c2ecf20Sopenharmony_ci	),
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	TP_printk("src=%pISpc dest=%pISpc size=%d tx_s=%d tx_rtt=%d "
708c2ecf20Sopenharmony_ci		  "tx_p=%d tx_x_calc=%u tx_x_recv=%llu tx_x=%llu tx_t_ipi=%d",
718c2ecf20Sopenharmony_ci		  __entry->saddr, __entry->daddr, __entry->size,
728c2ecf20Sopenharmony_ci		  __entry->tx_s, __entry->tx_rtt, __entry->tx_p,
738c2ecf20Sopenharmony_ci		  __entry->tx_x_calc, __entry->tx_x_recv, __entry->tx_x,
748c2ecf20Sopenharmony_ci		  __entry->tx_t_ipi)
758c2ecf20Sopenharmony_ci);
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#endif /* _TRACE_TCP_H */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* This part must be outside protection */
808c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
818c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH .
828c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
838c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace
848c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
85