Commit aff3083f authored by Tony Lu's avatar Tony Lu Committed by David S. Miller
Browse files

net/smc: Introduce tracepoints for tx and rx msg



This introduce two tracepoints for smc tx and rx msg to help us
diagnosis issues of data path. These two tracepoitns don't cover the
path of CORK or MSG_MORE in tx, just the top half of data path.

Signed-off-by: default avatarTony Lu <tonylu@linux.alibaba.com>
Reviewed-by: default avatarWen Gu <guwen@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48262608
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "smc_tx.h" /* smc_tx_consumer_update() */
#include "smc_rx.h"
#include "smc_stats.h"
#include "smc_tracepoint.h"

/* callback implementation to wakeup consumers blocked with smc_rx_wait().
 * indirectly called by smc_cdc_msg_recv_action().
@@ -438,6 +439,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
			if (msg && smc_rx_update_consumer(smc, cons, copylen))
				goto out;
		}

		trace_smc_rx_recvmsg(smc, copylen);
	} while (read_remaining);
out:
	return read_done;
+2 −0
Original line number Diff line number Diff line
@@ -4,3 +4,5 @@
#include "smc_tracepoint.h"

EXPORT_TRACEPOINT_SYMBOL(smc_switch_to_fallback);
EXPORT_TRACEPOINT_SYMBOL(smc_tx_sendmsg);
EXPORT_TRACEPOINT_SYMBOL(smc_rx_recvmsg);
+37 −0
Original line number Diff line number Diff line
@@ -38,6 +38,43 @@ TRACE_EVENT(smc_switch_to_fallback,
		      __entry->sk, __entry->clcsk, __entry->fallback_rsn)
);

DECLARE_EVENT_CLASS(smc_msg_event,

		    TP_PROTO(const struct smc_sock *smc, size_t len),

		    TP_ARGS(smc, len),

		    TP_STRUCT__entry(
				     __field(const void *, smc)
				     __field(size_t, len)
				     __string(name, smc->conn.lnk->ibname)
		    ),

		    TP_fast_assign(
				   __entry->smc = smc;
				   __entry->len = len;
				   __assign_str(name, smc->conn.lnk->ibname);
		    ),

		    TP_printk("smc=%p len=%zu dev=%s",
			      __entry->smc, __entry->len,
			      __get_str(name))
);

DEFINE_EVENT(smc_msg_event, smc_tx_sendmsg,

	     TP_PROTO(const struct smc_sock *smc, size_t len),

	     TP_ARGS(smc, len)
);

DEFINE_EVENT(smc_msg_event, smc_rx_recvmsg,

	     TP_PROTO(const struct smc_sock *smc, size_t len),

	     TP_ARGS(smc, len)
);

#endif /* _TRACE_SMC_H */

#undef TRACE_INCLUDE_PATH
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "smc_ism.h"
#include "smc_tx.h"
#include "smc_stats.h"
#include "smc_tracepoint.h"

#define SMC_TX_WORK_DELAY	0
#define SMC_TX_CORK_DELAY	(HZ >> 2)	/* 250 ms */
@@ -245,6 +246,8 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
					   SMC_TX_CORK_DELAY);
		else
			smc_tx_sndbuf_nonempty(conn);

		trace_smc_tx_sendmsg(smc, copylen);
	} /* while (msg_data_left(msg)) */

	return send_done;