162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#undef TRACE_SYSTEM
362306a36Sopenharmony_ci#define TRACE_SYSTEM dccp
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#if !defined(_TRACE_DCCP_H) || defined(TRACE_HEADER_MULTI_READ)
662306a36Sopenharmony_ci#define _TRACE_DCCP_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <net/sock.h>
962306a36Sopenharmony_ci#include "dccp.h"
1062306a36Sopenharmony_ci#include "ccids/ccid3.h"
1162306a36Sopenharmony_ci#include <linux/tracepoint.h>
1262306a36Sopenharmony_ci#include <trace/events/net_probe_common.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciTRACE_EVENT(dccp_probe,
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci	TP_PROTO(struct sock *sk, size_t size),
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci	TP_ARGS(sk, size),
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci	TP_STRUCT__entry(
2162306a36Sopenharmony_ci		/* sockaddr_in6 is always bigger than sockaddr_in */
2262306a36Sopenharmony_ci		__array(__u8, saddr, sizeof(struct sockaddr_in6))
2362306a36Sopenharmony_ci		__array(__u8, daddr, sizeof(struct sockaddr_in6))
2462306a36Sopenharmony_ci		__field(__u16, sport)
2562306a36Sopenharmony_ci		__field(__u16, dport)
2662306a36Sopenharmony_ci		__field(__u16, size)
2762306a36Sopenharmony_ci		__field(__u16, tx_s)
2862306a36Sopenharmony_ci		__field(__u32, tx_rtt)
2962306a36Sopenharmony_ci		__field(__u32, tx_p)
3062306a36Sopenharmony_ci		__field(__u32, tx_x_calc)
3162306a36Sopenharmony_ci		__field(__u64, tx_x_recv)
3262306a36Sopenharmony_ci		__field(__u64, tx_x)
3362306a36Sopenharmony_ci		__field(__u32, tx_t_ipi)
3462306a36Sopenharmony_ci	),
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	TP_fast_assign(
3762306a36Sopenharmony_ci		const struct inet_sock *inet = inet_sk(sk);
3862306a36Sopenharmony_ci		struct ccid3_hc_tx_sock *hc = NULL;
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci		if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3)
4162306a36Sopenharmony_ci			hc = ccid3_hc_tx_sk(sk);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci		memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
4462306a36Sopenharmony_ci		memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci		TP_STORE_ADDR_PORTS(__entry, inet, sk);
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci		/* For filtering use */
4962306a36Sopenharmony_ci		__entry->sport = ntohs(inet->inet_sport);
5062306a36Sopenharmony_ci		__entry->dport = ntohs(inet->inet_dport);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci		__entry->size = size;
5362306a36Sopenharmony_ci		if (hc) {
5462306a36Sopenharmony_ci			__entry->tx_s = hc->tx_s;
5562306a36Sopenharmony_ci			__entry->tx_rtt = hc->tx_rtt;
5662306a36Sopenharmony_ci			__entry->tx_p = hc->tx_p;
5762306a36Sopenharmony_ci			__entry->tx_x_calc = hc->tx_x_calc;
5862306a36Sopenharmony_ci			__entry->tx_x_recv = hc->tx_x_recv >> 6;
5962306a36Sopenharmony_ci			__entry->tx_x = hc->tx_x >> 6;
6062306a36Sopenharmony_ci			__entry->tx_t_ipi = hc->tx_t_ipi;
6162306a36Sopenharmony_ci		} else {
6262306a36Sopenharmony_ci			__entry->tx_s = 0;
6362306a36Sopenharmony_ci			memset_startat(__entry, 0, tx_rtt);
6462306a36Sopenharmony_ci		}
6562306a36Sopenharmony_ci	),
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	TP_printk("src=%pISpc dest=%pISpc size=%d tx_s=%d tx_rtt=%d "
6862306a36Sopenharmony_ci		  "tx_p=%d tx_x_calc=%u tx_x_recv=%llu tx_x=%llu tx_t_ipi=%d",
6962306a36Sopenharmony_ci		  __entry->saddr, __entry->daddr, __entry->size,
7062306a36Sopenharmony_ci		  __entry->tx_s, __entry->tx_rtt, __entry->tx_p,
7162306a36Sopenharmony_ci		  __entry->tx_x_calc, __entry->tx_x_recv, __entry->tx_x,
7262306a36Sopenharmony_ci		  __entry->tx_t_ipi)
7362306a36Sopenharmony_ci);
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#endif /* _TRACE_TCP_H */
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/* This part must be outside protection */
7862306a36Sopenharmony_ci#undef TRACE_INCLUDE_PATH
7962306a36Sopenharmony_ci#define TRACE_INCLUDE_PATH .
8062306a36Sopenharmony_ci#undef TRACE_INCLUDE_FILE
8162306a36Sopenharmony_ci#define TRACE_INCLUDE_FILE trace
8262306a36Sopenharmony_ci#include <trace/define_trace.h>
83