Skip to content

Commit aff3083

Browse files
Tony Ludavem330
authored andcommitted
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: Tony Lu <[email protected]> Reviewed-by: Wen Gu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4826260 commit aff3083

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

net/smc/smc_rx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "smc_tx.h" /* smc_tx_consumer_update() */
2323
#include "smc_rx.h"
2424
#include "smc_stats.h"
25+
#include "smc_tracepoint.h"
2526

2627
/* callback implementation to wakeup consumers blocked with smc_rx_wait().
2728
* indirectly called by smc_cdc_msg_recv_action().
@@ -438,6 +439,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,
438439
if (msg && smc_rx_update_consumer(smc, cons, copylen))
439440
goto out;
440441
}
442+
443+
trace_smc_rx_recvmsg(smc, copylen);
441444
} while (read_remaining);
442445
out:
443446
return read_done;

net/smc/smc_tracepoint.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
#include "smc_tracepoint.h"
55

66
EXPORT_TRACEPOINT_SYMBOL(smc_switch_to_fallback);
7+
EXPORT_TRACEPOINT_SYMBOL(smc_tx_sendmsg);
8+
EXPORT_TRACEPOINT_SYMBOL(smc_rx_recvmsg);

net/smc/smc_tracepoint.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,43 @@ TRACE_EVENT(smc_switch_to_fallback,
3838
__entry->sk, __entry->clcsk, __entry->fallback_rsn)
3939
);
4040

41+
DECLARE_EVENT_CLASS(smc_msg_event,
42+
43+
TP_PROTO(const struct smc_sock *smc, size_t len),
44+
45+
TP_ARGS(smc, len),
46+
47+
TP_STRUCT__entry(
48+
__field(const void *, smc)
49+
__field(size_t, len)
50+
__string(name, smc->conn.lnk->ibname)
51+
),
52+
53+
TP_fast_assign(
54+
__entry->smc = smc;
55+
__entry->len = len;
56+
__assign_str(name, smc->conn.lnk->ibname);
57+
),
58+
59+
TP_printk("smc=%p len=%zu dev=%s",
60+
__entry->smc, __entry->len,
61+
__get_str(name))
62+
);
63+
64+
DEFINE_EVENT(smc_msg_event, smc_tx_sendmsg,
65+
66+
TP_PROTO(const struct smc_sock *smc, size_t len),
67+
68+
TP_ARGS(smc, len)
69+
);
70+
71+
DEFINE_EVENT(smc_msg_event, smc_rx_recvmsg,
72+
73+
TP_PROTO(const struct smc_sock *smc, size_t len),
74+
75+
TP_ARGS(smc, len)
76+
);
77+
4178
#endif /* _TRACE_SMC_H */
4279

4380
#undef TRACE_INCLUDE_PATH

net/smc/smc_tx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "smc_ism.h"
2929
#include "smc_tx.h"
3030
#include "smc_stats.h"
31+
#include "smc_tracepoint.h"
3132

3233
#define SMC_TX_WORK_DELAY 0
3334
#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)
245246
SMC_TX_CORK_DELAY);
246247
else
247248
smc_tx_sndbuf_nonempty(conn);
249+
250+
trace_smc_tx_sendmsg(smc, copylen);
248251
} /* while (msg_data_left(msg)) */
249252

250253
return send_done;

0 commit comments

Comments
 (0)