From patchwork Fri Sep 3 08:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12473805 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 629A32FAE for ; Fri, 3 Sep 2021 08:15:24 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id e7so2853039plh.8 for ; Fri, 03 Sep 2021 01:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LwxhdUzNs4Yv7BXNL36duRUzjPNODr9/N8vCnfzjf38=; b=OcrvsWdqW3u17KZudNttY4Lum9mZTkmKIKM4T+QCpnPHn/KhYkJGTnFj336HBjuTGx zVucAGNy16nSb6WvyATtea1KyHG0Tgp2P2/v0pRHD+DP0KazM9MOSER0Bzgmf/gmv36C hc0z1HuTgai6cPn5g85DzeQZ38g9kUV1FpTLAj6JfdXZDj4iFsVE0jt94kJfyHwx4dqQ rgL7PHUgVKTIjYePev42LSg8LgZuks6eAvhUzrpqExKygE5CUCuy9AelLdK1XLtzyAds g8RfVtPbR0oTr9cDhqMkCi8c0qfI96N1HdA34L3w1Q5x0/UCHNdQnoAaxyewKBsmSRlz uvcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LwxhdUzNs4Yv7BXNL36duRUzjPNODr9/N8vCnfzjf38=; b=GQaxmPcJePzmLT35ZfeUgKwEoBGEBbK5iOYRkQTwe2dP4zzdtrXUlpFh0/PRxoty9x 9oxz8N7X7ohJ5lU0MUo8G2bG0OzYt8cPkeZ9qVOjRTyacSudatfhbDnDt5M4BwhjyVDp omKveFN6GJmFe1Leh1lR67k7NVZdmLa5W5IsWdje+xIEZqaqQk29fO48keBCWkdpRG3b l/z6klqkPd1gfi7HsK4J7bACArvOlxweK9ihUZV8TYI7l0G6KZOePvvoubCi9cM7Fy5v 93sLn2eXxnwPj9HPPiVYQIFbOSzrxhw320JGpFlBQ+7KfPukPYkQsDvtb6R94hjdAu2U t+Ag== X-Gm-Message-State: AOAM533xSH9NpWQkA70AOib1TZnVm4zxKzZoISR567an1iP8FbJAhV9p 4n4A2haV27RWsBitwrWh/BC8FKtIqgo= X-Google-Smtp-Source: ABdhPJw8aeb13KAxrtRaBsqApNAM+UCkHQG/ONtZob++/aQ9mv3N63pRYvbhT5zSymlr+NIekRObnA== X-Received: by 2002:a17:902:74c3:b0:132:287a:c052 with SMTP id f3-20020a17090274c300b00132287ac052mr2066066plt.32.1630656923799; Fri, 03 Sep 2021 01:15:23 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id j6sm5254452pgq.0.2021.09.03.01.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:15:23 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH RFC 1/5] mptcp: don't send RST for single subflow Date: Fri, 3 Sep 2021 16:15:09 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang When a bad checksum is detected and a single subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 1de7ce883c37..dfcd84abc13e 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1167,14 +1167,14 @@ static bool subflow_check_data_avail(struct sock *ssk) /* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { if (mptcp_has_another_subflow(ssk)) { + ssk->sk_err = EBADMSG; + tcp_set_state(ssk, TCP_CLOSE); + subflow->reset_transient = 0; + subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; + tcp_send_active_reset(ssk, GFP_ATOMIC); while ((skb = skb_peek(&ssk->sk_receive_queue))) sk_eat_skb(ssk, skb); } - ssk->sk_err = EBADMSG; - tcp_set_state(ssk, TCP_CLOSE); - subflow->reset_transient = 0; - subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; - tcp_send_active_reset(ssk, GFP_ATOMIC); WRITE_ONCE(subflow->data_avail, 0); return true; } From patchwork Fri Sep 3 08:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12473807 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63C862FAE for ; Fri, 3 Sep 2021 08:15:26 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id v123so3709018pfb.11 for ; Fri, 03 Sep 2021 01:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H52ZY+T5yNNgvSfOu6It6vN6CbQvCRfpMC6u2KrwYTM=; b=jL0aKNkLWmwgLpAQLMjEID7QC3TUZIntB//B6hdkG1S3Zo3l9K6HyrPebSseKMHJyq ASgH0mFCFbWtIY6Um5ptnXn4aWClTVMg1jou1F75Pf4F6s2b2ujrotIOpigZwZsBPeOl RGnoNT5qHyleLwX9JQ963Id8fIYy+IE6CTyj4V3PG00rWwgcrYV0WlWVp1zJuLTqvxoz gnC7twomBnEqDHo46ASjUtvCOsA+QGMUh7QrLV/eFIwvAOn+JzS9NofF4TuI79zRL9xG ZYXQ7aTq9TGfuD3hHqrQs30yRxpK1rrXaAZHWg13RXQWfatg3nD+o7f3UnqwDfQP+mdf dDdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H52ZY+T5yNNgvSfOu6It6vN6CbQvCRfpMC6u2KrwYTM=; b=ps5GSg9o0gdQvKpN+Aj9apNWVjEaElNmXkgGcphOFl3VrsQixZxgJp8zEiBiQGhJX3 T+2/rjiQYEuEabDCQyOBYnd1l6C+wDpeSUqByEnCFm3h66cNSyjskOJVyENXtRacAwKZ yW+cNvAt0FnKc/sKkwRHjFxHTMZ5mUH63PaaW9+Ip+vDwg9Elf70nh0JVpzqZS9K8jNo OwrGmrwVkKG76yiULA9nBIJrOBiXN0DhJgZ2ohvOQdUycX2XHYOHxc+MSuWeXby4PPjF xeOZcpCWg/unTqpcMfPlpiEBvuq8bcuUyd+XiNOOFV7+qvHrqHXbfwvbIkJ5kyhqM/Wa KrTA== X-Gm-Message-State: AOAM530r5FI3Lx4k2/UYvVdbBvL2GJoKn/htwIaAcQ11Lr6IXukR74A5 mfgt5wO7v4VMjEmSxoukk3LatqLi3J4= X-Google-Smtp-Source: ABdhPJzU/l2xJfJzv9HvQ1DohZmiKL1XzXOBZ0cdh4lCakWY705ckU4pKUgUakAyeMmlssMSb9QW1w== X-Received: by 2002:a05:6a00:26c8:b0:3f9:e5a9:92a8 with SMTP id p8-20020a056a0026c800b003f9e5a992a8mr2415248pfw.63.1630656925803; Fri, 03 Sep 2021 01:15:25 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id j6sm5254452pgq.0.2021.09.03.01.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:15:25 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH RFC 2/5] mptcp: infinite mapping sending Date: Fri, 3 Sep 2021 16:15:10 +0800 Message-Id: <7d43c0b1c5f336641d9c8edef80cd0e37b93b668.1630656206.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added the infinite mapping sending logic. Added a new flag snd_infinite_mapping_enable in mptcp_sock. Set it true when a single subflow is in use in mptcp_pm_mp_fail_received. In mptcp_sendmsg_frag, if this flag is true, call the new function mptcp_update_infinite_mapping to set the infinite mapping. In mptcp_write_options, send out the infinite mapping and fallback to a regular TCP. Signed-off-by: Geliang Tang --- net/mptcp/options.c | 13 +++++++++++++ net/mptcp/pm.c | 6 ++++++ net/mptcp/protocol.c | 21 +++++++++++++++++++++ net/mptcp/protocol.h | 1 + 4 files changed, 41 insertions(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 1ec6529c4326..e2df21246be7 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1326,6 +1326,19 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, put_unaligned_be32(mpext->data_len << 16 | TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); } + + if (mpext->data_len == 0) { + const struct sock *ssk = (const struct sock *)tp; + struct mptcp_subflow_context *subflow; + struct mptcp_sock *msk; + + subflow = mptcp_subflow_ctx(ssk); + msk = mptcp_sk(subflow->conn); + + pr_debug("write infinite mapping!"); + pr_fallback(msk); + __mptcp_do_fallback(msk); + } } } else if ((OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & opts->suboptions) { diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6ab386ff3294..39f2dcda53bf 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -251,7 +251,13 @@ void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup) void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) { + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + struct mptcp_sock *msk = mptcp_sk(subflow->conn); + pr_debug("fail_seq=%llu", fail_seq); + + if (!mptcp_has_another_subflow(sk)) + WRITE_ONCE(msk->snd_infinite_mapping_enable, true); } /* path manager helpers */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index faf6e7000d18..dd7738a6b7f5 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1282,6 +1282,22 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); } +static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_ext *mpext) +{ + if (!mpext) + return; + + mpext->data_seq = READ_ONCE(msk->ack_seq); + mpext->data_len = 0; + if (READ_ONCE(msk->csum_enabled)) + mpext->csum = 0; + + WRITE_ONCE(msk->snd_infinite_mapping_enable, false); + + pr_debug("infinite mapping: data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d", + mpext->data_seq, mpext->subflow_seq, mpext->data_len, mpext->dsn64); +} + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1390,6 +1406,10 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, out: if (READ_ONCE(msk->csum_enabled)) mptcp_update_data_checksum(tail, ret); + + if (READ_ONCE(msk->snd_infinite_mapping_enable)) + mptcp_update_infinite_mapping(msk, mpext); + mptcp_subflow_ctx(ssk)->rel_write_seq += ret; return ret; } @@ -2858,6 +2878,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, WRITE_ONCE(msk->fully_established, false); if (mp_opt->suboptions & OPTION_MPTCP_CSUMREQD) WRITE_ONCE(msk->csum_enabled, true); + WRITE_ONCE(msk->snd_infinite_mapping_enable, false); msk->write_seq = subflow_req->idsn + 1; msk->snd_nxt = msk->write_seq; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 99a23fff7b03..33400fcdf1b1 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -246,6 +246,7 @@ struct mptcp_sock { bool fully_established; bool rcv_data_fin; bool snd_data_fin_enable; + bool snd_infinite_mapping_enable; bool rcv_fastclose; bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; From patchwork Fri Sep 3 08:15:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12473809 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F41B2FAE for ; Fri, 3 Sep 2021 08:15:28 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id 18so3709430pfh.9 for ; Fri, 03 Sep 2021 01:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UWkgtNDpnyExH13Hh1PginhvBOJh7Fa7+LbLl4HfK3s=; b=KrLPK8giKxGGAZiQedOtJWSyubk+yJrxB+NV7wImo39rlOGFARirSa61km/W75BMp5 oNGzv1OJMho1G8wLu/8XvJoaRQ3ZQ/BJ+iDRHws49m72ZmKxIq1mzzbAo8Jgp+3vTMgJ ohELz0JM17mu8cI15XYKyYP1dq9hxKhhsrHJRPBmxFHeevKxTwhea0sAaYTbqSJx6onB KAW5HUCZk6T9jCGyXFJcVKEkeejLWJ47xLfUaWs2pkAz5AFEZZnL0+wpk19BlPooVeEQ CMvt5oYcIGTqPDYVZZQ0DxO//+l57HykeXHJl9wUYcQoRMIVV3Kk5GzhVFQfuBrLW5dz +L5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UWkgtNDpnyExH13Hh1PginhvBOJh7Fa7+LbLl4HfK3s=; b=cN+XraMJ/QJNXjGJD1sTwDSSuYiXMNNdxfasqpVPdyzpq5ABtfwsjqanlSEDpakORc 1U9U494tErTnJ1zdN7WdUgjVzLrS6hYfG38anLPb3zZevVL4fT7/rwzVX88sGiyhJThi 09wZJ6wHNryngXS/uR6T/LZ2MoQFlm5ALWAyDLd8b98WGOGTPfwNsYvIGwLkumUMRKaU 3e5fyLoNDO+SnAOLjdr7NIoXH2m7knt6CmFQLcMsqOG7UlJxVK9dvc/Lgd1BWU4yw6qq zTPIVuDP3JmaVHeJqu7TlihzRQmSL3dl01wZ4Z23TiMscs+Z19JunsypCSqCvqLHr8Ya 3wvA== X-Gm-Message-State: AOAM5317EPiMYwrJnnuJSc5UvfHQ2wWfBtr7mLLqnDyAqsI4zg6hNjEk I59aaTgje66KiPBiFXp5Ns1PNd2IzTg= X-Google-Smtp-Source: ABdhPJzuptyB52kqVnIu6IcFxDE/glb57jwkZFMjqFsMFERG4RU+wssVnRetciljjCPKHfAnix9rPA== X-Received: by 2002:a65:51c7:: with SMTP id i7mr2518839pgq.300.1630656927787; Fri, 03 Sep 2021 01:15:27 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id j6sm5254452pgq.0.2021.09.03.01.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:15:27 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH RFC 3/5] mptcp: infinite mapping receiving Date: Fri, 3 Sep 2021 16:15:11 +0800 Message-Id: <3a3eda61ce3b885b2c43cbe63320ecf068bf8267.1630656206.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <7d43c0b1c5f336641d9c8edef80cd0e37b93b668.1630656206.git.geliangtang@xiaomi.com> References: <7d43c0b1c5f336641d9c8edef80cd0e37b93b668.1630656206.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added the infinite mapping receiving logic. Added a new struct member infinite_mapping_received in struct mptcp_subflow_context, set it true when the infinite mapping is received. And added another new struct member infinite_rcv_seq to save the received infinite mapping sequence number. In subflow_check_data_avail, if the infinite_mapping_received flag is set, fallback to a regular TCP. Signed-off-by: Geliang Tang --- net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 33400fcdf1b1..ad26e7c0a18c 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -433,6 +433,7 @@ struct mptcp_subflow_context { backup : 1, send_mp_prio : 1, send_mp_fail : 1, + infinite_mapping_received : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */ @@ -449,6 +450,7 @@ struct mptcp_subflow_context { u8 reset_transient:1; u8 reset_reason:4; u8 stale_count; + u64 infinite_rcv_seq; long delegated_status; struct list_head delegated_node; /* link into delegated_action, protected by local BH */ diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index dfcd84abc13e..95ea01694bb3 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -967,7 +967,10 @@ static enum mapping_status get_mapping_status(struct sock *ssk, data_len = mpext->data_len; if (data_len == 0) { + pr_debug("infinite mapping received, data_seq=%llu", mpext->data_seq); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); + subflow->infinite_mapping_received = 1; + subflow->infinite_rcv_seq = mpext->data_seq; return MAPPING_INVALID; } @@ -1179,6 +1182,20 @@ static bool subflow_check_data_avail(struct sock *ssk) return true; } + if (subflow->infinite_mapping_received) { + pr_fallback(msk); + __mptcp_do_fallback(msk); + skb = skb_peek(&ssk->sk_receive_queue); + subflow->map_valid = 1; + subflow->map_seq = subflow->infinite_rcv_seq; + subflow->map_data_len = skb->len; + subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_DATA_AVAIL); + subflow->infinite_mapping_received = 0; + subflow->infinite_rcv_seq = 0; + return true; + } + if (subflow->mp_join || subflow->fully_established) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers From patchwork Fri Sep 3 08:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12473811 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFD622FAE for ; Fri, 3 Sep 2021 08:15:30 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id u6so3752656pfi.0 for ; Fri, 03 Sep 2021 01:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mJkLgOCoLJ4zw2xOzlXKs1iw7sdJh1E21hL80qTUNj0=; b=fC25G8dYC+R4P7PqV3PzwhR136XOnFxSmlw5yK5HIE15qrOT4Z6LIDhMgUBvUHNLcz sYo+xW0fR+azhqmvXktKdOEKmuP9NBVh57f0lS2Fep2Hxx9XEXOf3TBEHas8YL0FQls/ HEsr3jsGfshbtnn/MDG5zRcm70jyl1qc2/QT63zm/jKkkXMDHiaLppfKj+xKu9ciCcWu gy+8B8AZObArL1SQGmmIz9YfKDAs+qee+Kxj3IQ9q2DwC4Lt3PMvwWrN+LIiU+c++J20 Hdrqw9x6bR/bemI5pDVRkhTb2eWyy1Dt/aqKPGvRx+1eGo4moZVODtCEsCWIP5cNuP9C q3WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mJkLgOCoLJ4zw2xOzlXKs1iw7sdJh1E21hL80qTUNj0=; b=babH4zt95rvkpQ8X7i+muEIpTcdvNgO3KjkqXtQg+IVstoq5JXZZXZuH0koiVT6VwQ wvVRyS3ybq6i6xbPWSwzoyYcNFTniqntWpQklxUAWEojUt1M27ns6BLlcfBvLfVWEOEq SuKmiqGvcLa67O2lq2LFJOn/Qn0SMh4kQUE6HW1sJlsFKCC0oyY1ybO4mi5euyUlcSFu pkdnhJyzRROljqNHFITp13fG4/yEQSFH5l2oEchJNUSj0HSThrDg6qB3HfKYOdlBMbJi kemyxSKVtfovtMX11SHEv8h69Sk/mupGJCaGIfNQjpZAJZmeoFxpBakiGzlWYYxXMTsL dLBQ== X-Gm-Message-State: AOAM532n/KbF8UgoeXzsLpkXFOqXksTImnihcqjwZZHzChvamwkHreCf 4FM+LELJeV/GMpotm9JOqtx7ngqQAkU= X-Google-Smtp-Source: ABdhPJyc0iTpTxQh6I3+VqXgARwPQNJ9ZKFgZY7KfpLqFAbu4RWRZIEwBl6KWn7nO/0pvtcwnCxvfg== X-Received: by 2002:a63:3245:: with SMTP id y66mr2467293pgy.443.1630656930194; Fri, 03 Sep 2021 01:15:30 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id j6sm5254452pgq.0.2021.09.03.01.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:15:29 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH RFC 4/5] mptcp: add a mib for the infinite mapping sending Date: Fri, 3 Sep 2021 16:15:12 +0800 Message-Id: <8c484be5b9db1c3b81690bdba044042f57bf14b1.1630656206.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <3a3eda61ce3b885b2c43cbe63320ecf068bf8267.1630656206.git.geliangtang@xiaomi.com> References: <7d43c0b1c5f336641d9c8edef80cd0e37b93b668.1630656206.git.geliangtang@xiaomi.com> <3a3eda61ce3b885b2c43cbe63320ecf068bf8267.1630656206.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added a new mib named MPTCP_MIB_INFINITEMAPTX, increase it when a infinite mapping has been sent out. Signed-off-by: Geliang Tang --- net/mptcp/mib.c | 1 + net/mptcp/mib.h | 1 + net/mptcp/protocol.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c index b21ff9be04c6..ab55afdcae22 100644 --- a/net/mptcp/mib.c +++ b/net/mptcp/mib.c @@ -24,6 +24,7 @@ static const struct snmp_mib mptcp_snmp_list[] = { SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX), SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC), SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), + SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX), SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH), SNMP_MIB_ITEM("DataCsumErr", MPTCP_MIB_DATACSUMERR), diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index ecd3d8b117e0..7901f1338d15 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -17,6 +17,7 @@ enum linux_mptcp_mib_field { MPTCP_MIB_JOINACKRX, /* Received an ACK + MP_JOIN */ MPTCP_MIB_JOINACKMAC, /* HMAC was wrong on ACK + MP_JOIN */ MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */ + MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */ MPTCP_MIB_DSSTCPMISMATCH, /* DSS-mapping did not map with TCP's sequence numbers */ MPTCP_MIB_DATACSUMERR, /* The data checksum fail */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index dd7738a6b7f5..4987909991cd 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1284,6 +1284,8 @@ static void mptcp_update_data_checksum(struct sk_buff *skb, int added) static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_ext *mpext) { + struct sock *sk = (struct sock *)msk; + if (!mpext) return; @@ -1292,6 +1294,7 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e if (READ_ONCE(msk->csum_enabled)) mpext->csum = 0; + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_INFINITEMAPTX); WRITE_ONCE(msk->snd_infinite_mapping_enable, false); pr_debug("infinite mapping: data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d", From patchwork Fri Sep 3 08:15:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12473813 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10C232FAE for ; Fri, 3 Sep 2021 08:15:35 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id f129so4844704pgc.1 for ; Fri, 03 Sep 2021 01:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X0r8xkabuMTnFKOLePBis2c8/koRRx5UZF7RmXhOtk8=; b=WcmfAohf4+E6+PH9nlkVaY+Hj8KWGEjXdIsX4THzsAlFOaOF6gfaPxqTy8mkpQhazq m7gDIInyH/b+18ydcA16ci8okZCp9FyO/5jgFmsNdz958pCHHeGir1i5MOiYSVhyAnqT 25NzY/XJICxvMFilnVfcvlfhRr0LyEQjXRLKu9Od9jQ8XHHOGC/VZ0fpBoIkbW0PbtuY Pzj2w2+j5t5jr7o/5wkspCNMmFLznIk3ZNQAWPtpJPG2LEyB0jEesm4CnmHioEBDZIrY xC6eqmlbyIBd3a6ucIUaUftTbrfTIUXIL3FGf0OTL8gDFag37oRpRfChGEIEBqATBN01 bTvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X0r8xkabuMTnFKOLePBis2c8/koRRx5UZF7RmXhOtk8=; b=QpvJ8DXz0t9HDxPUXQyh0q+vDCl5TP/8eTg9fxgRd3a3oJh/EmqvmrV0t6fElQDWZl 7LLl7cZm1s7gboFOye/wU3GRv+b12gk4XeTBnBhS9m9bEJPoCbrYEb+KJ/0odZPDHPV9 WNYyO66QtyHrP1Av8a4WRcwQouWZZRu0IpdXNJZOnopU8dkwb4MzxWkcZ/OHO0DigqVw GOEdnlbHCApxsqmivw/mOt5zl4R8J+gk80C6zwT91Ymm2grHIBx/Phqn/zGMNRIJwtq5 uK2CLJITVBCmU55gPSP5BTfSo9DuZBwo9sC5rTUC6w0gj55Sy259/y3QaFzIZi8U1OJP 5Egw== X-Gm-Message-State: AOAM533YQmAVOX/PUko33+b0EMFlutbfrji2Rl8lxOjbRFyVZb+BzuGs c/CygaGAE03TRahILYkTsr46gSP2VC8= X-Google-Smtp-Source: ABdhPJwzYZPqJPNT43We1G+U3Dn2lsng7M7Fd4/OtiGl155w9kwb5NWfAuV8Y/42pikL9DcxokdnRA== X-Received: by 2002:a65:6283:: with SMTP id f3mr2515774pgv.369.1630656934551; Fri, 03 Sep 2021 01:15:34 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id j6sm5254452pgq.0.2021.09.03.01.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:15:33 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH RFC 5/5] DO-NOT-MERGE: mptcp: mp_fail test Date: Fri, 3 Sep 2021 16:15:13 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <8c484be5b9db1c3b81690bdba044042f57bf14b1.1630656206.git.geliangtang@xiaomi.com> References: <7d43c0b1c5f336641d9c8edef80cd0e37b93b668.1630656206.git.geliangtang@xiaomi.com> <3a3eda61ce3b885b2c43cbe63320ecf068bf8267.1630656206.git.geliangtang@xiaomi.com> <8c484be5b9db1c3b81690bdba044042f57bf14b1.1630656206.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang ./mptcp_join.sh -Cf Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 8 ++++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 4987909991cd..2d05236ad759 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1301,6 +1301,8 @@ static void mptcp_update_infinite_mapping(struct mptcp_sock *msk, struct mptcp_e mpext->data_seq, mpext->subflow_seq, mpext->data_len, mpext->dsn64); } +static int i; + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1413,6 +1415,12 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, if (READ_ONCE(msk->snd_infinite_mapping_enable)) mptcp_update_infinite_mapping(msk, mpext); + pr_debug("%s i=%d", __func__, i++); + if (i == 20) + tail->data_len = 1; + if (i > 40) + i = 0; + mptcp_subflow_ctx(ssk)->rel_write_seq += ret; return ret; } diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 255793c5ac4f..16fa761607e4 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -939,6 +939,24 @@ chk_link_usage() subflows_tests() { + # 1 subflow + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "1 subflow" 0 0 0 + + exit + + # multiple subflows + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "multiple subflows" 2 2 2 + reset run_tests $ns1 $ns2 10.0.1.1 chk_join_nr "no JOIN" "0" "0" "0"