Skip to content

Commit a176707

Browse files
committed
rxrpc: Make Tx loss-injection go through normal return and adjust tracing
In rxrpc_send_data_packet() make the loss-injection path return through the same code as the transmission path so that the RTT determination is initiated and any future timer shuffling will be done, despite the packet having been binned. Whilst we're at it: (1) Add to the tx_data tracepoint an indication of whether or not we're retransmitting a data packet. (2) When we're deciding whether or not to request an ACK, rather than checking if we're in fast-retransmit mode check instead if we're retransmitting. (3) Don't invoke the lose_skb tracepoint when losing a Tx packet as we're not altering the sk_buff refcount nor are we just seeing it after getting it off the Tx list. (4) The rxrpc_skb_tx_lost note is then no longer used so remove it. (5) rxrpc_lose_skb() no longer needs to deal with rxrpc_skb_tx_lost. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 8732db6 commit a176707

7 files changed

Lines changed: 19 additions & 23 deletions

File tree

include/trace/events/rxrpc.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,16 @@ TRACE_EVENT(rxrpc_rx_ack,
258258

259259
TRACE_EVENT(rxrpc_tx_data,
260260
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
261-
rxrpc_serial_t serial, u8 flags, bool lose),
261+
rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
262262

263-
TP_ARGS(call, seq, serial, flags, lose),
263+
TP_ARGS(call, seq, serial, flags, retrans, lose),
264264

265265
TP_STRUCT__entry(
266266
__field(struct rxrpc_call *, call )
267267
__field(rxrpc_seq_t, seq )
268268
__field(rxrpc_serial_t, serial )
269269
__field(u8, flags )
270+
__field(bool, retrans )
270271
__field(bool, lose )
271272
),
272273

@@ -275,6 +276,7 @@ TRACE_EVENT(rxrpc_tx_data,
275276
__entry->seq = seq;
276277
__entry->serial = serial;
277278
__entry->flags = flags;
279+
__entry->retrans = retrans;
278280
__entry->lose = lose;
279281
),
280282

net/rxrpc/ar-internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ enum rxrpc_skb_trace {
603603
rxrpc_skb_tx_cleaned,
604604
rxrpc_skb_tx_freed,
605605
rxrpc_skb_tx_got,
606-
rxrpc_skb_tx_lost,
607606
rxrpc_skb_tx_new,
608607
rxrpc_skb_tx_rotated,
609608
rxrpc_skb_tx_seen,
@@ -1073,7 +1072,7 @@ extern const s8 rxrpc_ack_priority[];
10731072
* output.c
10741073
*/
10751074
int rxrpc_send_call_packet(struct rxrpc_call *, u8);
1076-
int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *);
1075+
int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *, bool);
10771076
void rxrpc_reject_packets(struct rxrpc_local *);
10781077

10791078
/*

net/rxrpc/call_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
256256
rxrpc_get_skb(skb, rxrpc_skb_tx_got);
257257
spin_unlock_bh(&call->lock);
258258

259-
if (rxrpc_send_data_packet(call, skb) < 0) {
259+
if (rxrpc_send_data_packet(call, skb, true) < 0) {
260260
rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
261261
return;
262262
}

net/rxrpc/misc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ const char rxrpc_skb_traces[rxrpc_skb__nr_trace][7] = {
108108
[rxrpc_skb_tx_cleaned] = "Tx CLN",
109109
[rxrpc_skb_tx_freed] = "Tx FRE",
110110
[rxrpc_skb_tx_got] = "Tx GOT",
111-
[rxrpc_skb_tx_lost] = "Tx *L*",
112111
[rxrpc_skb_tx_new] = "Tx NEW",
113112
[rxrpc_skb_tx_rotated] = "Tx ROT",
114113
[rxrpc_skb_tx_seen] = "Tx SEE",

net/rxrpc/output.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type)
238238
/*
239239
* send a packet through the transport endpoint
240240
*/
241-
int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
241+
int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
242+
bool retrans)
242243
{
243244
struct rxrpc_connection *conn = call->conn;
244245
struct rxrpc_wire_header whdr;
@@ -247,6 +248,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
247248
struct kvec iov[2];
248249
rxrpc_serial_t serial;
249250
size_t len;
251+
bool lost = false;
250252
int ret, opt;
251253

252254
_enter(",{%d}", skb->len);
@@ -281,7 +283,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
281283
/* If our RTT cache needs working on, request an ACK. Also request
282284
* ACKs if a DATA packet appears to have been lost.
283285
*/
284-
if (call->cong_mode == RXRPC_CALL_FAST_RETRANSMIT ||
286+
if (retrans ||
285287
(call->peer->rtt_usage < 3 && sp->hdr.seq & 1) ||
286288
ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000),
287289
ktime_get_real()))
@@ -290,11 +292,9 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
290292
if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) {
291293
static int lose;
292294
if ((lose++ & 7) == 7) {
293-
trace_rxrpc_tx_data(call, sp->hdr.seq, serial,
294-
whdr.flags, true);
295-
rxrpc_lose_skb(skb, rxrpc_skb_tx_lost);
296-
_leave(" = 0 [lose]");
297-
return 0;
295+
ret = 0;
296+
lost = true;
297+
goto done;
298298
}
299299
}
300300

@@ -319,7 +319,8 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb)
319319
goto send_fragmentable;
320320

321321
done:
322-
trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags, false);
322+
trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags,
323+
retrans, lost);
323324
if (ret >= 0) {
324325
ktime_t now = ktime_get_real();
325326
skb->tstamp = now;

net/rxrpc/sendmsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,
144144
if (seq == 1 && rxrpc_is_client_call(call))
145145
rxrpc_expose_client_call(call);
146146

147-
ret = rxrpc_send_data_packet(call, skb);
147+
ret = rxrpc_send_data_packet(call, skb, false);
148148
if (ret < 0) {
149149
_debug("need instant resend %d", ret);
150150
rxrpc_instant_resend(call, ix);

net/rxrpc/skbuff.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,9 @@ void rxrpc_lose_skb(struct sk_buff *skb, enum rxrpc_skb_trace op)
7777
if (skb) {
7878
int n;
7979
CHECK_SLAB_OKAY(&skb->users);
80-
if (op == rxrpc_skb_tx_lost) {
81-
n = atomic_read(select_skb_count(op));
82-
trace_rxrpc_skb(skb, op, atomic_read(&skb->users), n, here);
83-
} else {
84-
n = atomic_dec_return(select_skb_count(op));
85-
trace_rxrpc_skb(skb, op, atomic_read(&skb->users), n, here);
86-
kfree_skb(skb);
87-
}
80+
n = atomic_dec_return(select_skb_count(op));
81+
trace_rxrpc_skb(skb, op, atomic_read(&skb->users), n, here);
82+
kfree_skb(skb);
8883
}
8984
}
9085

0 commit comments

Comments
 (0)