Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796102453; b=K+rcJIsM8irBeav21Q3SrfVAojjjfb3JFP3B4XxD2u4+qcWvl7nGlZa/GuKknIqIb0Uw qSbqGmHaQn0FwzUvwl7Ri9mEuBHw4AD1aPaAFicLurxi4ROU6HhlHh16/KbWmvOq2uwFn hvOg4WMIFAFhQk0Q72ypQ8Bl71wGHw7U1adTOu45YWDXsmfnaqqxr5sXX1/x7A6dD1Y1a ighe7WhC+hvWPzX5mFIkVO3LhSE1yA2rA+gurQfn/mAYbRMTQS3dc2e/irHjKxCP6bgGZ 0bYghUA/bkvSqjmYHudtcIPhGtLESDxZaidhkSquYEJ4mAyIFY0gEUFgTr32HD76jRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796102453; h=Received:DKIM-Signature:From:To:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=Alr6OKKVLhJYJ3xUsPeAFv/dO2xCTyebFJH7A1QV+1c=; b=t41Cs//t2V4Qce0agR3nuQc3OlZl+f0yAEa/XQ4RDPP+JZleX9dW2SD00Yb/mq9c78oG NEf+ZcpnmIxF58Baht41pBVh3M9mkBmqZyCrT4cNiarHtM4apGPNhVYAiDIfriWI56HAL wm/hS/TxjkPRfGobmZ9cj6/lZTxAtcS+SQNewxLFdh6KFfJ218/V1L4Igt2WEKpqrNarW YxzLgPc6TpppVlA7Zpul4CUgEQzEqNuDtOrt9RYHRU+Qe9GLjwY2tBNTcHG7NGrRHTa4r l9oqLQ9uC53pE3cjHFAeqm1IDqrRkS4EUAISkYCHxrez+EtLhXTqbEO0es+jP3XD3fA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Swe8iDHI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8E7C606A31A for ; Tue, 1 Dec 2026 05:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Swe8iDHI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F4881F00893 for ; Tue, 1 Dec 2026 05:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796102453; bh=Alr6OKKVLhJYJ3xUsPeAFv/dO2xCTyebFJH7A1QV+1c=; h=From:To:Subject:Date; b=Swe8iDHIc1uCnvn5tRE+ZBXLdZkv1KaT5ulY3JLUGhk2g/h/dShoMLL6uvvhLz5n1 4mRXiBVx4JRRbB+LTPOh1WvlmBcvMmtUvqu0oF7bNFFRZvdRU9hResHts9oxNST81C 6yPQUFyQQxdoHS1nsZqFw95Qjv9okjz62lSPSBKy0a93+G6FFHPpOie3+lTtMn51qM oTd9hJAIyEsMJLNvELGwHHmDSOGV4zAv/Sxco3Gq/uXEmBdGcvq4dIcV8vQm4ElsOD ONz3YEASm+xCMmCdcaeqVvvefzpq8pop8nVFP2SZbf3EkKjyY4WlYUr5ji+jZqf3Q0 oyMRkYVWii/XQ== From: Geliang Tang To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v6 0/5] mptcp: fixes for SIOCINQ Date: Tue, 1 Dec 2026 13:20:44 +0800 Message-ID: X-Mailer: git-send-email 2.55.0 X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Geliang Tang v6: - add patch 2: factor mptcp_data_fin() out of mptcp_pending_data_fin() as a standalone preparation. - patch 4: move the mptcp_data_fin() introduction to patch 2, and drop the rcv_data_fin_seq reset in mptcp_disconnect(). v5: - patch 3: check fallback in mptcp_inq_hint - https://patchwork.kernel.org/project/mptcp/cover/cover.1796008859.git.tanggeliang@kylinos.cn/ v4: - drop patch 1 "handle ack_seq advancing past rcv_data_fin_seq": revert '!before64()' back to '==' in mptcp_pending_data_fin(), the OFO queue edge case is not a real issue - add patch 2 "use SOCK_DONE in mptcp_inq_hint": replace the TCP_CLOSE/RCV_SHUTDOWN check with sock_flag(sk, SOCK_DONE), aligning with tcp_inq_hint() - patch 3: use sock_flag(sk, SOCK_DONE) to add FIN byte instead of checking TCP_CLOSE/RCV_SHUTDOWN and rcv_fastclose, simplifying the condition. - https://patchwork.kernel.org/project/mptcp/cover/cover.1795863454.git.tanggeliang@kylinos.cn/ v3: - patch 3: fix Sashiko AI review comment avoid comparing ack_seq with unset rcv_data_fin_seq (0) check TCP_CLOSE/RCV_SHUTDOWN directly, only call mptcp_data_fin() when rcv_data_fin is true, exclude MP_FASTCLOSE from +1 - https://patchwork.kernel.org/project/mptcp/cover/cover.1795396910.git.tanggeliang@kylinos.cn/ v2: - patch 3: drop mptcp_data_fin_seq(), reuse mptcp_data_fin() - u64 return couldn't distinguish "no DATA_FIN" from "DATA_FIN at seq 0" - mptcp_inq_hint() checks rcv_data_fin/TCP_CLOSE/RCV_SHUTDOWN first - https://patchwork.kernel.org/project/mptcp/cover/cover.1795348666.git.tanggeliang@kylinos.cn/ v1: - https://patchwork.kernel.org/project/mptcp/cover/cover.1795318567.git.tanggeliang@kylinos.cn/ The goal of this series is to make MPTCP's SIOCINQ fully consistent with TCP's: both report the number of readable data bytes, excluding the FIN byte. Patch 1 fixes mptcp_pending_data_fin() to use >= instead of == so that DATA_FIN is processed when ack_seq advances past rcv_data_fin_seq due to OFO queue processing. Patch 2 adds missing smp_wmb/smp_rmb barriers for rcv_data_fin_seq on weakly-ordered architectures. Patch 3 fixes mptcp_inq_hint() INT_MAX overflow on passive TFO by using mptcp_data_avail() instead of ack_seq minus map_seq, and reuses mptcp_data_fin() to guard the FIN byte (+1). Patch 4 adds mptcp_inq() that excludes the FIN byte, matching TCP's tcp_inq() behavior, and switches SIOCINQ to it. Geliang Tang (5): mptcp: add missing memory barriers for rcv_data_fin_seq mptcp: extract mptcp_data_fin helper mptcp: use SOCK_DONE in mptcp_inq_hint mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint mptcp: add mptcp_inq() for SIOCINQ net/mptcp/options.c | 1 + net/mptcp/protocol.c | 60 ++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 21 deletions(-) -- 2.55.0