From patchwork Sun Sep 26 14:29:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518297 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 D1EA93FCB for ; Sun, 26 Sep 2021 14:29:47 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id x191so8273232pgd.9 for ; Sun, 26 Sep 2021 07:29:47 -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=8pEVYQmO+Vs8OD4UzwV8aPzQVxwvvtDwq1B52ddwyoE=; b=cn/WzZ47W5siC2ZGMa2HeJ6b5YSFSOajjh5o7L/gs6xUMRyhqwdDS3mCatZuMQcu4t 8oV1RK1BxZx5ki08HLnoESWtZ9jG9ZY6BSJIeUtlkPYMjZJaxT29gyaVhjMlsYCZD/mG iGpGpXlEoXT0c0Pe/UfiJUgwCgv5Xoppen6YfG41KLzWeaFhvOBx8g4gnK66YX6/HcLC LViUEzL8t64FgYkFgiBewq9TyLJRPNJNfh3qOcGwkdx0+Q8nU6dNTOiTO3jMcemA1v2s Rtry/9JKTiVajIKAD6ZIlVvQXNRHkaKLcOLqtL5hMews4jGkhW3wjMww/uIV3QWH41f7 nHMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8pEVYQmO+Vs8OD4UzwV8aPzQVxwvvtDwq1B52ddwyoE=; b=1xZx00lohaX0QgzTO0LNxjnaq0bb4MMBS5HpA94KD+sg4MF6K1/rSJJ04RpM+x1aR9 v9Gli3q7NdU/Qm7zT2V+F1eNOLNS/+mWifVlV+kYw3tKMoNuAUfHBqxTt4sSU+wbWHwF 0lJB/iNocH8YLTW9bmef8NodBTv62l/Morad010rAFtgzP6vKpnFIpwbzqjwnM4h2r3Y pjxaVTCk05DRrVOQy4HU+h1gfCWXd9NNDepe+foiA4v0xIducYI5TihKDqZ0wF+xDYpE YslG9pWXeYbwGzUmpJrgIWsyrh3u4pbCnN0bGrqaUzynItIIHoVOduWgQfndAA7ncwhF pE+w== X-Gm-Message-State: AOAM5302k9wAMDYER8623Uo+8lRGbISjlbbuBIpNysWL49VSU/StDRE5 h+oXxHKfHoQPPBNanAGwGDkf/uoy6+0= X-Google-Smtp-Source: ABdhPJzkyM29+0M+nQ9ySBypfj7g6QZZqsXN0NTCe/tDi9ppt6c2G5hHDMbhFC9DWaOEvAF0S+245w== X-Received: by 2002:aa7:968e:0:b0:447:a593:926e with SMTP id f14-20020aa7968e000000b00447a593926emr18925766pfk.27.1632666587308; Sun, 26 Sep 2021 07:29:47 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:47 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Paolo Abeni Subject: [PATCH mptcp-next v5 1/8] mptcp: track and update contiguous data status Date: Sun, 26 Sep 2021 22:29:31 +0800 Message-Id: <50885831cb65affbe180d3d9be3ba879f8e331f2.1632666254.git.geliangtang@gmail.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 This patch added a new member last_retrans_seq in mptcp_subflow_context to track the last retransmitting sequence number. Add a new helper named mptcp_is_data_contiguous() to check whether the data is contiguous on a subflow. When a bad checksum is detected and a single contiguous subflow is in use, don't send RST + MP_FAIL, send data_ack + MP_FAIL instead. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 6 ++++++ net/mptcp/protocol.h | 8 ++++++++ net/mptcp/subflow.c | 12 ++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index f8ad049d6941..cf8cccfefb51 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -729,6 +729,9 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk) if (unlikely(subflow->disposable)) return; + if (!subflow->last_retrans_seq || mptcp_is_data_contiguous(ssk)) + subflow->last_retrans_seq = tcp_sk(ssk)->snd_una - 1; + ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf); sk_rbuf = READ_ONCE(sk->sk_rcvbuf); if (unlikely(ssk_rbuf > sk_rbuf)) @@ -2415,6 +2418,7 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk) static void __mptcp_retrans(struct sock *sk) { struct mptcp_sock *msk = mptcp_sk(sk); + struct mptcp_subflow_context *subflow; struct mptcp_sendmsg_info info = {}; struct mptcp_data_frag *dfrag; size_t copied = 0; @@ -2464,6 +2468,8 @@ static void __mptcp_retrans(struct sock *sk) dfrag->already_sent = max(dfrag->already_sent, info.sent); tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, info.size_goal); + subflow = mptcp_subflow_ctx(ssk); + subflow->last_retrans_seq = tcp_sk(ssk)->snd_nxt; } release_sock(ssk); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 7379ab580a7e..e090a9244f8b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -416,6 +416,7 @@ struct mptcp_subflow_context { u32 map_data_len; __wsum map_data_csum; u32 map_csum_len; + u32 last_retrans_seq; u32 request_mptcp : 1, /* send MP_CAPABLE */ request_join : 1, /* send MP_JOIN */ request_bkup : 1, @@ -625,6 +626,13 @@ static inline bool mptcp_has_another_subflow(struct sock *ssk) return false; } +static inline bool mptcp_is_data_contiguous(struct sock *ssk) +{ + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + + return before(subflow->last_retrans_seq, tcp_sk(ssk)->snd_una); +} + void __init mptcp_proto_init(void); #if IS_ENABLED(CONFIG_MPTCP_IPV6) int __init mptcp_proto_v6_init(void); diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 6172f380dfb7..a8f46a48feb1 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1166,15 +1166,15 @@ static bool subflow_check_data_avail(struct sock *ssk) fallback: /* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { - if (mptcp_has_another_subflow(ssk)) { + if (mptcp_has_another_subflow(ssk) || !mptcp_is_data_contiguous(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 Sun Sep 26 14:29:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518299 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 34DEB3FCB for ; Sun, 26 Sep 2021 14:29:49 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id k23so10528193pji.0 for ; Sun, 26 Sep 2021 07:29:49 -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=aImpRo1tXFoohxU2lmnLZDP4zK7ys+eyhb6HmIPSZ9Q=; b=AsACY/ZJPBF0eCOU3jV3Oz8/1o9MgPPWlqQbncWIrYbc3qcPd9tFDW/M8BapmDyMxG N/mqU6Mrd71gFsGIk6lV0HrylVL6FFnPHhr44L+ufq3pLgWO/fFHTVFZRvP8OOqOUOrM 8qCz7apVw++Y8G+uzU5QktCSi9YvVtczrGDQBlzlJOMiF+W3ZlN1jGSSqn7DcQMKhdO4 bhusM5e0wh8vmg0kCp8BvZKK6iTP7gzeAnY0inEcvqDAraBS+SmKONkyTS0FKNJgYbXn dxyqrkKq/NYAuv7CNuIJ8aBGoZAT30fxaNxHhtHB/USdThFMD+fxBaF6vNdYMmK/dIbO svAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aImpRo1tXFoohxU2lmnLZDP4zK7ys+eyhb6HmIPSZ9Q=; b=3vrWQraxtf9watgN7xR7zEEsWigK+A2gJSYfmx5jGdU/tfOWFyeBH8pXXr0NS2MvZ7 lr0v4X65BsiBcvee9DgV7xO1AqJFsWHFkbevRmAWV5XT4Bgp4TcoiEZsLDZq5kLSX2xG AkaOrcMD3relXw84PMcoyx1C1451feFu858lwiibkyD+f9gf8Qz8eqOQhaLG3S2W+EG4 NUlk71tvnSeVCYqJrGjHsllYNvr1wZ3bjU96j+r4S3iLA0aTXNnCGGtvxUm9Oio9tSfw V0TpQcTn/LaNPb2g0cDMeY33JvEP6BagMTmEk/QKlX1X7yl6Jf5YbBmsAf5aYtP4PH/V sf3A== X-Gm-Message-State: AOAM5319gE/2Wi7h9P+2atKCIRVbW87ff40BQL9q0LycDwaTHZ0CW3/B 5t2vx5BR7radlXbRH4KImO3qMBK8FNA= X-Google-Smtp-Source: ABdhPJwYxvtGpu4YdJe9nrgcWTQb/GxEEba0oBsg336RW4KbyPzmytsOODye+w8+xGq+3N/j7uT8bg== X-Received: by 2002:a17:90a:c712:: with SMTP id o18mr12351714pjt.124.1632666588636; Sun, 26 Sep 2021 07:29:48 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:48 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 2/8] mptcp: add last_fully_acked_dss_start_seq in the msk Date: Sun, 26 Sep 2021 22:29:32 +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 This patch added a new member named last_fully_acked_dss_start_seq to the msk to keep track of the beginning of the last fully-acked data segment. This would be updated in __mptcp_clean_una. Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 3 +++ net/mptcp/protocol.h | 1 + 2 files changed, 4 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index cf8cccfefb51..1cf43073845a 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1074,6 +1074,7 @@ static void __mptcp_clean_una(struct sock *sk) WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); } + msk->last_fully_acked_dss_start_seq = dfrag->data_seq; dfrag_clear(sk, dfrag); cleaned = true; } @@ -2895,6 +2896,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk, msk->snd_una = msk->write_seq; msk->wnd_end = msk->snd_nxt + req->rsk_rcv_wnd; msk->setsockopt_seq = mptcp_sk(sk)->setsockopt_seq; + msk->last_fully_acked_dss_start_seq = subflow_req->idsn - 1; if (mp_opt->suboptions & OPTIONS_MPTCP_MPC) { msk->can_ack = true; @@ -3151,6 +3153,7 @@ void mptcp_finish_connect(struct sock *ssk) WRITE_ONCE(msk->rcv_wnd_sent, ack_seq); WRITE_ONCE(msk->can_ack, 1); WRITE_ONCE(msk->snd_una, msk->write_seq); + WRITE_ONCE(msk->last_fully_acked_dss_start_seq, subflow->idsn - 1); mptcp_pm_new_connection(msk, ssk, 0); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index e090a9244f8b..e9064fec0ed2 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -224,6 +224,7 @@ struct mptcp_sock { u64 remote_key; u64 write_seq; u64 snd_nxt; + u64 last_fully_acked_dss_start_seq; u64 ack_seq; u64 rcv_wnd_sent; u64 rcv_data_fin_seq; From patchwork Sun Sep 26 14:29:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518301 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 BFBB93FCB for ; Sun, 26 Sep 2021 14:29:50 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id n18so15164737pgm.12 for ; Sun, 26 Sep 2021 07:29:50 -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=l/Nh0mUkMfSp5wC9uccppV20cTh8J8w06paeI+Ik/IQ=; b=F7ttpSB3USTI6/Ksz8B22w4JTvgcYYfR44Pdsxy9p18TRtlCl0uOc6Dokt0L2lLkYs MLbhH3J08UXRsMonMXMVM4r6dShmwMe+8dfgcg3FEIa8lGweUBDd01hcKko15czOVD6k mqziFOihmQP/cwDCuytskADuhbf6kJSk/qbY8WkVPd4IGuDtDsSzCh5ZicqY/Csd1Tk2 wZ4qKTFttJCbLE1nVZt6aHcT5o9QeeFY7Qvq8IArDHcm4bHbLnO+wuq9e9t8NvWPppPZ KkXAAW9xpy/mVaF9art8y/ev+a2mpSmOm8XzDPuKxK7YK05ICSgDm7bJIR27hal9A6Ax 0eZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l/Nh0mUkMfSp5wC9uccppV20cTh8J8w06paeI+Ik/IQ=; b=tqGmXwqPg+6y5CuEL83z2VrCCJYb4UDut9GC8hhqJGeCzJCYtHuXGw92sEWU68hVDi ZuoX2T5n7Sq20bLapJuHiKaFIO5OTPkXIkjoBopKPYSPIBOg7CSbWDeYAGqC+uQ+QJ55 anlV0cKAPlsJB8oCd1+Bwy12amZ7uh+rYL8ki7TPNh0/aVNUb7PgbPQiomyMzaOXUcDY woJQSg1bRfX2cFYyz9ZlCjUP4t3BZ1BMLGPlNxgYdqq5jDmIjo8t9GsYNoQx48nqM8o8 ZKRZi4AvUBr0aC5Y3RoeO7Rx37IdRH5gyxOEVPiEdXvZHTs+EnLUEVZ2j9Wn5upqcprD QtOA== X-Gm-Message-State: AOAM532cHVHLjsT/RQzkknFfLeJ9nH3eHfSopEME7mdbn/TQZGntSg4V WDRJ+xTap8EftU0zDso25moei9uZtWI= X-Google-Smtp-Source: ABdhPJw24JREICmeRtoqlNjBrPyzsP4nE32aotIdIqwKRZ4OnS4yG11z3Z59NctQnY794xQ8tOg3Kg== X-Received: by 2002:a63:f913:: with SMTP id h19mr12734111pgi.351.1632666590238; Sun, 26 Sep 2021 07:29:50 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:50 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 3/8] mptcp: infinite mapping sending Date: Sun, 26 Sep 2021 22:29:33 +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 This patch added the infinite mapping sending logic. Added a new flag send_infinite_map in struct mptcp_subflow_context. Set it true when a single contiguous 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_map to set the infinite mapping. Signed-off-by: Geliang Tang --- include/net/mptcp.h | 3 ++- net/mptcp/options.c | 2 +- net/mptcp/pm.c | 5 +++++ net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 12 ++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/include/net/mptcp.h b/include/net/mptcp.h index f83fa48408b3..29e930540ea2 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -35,7 +35,8 @@ struct mptcp_ext { frozen:1, reset_transient:1; u8 reset_reason:4, - csum_reqd:1; + csum_reqd:1, + infinite_map:1; }; #define MPTCP_RM_IDS_MAX 8 diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 422f4acfb3e6..f4591421ed22 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -816,7 +816,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, opts->suboptions = 0; - if (unlikely(__mptcp_check_fallback(msk))) + if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) return false; if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6ab386ff3294..27d43a613e9a 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -251,7 +251,12 @@ 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); + pr_debug("fail_seq=%llu", fail_seq); + + if (!mptcp_has_another_subflow(sk) && mptcp_is_data_contiguous(sk)) + subflow->send_infinite_map = 1; } /* path manager helpers */ diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 1cf43073845a..60953b61b3c9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1277,6 +1277,23 @@ 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_map(struct mptcp_sock *msk, struct sock *ssk, + struct mptcp_ext *mpext) +{ + if (!mpext) + return; + + mpext->infinite_map = 1; + mpext->data_seq = READ_ONCE(msk->last_fully_acked_dss_start_seq); + mpext->subflow_seq = 0; + mpext->data_len = 0; + mpext->csum = 0; + + mptcp_subflow_ctx(ssk)->send_infinite_map = 0; + pr_fallback(msk); + __mptcp_do_fallback(msk); +} + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1409,6 +1426,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, out: if (READ_ONCE(msk->csum_enabled)) mptcp_update_data_checksum(skb, copy); + if (mptcp_subflow_ctx(ssk)->send_infinite_map) + mptcp_update_infinite_map(msk, ssk, mpext); mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; } diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index e9064fec0ed2..005c18e81e18 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, + send_infinite_map : 1, rx_eof : 1, can_ack : 1, /* only after processing the remote a key */ disposable : 1, /* ctx can be free at ulp release time */ @@ -876,6 +877,17 @@ static inline void mptcp_do_fallback(struct sock *sk) #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)", __func__, a) +static inline bool mptcp_check_infinite_map(struct sk_buff *skb) +{ + struct mptcp_ext *mpext; + + mpext = skb ? mptcp_get_ext(skb) : NULL; + if (mpext && mpext->infinite_map) + return true; + + return false; +} + static inline bool subflow_simultaneous_connect(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); From patchwork Sun Sep 26 14:29:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518303 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 4B6D33FCB for ; Sun, 26 Sep 2021 14:29:52 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id k17so13341208pff.8 for ; Sun, 26 Sep 2021 07:29:52 -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=5mwTCIBh9gfY5OWOEnNNUvnEu48VjJVwgNMzq73ng5Y=; b=lrXYD+sSS/eyUF5R59fXTkTW6cj9FNJjvbf+5O9LVH5/gvtynWLxKurRbWcgWMVaJI 3lbDCJwVXD1YXQwGdjAgiq+fsuxU1Yv7Z7Iw91CL8Sgm9CoCoQcqbdPUz+x8WwptSGXj 2t0hM7bjA3tZi5OIL247YkWceN0vQVvh1eTxM0yapA5OREq8HL8S9vfmo9g8LyLmKz5T Sc9JMI+URbJ7hJubK81+4RohmyWmbNYxW1MaTLRX2VhF6G6qo+vyFAR/VwyrHwsALjwH 5+Spb1xNOIKOyMITfbOLuA66U09hJMCNAk3ZT9nNP52Z5HFR4CkwpDd9FAR7CmcM4F4B qMfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5mwTCIBh9gfY5OWOEnNNUvnEu48VjJVwgNMzq73ng5Y=; b=qu7BGlnB47uzqZHxGwaLWY6qQE7zyd9lbBpP+h2m2BNa2Pz1JFzflwHvkGgIUCi9xD u2weYOWHnnFouAyzjMXOHR9zqRlFTKYfxQN7a1EYl6wLSVN/9A0T0LsjBTYy44WWy0+B cg0N5EI/t3gr0CwG2zgEmlqvY3D6G0feW7S8OAXTeE4MaX5MrJ8rhXgcxHGQssICOc0h ES0aQne/N0fkXNU+tPwodxADvQXkDLiFeDZFq0+SR9lflXm08jbHdIFC+pO6gSOG4/tk 4Xwn/Z+bed02bIBX5z9p9j+F8T5sWirJUeJ0C1vIOH7IqGgrK0xkyO7BiI9CTcIaGesx pRlw== X-Gm-Message-State: AOAM533kZMT95d5XcD3DM+QppYTH3sG2qRJ02/qAUe5nDv2+QkibaZOn laQFjoUotCEpVk/9g0HKoMahLlacLlE= X-Google-Smtp-Source: ABdhPJwy9vACWZMx+Vvj241+svpCmx04XVXy4PXZHykD7tK50H+o/rOZ00xHPcneb2vH4iHn+i7XAw== X-Received: by 2002:a63:ce52:: with SMTP id r18mr4860321pgi.350.1632666591738; Sun, 26 Sep 2021 07:29:51 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:51 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 4/8] mptcp: add the fallback check Date: Sun, 26 Sep 2021 22:29:34 +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 This patch added the fallback check in subflow_check_data_avail. Only do the fallback when the msk isn't fallen back yet. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a8f46a48feb1..023fb95e1fa2 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1164,35 +1164,37 @@ static bool subflow_check_data_avail(struct sock *ssk) return false; fallback: - /* RFC 8684 section 3.7. */ - if (subflow->send_mp_fail) { - if (mptcp_has_another_subflow(ssk) || !mptcp_is_data_contiguous(ssk)) { + if (!__mptcp_check_fallback(msk)) { + /* RFC 8684 section 3.7. */ + if (subflow->send_mp_fail) { + if (mptcp_has_another_subflow(ssk) || !mptcp_is_data_contiguous(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); + } + WRITE_ONCE(subflow->data_avail, 0); + return true; + } + + if (subflow->mp_join || subflow->fully_established) { + /* fatal protocol error, close the socket. + * subflow_error_report() will introduce the appropriate barriers + */ ssk->sk_err = EBADMSG; tcp_set_state(ssk, TCP_CLOSE); subflow->reset_transient = 0; - subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; + subflow->reset_reason = MPTCP_RST_EMPTCP; tcp_send_active_reset(ssk, GFP_ATOMIC); - while ((skb = skb_peek(&ssk->sk_receive_queue))) - sk_eat_skb(ssk, skb); + WRITE_ONCE(subflow->data_avail, 0); + return false; } - WRITE_ONCE(subflow->data_avail, 0); - return true; - } - if (subflow->mp_join || subflow->fully_established) { - /* fatal protocol error, close the socket. - * subflow_error_report() will introduce the appropriate barriers - */ - ssk->sk_err = EBADMSG; - tcp_set_state(ssk, TCP_CLOSE); - subflow->reset_transient = 0; - subflow->reset_reason = MPTCP_RST_EMPTCP; - tcp_send_active_reset(ssk, GFP_ATOMIC); - WRITE_ONCE(subflow->data_avail, 0); - return false; + __mptcp_do_fallback(msk); } - - __mptcp_do_fallback(msk); skb = skb_peek(&ssk->sk_receive_queue); subflow->map_valid = 1; subflow->map_seq = READ_ONCE(msk->ack_seq); From patchwork Sun Sep 26 14:29:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518305 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 9B9743FCB for ; Sun, 26 Sep 2021 14:29:53 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id y1so9911689plk.10 for ; Sun, 26 Sep 2021 07:29:53 -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=Owtom+qlrhC9U0a2v82D0lz5hlmsc4/3nQcA0zRwTIw=; b=RQdu6ZhmgkNOCznvuVtvASWnpi+v81KHtKj1NGxTb1XydnpMmzkt9eNCm0Dm+F5A2X nm33m4b3fBFmoyifRCEGf2R6owl6wXaZLRZFoxMgEvbt5g4iwnNsr7dFmlHs6QEae9Wd LMJYKRB/lhEL20j5BwL0n8sNzaT8TVDFAocCNy91KUYiTOpAwUmUK7ODcOTT7jZe6WQr LDDlfIfwQbKiGYBmQ6HVIFEl3QzhXGYAg4UvObPYwNJ80pREnwPrP0wEl87cBxR6tvYL Ml2oH3YKC72k3tafrJdAv3Bw55t8z5LrJa8xX43nEeoxWv2qUWQNyoYZhNELi1uPr5eV DpaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Owtom+qlrhC9U0a2v82D0lz5hlmsc4/3nQcA0zRwTIw=; b=WtaeaDE/oQCb7jp+PCBoAEovexTykjbliF/7qvDHDx8kssHAfZ4c1ENaRUACaHyBio zB1qpcOz5iJGf0XTxfMmpJbIzlZ4JAKP2I29zHaNAC4pb2EcmIcyF4Zpgv5XPGQeomPz AWVCnSQGhBAN1HikShvBZuhLf1qYD9UROFAbVWwzae/o3lRF2bh8hOmziBxkHkMpj7iW 0u0fI4lDiYS489uBjXkkDKEnbN77zI/qRXY17ALkZbfXDGtRIWFkJSUAAFCgZpMSGXvz 9qRKGpKFJnJJxSH04QofMQIuNVUVq8+f+Ta8u9A3zutoNjrRmSMiWFbuFNd/nXALkM7V TPpQ== X-Gm-Message-State: AOAM531Ccgv1czpQq+e7IaPjVXs3EQf96F/34hqC84LVNCY55P94DRnP jN0YoZd6TSTQsx/O+3laIZZ5iUqcqZs= X-Google-Smtp-Source: ABdhPJwh6yVrfwm9ovDpbRxR1JJii+vuM8MJNgig16rqjOzcSKQTwOkko66oI4R8JQg/UMA5gfPvDQ== X-Received: by 2002:a17:90a:4306:: with SMTP id q6mr14200967pjg.17.1632666593115; Sun, 26 Sep 2021 07:29:53 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:52 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 5/8] mptcp: infinite mapping receiving Date: Sun, 26 Sep 2021 22:29:35 +0800 Message-Id: <3a055280313efe6030d8f0130662a662dd9c734e.1632666254.git.geliangtang@gmail.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 This patch added the infinite mapping receiving logic. When the infinite mapping is received, set the map_data_len of the subflow to 0. In subflow_check_data_avail, only reset the subflow when the map_data_len of the subflow is non-zero. Signed-off-by: Geliang Tang --- net/mptcp/subflow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 023fb95e1fa2..81ebefdef88d 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -968,6 +968,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, data_len = mpext->data_len; if (data_len == 0) { MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); + subflow->map_data_len = 0; return MAPPING_INVALID; } @@ -1180,7 +1181,7 @@ static bool subflow_check_data_avail(struct sock *ssk) return true; } - if (subflow->mp_join || subflow->fully_established) { + if ((subflow->mp_join || subflow->fully_established) && subflow->map_data_len) { /* fatal protocol error, close the socket. * subflow_error_report() will introduce the appropriate barriers */ From patchwork Sun Sep 26 14:29:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518307 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 261BB3FCB for ; Sun, 26 Sep 2021 14:29:55 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id t9so1771580pju.5 for ; Sun, 26 Sep 2021 07:29:55 -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=mh7ETeQHHVy6RSbJvJ3ZPRl552Rp7l2WLEaocUQ7xbg=; b=pEwAWeiCVB7soPG9lvidF500uSXJiiUcPgo0/brXQUVmxQzvgXl6Tz8+lHvXAVh6Rr fHHQulK6hh4oGV19Ytji2a5Wps9SE45KI54ZRhUBr7V2QF5vDLS7j0JTt/i/ktFq3Bap WVdoKfiI23n9y2ZXdxfoUTKH8WwGDRH/Qsnoe8rFpNY0oyD7MIw42FdbzT0mdKSwMHiF Ky9qEHIfllxuOvDsQYB6yLDy1qLVF++jgEXcpHOq/PDLlpEceRiq+7nqHVsDXgX6A2Si sdVYsEl8uryYz7KQIdhMP+Z3MWFOBhbXKMMDic3bKFiNCcT6wwXNgFovFdu6YJo5yGny X1nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mh7ETeQHHVy6RSbJvJ3ZPRl552Rp7l2WLEaocUQ7xbg=; b=an8kHqcDjByaYLpJby56f6+vofd19bhaeqcHj/emVBVLe8b6b/v8++VNkwIspEZdU2 eti1Ql82YcJEDbC3vWQB0FLDidVowuVIzQqIxgERCjL+UviDqSrZbpgUIu0gsRVzAVVp ASCPpkZ9FqlmyhhLBkrnswqcUM+oc7bgrZuVELUJOikSQQizEet+pz2oQb3i/7l2l6HT t3m4m7+BqZePBHt/nivpDkMI60wbYOSFETCfszgaqb2JjSPvKgL5S8WU/Tkpg4yy1n9L DelDt9EVOKGZo06ddk0vYR3uraYKD6Ri0y2dJMKo/TkfmZW6KxNUiWFeH4yp2MSczUCK kyog== X-Gm-Message-State: AOAM532IR3jkLwMHmwrZqMJseVtLwrHf6mSi8nCObhKCyXQLU/+d7lJt heuiVYYShxueAoPpWnw6JkJJduDn60w= X-Google-Smtp-Source: ABdhPJwRifpZeM+SJANgVE6FuZsPWsxC5aIufOkGEcBWM4sR3IPOySwMMny9SQC4myxnkbo4NECznw== X-Received: by 2002:a17:902:7c90:b0:13d:9572:86b6 with SMTP id y16-20020a1709027c9000b0013d957286b6mr18216778pll.72.1632666594580; Sun, 26 Sep 2021 07:29:54 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:54 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 6/8] mptcp: add mib for infinite map sending Date: Sun, 26 Sep 2021 22:29:36 +0800 Message-Id: <9186ba3a1b31f5ef9cf9c5a171bdafdccaa9fde3.1632666254.git.geliangtang@gmail.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 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 | 1 + 3 files changed, 3 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 60953b61b3c9..c735adc6b835 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1289,6 +1289,7 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk, mpext->data_len = 0; mpext->csum = 0; + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX); mptcp_subflow_ctx(ssk)->send_infinite_map = 0; pr_fallback(msk); __mptcp_do_fallback(msk); From patchwork Sun Sep 26 14:29:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518309 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 8E6D23FCB for ; Sun, 26 Sep 2021 14:29:56 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id pf3-20020a17090b1d8300b0019e081aa87bso11315945pjb.0 for ; Sun, 26 Sep 2021 07:29:56 -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=VkKzUiWsVaredgIGXg1iu5+B3Z7qsRltK25YrnE3fbY=; b=mOTtkrQZSMetnO45/08TMf4tiBFeLCIR07z4gsKQlAXB5Z1cJ59Nj5ayJ8mVQuGli+ 3ZXg5YFJdzHUm48W6IgeoOoQlNPqbkmKteP23gwD8S4uzQRhIEStLrXkKB4QaYBF05fl ioNw/FFzatsbS+knORUE02t1u0DjgiRmn0ZiwJPZfY2i9+16HoRpV5T1fcdA0cWqfQyH e3o9ceNSZK9aMax8sUhG3OBcEAuBKUjgoFTacyA2WLCmklIxlINBD6PEnbUeIFO45lQ7 4eX4lEucrty1AvfdBvSc2QO5re7LBuqXa/2fcDI6JMvLO4vDu94kYBgqBDlDTVIeX9Sy hM0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VkKzUiWsVaredgIGXg1iu5+B3Z7qsRltK25YrnE3fbY=; b=3iqBNx6imVjdlsCMohHdFUCV/cRpIXneWbrzphdRZad+XcpZWEw8fhR9o7d5iWY/qv NA1521J3bOUGaPS8E1xwh4Sng7echVjfcrEgh3GFsHgxdAd+smGHmvvIVxAp7RtA1kxB 4Yl7u/a+qn/F4NB/rRddib4wZPxkMYGzW+1aSfdmimJaUTqpnnsz3e1/YMdnAJaelCUs 2Y4nKhXLDGXuD8i/NwQ5MaEBqTnJ8wErH3+Mp1yoqDfPqRv1EiO4qy64pPlB9UFn0pyB KtDVJ0fyjGD7fM1RBk4KFYedpt9y2vHPRUl/iryxiFaP6EaQd99nBuf/FG1g46j9nks7 CV8g== X-Gm-Message-State: AOAM533sxHeIpGpPCsnWKo1AllVM/wBmt4MyRfNKMLQmUcf9nAYUQeRG 8wrxvrICG1Fr6QKXX91LK78FBpgvDsc= X-Google-Smtp-Source: ABdhPJwfPIQKJbg/gkFy5Wzzq36gVkSqBtfidt3uGqyptkxXh9M3TrugOBptQOwvp8fMWs9NrrAPNw== X-Received: by 2002:a17:902:6ac2:b0:13e:2b51:ca27 with SMTP id i2-20020a1709026ac200b0013e2b51ca27mr610551plt.65.1632666596034; Sun, 26 Sep 2021 07:29:56 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:55 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 7/8] selftests: mptcp: add infinite map mibs check Date: Sun, 26 Sep 2021 22:29:37 +0800 Message-Id: <3191f501117aec229ced38e1e875ec6edaa1996a.1632666254.git.geliangtang@gmail.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 This patch added a function chk_infi_nr to check the mibs for the infinite mapping. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 255793c5ac4f..fe0c8f3164a7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -615,6 +615,43 @@ chk_fail_nr() fi } +chk_infi_nr() +{ + local mp_infi_nr_tx=$1 + local mp_infi_nr_rx=$2 + local count + local dump_stats + + printf "%-39s %s" " " "itx" + count=`ip netns exec $ns1 nstat -as | grep InfiniteMapTx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_tx" ]; then + echo "[fail] got $count infinite map[s] TX expected $mp_infi_nr_tx" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - irx " + count=`ip netns exec $ns2 nstat -as | grep InfiniteMapRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$mp_infi_nr_rx" ]; then + echo "[fail] got $count infinite map[s] RX expected $mp_infi_nr_rx" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + if [ "${dump_stats}" = 1 ]; then + echo Server ns stats + ip netns exec $ns1 nstat -as | grep MPTcp + echo Client ns stats + ip netns exec $ns2 nstat -as | grep MPTcp + fi +} + chk_join_nr() { local msg="$1" @@ -665,6 +702,7 @@ chk_join_nr() if [ $checksum -eq 1 ]; then chk_csum_nr chk_fail_nr 0 0 + chk_infi_nr 0 0 fi } From patchwork Sun Sep 26 14:29:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12518311 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 CB28F3FCB for ; Sun, 26 Sep 2021 14:29:57 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id bj3-20020a17090b088300b0019e6603fe89so9791002pjb.4 for ; Sun, 26 Sep 2021 07:29:57 -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=jt1KMRIAZMC1n0qcBDwo+awr5yycCMAD2SaHZUIXMV0=; b=ODCkjHueSb4z6GxTUE2KyMZnPYfO1ldvqw88PND/6EmCXXTlyXQVMQHqvo5eUb1j8w UeiFykoaFdAfRHHuE2R0LavRMl27soowsg196olt7yYMy/piMQ3PWayHLHkOUqWr2SS6 vlA0J0PHw2GjaGzYYZLu3huw95ew0fzExTr7kgxvijhLeqXag2z20cMYbOz6wdOTqgjF 0ya77wamcRx9TL2yYkwn/RHlXCUF7e+TwVM98BqX7uEh9fit9X7ui1zezpn7PThocHqZ NoGTtb5KyEYq6bntiq9weZk0RNRC0JLKduP5KjYsYwtAukmxwvzkItd6YX8CUzIXY3Rd 9Jtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jt1KMRIAZMC1n0qcBDwo+awr5yycCMAD2SaHZUIXMV0=; b=3z9gaeIlI5kkg2OIWldAueuu1+745jTrRgAg+9beyeoqfG1DFFrDEKz0+aBumA4nUU eTnngcUmI7zfEvWkzzH8U28kqIo2t3JyaSe9kQPwRBBT8L1Y/maeINIgeOg4ffTrIygc B3/DovFQJWA5yTJNGVC1SC6C+rfgXutamZUb/Sdz2dbb1FacbM3CWtDsGFw85vy+yhJG U+TyvpT18SeKH+TeNw0JoRFX2BZBeLu/uKqaS91NX9tm982afAGi7Ff7ckSq3sf+ZiGg P3Dn1fpRN5QdTuSmbLX65x/9DRuOrlBqAh68k5obORoKrmk7WkbCoTudYXAIY52EnB4V gNOQ== X-Gm-Message-State: AOAM531oHYN29ojOT47ho8Are8q7nIsLE3bavpUvqG1vk4wUvak97zHB KI6zoMbPsdxv5nqMU43oGXvDFAr3Bq4= X-Google-Smtp-Source: ABdhPJy7TEv3nx5sLsdV1k6PxAm6gS8Gnbn62TnacE5Ta2DG4Rha6qajtnxK4KnCfsCXb7cdvccs1Q== X-Received: by 2002:a17:902:c789:b0:13c:a112:6383 with SMTP id w9-20020a170902c78900b0013ca1126383mr18291300pla.42.1632666597364; Sun, 26 Sep 2021 07:29:57 -0700 (PDT) Received: from MiBook.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x9sm2421082pjr.44.2021.09.26.07.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 07:29:57 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v5 8/8] DO-NOT-MERGE: mptcp: mp_fail test Date: Sun, 26 Sep 2021 22:29:38 +0800 Message-Id: <20b70e7c602d039f1b073321ec1e87a3641315e7.1632666254.git.geliangtang@gmail.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 ./mptcp_join.sh -Cf Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 9 +++++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index c735adc6b835..dec87c05361b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1295,6 +1295,8 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk, struct sock *ssk, __mptcp_do_fallback(msk); } +static int j; + static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, struct mptcp_data_frag *dfrag, struct mptcp_sendmsg_info *info) @@ -1429,6 +1431,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, mptcp_update_data_checksum(skb, copy); if (mptcp_subflow_ctx(ssk)->send_infinite_map) mptcp_update_infinite_map(msk, ssk, mpext); + + pr_debug("%s j=%d", __func__, j++); + if (j == 20) + skb->data_len = 1; + if (j > 40) + j = 0; + mptcp_subflow_ctx(ssk)->rel_write_seq += copy; return copy; } diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index fe0c8f3164a7..38663f6373b8 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -977,6 +977,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"