/* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright Amazon.com, Inc. or its affiliates. All rights reserved. */

#undef LTTNG_UST_TRACEPOINT_PROVIDER
#define LTTNG_UST_TRACEPOINT_PROVIDER EFA_RDM_TP_PROV

#undef LTTNG_UST_TRACEPOINT_INCLUDE
#define LTTNG_UST_TRACEPOINT_INCLUDE "rdm/efa_rdm_tracepoint_def.h"

#if !defined(_EFA_RDM_TP_DEF_H) || defined(LTTNG_UST_TRACEPOINT_HEADER_MULTI_READ)
#define _EFA_RDM_TP_DEF_H

#include <lttng/tracepoint.h>

#define EFA_RDM_TP_PROV efa_rdm

/* efa_rdm_hmem tracepoints subset */
#include "efa_rdm_hmem_tracepoint_def.h"

/* Pre-defined tracepoints */

#define X_ENTRY_ARGS \
	int, msg_id, \
	size_t, ctx, \
	int, total_len

#define X_ENTRY_FIELDS \
	lttng_ust_field_integer(int, msg_id, msg_id) \
	lttng_ust_field_integer_hex(size_t, ctx, ctx) \
	lttng_ust_field_integer(int, total_len, total_len)

#define RDM_MSG_ARGS \
	size_t, msg_ctx, \
	size_t, addr

#define RDM_MSG_FIELDS \
	lttng_ust_field_integer_hex(size_t, msg_ctx, msg_ctx) \
	lttng_ust_field_integer_hex(size_t, addr, addr)

#define CQ_ENTRY_ARGS \
	int, tag, \
	size_t, addr

#define CQ_ENTRY_FIELDS \
	lttng_ust_field_integer(int, tag, tag) \
	lttng_ust_field_integer_hex(size_t, addr, addr)

#define PKE_ARGS \
	size_t, wr_id

#define PKE_FIELDS \
	lttng_ust_field_integer_hex(size_t, wr_id, wr_id)

#define PKE_OPE_ARGS \
	PKE_ARGS , \
	int, size, \
	X_ENTRY_ARGS

#define PKE_OPE_FIELDS \
	PKE_FIELDS \
	lttng_ust_field_integer(int, size, size) \
	X_ENTRY_FIELDS

#define PKE_OPE_CQ_ENTRY_ARGS \
	PKE_OPE_ARGS , \
	CQ_ENTRY_ARGS

#define PKE_OPE_CQ_ENTRY_FIELDS \
	PKE_OPE_FIELDS \
	CQ_ENTRY_FIELDS

#define PKE_TYPE_ARGS \
	int, pkt_type

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, x_entry,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS),
	LTTNG_UST_TP_FIELDS(X_ENTRY_FIELDS))

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry, EFA_RDM_TP_PROV,
	send_begin,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, send_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry, EFA_RDM_TP_PROV,
	recv_begin,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, recv_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope_cq_entry, EFA_RDM_TP_PROV,
	msg_recv_unexpected_nontagged,
	LTTNG_UST_TP_ARGS(PKE_OPE_CQ_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, msg_recv_unexpected_nontagged, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	msg_match_expected_tagged,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, msg_match_expected_tagged, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	msg_match_expected_nontagged,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, msg_match_expected_nontagged, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry, EFA_RDM_TP_PROV,
	longread_read_posted,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, longread_read_posted, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry, EFA_RDM_TP_PROV,
	runtread_read_posted,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, runtread_read_posted, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, msg_context,
	LTTNG_UST_TP_ARGS(RDM_MSG_ARGS),
	LTTNG_UST_TP_FIELDS(RDM_MSG_FIELDS))

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
	send_begin_msg_context,
	LTTNG_UST_TP_ARGS(RDM_MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, send_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
	recv_begin_msg_context,
	LTTNG_UST_TP_ARGS(RDM_MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, recv_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
	read_begin_msg_context,
	LTTNG_UST_TP_ARGS(RDM_MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, read_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
	write_begin_msg_context,
	LTTNG_UST_TP_ARGS(RDM_MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, write_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, x_entry_cq_entry,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS),
	LTTNG_UST_TP_FIELDS(X_ENTRY_FIELDS CQ_ENTRY_FIELDS))

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, x_entry_cq_entry_pke_type,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS, PKE_TYPE_ARGS),
	LTTNG_UST_TP_FIELDS(X_ENTRY_FIELDS CQ_ENTRY_FIELDS lttng_ust_field_integer(int, pkt_type, pkt_type)))

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry_cq_entry_pke_type, EFA_RDM_TP_PROV,
	poll_cq_ope,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS, PKE_TYPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, poll_cq_ope, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry_cq_entry, EFA_RDM_TP_PROV,
	send_end,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, send_end, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry_cq_entry, EFA_RDM_TP_PROV,
	recv_end,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, recv_end, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, pke_ope_cq_entry,
	LTTNG_UST_TP_ARGS(PKE_OPE_CQ_ENTRY_ARGS),
	LTTNG_UST_TP_FIELDS(PKE_OPE_CQ_ENTRY_FIELDS))

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope_cq_entry, EFA_RDM_TP_PROV,
	msg_recv_unexpected_tagged,
	LTTNG_UST_TP_ARGS(PKE_OPE_CQ_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, msg_recv_unexpected_tagged, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, x_entry_cq_entry, EFA_RDM_TP_PROV,
	msg_match_unexpected,
	LTTNG_UST_TP_ARGS(X_ENTRY_ARGS, CQ_ENTRY_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, msg_match_unexpected, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT(EFA_RDM_TP_PROV,
	read_completed,
	LTTNG_UST_TP_ARGS(
		X_ENTRY_ARGS,
		size_t, context
	),
	LTTNG_UST_TP_FIELDS(
		X_ENTRY_FIELDS
		lttng_ust_field_integer_hex(size_t, context, context)
	)
)
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, read_completed, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT(EFA_RDM_TP_PROV,
	poll_cq,
	LTTNG_UST_TP_ARGS(PKE_ARGS),
	LTTNG_UST_TP_FIELDS(PKE_FIELDS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, poll_cq, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_CLASS(EFA_RDM_TP_PROV, pke_ope,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS),
	LTTNG_UST_TP_FIELDS(PKE_OPE_FIELDS))

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	recv_unexp_match_found,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, recv_unexp_match_found, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_proc_matched_msg_begin,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_proc_matched_msg_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_proc_matched_msg_end,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_proc_matched_msg_end, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_blocking_copy_payload_begin,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_blocking_copy_payload_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_blocking_copy_payload_end,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_blocking_copy_payload_end, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_local_read_copy_payload_begin,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_local_read_copy_payload_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	rx_pke_local_read_copy_payload_end,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, rx_pke_local_read_copy_payload_end, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	trigger_handshake_begin,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, trigger_handshake_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	post_handshake_begin,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, post_handshake_begin, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, pke_ope, EFA_RDM_TP_PROV,
	handshake_send_completion,
	LTTNG_UST_TP_ARGS(PKE_OPE_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, handshake_send_completion, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT(EFA_RDM_TP_PROV,
	handshake_recv_completion,
	LTTNG_UST_TP_ARGS(PKE_ARGS),
	LTTNG_UST_TP_FIELDS(PKE_FIELDS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, handshake_recv_completion, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

#endif /* _EFA_RDM_TP_DEF_H */

#include <lttng/tracepoint-event.h>
