From mboxrd@z Thu Jan 1 00:00:00 1970 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 0CE53403E96 for ; Mon, 3 Aug 2026 13:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785762994; cv=none; b=gRemxmx5rpcggxOx19/X1qP8Rd9hnx6qsY0djln+q/qZdRRSX9z1fH0acbKNhUfe4e9ptKEvUxZWwiYD2tZHLxdd86w9DYgH+I7NLw4Fk2WfiUQifbecQZljM4BE4isiap0589N8zjJv714eisVIwlnUZrEy68fQwzH6u30WchM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785762994; c=relaxed/simple; bh=8RXMK0OkGfAfbbNAGBMBP4nWRi16kTZnfvOhVNTkvck=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FwRbElNrfL4zUkicMqd9Ws+CPHYCzTOwSD3pm2Q0b1BEzX1IH6vjxv7pwsXFcp/hXGOJJq6VZSLA6o/sPbELhKOOzQTJhEWDyU0YhOx9LH1rtYESzj7MEJ3nE99rS4htmGaUwm62RG2BI3PdNpJ0e0S7qRmFJFxV9fc5PNlsyYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dbBHS4oF; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=JB0F70Q7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dbBHS4oF"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="JB0F70Q7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785762982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vzdRbbpPFYy08EoNBkHrDc9rosP5rQCDCdEJJiDjoSA=; b=dbBHS4oFiOA8zAgHYuwKQdMhAlV2kbRprFNFtKf4UDMLHNen6aCukoVORrELSrBctDTFPg wFTzqjtZeqZGt7DPOH66UhKnW4rISUUHmHGxGQVHNVVir7KjFRdzSzukZiJ3Li0hKddhp1 iW4pVTDFvvuZafTCsprbiHSYhXPKw9U= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-bJdF1d2lP-ODdO_EYTY4Pw-1; Mon, 03 Aug 2026 09:16:21 -0400 X-MC-Unique: bJdF1d2lP-ODdO_EYTY4Pw-1 X-Mimecast-MFC-AGG-ID: bJdF1d2lP-ODdO_EYTY4Pw_1785762980 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-495474a5fbcso19157355e9.1 for ; Mon, 03 Aug 2026 06:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1785762980; x=1786367780; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=vzdRbbpPFYy08EoNBkHrDc9rosP5rQCDCdEJJiDjoSA=; b=JB0F70Q73draHfhS2MXkzxG5MBkAKO6GReCDmPNiFHAEI9jlX/x6oxVOeUB/YpArSm qIHNtrh0NyONRfisdda4umT0NM0m3YpHLa68f3FupX06KPi6VfEVhJlX354VGrhr2RdA W7iFcq9P0zrIYNbtAaqGWG+qlf0tXiRJdDO1bqjoxziNbI2JpDN5urGD9wjvJutg7MUJ sNn4C1ERSsCdB85NfDybPx1BxUqCjd2LVEexubwIQpQyPhKBTxIU2CIgXURQiZCMu1J9 KggHSNUzbdzQgFWJZy4/bYVuH23BSorS6YjZls2xHsjVfe6cvXfqYaUhBw8eCglQ3UBL iaXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785762980; x=1786367780; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vzdRbbpPFYy08EoNBkHrDc9rosP5rQCDCdEJJiDjoSA=; b=deohC1dygoNvN8O3E12JTGmdEPYdG6Fr/1I2mpieUU4Oavq3yo0LIeMc9yN450O4yp V6qZ7OzhzO9jFYfhq2935RDBszJWufDtnou81EDefjBuo7Je7mVooCJ99D2sF+liscO6 mDCSmFB9R7lerxERqBict3tsw47FlYSwVLY3gq0Zb3FSXoV3M9ZqOp83u2fdtwpFYsVe yu7YTXqgjA/tmXgtRiLDB/rp7YYp8V/5CICnjxfvMVEVzyQSBmcy8LerJsOZKI1EhOUS iRIcVw2Tno5iwNvPFVrcq6VUbN8I5C4dQu6sQYXWYLO5DXSPgdEGL4IW8KKYwoKcXpNh gjYQ== X-Forwarded-Encrypted: i=1; AHgh+RpGpsOsRuH+bnrgqbESZHKLhAQm2/8nudufcBxZqyHEM010JZrdy8zU3J5/0DMJMmI8sQKRWIwasv9pUHA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/TOexBE1hsi1mciDh+uDSJNre8q8J0uu3E+BwDeUKLN7AgH5L JJBvan+czeZkAY1m4/tzMlOxF6h7DeEOhn4OmAI0IjNwvZqMLeEt/n1/l5bJ/3lCD5jHqP41XCj e1W8r8QKmpn9iFUwk3bce2ijmsNBQyndb4WagWvKnO0qswEvbM2S/q1fuhoBFnrLFUE2PwS5jiQ == X-Gm-Gg: AR+sD130AwhmEakPUAXHlpE+QPvmRjUD0Eyytz9oBvgqQgBrZeIZMlBSB9cKGfKoH9x lupDTGGtu8U4abPwQSfvrEawIcP+JpkoDDCQqiYzp/oX9li9cU+I6D00QIzTJ+bIZE1uoe2e7rN fQNIpbF3hYxmkO/NVJexkNIE+P0ex8LTXbnfUepJukNcAU1ZxqrxqUvfMva2MAbtIbWHFwfB4j4 A6g+To74KJO6BpAlSgh3CQoI/+QwbzIh+t22x0ZwBcxTdr1aWj3x5SALwUUDhFxO2qifHEWb/bX A9m23B7lk09TlshAHA1UFGAjsDUPMhRg0TI/MNDaWbDokqE+ukqpcYKGUE4pdZ9A8pAQY+/GyLZ 43vVu5vhaoh1lfSipIS7jDI7fMDkCTosPCTCbTjOqNbLoULolcTQShrWnDmAcG+x9z7c2qrsrgZ 0= X-Received: by 2002:a05:600c:3f0d:b0:495:641a:bd3f with SMTP id 5b1f17b1804b1-4980c673891mr238817835e9.13.1785762979852; Mon, 03 Aug 2026 06:16:19 -0700 (PDT) X-Received: by 2002:a05:600c:3f0d:b0:495:641a:bd3f with SMTP id 5b1f17b1804b1-4980c673891mr238816565e9.13.1785762979395; Mon, 03 Aug 2026 06:16:19 -0700 (PDT) Received: from [192.168.188.217] (ip239-44-231-195.pool-bba.aruba.it. [195.231.44.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b67529sm240193505e9.8.2026.08.03.06.16.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Aug 2026 06:16:18 -0700 (PDT) Message-ID: <3e83bad9-833e-4946-b29f-cd006ecdc981@redhat.com> Date: Mon, 3 Aug 2026 15:16:17 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v2 2/5] mptcp: let the retrans scheduler do its job To: "Matthieu Baerts (NGI0)" , Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Simon Horman Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, Gang Yan References: <20260731-net-next-mptcp-oooq-pruning-v2-0-24838164fa21@kernel.org> <20260731-net-next-mptcp-oooq-pruning-v2-2-24838164fa21@kernel.org> From: Paolo Abeni Content-Language: en-US In-Reply-To: <20260731-net-next-mptcp-oooq-pruning-v2-2-24838164fa21@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/31/26 4:24 PM, Matthieu Baerts (NGI0) wrote: > @@ -2851,14 +2849,88 @@ static void __mptcp_retrans(struct sock *sk) > struct mptcp_sock *msk = mptcp_sk(sk); > struct mptcp_subflow_context *subflow; > struct mptcp_data_frag *dfrag; > + bool need_retrans; > + u64 retrans_seq; > int err, len; > > - mptcp_clean_una_wakeup(sk); > - > - /* first check ssk: need to kick "stale" logic */ > - err = mptcp_sched_get_retrans(msk); > + mptcp_data_lock(sk); > + __mptcp_clean_una_wakeup(sk); > + retrans_seq = msk->snd_una; > dfrag = mptcp_rtx_head(sk); > - if (!dfrag) { > + need_retrans = !!dfrag; > + mptcp_data_unlock(sk); > + if (!dfrag) > + goto check_data_fin; Clashiko notes that the above will not kick the stale logic anymore when all send data has been acked, and there is pending, unsent data. That is intentional and safe: if no data is in-flight, we don't need stale subflows detection. > + > + for (;;) { > + bool already_retrans; > + u64 sent_seq; > + > + /* The default scheduler will kick "stale" logic, that in > + * turn can process incoming acks and clean the RTX queue; > + * ensure that the current dfrag will still be around > + * afterwards. > + */ > + get_page(dfrag->page); > + err = mptcp_sched_get_retrans(msk); Clashiko noted that the above can cause bad accounting for the stale logic. This needs to be fixed. > + if (err) { > + put_page(dfrag->page); > + break; > + } > + > + /* Incoming acks can have moved retrans sequence after > + * the current dfrag, if so try to start again from RTX head. > + */ > + mptcp_data_lock(sk); > + already_retrans = !before64(msk->snd_una, dfrag->data_seq + > + dfrag->already_sent); > + put_page(dfrag->page); > + if (already_retrans) { > + __mptcp_clean_una_wakeup(sk); > + retrans_seq = msk->snd_una; > + dfrag = mptcp_rtx_head(sk); > + need_retrans = !!dfrag; > + } else if (after64(msk->snd_una, retrans_seq)) { > + retrans_seq = msk->snd_una; > + } > + mptcp_data_unlock(sk); > + > + /* `already_sent` can be 0 for `dfrag` belonging to the RTX > + * queue due to __mptcp_retransmit_pending_data(). > + */ > + if (!dfrag || !dfrag->already_sent) > + break; > + > + /* Can fail only in case of fallback. */ > + len = __mptcp_push_retrans(sk, dfrag, retrans_seq); > + if (len < 0) > + goto clear_scheduled; > + > + retrans_seq += len; > + msk->bytes_retrans += len; > + dfrag->already_sent = max_t(u16, dfrag->already_sent, > + retrans_seq - dfrag->data_seq); > + > + /* With csum enabled retransmission can send new data. */ > + sent_seq = dfrag->already_sent + dfrag->data_seq; > + if (after64(sent_seq, msk->snd_nxt)) > + WRITE_ONCE(msk->snd_nxt, sent_seq); > + > + /* Attempt the next fragment only if the current one is > + * completely retransmitted. > + */ > + if (before64(retrans_seq, dfrag->data_seq + dfrag->data_len)) > + break; > + > + dfrag = list_is_last(&dfrag->list, &msk->rtx_queue) ? > + NULL : list_next_entry(dfrag, list); > + if (!dfrag) > + break; > + } > + > + /* Attempt data-fin retransmission only when the RTX queue is empty. */ > + if (!need_retrans) { Clashiko noted that an error path could reach here with an outdated `need_retrans` value. It needs to be fixed. /P