mptcp: add tracepoint in get_mapping_status
authorGeliang Tang <geliangtang@gmail.com>
Fri, 16 Apr 2021 22:38:05 +0000 (15:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Apr 2021 00:10:40 +0000 (17:10 -0700)
This patch added a tracepoint in the mapping status function
get_mapping_status() to dump every mpext field.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/trace/events/mptcp.h
net/mptcp/subflow.c

index b1617a0162da77c1b85d04cbc7ec59808c79ed6d..ec20350d82ebe14e50528bfa06e8bd8a4dfed256 100644 (file)
@@ -54,6 +54,58 @@ TRACE_EVENT(mptcp_subflow_get_send,
                  __entry->backup, __entry->ratio)
 );
 
+DECLARE_EVENT_CLASS(mptcp_dump_mpext,
+
+       TP_PROTO(struct mptcp_ext *mpext),
+
+       TP_ARGS(mpext),
+
+       TP_STRUCT__entry(
+               __field(u64, data_ack)
+               __field(u64, data_seq)
+               __field(u32, subflow_seq)
+               __field(u16, data_len)
+               __field(u8, use_map)
+               __field(u8, dsn64)
+               __field(u8, data_fin)
+               __field(u8, use_ack)
+               __field(u8, ack64)
+               __field(u8, mpc_map)
+               __field(u8, frozen)
+               __field(u8, reset_transient)
+               __field(u8, reset_reason)
+       ),
+
+       TP_fast_assign(
+               __entry->data_ack = mpext->ack64 ? mpext->data_ack : mpext->data_ack32;
+               __entry->data_seq = mpext->data_seq;
+               __entry->subflow_seq = mpext->subflow_seq;
+               __entry->data_len = mpext->data_len;
+               __entry->use_map = mpext->use_map;
+               __entry->dsn64 = mpext->dsn64;
+               __entry->data_fin = mpext->data_fin;
+               __entry->use_ack = mpext->use_ack;
+               __entry->ack64 = mpext->ack64;
+               __entry->mpc_map = mpext->mpc_map;
+               __entry->frozen = mpext->frozen;
+               __entry->reset_transient = mpext->reset_transient;
+               __entry->reset_reason = mpext->reset_reason;
+       ),
+
+       TP_printk("data_ack=%llu data_seq=%llu subflow_seq=%u data_len=%u use_map=%u dsn64=%u data_fin=%u use_ack=%u ack64=%u mpc_map=%u frozen=%u reset_transient=%u reset_reason=%u",
+                 __entry->data_ack, __entry->data_seq,
+                 __entry->subflow_seq, __entry->data_len,
+                 __entry->use_map, __entry->dsn64,
+                 __entry->data_fin, __entry->use_ack,
+                 __entry->ack64, __entry->mpc_map,
+                 __entry->frozen, __entry->reset_transient,
+                 __entry->reset_reason)
+);
+
+DEFINE_EVENT(mptcp_dump_mpext, get_mapping_status,
+       TP_PROTO(struct mptcp_ext *mpext),
+       TP_ARGS(mpext));
+
 #endif /* _TRACE_MPTCP_H */
 
 /* This part must be outside protection */
index c3da84576b3c15a971845d844d1ffa8fe4035cc0..d8a2a55ae916843738fab6c0576549f3f56cf6a6 100644 (file)
@@ -25,6 +25,8 @@
 #include "protocol.h"
 #include "mib.h"
 
+#include <trace/events/mptcp.h>
+
 static void mptcp_subflow_ops_undo_override(struct sock *ssk);
 
 static void SUBFLOW_REQ_INC_STATS(struct request_sock *req,
@@ -862,9 +864,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
                goto validate_seq;
        }
 
-       pr_debug("seq=%llu is64=%d ssn=%u data_len=%u data_fin=%d",
-                mpext->data_seq, mpext->dsn64, mpext->subflow_seq,
-                mpext->data_len, mpext->data_fin);
+       trace_get_mapping_status(mpext);
 
        data_len = mpext->data_len;
        if (data_len == 0) {