Skip to content

Commit

Permalink
mptcp: add tracepoint in subflow_check_data_avail
Browse files Browse the repository at this point in the history
This patch added a tracepoint in subflow_check_data_avail() to show the
mapping status.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
  • Loading branch information
geliangtang authored and matttbe committed Apr 1, 2021
1 parent 834cb89 commit 769badb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
29 changes: 29 additions & 0 deletions include/trace/events/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

#include <linux/tracepoint.h>

#define show_mapping_status(status) \
__print_symbolic(status, \
{ 0, "MAPPING_OK" }, \
{ 1, "MAPPING_INVALID" }, \
{ 2, "MAPPING_EMPTY" }, \
{ 3, "MAPPING_DATA_FIN" }, \
{ 4, "MAPPING_DUMMY" })

TRACE_EVENT(mptcp_subflow_get_send,

TP_PROTO(struct mptcp_subflow_context *subflow),
Expand Down Expand Up @@ -131,6 +139,27 @@ TRACE_EVENT(ack_update_msk,
__entry->msk_wnd_end)
);

TRACE_EVENT(subflow_check_data_avail,

TP_PROTO(__u8 status, struct sk_buff *skb),

TP_ARGS(status, skb),

TP_STRUCT__entry(
__field(u8, status)
__field(const void *, skb)
),

TP_fast_assign(
__entry->status = status;
__entry->skb = skb;
),

TP_printk("mapping_status=%s, skb=%p",
show_mapping_status(__entry->status),
__entry->skb)
);

#endif /* _TRACE_MPTCP_H */

/* This part must be outside protection */
Expand Down
4 changes: 1 addition & 3 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,6 @@ static bool subflow_check_data_avail(struct sock *ssk)
struct mptcp_sock *msk;
struct sk_buff *skb;

pr_debug("msk=%p ssk=%p data_avail=%d skb=%p", subflow->conn, ssk,
subflow->data_avail, skb_peek(&ssk->sk_receive_queue));
if (!skb_peek(&ssk->sk_receive_queue))
subflow->data_avail = 0;
if (subflow->data_avail)
Expand All @@ -1011,7 +1009,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
u64 old_ack;

status = get_mapping_status(ssk, msk);
pr_debug("msk=%p ssk=%p status=%d", msk, ssk, status);
trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
if (status == MAPPING_INVALID) {
ssk->sk_err = EBADMSG;
goto fatal;
Expand Down

0 comments on commit 769badb

Please sign in to comment.