Skip to content

Commit 1a01319

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Defer the response to a PING ACK until we've parsed it
Defer the generation of a PING RESPONSE ACK in response to a PING ACK until we've parsed the PING ACK so that we pick up any changes to the packet queue so that we can update ackinfo. This is also applied to an ACK generated in response to an ACK with the REQUEST_ACK flag set. Note that whilst the problem was added in commit 248f219, it didn't really matter at that point because the ACK was proposed in softirq mode and generated asynchronously later in process context, taking the latest values at the time. But this fix is only needed since the move to parse incoming packets in an I/O thread rather than in softirq and generate the ACK at point of proposal (b034684). Fixes: 248f219 ("rxrpc: Rewrite the data and ack handling code") Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: "David S. Miller" <[email protected]> cc: Eric Dumazet <[email protected]> cc: Jakub Kicinski <[email protected]> cc: Paolo Abeni <[email protected]> cc: [email protected] cc: [email protected] Signed-off-by: David S. Miller <[email protected]>
1 parent 3798680 commit 1a01319

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

net/rxrpc/input.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -814,14 +814,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
814814
}
815815
}
816816

817-
if (ack.reason == RXRPC_ACK_PING) {
818-
rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial,
819-
rxrpc_propose_ack_respond_to_ping);
820-
} else if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
821-
rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial,
822-
rxrpc_propose_ack_respond_to_ack);
823-
}
824-
825817
/* If we get an EXCEEDS_WINDOW ACK from the server, it probably
826818
* indicates that the client address changed due to NAT. The server
827819
* lost the call because it switched to a different peer.
@@ -832,7 +824,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
832824
rxrpc_is_client_call(call)) {
833825
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
834826
0, -ENETRESET);
835-
return;
827+
goto send_response;
836828
}
837829

838830
/* If we get an OUT_OF_SEQUENCE ACK from the server, that can also
@@ -846,15 +838,15 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
846838
rxrpc_is_client_call(call)) {
847839
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
848840
0, -ENETRESET);
849-
return;
841+
goto send_response;
850842
}
851843

852844
/* Discard any out-of-order or duplicate ACKs (outside lock). */
853845
if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
854846
trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
855847
first_soft_ack, call->acks_first_seq,
856848
prev_pkt, call->acks_prev_seq);
857-
return;
849+
goto send_response;
858850
}
859851

860852
info.rxMTU = 0;
@@ -894,7 +886,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
894886
case RXRPC_CALL_SERVER_AWAIT_ACK:
895887
break;
896888
default:
897-
return;
889+
goto send_response;
898890
}
899891

900892
if (before(hard_ack, call->acks_hard_ack) ||
@@ -906,7 +898,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
906898
if (after(hard_ack, call->acks_hard_ack)) {
907899
if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
908900
rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ack);
909-
return;
901+
goto send_response;
910902
}
911903
}
912904

@@ -924,6 +916,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
924916
rxrpc_propose_ack_ping_for_lost_reply);
925917

926918
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);
927927
}
928928

929929
/*

0 commit comments

Comments
 (0)