Skip to content

Commit e867e87

Browse files
committed
Merge tag 'rxrpc-rewrite-20160917-2' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
David Howells says: ==================== rxrpc: Tracepoint addition and improvement Here is a set of patches that add some more tracepoints and improve a couple of existing ones. New additions include: (1) Connection refcount tracking. (2) Client connection state machine tracking. (3) Tx and Rx packet lifecycle. (4) ACK reception and transmission. (5) recvmsg processing. Updates include: (1) Print the symbolic packet name in the Rx packet tracepoint. (2) Additional call refcount trace events. (3) Improvements to sk_buff tracking with AF_RXRPC. In addition: (1) Config option to inject packet loss during both transmission and reception. (2) Removal of some printks. This series needs to be applied on top of the previously posted fixes. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 5b0c6fc + 8a681c3 commit e867e87

19 files changed

+740
-150
lines changed

include/trace/events/rxrpc.h

Lines changed: 216 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,66 @@
1616

1717
#include <linux/tracepoint.h>
1818

19+
TRACE_EVENT(rxrpc_conn,
20+
TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
21+
int usage, const void *where),
22+
23+
TP_ARGS(conn, op, usage, where),
24+
25+
TP_STRUCT__entry(
26+
__field(struct rxrpc_connection *, conn )
27+
__field(int, op )
28+
__field(int, usage )
29+
__field(const void *, where )
30+
),
31+
32+
TP_fast_assign(
33+
__entry->conn = conn;
34+
__entry->op = op;
35+
__entry->usage = usage;
36+
__entry->where = where;
37+
),
38+
39+
TP_printk("C=%p %s u=%d sp=%pSR",
40+
__entry->conn,
41+
rxrpc_conn_traces[__entry->op],
42+
__entry->usage,
43+
__entry->where)
44+
);
45+
46+
TRACE_EVENT(rxrpc_client,
47+
TP_PROTO(struct rxrpc_connection *conn, int channel,
48+
enum rxrpc_client_trace op),
49+
50+
TP_ARGS(conn, channel, op),
51+
52+
TP_STRUCT__entry(
53+
__field(struct rxrpc_connection *, conn )
54+
__field(u32, cid )
55+
__field(int, channel )
56+
__field(int, usage )
57+
__field(enum rxrpc_client_trace, op )
58+
__field(enum rxrpc_conn_cache_state, cs )
59+
),
60+
61+
TP_fast_assign(
62+
__entry->conn = conn;
63+
__entry->channel = channel;
64+
__entry->usage = atomic_read(&conn->usage);
65+
__entry->op = op;
66+
__entry->cid = conn->proto.cid;
67+
__entry->cs = conn->cache_state;
68+
),
69+
70+
TP_printk("C=%p h=%2d %s %s i=%08x u=%d",
71+
__entry->conn,
72+
__entry->channel,
73+
rxrpc_client_traces[__entry->op],
74+
rxrpc_conn_cache_states[__entry->cs],
75+
__entry->cid,
76+
__entry->usage)
77+
);
78+
1979
TRACE_EVENT(rxrpc_call,
2080
TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
2181
int usage, const void *where, const void *aux),
@@ -47,14 +107,14 @@ TRACE_EVENT(rxrpc_call,
47107
);
48108

49109
TRACE_EVENT(rxrpc_skb,
50-
TP_PROTO(struct sk_buff *skb, int op, int usage, int mod_count,
51-
const void *where),
110+
TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op,
111+
int usage, int mod_count, const void *where),
52112

53113
TP_ARGS(skb, op, usage, mod_count, where),
54114

55115
TP_STRUCT__entry(
56116
__field(struct sk_buff *, skb )
57-
__field(int, op )
117+
__field(enum rxrpc_skb_trace, op )
58118
__field(int, usage )
59119
__field(int, mod_count )
60120
__field(const void *, where )
@@ -70,11 +130,7 @@ TRACE_EVENT(rxrpc_skb,
70130

71131
TP_printk("s=%p %s u=%d m=%d p=%pSR",
72132
__entry->skb,
73-
(__entry->op == 0 ? "NEW" :
74-
__entry->op == 1 ? "SEE" :
75-
__entry->op == 2 ? "GET" :
76-
__entry->op == 3 ? "FRE" :
77-
"PUR"),
133+
rxrpc_skb_traces[__entry->op],
78134
__entry->usage,
79135
__entry->mod_count,
80136
__entry->where)
@@ -93,11 +149,12 @@ TRACE_EVENT(rxrpc_rx_packet,
93149
memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
94150
),
95151

96-
TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x",
152+
TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s",
97153
__entry->hdr.epoch, __entry->hdr.cid,
98154
__entry->hdr.callNumber, __entry->hdr.serviceId,
99155
__entry->hdr.serial, __entry->hdr.seq,
100-
__entry->hdr.type, __entry->hdr.flags)
156+
__entry->hdr.type, __entry->hdr.flags,
157+
__entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK")
101158
);
102159

103160
TRACE_EVENT(rxrpc_rx_done,
@@ -147,6 +204,155 @@ TRACE_EVENT(rxrpc_abort,
147204
__entry->abort_code, __entry->error, __entry->why)
148205
);
149206

207+
TRACE_EVENT(rxrpc_transmit,
208+
TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why),
209+
210+
TP_ARGS(call, why),
211+
212+
TP_STRUCT__entry(
213+
__field(struct rxrpc_call *, call )
214+
__field(enum rxrpc_transmit_trace, why )
215+
__field(rxrpc_seq_t, tx_hard_ack )
216+
__field(rxrpc_seq_t, tx_top )
217+
),
218+
219+
TP_fast_assign(
220+
__entry->call = call;
221+
__entry->why = why;
222+
__entry->tx_hard_ack = call->tx_hard_ack;
223+
__entry->tx_top = call->tx_top;
224+
),
225+
226+
TP_printk("c=%p %s f=%08x n=%u",
227+
__entry->call,
228+
rxrpc_transmit_traces[__entry->why],
229+
__entry->tx_hard_ack + 1,
230+
__entry->tx_top - __entry->tx_hard_ack)
231+
);
232+
233+
TRACE_EVENT(rxrpc_rx_ack,
234+
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first, u8 reason, u8 n_acks),
235+
236+
TP_ARGS(call, first, reason, n_acks),
237+
238+
TP_STRUCT__entry(
239+
__field(struct rxrpc_call *, call )
240+
__field(rxrpc_seq_t, first )
241+
__field(u8, reason )
242+
__field(u8, n_acks )
243+
),
244+
245+
TP_fast_assign(
246+
__entry->call = call;
247+
__entry->first = first;
248+
__entry->reason = reason;
249+
__entry->n_acks = n_acks;
250+
),
251+
252+
TP_printk("c=%p %s f=%08x n=%u",
253+
__entry->call,
254+
rxrpc_acks(__entry->reason),
255+
__entry->first,
256+
__entry->n_acks)
257+
);
258+
259+
TRACE_EVENT(rxrpc_tx_ack,
260+
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first,
261+
rxrpc_serial_t serial, u8 reason, u8 n_acks),
262+
263+
TP_ARGS(call, first, serial, reason, n_acks),
264+
265+
TP_STRUCT__entry(
266+
__field(struct rxrpc_call *, call )
267+
__field(rxrpc_seq_t, first )
268+
__field(rxrpc_serial_t, serial )
269+
__field(u8, reason )
270+
__field(u8, n_acks )
271+
),
272+
273+
TP_fast_assign(
274+
__entry->call = call;
275+
__entry->first = first;
276+
__entry->serial = serial;
277+
__entry->reason = reason;
278+
__entry->n_acks = n_acks;
279+
),
280+
281+
TP_printk("c=%p %s f=%08x r=%08x n=%u",
282+
__entry->call,
283+
rxrpc_acks(__entry->reason),
284+
__entry->first,
285+
__entry->serial,
286+
__entry->n_acks)
287+
);
288+
289+
TRACE_EVENT(rxrpc_receive,
290+
TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
291+
rxrpc_serial_t serial, rxrpc_seq_t seq),
292+
293+
TP_ARGS(call, why, serial, seq),
294+
295+
TP_STRUCT__entry(
296+
__field(struct rxrpc_call *, call )
297+
__field(enum rxrpc_receive_trace, why )
298+
__field(rxrpc_serial_t, serial )
299+
__field(rxrpc_seq_t, seq )
300+
__field(rxrpc_seq_t, hard_ack )
301+
__field(rxrpc_seq_t, top )
302+
),
303+
304+
TP_fast_assign(
305+
__entry->call = call;
306+
__entry->why = why;
307+
__entry->serial = serial;
308+
__entry->seq = seq;
309+
__entry->hard_ack = call->rx_hard_ack;
310+
__entry->top = call->rx_top;
311+
),
312+
313+
TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
314+
__entry->call,
315+
rxrpc_receive_traces[__entry->why],
316+
__entry->serial,
317+
__entry->seq,
318+
__entry->hard_ack,
319+
__entry->top)
320+
);
321+
322+
TRACE_EVENT(rxrpc_recvmsg,
323+
TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
324+
rxrpc_seq_t seq, unsigned int offset, unsigned int len,
325+
int ret),
326+
327+
TP_ARGS(call, why, seq, offset, len, ret),
328+
329+
TP_STRUCT__entry(
330+
__field(struct rxrpc_call *, call )
331+
__field(enum rxrpc_recvmsg_trace, why )
332+
__field(rxrpc_seq_t, seq )
333+
__field(unsigned int, offset )
334+
__field(unsigned int, len )
335+
__field(int, ret )
336+
),
337+
338+
TP_fast_assign(
339+
__entry->call = call;
340+
__entry->why = why;
341+
__entry->seq = seq;
342+
__entry->offset = offset;
343+
__entry->len = len;
344+
__entry->ret = ret;
345+
),
346+
347+
TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
348+
__entry->call,
349+
rxrpc_recvmsg_traces[__entry->why],
350+
__entry->seq,
351+
__entry->offset,
352+
__entry->len,
353+
__entry->ret)
354+
);
355+
150356
#endif /* _TRACE_RXRPC_H */
151357

152358
/* This part must be outside protection */

net/rxrpc/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ config AF_RXRPC_IPV6
2626
Say Y here to allow AF_RXRPC to use IPV6 UDP as well as IPV4 UDP as
2727
its network transport.
2828

29+
config AF_RXRPC_INJECT_LOSS
30+
bool "Inject packet loss into RxRPC packet stream"
31+
depends on AF_RXRPC
32+
help
33+
Say Y here to inject packet loss by discarding some received and some
34+
transmitted packets.
35+
2936

3037
config AF_RXRPC_DEBUG
3138
bool "RxRPC dynamic debugging"

net/rxrpc/af_rxrpc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ u32 rxrpc_epoch;
4545
atomic_t rxrpc_debug_id;
4646

4747
/* count of skbs currently in use */
48-
atomic_t rxrpc_n_skbs;
48+
atomic_t rxrpc_n_tx_skbs, rxrpc_n_rx_skbs;
4949

5050
struct workqueue_struct *rxrpc_workqueue;
5151

@@ -867,7 +867,8 @@ static void __exit af_rxrpc_exit(void)
867867
proto_unregister(&rxrpc_proto);
868868
rxrpc_destroy_all_calls();
869869
rxrpc_destroy_all_connections();
870-
ASSERTCMP(atomic_read(&rxrpc_n_skbs), ==, 0);
870+
ASSERTCMP(atomic_read(&rxrpc_n_tx_skbs), ==, 0);
871+
ASSERTCMP(atomic_read(&rxrpc_n_rx_skbs), ==, 0);
871872
rxrpc_destroy_all_locals();
872873

873874
remove_proc_entry("rxrpc_conns", init_net.proc_net);

0 commit comments

Comments
 (0)