From patchwork Tue Sep 7 10:41:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12478263 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.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 A0A983FC1 for ; Tue, 7 Sep 2021 10:42:07 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id 17so9497895pgp.4 for ; Tue, 07 Sep 2021 03:42:07 -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=z4ipqZ6YwAe6GdDe2f7sH0TYCUu5GsEf1qXuaqPdSx4=; b=N9rLV4cajSM9s5dDghKpcLxeXPiUQer+Z41da+Nf3R/rgP9iVlfu/vjYR+ebxCalsY QERBWnr32bN6uE8iPkMElkbROg2cP16fX0Syuf/SGOwkBsw/7qHwerJl1N0xWZoNcG/+ BU3uWdnrv7KiSa0jmOFvtcr2CbuNZsh8bunLucjCvL2eQHCn/KCpy3/d49atphsR6JHR IL0ikE983iVln3qiWu4TW6oMpdwv+mjrOFocoP1FbTXaqU7Q25rRTJAG3+YVbN+jXhwF qib5RK/Ih6BBQwFWIy5L3RY24aNaRbtJU5vzeuYcAcesVEwiawND2C0gxV8qBuwztUwA 8UJQ== 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=z4ipqZ6YwAe6GdDe2f7sH0TYCUu5GsEf1qXuaqPdSx4=; b=Jk/DiS8M9o4lYd8c51qQa2Wo/gjjxT7rFva4gowN5WMxryu/9qSIdEVrZjpTHQa03l AWZxK5g8/h3sDtIsQkYF/N3GOu+JAJnYRv7sHVjE7UTEedrtrEJ/vQMsAcWkRPiOYniY sGmIYENwDwzVnzdMUegiej+CBJZ2W0A09DyyaS+QHGuwPWbkTb5e/ttNXnEhe0dhoK7v 5lTHwbLdDwg3x33PSbO3pG/XQSWf4JOIy9v2P8js1w7FosU8Iyv+nqB+9wLQYpZ5Qwx4 URSUZn7z7v4tNNHZ09yhVdGVyRbU30On/Sxe68ZVMHkD9ksf5G2D/vUaFJ3vhXeTlH/I qjMQ== X-Gm-Message-State: AOAM5307iF0yQyx1crro2ZdraZ51U0kkSUGc16Gr5cYre0SgdZ4GxmFQ oe81xmXqhrvvcVaa5J3a45gcsmZa4Yk= X-Google-Smtp-Source: ABdhPJyhUu6Aj/NtviSFv8P0+FCLfQHY8mYhwZ7VjSbu/+7L5G5od222xHGcfoxPJ1ZSBCNadqZiEA== X-Received: by 2002:a62:8048:0:b0:416:2682:e56a with SMTP id j69-20020a628048000000b004162682e56amr6139567pfd.73.1631011326896; Tue, 07 Sep 2021 03:42:06 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x189sm10571885pfc.52.2021.09.07.03.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 03:42:06 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH RFC mptcp-next 1/4] mptcp: add a new sysctl scheduler Date: Tue, 7 Sep 2021 18:41:56 +0800 Message-Id: <268ae875a7e4546922c30a974f9d675562b632e0.1631011068.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 a new sysctl, named scheduler, to support for selection of different schedulers. Signed-off-by: Geliang Tang --- Documentation/networking/mptcp-sysctl.rst | 8 ++++++++ net/mptcp/ctrl.c | 14 ++++++++++++++ net/mptcp/protocol.h | 3 +++ 3 files changed, 25 insertions(+) diff --git a/Documentation/networking/mptcp-sysctl.rst b/Documentation/networking/mptcp-sysctl.rst index b0d4da71e68e..ecd593c44e26 100644 --- a/Documentation/networking/mptcp-sysctl.rst +++ b/Documentation/networking/mptcp-sysctl.rst @@ -57,3 +57,11 @@ stale_loss_cnt - INTEGER This is a per-namespace sysctl. Default: 4 + +scheduler - STRING + Select the scheduler of your choice. + + Support for selection of different schedulers. This is a per-namespace + sysctl. + + Default: "default" diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 8b235468c88f..369369b0b17e 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -26,6 +26,7 @@ struct mptcp_pernet { u8 mptcp_enabled; u8 checksum_enabled; u8 allow_join_initial_addr_port; + char scheduler[MPTCP_SCHED_NAME_MAX]; }; static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) @@ -58,6 +59,11 @@ unsigned int mptcp_stale_loss_cnt(const struct net *net) return mptcp_get_pernet(net)->stale_loss_cnt; } +char *mptcp_get_scheduler(struct net *net) +{ + return mptcp_get_pernet(net)->scheduler; +} + static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet) { pernet->mptcp_enabled = 1; @@ -65,6 +71,7 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet) pernet->checksum_enabled = 0; pernet->allow_join_initial_addr_port = 1; pernet->stale_loss_cnt = 4; + strcpy(pernet->scheduler, "default"); } #ifdef CONFIG_SYSCTL @@ -108,6 +115,12 @@ static struct ctl_table mptcp_sysctl_table[] = { .mode = 0644, .proc_handler = proc_douintvec_minmax, }, + { + .procname = "scheduler", + .maxlen = MPTCP_SCHED_NAME_MAX, + .mode = 0644, + .proc_handler = proc_dostring, + }, {} }; @@ -128,6 +141,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet) table[2].data = &pernet->checksum_enabled; table[3].data = &pernet->allow_join_initial_addr_port; table[4].data = &pernet->stale_loss_cnt; + table[5].data = &pernet->scheduler; hdr = register_net_sysctl(net, MPTCP_SYSCTL_PATH, table); if (!hdr) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 99a23fff7b03..305d373332b7 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -206,6 +206,8 @@ struct mptcp_pm_data { struct mptcp_rm_list rm_list_rx; }; +#define MPTCP_SCHED_NAME_MAX 16 + struct mptcp_data_frag { struct list_head list; u64 data_seq; @@ -564,6 +566,7 @@ unsigned int mptcp_get_add_addr_timeout(const struct net *net); int mptcp_is_checksum_enabled(const struct net *net); int mptcp_allow_join_id0(const struct net *net); unsigned int mptcp_stale_loss_cnt(const struct net *net); +char *mptcp_get_scheduler(struct net *net); void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow, struct mptcp_options_received *mp_opt); bool __mptcp_retransmit_pending_data(struct sock *sk); From patchwork Tue Sep 7 10:41:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12478265 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 1959B3FC1 for ; Tue, 7 Sep 2021 10:42:09 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id fs6so6022365pjb.4 for ; Tue, 07 Sep 2021 03:42:09 -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=Z7jUhcYhzYJSdo9US0yEIy+lB4N82r6XMS+6fJgmaHM=; b=JeupBXqy7emI4mmIe4A5OrrBiF123Wd9JhFIcxd2wyIu4/nurBezbnVwNTg41tBH62 Z370PeqERyvOWSmBECVGV3ExcwGcP6GjQgfqP/XhDgy4PkTMo7hbyEOgob4m9ZYguC5B TdlDyzxY6oQRu5DKwZTlnlMmCJ/bszQ8BBy98LwVPUQZKcspSG9xyI85XUd3I5qKd3iA kkRpjEu5ngPdL/L3TaL8DwzVK6bKjw078g92Z4gae+aIpwH3+HMoEVfpzrr3rR6rUZkS ucb9WEJUsmWJCczvUWTlmQ7aXe3qVOwS+RsVfNAvjU5wZU5hW91ztVN4lwFYlQws2vd/ Y4uw== 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=Z7jUhcYhzYJSdo9US0yEIy+lB4N82r6XMS+6fJgmaHM=; b=JQru0QT9BOH2UhN4qnfAFFvnHkrPExUXdr0xcQcI+Y7Dvpvzy1IGK9AJOmsJwPgZ/S rTh67YTD781r0CcWEwfHJNpchZJt2DJe+7QbGzdRtiAeDmBNhD3v2C1kUgE+AXIQSYtT aTbQUzNWy55f9AdQAcetG8m1eR0LTpaJGQJgCh2iGXE+dKBdBvLd7KPRrwG96QQMkHiE C4iT7mvxBM/i0XzYYztY4EcXJX0brdiPeoPIIlJ/g9fZruOkJVP9KPxmnE1RvKMzdRec W3OZNRaooVy9z+d8eDcb9aAWh/QuW3DqrIbTwK5Ya0NiPugpnPzBDshf5HYiqVoBTDnU Z+Bw== X-Gm-Message-State: AOAM5339OFI1zEjR6JYcV7d7KBtvX826bJrKTPnjZ3h656kGaZFg1sQl 5jaw5DnVA0nNnBwuMJdc2Jy8rAIbZks= X-Google-Smtp-Source: ABdhPJxvotBbtg5UqEdTEI8ce5BueFb6UHezuSSDfTwwyHX/yDnHIJvZ//wtXdcbHzWATHcy45en/w== X-Received: by 2002:a17:90a:6503:: with SMTP id i3mr3929796pjj.22.1631011328575; Tue, 07 Sep 2021 03:42:08 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x189sm10571885pfc.52.2021.09.07.03.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 03:42:08 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH RFC mptcp-next 2/4] mptcp: add struct mptcp_sched_ops Date: Tue, 7 Sep 2021 18:41:57 +0800 Message-Id: <4089672c8557e031d38306ef49e26e9902e7db57.1631011068.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 struct mptcp_sched_ops. And define the scheduler init, register and find functions. Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 60 +++++++++++++++++++++++++++++++++++++++++--- net/mptcp/protocol.h | 8 ++++++ 2 files changed, 65 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2a525c7ae920..ab72a3950f2b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1515,6 +1515,58 @@ static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) return NULL; } +static struct mptcp_sched_ops mptcp_sched_default = { + .get_subflow = mptcp_subflow_get_send, + .name = "default", + .owner = THIS_MODULE, +}; + +static DEFINE_SPINLOCK(mptcp_sched_list_lock); +static LIST_HEAD(mptcp_sched_list); + +static struct mptcp_sched_ops *mptcp_sched_find(const char *name) +{ + struct mptcp_sched_ops *ops; + + list_for_each_entry_rcu(ops, &mptcp_sched_list, list) { + if (!strcmp(ops->name, name)) + return ops; + } + + return NULL; +} + +static int mptcp_register_scheduler(struct mptcp_sched_ops *sched) +{ + int ret = 0; + + if (!sched->get_subflow) + return -EINVAL; + + spin_lock(&mptcp_sched_list_lock); + if (mptcp_sched_find(sched->name)) { + pr_debug("%s already registered", sched->name); + ret = -EEXIST; + } else { + list_add_tail_rcu(&sched->list, &mptcp_sched_list); + pr_debug("%s registered", sched->name); + } + spin_unlock(&mptcp_sched_list_lock); + return 0; +} + +static void mptcp_sched_data_init(struct mptcp_sock *msk) +{ + struct net *net = sock_net((struct sock *)msk); + + msk->sched = mptcp_sched_find(mptcp_get_scheduler(net)); +} + +static void mptcp_sched_init(void) +{ + mptcp_register_scheduler(&mptcp_sched_default); +} + static void mptcp_push_release(struct sock *sk, struct sock *ssk, struct mptcp_sendmsg_info *info) { @@ -1567,7 +1619,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags) prev_ssk = ssk; mptcp_flush_join_list(msk); - ssk = mptcp_subflow_get_send(msk); + ssk = msk->sched->get_subflow(msk); /* First check. If the ssk has changed since * the last round, release prev_ssk @@ -1634,7 +1686,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk) * check for a different subflow usage only after * spooling the first chunk of data */ - xmit_ssk = first ? ssk : mptcp_subflow_get_send(mptcp_sk(sk)); + xmit_ssk = first ? ssk : mptcp_sk(sk)->sched->get_subflow(mptcp_sk(sk)); if (!xmit_ssk) goto out; if (xmit_ssk != ssk) { @@ -2534,6 +2586,7 @@ static int __mptcp_init_sock(struct sock *sk) msk->recovery = false; mptcp_pm_data_init(msk); + mptcp_sched_data_init(msk); /* re-use the csk retrans timer for MPTCP-level retrans */ timer_setup(&msk->sk.icsk_retransmit_timer, mptcp_retransmit_timer, 0); @@ -3005,7 +3058,7 @@ void __mptcp_check_push(struct sock *sk, struct sock *ssk) return; if (!sock_owned_by_user(sk)) { - struct sock *xmit_ssk = mptcp_subflow_get_send(mptcp_sk(sk)); + struct sock *xmit_ssk = mptcp_sk(sk)->sched->get_subflow(mptcp_sk(sk)); if (xmit_ssk == ssk) __mptcp_subflow_push_pending(sk, ssk); @@ -3569,6 +3622,7 @@ void __init mptcp_proto_init(void) mptcp_subflow_init(); mptcp_pm_init(); + mptcp_sched_init(); mptcp_token_init(); if (proto_register(&mptcp_prot, MPTCP_USE_SLAB) != 0) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 305d373332b7..71237d1458ea 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -207,6 +207,13 @@ struct mptcp_pm_data { }; #define MPTCP_SCHED_NAME_MAX 16 +struct mptcp_sched_ops { + struct list_head list; + + struct sock * (*get_subflow)(struct mptcp_sock *msk); + char name[MPTCP_SCHED_NAME_MAX]; + struct module *owner; +}; struct mptcp_data_frag { struct list_head list; @@ -264,6 +271,7 @@ struct mptcp_sock { struct socket *subflow; /* outgoing connect/listener/!mp_capable */ struct sock *first; struct mptcp_pm_data pm; + struct mptcp_sched_ops *sched; struct { u32 space; /* bytes copied in last measurement window */ u32 copied; /* bytes copied in this measurement window */ From patchwork Tue Sep 7 10:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12478267 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 D59C43FC1 for ; Tue, 7 Sep 2021 10:42:10 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id n18so9475154pgm.12 for ; Tue, 07 Sep 2021 03:42:10 -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=nRF453gc3LoiL+DkmEG/qr8KJt3b8ZPwvak9UGeLFkM=; b=LAblFN+zHU/MP6R+KAFtj2sC3ddVaeRY6fFAKIr7sjTB2QUmvl/IgHgLO+NBvlZHH/ PPKjaH3236lfhTZzOoAM1lvMIvf9U2w5wnl7VyFMAJVNuMcxBGAX7QPy2q3RVAhDDeFA MtEhzXFTDQaPcRIfaQAU+m0awzpS58uEIB9eeUJjilLdDi9KyBfKt53BDtu9as3gnQXC 2qkjWgEfki0hkp9reBC6EVJSO+57kindgsibYyp3SCe9ue2qdr811el+CCBo/qYGioil d0wTR9coZdnF+d/vfKdYpz9VRmuoHDm10Rg1S6oEiHFDSMLt9WBK08wWOtARMhDq476Z DcwA== 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=nRF453gc3LoiL+DkmEG/qr8KJt3b8ZPwvak9UGeLFkM=; b=SBUIqRUBthnE6W4HyBYQs/nTUTw0eZh3jNeoeZd+/Hwf+7n0yZFEaYY1uqzOVVSEDV B3cZLQ0Trg4b+g0v8ica+rvwE89N1mReNlxhxrL5eImm3Yg/NOaUJODPL8WdwuGd1Gj/ W/LUqeIM4eF/dgxI9FaLdrctzdmZC7DyyRSfNWipVMjRLMh42KPOeQUXwuGYBGuCNk14 l1DiU5cI5Um0jYDLTpoAwWrUkaF8Q/eLbQs+JjdYmKLq0IHwbsRSVfCNy8LLxKFzro7V px+HsAUgZSt+1DMGU4gVL41FygEvX9/Uz2PoFX7/cNivfdHpet6gHo7K56Qdbqpb6TDN uiQw== X-Gm-Message-State: AOAM5301G6fZ5C6CT5rAeKYOfaL5REgWR7XnFWPASnmOjH1z6G7O54is d07KyQj+8J4jw64qVWUq5i64Yy2rcJ0= X-Google-Smtp-Source: ABdhPJyQlLPty/0iRY1S8pZE6y9c9upMmmMa+g7EzfNVXfaDnmzKuRwba93UzpnKp3jU1uGjd/BqsQ== X-Received: by 2002:aa7:9282:0:b0:3e2:800a:b423 with SMTP id j2-20020aa79282000000b003e2800ab423mr16130932pfa.21.1631011330324; Tue, 07 Sep 2021 03:42:10 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x189sm10571885pfc.52.2021.09.07.03.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 03:42:10 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH RFC mptcp-next 3/4] mptcp: round-robin packet scheduler support Date: Tue, 7 Sep 2021 18:41:58 +0800 Message-Id: <95d450f9694cf9d95081a77db529db2181d0d3b3.1631011068.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 Implement the round-robin packet scheduler like on the mptcp.org kernel. Signed-off-by: Geliang Tang --- net/mptcp/Kconfig | 7 +++++++ net/mptcp/protocol.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/net/mptcp/Kconfig b/net/mptcp/Kconfig index 10c97e19a7da..0df36991566a 100644 --- a/net/mptcp/Kconfig +++ b/net/mptcp/Kconfig @@ -23,6 +23,13 @@ config MPTCP_IPV6 depends on IPV6=y default y +config MPTCP_ROUNDROBIN + tristate "MPTCP Round-Robin" + default n + help + This is a very simple round-robin scheduler. Probably has bad performance + but might be interesting for researchers. + config MPTCP_KUNIT_TEST tristate "This builds the MPTCP KUnit tests" if !KUNIT_ALL_TESTS depends on KUNIT diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index ab72a3950f2b..b78c4eb4947f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1521,6 +1521,29 @@ static struct mptcp_sched_ops mptcp_sched_default = { .owner = THIS_MODULE, }; +#if IS_ENABLED(CONFIG_MPTCP_ROUNDROBIN) +static struct sock *rr_get_subflow(struct mptcp_sock *msk) +{ + struct mptcp_subflow_context *subflow; + struct sock *ssk; + + mptcp_for_each_subflow(msk, subflow) { + ssk = mptcp_subflow_tcp_sock(subflow); + if (ssk != msk->last_snd) { + pr_debug("msk=%p ssk=%p last_snd=%p", msk, ssk, msk->last_snd); + msk->last_snd = ssk; + } + } + return msk->last_snd; +} + +static struct mptcp_sched_ops mptcp_sched_rr = { + .get_subflow = rr_get_subflow, + .name = "roundrobin", + .owner = THIS_MODULE, +}; +#endif + static DEFINE_SPINLOCK(mptcp_sched_list_lock); static LIST_HEAD(mptcp_sched_list); @@ -1565,6 +1588,9 @@ static void mptcp_sched_data_init(struct mptcp_sock *msk) static void mptcp_sched_init(void) { mptcp_register_scheduler(&mptcp_sched_default); +#if IS_ENABLED(CONFIG_MPTCP_ROUNDROBIN) + mptcp_register_scheduler(&mptcp_sched_rr); +#endif } static void mptcp_push_release(struct sock *sk, struct sock *ssk, From patchwork Tue Sep 7 10:41:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12478269 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 B54E13FC1 for ; Tue, 7 Sep 2021 10:42:12 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id k24so9486111pgh.8 for ; Tue, 07 Sep 2021 03:42:12 -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=1K7ugEhop6LCWfr4ijQCmh95fD7Pz5Fai/YV5A3EDdc=; b=VkpOGbjDZLHlsNiIN61pNlaphJYMnAb5PpWHzJzWlfQXID2h1ricQgXAQaVP4f76ZV A/88kM96zEaa9DqL4J1oXpeYL5/yBxXBlac7ovKiy88XOgVx3NNkgYasilUHwCqOPKpY N3alTTO3DY6b+jIhir9zk1TjaT/TkECSZV5UzLQyF7V7XNa/d/3fA8ho2hTyUBmdnAzm LN1Qdpd39YzkpdjK2Fsq5xpvRO5jgonn33EiHekSVejl0OEeFEzZd8SihTVFHN0LqE6S wl+Wpz/EcpUnlu34aFAQgEi7rbuMzDRjmsJhqJLi1ZtUCpjMeknvu5e8yZvGLYvtcGsg d4JA== 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=1K7ugEhop6LCWfr4ijQCmh95fD7Pz5Fai/YV5A3EDdc=; b=H3z0Fgz/WqXQpGVoMAbd8Z34VVZUOzemk/fLIM6nyR+CMZ+deHttobHrZqz4Pa811g simLIgTTUnY+ukcow3Yty3U9FOPytojN/J/mPB+/vKuLk/BXNEQomi/cmir5n1XHapLb oX/wHByG0z+aAlOzQphdhEIi4ODiDnIuaZkJ9UMwlRjW9NP1v2iarjtsagSlbdHc4YkA StsGiYdAidgrqNf+u5w+R9y4D74592zGkS6y9JKU1VsXFnZ1/iLu7R9zIkYYSZAnUHNB eEcJhns4sjGlzpq6Gqu8h6dYlFt6cCqXfpBoE92buVvrlI6My0S0xj/YEVVYnpLrDgeQ n0Lw== X-Gm-Message-State: AOAM533uM+sKZEtdG85b4/BlysMfa3WEW1CpbNB0qUHYj0oNyroND7CQ R6F3xO0vLsbyCXknmJRiYHEZXy+Dp7c= X-Google-Smtp-Source: ABdhPJxhr80cY3lMcP/ge53m4BivKZeJKD27FiZSXhTHbIGrJmHLYlsTU7Nr6sLApEVNwP//49+taQ== X-Received: by 2002:a05:6a00:d72:b0:3f7:7f03:6cfb with SMTP id n50-20020a056a000d7200b003f77f036cfbmr20476783pfv.1.1631011332158; Tue, 07 Sep 2021 03:42:12 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id x189sm10571885pfc.52.2021.09.07.03.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 03:42:11 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [PATCH RFC mptcp-next 4/4] selftests: mptcp: add round-robin testcase Date: Tue, 7 Sep 2021 18:41:59 +0800 Message-Id: <7e749e6d27fee702dfc1c6478cb426c36e84a3ac.1631011068.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 Add the round-robin scheduler testcase. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 255793c5ac4f..c69b1dce95f7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -15,6 +15,7 @@ timeout_test=$((timeout_poll * 2 + 1)) mptcp_connect="" capture=0 checksum=0 +roundrobin=0 do_all_tests=1 TEST_COUNT=0 @@ -55,6 +56,9 @@ init() if [ $checksum -eq 1 ]; then ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1 fi + if [ $roundrobin -eq 1 ]; then + ip netns exec $netns sysctl -q net.mptcp.scheduler="roundrobin" + fi done # ns1 ns2 @@ -1854,9 +1858,12 @@ for arg in "$@"; do if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"C"[0-9a-zA-Z]*$ ]]; then checksum=1 fi + if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"R"[0-9a-zA-Z]*$ ]]; then + roundrobin=1 + fi - # exception for the capture/checksum options, the rest means: a part of the tests - if [ "${arg}" != "-c" ] && [ "${arg}" != "-C" ]; then + # exception for the capture/checksum/roundrobin options, the rest means: a part of the tests + if [ "${arg}" != "-c" ] && [ "${arg}" != "-C" ] && [ "${arg}" != "-R" ]; then do_all_tests=0 fi done