From nobody Sat Feb 7 12:14:04 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:956b:0:0:0:0:0 with SMTP id y98csp293771jah; Thu, 28 Oct 2021 06:08:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOuECJqOeg7Z/3dXP9Ai4kDhnIAaER3TXovx4115ILC3a6KkYzsh+AcSTH0EoQGPULR+Ns X-Received: by 2002:aca:3555:: with SMTP id c82mr8342153oia.29.1635426528698; Thu, 28 Oct 2021 06:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635426528; cv=none; d=google.com; s=arc-20160816; b=NfDtDu+fLEZST2/F7twTbRQC/DN5s5bXM8nBOiJjuSOlDe0kckobNvhVCGiYQA8XM3 qUflpdQVPArN68s9Vv8ZzjDOTx4BteKO91VqZepDVi/1TTcdi1nnmMnSlCq5sm7CG/Fu KovrVazilLcOypZ7uv6vpMEJP9/3zLkXoCo94mfHLsHSt4WSSylaS2AguuOEr0eh8T/I wQtddi0K3X+qqy51HfehCEkNRBhPc7XvSnLrw0jSGuQca6wbZIpv8RYRdGAFgJ7b63iQ XjllSm+s//9DYZjeS7vEySz9QmcwZf0S+BoF8Fv2Upbt+S5ys+DzW8FXi7uVGQZguy+4 4LDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=oqJmOXQJgdGlxJF0fJEfIeg/KvywkkxkT464zJL0R4w=; b=VFv7wBhxmY/UTst4KBAVMfHu8nsE8aS6KZHmyLgkhorcxCHAHKPCD796szA8E5QHqH IFm/Xd4Fvjku4XRsCMOIzRJLpW1l3IoCObC0lptprSlbJSNEw6xZK8ztMjEWICY1Df0I q8dAdAdnsc458BRDkTpgy0IGeSskc/gJ+NzoVlNCHwTx5jSOs2FPI1WNOGYGNQKsrP+Y f5JZrv9CyLNl0CxKIH8iqpHL3p4RN+zly2OCJb4pDbh+dowk27dHCuoR0KCQCsVhssLQ xq0sMDy4Gy3YJBRUu1wvcevzlVrK2nAvVUlNjf2WqmcyD3utQ0zuWcch62Faxo/QZ5uR buwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J0ye6ltn; spf=pass (google.com: domain of mptcp+bounces-2309-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2309-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id h6si3326417ooj.15.2021.10.28.06.08.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Oct 2021 06:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-2309-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J0ye6ltn; spf=pass (google.com: domain of mptcp+bounces-2309-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2309-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 6CFCC1C0AB4 for ; Thu, 28 Oct 2021 13:08:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F05752C83; Thu, 28 Oct 2021 13:08:45 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81282C87 for ; Thu, 28 Oct 2021 13:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635426523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oqJmOXQJgdGlxJF0fJEfIeg/KvywkkxkT464zJL0R4w=; b=J0ye6ltnG33rs5CcVMX6ydHL2a67/O+tU0/XZfM6m8N2v8uh2p3uH8b9XQhKET5fK07jdp erzt2ILTaR58hI9gTC6TK/jkPD8sKznCHnexF5Fe6rbmzNi2on7Qv0z8AsJYWNJWB5e7mq mN7+PBCdQA6WTxMHDFQJDqn6ibwFpFY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-iH8LFPq5MmKbLxI0CXgQqQ-1; Thu, 28 Oct 2021 09:08:41 -0400 X-MC-Unique: iH8LFPq5MmKbLxI0CXgQqQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 057BFBBF10 for ; Thu, 28 Oct 2021 13:08:41 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FE5D19D9F for ; Thu, 28 Oct 2021 13:08:40 +0000 (UTC) From: Paolo Abeni To: mptcp Subject: [PATCH mptcp-net 1/2] mptcp: fix delack timer Date: Thu, 28 Oct 2021 15:08:32 +0200 Message-Id: <9f483991d5eb9d42d142fb887a2940664fcb1041.1635426465.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric Dumazet To compute the rtx timeout schedule_3rdack_retransmission() does multiple things in the wrong way: srtt_us is measures in usec/8 and the timeout itself is an absolute vale. Fixes: ec3edaa7ca6ce02f ("mptcp: Add handling of outgoing MP_JOIN requests") Signed-off-by: Eric Dumazet --- commit message typos added by me --- net/mptcp/options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 422f4acfb3e6..465d4143d555 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -434,9 +434,10 @@ static void schedule_3rdack_retransmission(struct sock= *sk) =20 /* reschedule with a timeout above RTT, as we must look only for drop */ if (tp->srtt_us) - timeout =3D tp->srtt_us << 1; + timeout =3D usecs_to_jiffies(tp->srtt_us >> (3-1)); else timeout =3D TCP_TIMEOUT_INIT; + timeout +=3D jiffies; =20 WARN_ON_ONCE(icsk->icsk_ack.pending & ICSK_ACK_TIMER); icsk->icsk_ack.pending |=3D ICSK_ACK_SCHED | ICSK_ACK_TIMER; --=20 2.26.3 From nobody Sat Feb 7 12:14:04 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:956b:0:0:0:0:0 with SMTP id y98csp293807jah; Thu, 28 Oct 2021 06:08:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgQ4fkMUgR5atSlCpwTCA/4K2RlFdWB8nBznBd4TZcnc1vp4IlEsig2j5j6iR2BOxFOyAX X-Received: by 2002:a63:751d:: with SMTP id q29mr3136542pgc.222.1635426529753; Thu, 28 Oct 2021 06:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635426529; cv=none; d=google.com; s=arc-20160816; b=WeQZUvJoj2tLthhl4ob+lSfKWxekBwwPWHJxxGUsfSyR6CStLKOg7VEX7KAnr5TS9W JfA74VQlA9ZIqrdCWF6VmsfdslyKgBhZvVLRlOd16XPlw80ljIAmldm7ktML0EM/RGp8 G1bDm3DA1lOHTHBmD+pZoRE1NLgcR4zkVMrpqYo4ydACPnRtrb3h9nPOAzoqHoNB+n/w OFOK83We5/7v8a8h1LYmJBVXzw85eUNKgEeqfItWGTtr7Aheoj/F99aCO2u5ooZGQi5O dRieUGavPviGuOzc3/GcqXHPFYJVADmmjpmdRjCf2uJu1WowQsYpb9ks+WSGpBvterMo PnGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=EEL7dSBhMDJ5HgGkCAFTX3dotRFWXKIiHItes1YHKWc=; b=hGiaOOM3xDypucPexAcWDsSDwQ3iH1pEMuYZPM6FEu5M0eHki5YVh2Vc3WN7G3uOtg XxFNQvIdMopPujU3Sel1yps3iKQdFHMGQMiwaQBL2kOOU/XpGaNjqmy9p0MlJ8gS/g0P Zm81BZlkpfKc+0NnOG3k1+SjhWkoK/VGutYZgZOo2/vaKmTqvNVWjHfTVYqDbET2WaX+ I35gfkcaYKciceETV4VbuLxGWKZHZSin9rEhbMKM2Fw/7YZSsm9REiLNaupyCkZJj/uC mon9quY2xOZiPB8FZHh6R3tfarQssrJ39scz2F4Q/0k/W3x2cqbBwM5+iFZq3YMSIxX9 4g2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TlmCo2iY; spf=pass (google.com: domain of mptcp+bounces-2310-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2310-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id 11si1384227pgu.329.2021.10.28.06.08.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Oct 2021 06:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-2310-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TlmCo2iY; spf=pass (google.com: domain of mptcp+bounces-2310-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-2310-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id 4295C3E0FF3 for ; Thu, 28 Oct 2021 13:08:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD45A2C87; Thu, 28 Oct 2021 13:08:46 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 205222C8E for ; Thu, 28 Oct 2021 13:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635426524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EEL7dSBhMDJ5HgGkCAFTX3dotRFWXKIiHItes1YHKWc=; b=TlmCo2iYQ+1VSPk+ewCS+sLTT6QiL2ECI3UW+IzsXIcwiPBm8VhTC5Qo45fJXJvDyvF0LJ GwgZ1T3KUGLkCJsWTXSjJSEDwwk4rPlVAdzZ+idO5XJdECbxxQREQjtWKORLsTA1cskorJ kssgY4sLosVo04A3U15gAQsmzA+Ztds= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-LF8Khtx1PJ6Rsf-2qr4g3g-1; Thu, 28 Oct 2021 09:08:42 -0400 X-MC-Unique: LF8Khtx1PJ6Rsf-2qr4g3g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 293ED802B7A for ; Thu, 28 Oct 2021 13:08:42 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63B7419D9F for ; Thu, 28 Oct 2021 13:08:41 +0000 (UTC) From: Paolo Abeni To: mptcp Subject: [PATCH mptcp-net 2/2] mptcp: use delegate action to schedule 3rd ack retrans Date: Thu, 28 Oct 2021 15:08:33 +0200 Message-Id: <2a28807616445b389496dc0f172e206180f5a099.1635426465.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Scheduling a delack in mptcp_established_options_mp() is not a good idea: such function is called by tcp_send_ack() and the pending delayed ack will be cleared shortly after by the tcp_event_ack_sent() call in __tcp_transmit_skb(). Instead use the mptcp delegated action infrastructure to schedule the delayed ack after the current bh processing completes. Additionally moves the schedule_3rdack_retransmission() helper into protocol.c to avoid making it visible in a different compilation unit. Fixes: ec3edaa7ca6ce02f ("mptcp: Add handling of outgoing MP_JOIN requests") Signed-off-by: Paolo Abeni --- side note: Why we already see 3rd ack retransimssion in pcap traces even if the delac= k timer was broken sice the beginning?!? I guess that is due to pure ack generated by mptcp_recvmsg() and pushed on all the subflow. mptcp_send_ack() only checks for the TCP status and not the MPTCP one. When landing on MPJ subflows not already fully established, such data-ack will be converted in = MPJ 3rd ack by the MPTCP output path/out options building, as the MPJ option has higher priority than DSS --- net/mptcp/options.c | 33 ++++++++--------------------- net/mptcp/protocol.c | 50 ++++++++++++++++++++++++++++++++++++-------- net/mptcp/protocol.h | 17 ++++++++------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 465d4143d555..12ffee025373 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -422,29 +422,6 @@ bool mptcp_syn_options(struct sock *sk, const struct s= k_buff *skb, return false; } =20 -/* MP_JOIN client subflow must wait for 4th ack before sending any data: - * TCP can't schedule delack timer before the subflow is fully established. - * MPTCP uses the delack timer to do 3rd ack retransmissions - */ -static void schedule_3rdack_retransmission(struct sock *sk) -{ - struct inet_connection_sock *icsk =3D inet_csk(sk); - struct tcp_sock *tp =3D tcp_sk(sk); - unsigned long timeout; - - /* reschedule with a timeout above RTT, as we must look only for drop */ - if (tp->srtt_us) - timeout =3D usecs_to_jiffies(tp->srtt_us >> (3-1)); - else - timeout =3D TCP_TIMEOUT_INIT; - timeout +=3D jiffies; - - WARN_ON_ONCE(icsk->icsk_ack.pending & ICSK_ACK_TIMER); - icsk->icsk_ack.pending |=3D ICSK_ACK_SCHED | ICSK_ACK_TIMER; - icsk->icsk_ack.timeout =3D timeout; - sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout); -} - static void clear_3rdack_retransmission(struct sock *sk) { struct inet_connection_sock *icsk =3D inet_csk(sk); @@ -527,7 +504,15 @@ static bool mptcp_established_options_mp(struct sock *= sk, struct sk_buff *skb, *size =3D TCPOLEN_MPTCP_MPJ_ACK; pr_debug("subflow=3D%p", subflow); =20 - schedule_3rdack_retransmission(sk); + /* we can use the full delegate action helper only from BH context + * If we are in process context - sk is flushing the backlog at + * socket lock release time - just set the appropriate flag, will + * be handled by the release callback + */ + if (sock_owned_by_user(sk)) + set_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status); + else + mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); return true; } return false; diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 582f5f88d6ef..cd00f8998375 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1619,7 +1619,7 @@ static void __mptcp_subflow_push_pending(struct sock = *sk, struct sock *ssk) if (!xmit_ssk) goto out; if (xmit_ssk !=3D ssk) { - mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk)); + mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk), MPTCP_DELEGATE_SEN= D); goto out; } =20 @@ -2972,7 +2972,7 @@ void __mptcp_check_push(struct sock *sk, struct sock = *ssk) if (xmit_ssk =3D=3D ssk) __mptcp_subflow_push_pending(sk, ssk); else if (xmit_ssk) - mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk)); + mptcp_subflow_delegate(mptcp_subflow_ctx(xmit_ssk), MPTCP_DELEGATE_SEND= ); } else { set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags); } @@ -3022,18 +3022,50 @@ static void mptcp_release_cb(struct sock *sk) __mptcp_update_rmem(sk); } =20 +/* MP_JOIN client subflow must wait for 4th ack before sending any data: + * TCP can't schedule delack timer before the subflow is fully established. + * MPTCP uses the delack timer to do 3rd ack retransmissions + */ +static void schedule_3rdack_retransmission(struct sock *ssk) +{ + struct inet_connection_sock *icsk =3D inet_csk(ssk); + struct tcp_sock *tp =3D tcp_sk(ssk); + unsigned long timeout; + + if (mptcp_subflow_ctx(ssk)->fully_established) + return; + + /* reschedule with a timeout above RTT, as we must look only for drop */ + if (tp->srtt_us) + timeout =3D usecs_to_jiffies(tp->srtt_us >> (3-1)); + else + timeout =3D TCP_TIMEOUT_INIT; + timeout +=3D jiffies; + + WARN_ON_ONCE(icsk->icsk_ack.pending & ICSK_ACK_TIMER); + icsk->icsk_ack.pending |=3D ICSK_ACK_SCHED | ICSK_ACK_TIMER; + icsk->icsk_ack.timeout =3D timeout; + sk_reset_timer(ssk, &icsk->icsk_delack_timer, timeout); +} + void mptcp_subflow_process_delegated(struct sock *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); struct sock *sk =3D subflow->conn; =20 - mptcp_data_lock(sk); - if (!sock_owned_by_user(sk)) - __mptcp_subflow_push_pending(sk, ssk); - else - set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags); - mptcp_data_unlock(sk); - mptcp_subflow_delegated_done(subflow); + if (test_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status)) { + mptcp_data_lock(sk); + if (!sock_owned_by_user(sk)) + __mptcp_subflow_push_pending(sk, ssk); + else + set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags); + mptcp_data_unlock(sk); + mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_SEND); + } + if (test_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status)) { + schedule_3rdack_retransmission(ssk); + mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_ACK); + } } =20 static int mptcp_hash(struct sock *sk) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 46691acdea24..f6f4054e19ee 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -387,6 +387,7 @@ struct mptcp_delegated_action { DECLARE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions); =20 #define MPTCP_DELEGATE_SEND 0 +#define MPTCP_DELEGATE_ACK 1 =20 /* MPTCP subflow context */ struct mptcp_subflow_context { @@ -493,23 +494,23 @@ static inline void mptcp_add_pending_subflow(struct m= ptcp_sock *msk, =20 void mptcp_subflow_process_delegated(struct sock *ssk); =20 -static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *su= bflow) +static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *su= bflow, int action) { struct mptcp_delegated_action *delegated; bool schedule; =20 + /* the caller held the subflow bh socket lock */ + lockdep_assert_in_softirq(); + /* The implied barrier pairs with mptcp_subflow_delegated_done(), and * ensures the below list check sees list updates done prior to status * bit changes */ - if (!test_and_set_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status)) { + if (!test_and_set_bit(action, &subflow->delegated_status)) { /* still on delegated list from previous scheduling */ if (!list_empty(&subflow->delegated_node)) return; =20 - /* the caller held the subflow bh socket lock */ - lockdep_assert_in_softirq(); - delegated =3D this_cpu_ptr(&mptcp_delegated_actions); schedule =3D list_empty(&delegated->head); list_add_tail(&subflow->delegated_node, &delegated->head); @@ -534,16 +535,16 @@ mptcp_subflow_delegated_next(struct mptcp_delegated_a= ction *delegated) =20 static inline bool mptcp_subflow_has_delegated_action(const struct mptcp_s= ubflow_context *subflow) { - return test_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status); + return !!READ_ONCE(subflow->delegated_status); } =20 -static inline void mptcp_subflow_delegated_done(struct mptcp_subflow_conte= xt *subflow) +static inline void mptcp_subflow_delegated_done(struct mptcp_subflow_conte= xt *subflow, int action) { /* pairs with mptcp_subflow_delegate, ensures delegate_node is updated be= fore * touching the status bit */ smp_wmb(); - clear_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status); + clear_bit(action, &subflow->delegated_status); } =20 int mptcp_is_enabled(const struct net *net); --=20 2.26.3