Skip to content

Commit 3c15504

Browse files
committed
Merge branch 'rxrpc-ack-fixes'
David Howells says: ==================== rxrpc: ACK handling fixes Here are a couple of patches to fix ACK handling in AF_RXRPC: (1) Allow RTT determination to use an ACK of any type as the response from which to calculate RTT, provided ack.serial matches the serial number of the outgoing packet. (2) Defer the response to a PING ACK packet (or any ACK with the REQUEST_ACK flag set) until after we've parsed the packet so that we carry up to date information if the Tx or Rx rings are advanced. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 75a50c4 + 1a01319 commit 3c15504

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

include/trace/events/rxrpc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@
328328
E_(rxrpc_rtt_tx_ping, "PING")
329329

330330
#define rxrpc_rtt_rx_traces \
331-
EM(rxrpc_rtt_rx_cancel, "CNCL") \
331+
EM(rxrpc_rtt_rx_other_ack, "OACK") \
332332
EM(rxrpc_rtt_rx_obsolete, "OBSL") \
333333
EM(rxrpc_rtt_rx_lost, "LOST") \
334334
EM(rxrpc_rtt_rx_ping_response, "PONG") \

net/rxrpc/input.c

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,8 @@ static void rxrpc_complete_rtt_probe(struct rxrpc_call *call,
643643
clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
644644
smp_mb(); /* Read data before setting avail bit */
645645
set_bit(i, &call->rtt_avail);
646-
if (type != rxrpc_rtt_rx_cancel)
647-
rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
648-
sent_at, resp_time);
649-
else
650-
trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i,
651-
orig_serial, acked_serial, 0, 0);
646+
rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
647+
sent_at, resp_time);
652648
matched = true;
653649
}
654650

@@ -801,28 +797,21 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
801797
summary.ack_reason, nr_acks);
802798
rxrpc_inc_stat(call->rxnet, stat_rx_acks[ack.reason]);
803799

804-
switch (ack.reason) {
805-
case RXRPC_ACK_PING_RESPONSE:
806-
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
807-
rxrpc_rtt_rx_ping_response);
808-
break;
809-
case RXRPC_ACK_REQUESTED:
810-
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
811-
rxrpc_rtt_rx_requested_ack);
812-
break;
813-
default:
814-
if (acked_serial != 0)
800+
if (acked_serial != 0) {
801+
switch (ack.reason) {
802+
case RXRPC_ACK_PING_RESPONSE:
815803
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
816-
rxrpc_rtt_rx_cancel);
817-
break;
818-
}
819-
820-
if (ack.reason == RXRPC_ACK_PING) {
821-
rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial,
822-
rxrpc_propose_ack_respond_to_ping);
823-
} else if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
824-
rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial,
825-
rxrpc_propose_ack_respond_to_ack);
804+
rxrpc_rtt_rx_ping_response);
805+
break;
806+
case RXRPC_ACK_REQUESTED:
807+
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
808+
rxrpc_rtt_rx_requested_ack);
809+
break;
810+
default:
811+
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
812+
rxrpc_rtt_rx_other_ack);
813+
break;
814+
}
826815
}
827816

828817
/* If we get an EXCEEDS_WINDOW ACK from the server, it probably
@@ -835,7 +824,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
835824
rxrpc_is_client_call(call)) {
836825
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
837826
0, -ENETRESET);
838-
return;
827+
goto send_response;
839828
}
840829

841830
/* If we get an OUT_OF_SEQUENCE ACK from the server, that can also
@@ -849,15 +838,15 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
849838
rxrpc_is_client_call(call)) {
850839
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
851840
0, -ENETRESET);
852-
return;
841+
goto send_response;
853842
}
854843

855844
/* Discard any out-of-order or duplicate ACKs (outside lock). */
856845
if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
857846
trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
858847
first_soft_ack, call->acks_first_seq,
859848
prev_pkt, call->acks_prev_seq);
860-
return;
849+
goto send_response;
861850
}
862851

863852
info.rxMTU = 0;
@@ -897,7 +886,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
897886
case RXRPC_CALL_SERVER_AWAIT_ACK:
898887
break;
899888
default:
900-
return;
889+
goto send_response;
901890
}
902891

903892
if (before(hard_ack, call->acks_hard_ack) ||
@@ -909,7 +898,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
909898
if (after(hard_ack, call->acks_hard_ack)) {
910899
if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
911900
rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ack);
912-
return;
901+
goto send_response;
913902
}
914903
}
915904

@@ -927,6 +916,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
927916
rxrpc_propose_ack_ping_for_lost_reply);
928917

929918
rxrpc_congestion_management(call, skb, &summary, acked_serial);
919+
920+
send_response:
921+
if (ack.reason == RXRPC_ACK_PING)
922+
rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial,
923+
rxrpc_propose_ack_respond_to_ping);
924+
else if (sp->hdr.flags & RXRPC_REQUEST_ACK)
925+
rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial,
926+
rxrpc_propose_ack_respond_to_ack);
930927
}
931928

932929
/*

0 commit comments

Comments
 (0)