Skip to content

Commit 49e19ec

Browse files
committed
rxrpc: Add tracepoints to record received packets and end of data_ready
Add two tracepoints: (1) Record the RxRPC protocol header of packets retrieved from the UDP socket by the data_ready handler. (2) Record the outcome of the data_ready handler. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 2ab2721 commit 49e19ec

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

include/trace/events/rxrpc.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,44 @@ TRACE_EVENT(rxrpc_skb,
8080
__entry->where)
8181
);
8282

83+
TRACE_EVENT(rxrpc_rx_packet,
84+
TP_PROTO(struct rxrpc_skb_priv *sp),
85+
86+
TP_ARGS(sp),
87+
88+
TP_STRUCT__entry(
89+
__field_struct(struct rxrpc_host_header, hdr )
90+
),
91+
92+
TP_fast_assign(
93+
memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
94+
),
95+
96+
TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x",
97+
__entry->hdr.epoch, __entry->hdr.cid,
98+
__entry->hdr.callNumber, __entry->hdr.serviceId,
99+
__entry->hdr.serial, __entry->hdr.seq,
100+
__entry->hdr.type, __entry->hdr.flags)
101+
);
102+
103+
TRACE_EVENT(rxrpc_rx_done,
104+
TP_PROTO(int result, int abort_code),
105+
106+
TP_ARGS(result, abort_code),
107+
108+
TP_STRUCT__entry(
109+
__field(int, result )
110+
__field(int, abort_code )
111+
),
112+
113+
TP_fast_assign(
114+
__entry->result = result;
115+
__entry->abort_code = abort_code;
116+
),
117+
118+
TP_printk("r=%d a=%d", __entry->result, __entry->abort_code)
119+
);
120+
83121
TRACE_EVENT(rxrpc_abort,
84122
TP_PROTO(const char *why, u32 cid, u32 call_id, rxrpc_seq_t seq,
85123
int abort_code, int error),

net/rxrpc/input.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ void rxrpc_data_ready(struct sock *sk)
683683
/* dig out the RxRPC connection details */
684684
if (rxrpc_extract_header(sp, skb) < 0)
685685
goto bad_message;
686+
trace_rxrpc_rx_packet(sp);
686687

687688
_net("Rx RxRPC %s ep=%x call=%x:%x",
688689
sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient",
@@ -767,6 +768,7 @@ void rxrpc_data_ready(struct sock *sk)
767768
out_unlock:
768769
rcu_read_unlock();
769770
out:
771+
trace_rxrpc_rx_done(0, 0);
770772
return;
771773

772774
cant_route_call:
@@ -780,7 +782,7 @@ void rxrpc_data_ready(struct sock *sk)
780782
skb_queue_tail(&local->accept_queue, skb);
781783
rxrpc_queue_work(&local->processor);
782784
_leave(" [incoming]");
783-
return;
785+
goto out;
784786
}
785787
skb->priority = RX_INVALID_OPERATION;
786788
} else {
@@ -789,7 +791,7 @@ void rxrpc_data_ready(struct sock *sk)
789791

790792
if (sp->hdr.type != RXRPC_PACKET_TYPE_ABORT) {
791793
_debug("reject type %d",sp->hdr.type);
792-
rxrpc_reject_packet(local, skb);
794+
goto reject_packet;
793795
} else {
794796
rxrpc_free_skb(skb);
795797
}
@@ -798,6 +800,8 @@ void rxrpc_data_ready(struct sock *sk)
798800

799801
bad_message:
800802
skb->priority = RX_PROTOCOL_ERROR;
803+
reject_packet:
804+
trace_rxrpc_rx_done(skb->mark, skb->priority);
801805
rxrpc_reject_packet(local, skb);
802806
_leave(" [badmsg]");
803807
}

0 commit comments

Comments
 (0)