Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3265776rdb; Thu, 16 Nov 2023 05:13:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVgmLY0fQpgrRjxGqu7xYSK5Sop1YkipuYZvH4KcEfbuApEyXDSeqE5iiESgCPef2Zq919 X-Received: by 2002:a17:90b:33c7:b0:280:ff37:8981 with SMTP id lk7-20020a17090b33c700b00280ff378981mr13392000pjb.44.1700140422048; Thu, 16 Nov 2023 05:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700140422; cv=none; d=google.com; s=arc-20160816; b=C4m/SKULca+uzRv5Df9s6yJH2Yftg3X7wvoXxvT22H8PbUDbM6EE/zZe6vh1nioznz smS+IdWOyNS2EZ3NCnFR0rsnpzXBhADlQa2SxJ5tTKT6vJlsIU/i173WKBZlkSPdgCMQ y7h1pJBMGTigKVxLDbujmJQH6acuKIuShRR3RRVU+cM7An/o6Tu0/zEI9ljmV456yOXu wA0R0zMMNPm/FdG1hWwo2OqvF56vwMRJLjYbIqSsHkwgLMi3/kQsvGQGjx1lBhNQqCFj O3Q7q3SX1VyNXrfTfeYtrilr4Bveptel048zLB0kj1toGpjIfr+6jO+o+rUoxsTkhO42 5TuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pni06L1Erygx16Uv1x1PI2n1eAvBA/ceTvUPGaZmGjw=; fh=icnuzcdbhXgwjK0pgvJXK7xplE+Och0jvyZv2PxZJ18=; b=ZKqhIK0760os22oEPch0eg2KKYdcYQVtruc5LBjeYcue3s6gukAUCMKglL3dNQ9NX5 NOBaNq0rtauHBX/BTQZuji+NUZTzTwpr+hQmR42ptgGCZ4ZraEvMy3OLxfWoFvz9vhbt t+LYbGH1a39jP5lWDVo8h2qYjzSMS8APnmaCv9ZknzdRwmG3sr3axtEfnPGzwj/8rpE7 Ml55EZwyZKabKDsZLQc+9sHdtuRFHQvmBEXK5Kgo2iKVV9k/kw0NbkC4rKOpTl7o3Y9A fF/KbVfzhi5K82eBChlKZRM5KZ+um6K7P96U3i0JFdRmPgRlAbNeV51UhiiDafCX0Qba juuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnucxyMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id qc12-20020a17090b288c00b0027ff63ac6c6si2120545pjb.28.2023.11.16.05.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 05:13:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnucxyMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6EF2D8184520; Thu, 16 Nov 2023 05:13:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230326AbjKPNNY (ORCPT + 99 others); Thu, 16 Nov 2023 08:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbjKPNNT (ORCPT ); Thu, 16 Nov 2023 08:13:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F38D56 for ; Thu, 16 Nov 2023 05:13:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700140393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pni06L1Erygx16Uv1x1PI2n1eAvBA/ceTvUPGaZmGjw=; b=EnucxyMqfplZsKGIswrfuxvUBdYtWSFqSW8AUG3ynyH51LCQLi/t5eLwYOfow77Eqb6c1w Ro/MaFJ2UuFuWksuV9GVKm/Fqc5COoWTtc98pvxKaXdgEcYqmWgZNXN4gWCY/gxohU3hHw 8sN4an6NMQIzBpLISEPfmqiUcVRtd/Y= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-5lcP13W_Nei-aSb7UBKm-Q-1; Thu, 16 Nov 2023 08:13:07 -0500 X-MC-Unique: 5lcP13W_Nei-aSb7UBKm-Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 541263C14903; Thu, 16 Nov 2023 13:13:07 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B5EF2026D66; Thu, 16 Nov 2023 13:13:06 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it Date: Thu, 16 Nov 2023 13:12:59 +0000 Message-ID: <20231116131259.103513-3-dhowells@redhat.com> In-Reply-To: <20231116131259.103513-1-dhowells@redhat.com> References: <20231116131259.103513-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 05:13:39 -0800 (PST) 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 248f219cb8bc, 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 (b0346843b1076b34a0278ff601f8f287535cb064). Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code") Signed-off-by: David Howells cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- net/rxrpc/input.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 3f9594d12519..92495e73b869 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -814,14 +814,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) } } - if (ack.reason == RXRPC_ACK_PING) { - rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial, - rxrpc_propose_ack_respond_to_ping); - } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) { - rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial, - rxrpc_propose_ack_respond_to_ack); - } - /* If we get an EXCEEDS_WINDOW ACK from the server, it probably * indicates that the client address changed due to NAT. The server * 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) rxrpc_is_client_call(call)) { rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED, 0, -ENETRESET); - return; + goto send_response; } /* If we get an OUT_OF_SEQUENCE ACK from the server, that can also @@ -846,7 +838,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) rxrpc_is_client_call(call)) { rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED, 0, -ENETRESET); - return; + goto send_response; } /* Discard any out-of-order or duplicate ACKs (outside lock). */ @@ -854,7 +846,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, first_soft_ack, call->acks_first_seq, prev_pkt, call->acks_prev_seq); - return; + goto send_response; } info.rxMTU = 0; @@ -894,7 +886,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) case RXRPC_CALL_SERVER_AWAIT_ACK: break; default: - return; + goto send_response; } 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) if (after(hard_ack, call->acks_hard_ack)) { if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) { rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ack); - return; + goto send_response; } } @@ -924,6 +916,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) rxrpc_propose_ack_ping_for_lost_reply); rxrpc_congestion_management(call, skb, &summary, acked_serial); + +send_response: + if (ack.reason == RXRPC_ACK_PING) + rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial, + rxrpc_propose_ack_respond_to_ping); + else if (sp->hdr.flags & RXRPC_REQUEST_ACK) + rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial, + rxrpc_propose_ack_respond_to_ack); } /*