All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Geliang Tang <geliang.tang@suse.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v6 7/8] selftests: bpf: add bpf_first scheduler
Date: Fri, 25 Mar 2022 17:23:03 -0700 (PDT)	[thread overview]
Message-ID: <4ce8289-594-6e5f-8a8f-4e1fe0584a7@linux.intel.com> (raw)
In-Reply-To: <35c97d89297abe349b746582f5db9319c171a787.1648223504.git.geliang.tang@suse.com>

On Sat, 26 Mar 2022, Geliang Tang wrote:

> This patch implemented the simplest MPTCP scheduler, named bpf_first,
> which always picks the first subflow to send data.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> tools/testing/selftests/bpf/bpf_tcp_helpers.h | 12 ++++++++
> tools/testing/selftests/bpf/progs/bpf_first.c | 30 +++++++++++++++++++
> 2 files changed, 42 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/progs/bpf_first.c
>
> diff --git a/tools/testing/selftests/bpf/bpf_tcp_helpers.h b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> index f92357597e63..5bb21b24231f 100644
> --- a/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> @@ -197,6 +197,18 @@ struct tcp_congestion_ops {
> 	void *owner;
> };
>
> +#define MPTCP_SCHED_NAME_MAX 16
> +
> +struct mptcp_sched_ops {
> +	char name[MPTCP_SCHED_NAME_MAX];
> +
> +	void (*init)(struct mptcp_sock *msk);
> +	void (*release)(struct mptcp_sock *msk);
> +
> +	struct sock *	(*get_subflow)(struct mptcp_sock *msk);
> +	void *owner;
> +};
> +
> #define min(a, b) ((a) < (b) ? (a) : (b))
> #define max(a, b) ((a) > (b) ? (a) : (b))
> #define min_not_zero(x, y) ({			\
> diff --git a/tools/testing/selftests/bpf/progs/bpf_first.c b/tools/testing/selftests/bpf/progs/bpf_first.c
> new file mode 100644
> index 000000000000..3ae5c1eab5f5
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/bpf_first.c

I suggest naming this mptcp_bpf_first.c instead, to clarify that it's 
specific to MPTCP.

- Mat

> @@ -0,0 +1,30 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright (c) 2022, SUSE. */
> +
> +#include <linux/bpf.h>
> +#include "bpf_tcp_helpers.h"
> +
> +char _license[] SEC("license") = "GPL";
> +
> +SEC("struct_ops/mptcp_sched_first_init")
> +void BPF_PROG(mptcp_sched_first_init, struct mptcp_sock *msk)
> +{
> +}
> +
> +SEC("struct_ops/mptcp_sched_first_release")
> +void BPF_PROG(mptcp_sched_first_release, struct mptcp_sock *msk)
> +{
> +}
> +
> +struct sock *BPF_STRUCT_OPS(bpf_first_get_subflow, struct mptcp_sock *msk)
> +{
> +	return msk->first;
> +}
> +
> +SEC(".struct_ops")
> +struct mptcp_sched_ops first = {
> +	.init		= (void *)mptcp_sched_first_init,
> +	.release	= (void *)mptcp_sched_first_release,
> +	.get_subflow	= (void *)bpf_first_get_subflow,
> +	.name		= "bpf_first",
> +};
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

  reply	other threads:[~2022-03-26  0:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 16:11 [PATCH mptcp-next v6 0/8] BPF packet scheduler Geliang Tang
2022-03-25 16:11 ` [PATCH mptcp-next v6 1/8] mptcp: add struct mptcp_sched_ops Geliang Tang
2022-03-25 16:11 ` [PATCH mptcp-next v6 2/8] mptcp: register default scheduler Geliang Tang
2022-03-25 16:11 ` [PATCH mptcp-next v6 3/8] mptcp: add a new sysctl scheduler Geliang Tang
2022-03-25 16:12 ` [PATCH mptcp-next v6 4/8] mptcp: add sched in mptcp_sock Geliang Tang
2022-03-25 23:58   ` Mat Martineau
2022-03-25 16:12 ` [PATCH mptcp-next v6 5/8] mptcp: add get_subflow wrapper Geliang Tang
2022-03-25 16:12 ` [PATCH mptcp-next v6 6/8] mptcp: add bpf_mptcp_sched_ops Geliang Tang
2022-03-26  0:22   ` Mat Martineau
2022-03-25 16:12 ` [PATCH mptcp-next v6 7/8] selftests: bpf: add bpf_first scheduler Geliang Tang
2022-03-26  0:23   ` Mat Martineau [this message]
2022-03-25 16:12 ` [PATCH mptcp-next v6 8/8] selftests: bpf: add bpf_first test Geliang Tang
2022-03-30 16:54   ` selftests: bpf: add bpf_first test: Build Failure MPTCP CI
2022-03-30 20:51   ` selftests: bpf: add bpf_first test: Tests Results MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ce8289-594-6e5f-8a8f-4e1fe0584a7@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=geliang.tang@suse.com \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.