xref: /linux/net/tls/trace.h (revision 7ec462100ef9142344ddbf86f2c3008b97acddbe)
18538d29cSJakub Kicinski /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
28538d29cSJakub Kicinski /* Copyright (C) 2019 Netronome Systems, Inc. */
38538d29cSJakub Kicinski 
48538d29cSJakub Kicinski #undef TRACE_SYSTEM
58538d29cSJakub Kicinski #define TRACE_SYSTEM tls
68538d29cSJakub Kicinski 
78538d29cSJakub Kicinski #if !defined(_TLS_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
88538d29cSJakub Kicinski #define _TLS_TRACE_H_
98538d29cSJakub Kicinski 
10*5f60d5f6SAl Viro #include <linux/unaligned.h>
118538d29cSJakub Kicinski #include <linux/tracepoint.h>
128538d29cSJakub Kicinski 
138538d29cSJakub Kicinski struct sock;
148538d29cSJakub Kicinski 
158538d29cSJakub Kicinski TRACE_EVENT(tls_device_offload_set,
168538d29cSJakub Kicinski 
178538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk, int dir, u32 tcp_seq, u8 *rec_no, int ret),
188538d29cSJakub Kicinski 
198538d29cSJakub Kicinski 	TP_ARGS(sk, dir, tcp_seq, rec_no, ret),
208538d29cSJakub Kicinski 
218538d29cSJakub Kicinski 	TP_STRUCT__entry(
228538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
238538d29cSJakub Kicinski 		__field(	u64,		rec_no		)
248538d29cSJakub Kicinski 		__field(	int,		dir		)
258538d29cSJakub Kicinski 		__field(	u32,		tcp_seq		)
268538d29cSJakub Kicinski 		__field(	int,		ret		)
278538d29cSJakub Kicinski 	),
288538d29cSJakub Kicinski 
298538d29cSJakub Kicinski 	TP_fast_assign(
308538d29cSJakub Kicinski 		__entry->sk = sk;
318538d29cSJakub Kicinski 		__entry->rec_no = get_unaligned_be64(rec_no);
328538d29cSJakub Kicinski 		__entry->dir = dir;
338538d29cSJakub Kicinski 		__entry->tcp_seq = tcp_seq;
348538d29cSJakub Kicinski 		__entry->ret = ret;
358538d29cSJakub Kicinski 	),
368538d29cSJakub Kicinski 
378538d29cSJakub Kicinski 	TP_printk(
388538d29cSJakub Kicinski 		"sk=%p direction=%d tcp_seq=%u rec_no=%llu ret=%d",
398538d29cSJakub Kicinski 		__entry->sk, __entry->dir, __entry->tcp_seq, __entry->rec_no,
408538d29cSJakub Kicinski 		__entry->ret
418538d29cSJakub Kicinski 	)
428538d29cSJakub Kicinski );
438538d29cSJakub Kicinski 
449ec1c6acSJakub Kicinski TRACE_EVENT(tls_device_decrypted,
459ec1c6acSJakub Kicinski 
469ec1c6acSJakub Kicinski 	TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, u32 rec_len,
479ec1c6acSJakub Kicinski 		 bool encrypted, bool decrypted),
489ec1c6acSJakub Kicinski 
499ec1c6acSJakub Kicinski 	TP_ARGS(sk, tcp_seq, rec_no, rec_len, encrypted, decrypted),
509ec1c6acSJakub Kicinski 
519ec1c6acSJakub Kicinski 	TP_STRUCT__entry(
529ec1c6acSJakub Kicinski 		__field(	struct sock *,	sk		)
539ec1c6acSJakub Kicinski 		__field(	u64,		rec_no		)
549ec1c6acSJakub Kicinski 		__field(	u32,		tcp_seq		)
559ec1c6acSJakub Kicinski 		__field(	u32,		rec_len		)
569ec1c6acSJakub Kicinski 		__field(	bool,		encrypted	)
579ec1c6acSJakub Kicinski 		__field(	bool,		decrypted	)
589ec1c6acSJakub Kicinski 	),
599ec1c6acSJakub Kicinski 
609ec1c6acSJakub Kicinski 	TP_fast_assign(
619ec1c6acSJakub Kicinski 		__entry->sk = sk;
629ec1c6acSJakub Kicinski 		__entry->rec_no = get_unaligned_be64(rec_no);
639ec1c6acSJakub Kicinski 		__entry->tcp_seq = tcp_seq;
649ec1c6acSJakub Kicinski 		__entry->rec_len = rec_len;
659ec1c6acSJakub Kicinski 		__entry->encrypted = encrypted;
669ec1c6acSJakub Kicinski 		__entry->decrypted = decrypted;
679ec1c6acSJakub Kicinski 	),
689ec1c6acSJakub Kicinski 
699ec1c6acSJakub Kicinski 	TP_printk(
709ec1c6acSJakub Kicinski 		"sk=%p tcp_seq=%u rec_no=%llu len=%u encrypted=%d decrypted=%d",
719ec1c6acSJakub Kicinski 		__entry->sk, __entry->tcp_seq,
729ec1c6acSJakub Kicinski 		__entry->rec_no, __entry->rec_len,
739ec1c6acSJakub Kicinski 		__entry->encrypted, __entry->decrypted
749ec1c6acSJakub Kicinski 	)
759ec1c6acSJakub Kicinski );
769ec1c6acSJakub Kicinski 
778538d29cSJakub Kicinski TRACE_EVENT(tls_device_rx_resync_send,
788538d29cSJakub Kicinski 
798538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, int sync_type),
808538d29cSJakub Kicinski 
818538d29cSJakub Kicinski 	TP_ARGS(sk, tcp_seq, rec_no, sync_type),
828538d29cSJakub Kicinski 
838538d29cSJakub Kicinski 	TP_STRUCT__entry(
848538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
858538d29cSJakub Kicinski 		__field(	u64,		rec_no		)
868538d29cSJakub Kicinski 		__field(	u32,		tcp_seq		)
878538d29cSJakub Kicinski 		__field(	int,		sync_type	)
888538d29cSJakub Kicinski 	),
898538d29cSJakub Kicinski 
908538d29cSJakub Kicinski 	TP_fast_assign(
918538d29cSJakub Kicinski 		__entry->sk = sk;
928538d29cSJakub Kicinski 		__entry->rec_no = get_unaligned_be64(rec_no);
938538d29cSJakub Kicinski 		__entry->tcp_seq = tcp_seq;
948538d29cSJakub Kicinski 		__entry->sync_type = sync_type;
958538d29cSJakub Kicinski 	),
968538d29cSJakub Kicinski 
978538d29cSJakub Kicinski 	TP_printk(
988538d29cSJakub Kicinski 		"sk=%p tcp_seq=%u rec_no=%llu sync_type=%d",
998538d29cSJakub Kicinski 		__entry->sk, __entry->tcp_seq, __entry->rec_no,
1008538d29cSJakub Kicinski 		__entry->sync_type
1018538d29cSJakub Kicinski 	)
1028538d29cSJakub Kicinski );
1038538d29cSJakub Kicinski 
1048538d29cSJakub Kicinski TRACE_EVENT(tls_device_rx_resync_nh_schedule,
1058538d29cSJakub Kicinski 
1068538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk),
1078538d29cSJakub Kicinski 
1088538d29cSJakub Kicinski 	TP_ARGS(sk),
1098538d29cSJakub Kicinski 
1108538d29cSJakub Kicinski 	TP_STRUCT__entry(
1118538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
1128538d29cSJakub Kicinski 	),
1138538d29cSJakub Kicinski 
1148538d29cSJakub Kicinski 	TP_fast_assign(
1158538d29cSJakub Kicinski 		__entry->sk = sk;
1168538d29cSJakub Kicinski 	),
1178538d29cSJakub Kicinski 
1188538d29cSJakub Kicinski 	TP_printk(
1198538d29cSJakub Kicinski 		"sk=%p", __entry->sk
1208538d29cSJakub Kicinski 	)
1218538d29cSJakub Kicinski );
1228538d29cSJakub Kicinski 
1238538d29cSJakub Kicinski TRACE_EVENT(tls_device_rx_resync_nh_delay,
1248538d29cSJakub Kicinski 
1258538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk, u32 sock_data, u32 rec_len),
1268538d29cSJakub Kicinski 
1278538d29cSJakub Kicinski 	TP_ARGS(sk, sock_data, rec_len),
1288538d29cSJakub Kicinski 
1298538d29cSJakub Kicinski 	TP_STRUCT__entry(
1308538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
1318538d29cSJakub Kicinski 		__field(	u32,		sock_data	)
1328538d29cSJakub Kicinski 		__field(	u32,		rec_len		)
1338538d29cSJakub Kicinski 	),
1348538d29cSJakub Kicinski 
1358538d29cSJakub Kicinski 	TP_fast_assign(
1368538d29cSJakub Kicinski 		__entry->sk = sk;
1378538d29cSJakub Kicinski 		__entry->sock_data = sock_data;
1388538d29cSJakub Kicinski 		__entry->rec_len = rec_len;
1398538d29cSJakub Kicinski 	),
1408538d29cSJakub Kicinski 
1418538d29cSJakub Kicinski 	TP_printk(
1428538d29cSJakub Kicinski 		"sk=%p sock_data=%u rec_len=%u",
1438538d29cSJakub Kicinski 		__entry->sk, __entry->sock_data, __entry->rec_len
1448538d29cSJakub Kicinski 	)
1458538d29cSJakub Kicinski );
1468538d29cSJakub Kicinski 
1478538d29cSJakub Kicinski TRACE_EVENT(tls_device_tx_resync_req,
1488538d29cSJakub Kicinski 
1498538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk, u32 tcp_seq, u32 exp_tcp_seq),
1508538d29cSJakub Kicinski 
1518538d29cSJakub Kicinski 	TP_ARGS(sk, tcp_seq, exp_tcp_seq),
1528538d29cSJakub Kicinski 
1538538d29cSJakub Kicinski 	TP_STRUCT__entry(
1548538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
1558538d29cSJakub Kicinski 		__field(	u32,		tcp_seq		)
1568538d29cSJakub Kicinski 		__field(	u32,		exp_tcp_seq	)
1578538d29cSJakub Kicinski 	),
1588538d29cSJakub Kicinski 
1598538d29cSJakub Kicinski 	TP_fast_assign(
1608538d29cSJakub Kicinski 		__entry->sk = sk;
1618538d29cSJakub Kicinski 		__entry->tcp_seq = tcp_seq;
1628538d29cSJakub Kicinski 		__entry->exp_tcp_seq = exp_tcp_seq;
1638538d29cSJakub Kicinski 	),
1648538d29cSJakub Kicinski 
1658538d29cSJakub Kicinski 	TP_printk(
1668538d29cSJakub Kicinski 		"sk=%p tcp_seq=%u exp_tcp_seq=%u",
1678538d29cSJakub Kicinski 		__entry->sk, __entry->tcp_seq, __entry->exp_tcp_seq
1688538d29cSJakub Kicinski 	)
1698538d29cSJakub Kicinski );
1708538d29cSJakub Kicinski 
1718538d29cSJakub Kicinski TRACE_EVENT(tls_device_tx_resync_send,
1728538d29cSJakub Kicinski 
1738538d29cSJakub Kicinski 	TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no),
1748538d29cSJakub Kicinski 
1758538d29cSJakub Kicinski 	TP_ARGS(sk, tcp_seq, rec_no),
1768538d29cSJakub Kicinski 
1778538d29cSJakub Kicinski 	TP_STRUCT__entry(
1788538d29cSJakub Kicinski 		__field(	struct sock *,	sk		)
1798538d29cSJakub Kicinski 		__field(	u64,		rec_no		)
1808538d29cSJakub Kicinski 		__field(	u32,		tcp_seq		)
1818538d29cSJakub Kicinski 	),
1828538d29cSJakub Kicinski 
1838538d29cSJakub Kicinski 	TP_fast_assign(
1848538d29cSJakub Kicinski 		__entry->sk = sk;
1858538d29cSJakub Kicinski 		__entry->rec_no = get_unaligned_be64(rec_no);
1868538d29cSJakub Kicinski 		__entry->tcp_seq = tcp_seq;
1878538d29cSJakub Kicinski 	),
1888538d29cSJakub Kicinski 
1898538d29cSJakub Kicinski 	TP_printk(
1908538d29cSJakub Kicinski 		"sk=%p tcp_seq=%u rec_no=%llu",
1918538d29cSJakub Kicinski 		__entry->sk, __entry->tcp_seq, __entry->rec_no
1928538d29cSJakub Kicinski 	)
1938538d29cSJakub Kicinski );
1948538d29cSJakub Kicinski 
1958538d29cSJakub Kicinski #endif /* _TLS_TRACE_H_ */
1968538d29cSJakub Kicinski 
1978538d29cSJakub Kicinski #undef TRACE_INCLUDE_PATH
1988538d29cSJakub Kicinski #define TRACE_INCLUDE_PATH .
1998538d29cSJakub Kicinski #undef TRACE_INCLUDE_FILE
2008538d29cSJakub Kicinski #define TRACE_INCLUDE_FILE trace
2018538d29cSJakub Kicinski 
2028538d29cSJakub Kicinski #include <trace/define_trace.h>
203