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 v2 5/5] Squash to "selftests/bpf: add bpf_first scheduler"
Date: Mon, 23 May 2022 18:02:36 -0700 (PDT)	[thread overview]
Message-ID: <b475a6e4-c734-e78c-bf90-19601686aac6@linux.intel.com> (raw)
In-Reply-To: <94abb5c4207ee3fc0827c77816648ad37dccf5d0.1653305364.git.geliang.tang@suse.com>

On Mon, 23 May 2022, Geliang Tang wrote:

> Add set_bit() helper and use new get_subflow API.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> tools/testing/selftests/bpf/bpf_tcp_helpers.h       | 11 +++++++++++
> tools/testing/selftests/bpf/progs/mptcp_bpf_first.c | 10 ++++++----
> 2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/bpf_tcp_helpers.h b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> index cb3db7ea36b9..9c7d33e106a4 100644
> --- a/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_tcp_helpers.h
> @@ -260,4 +260,15 @@ struct mptcp_sock {
> 	char		ca_name[TCP_CA_NAME_MAX];
> } __attribute__((preserve_access_index));
>
> +#define _AC(X,Y)	(X##Y)
> +#define UL(x)		(_AC(x, UL))
> +
> +static inline void set_bit(unsigned int nr, volatile unsigned long *addr)
> +{
> +        unsigned long *p = ((unsigned long *)addr) + (nr / sizeof(unsigned long));
> +        unsigned long mask = UL(1) << (nr % sizeof(unsigned long));
> +
> +        *p  |= mask;
> +}
> +
> #endif
> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c
> index fd67b5f42964..e5dc53965642 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_first.c
> @@ -16,11 +16,13 @@ void BPF_PROG(mptcp_sched_first_release, const struct mptcp_sock *msk)
> {
> }
>
> -void BPF_STRUCT_OPS(bpf_first_get_subflow, const struct mptcp_sock *msk,
> -		    bool reinject, struct mptcp_sched_data *data)
> +unsigned long BPF_STRUCT_OPS(bpf_first_get_subflow, const struct mptcp_sock *msk,
> +			     bool reinject, struct mptcp_sched_data *data)
> {
> -	data->sock = msk->first;
> -	data->call_again = 0;
> +	unsigned long bitmap = 0;
> +
> +	set_bit(0, &bitmap);
> +	return bitmap;

It might be more realistic to return the first non-backup subflow (or 
first backup if there are only backup subflows). Do you think that would 
be better as a replacement for this test or as an additional test?

- Mat

> }
>
> SEC(".struct_ops")
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

      parent reply	other threads:[~2022-05-24  1:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 11:33 [PATCH mptcp-next v2 0/5] BPF packet scheduler Geliang Tang
2022-05-23 11:33 ` [PATCH mptcp-next v2 1/5] Squash to "mptcp: add struct mptcp_sched_ops" Geliang Tang
2022-05-23 11:33 ` [PATCH mptcp-next v2 2/5] Squash to "mptcp: add sched in mptcp_sock" Geliang Tang
2022-05-23 11:33 ` [PATCH mptcp-next v2 3/5] Squash to "mptcp: add get_subflow wrappers" Geliang Tang
2022-05-24  1:01   ` Mat Martineau
2022-05-26 12:18     ` Geliang Tang
2022-05-26 23:48       ` Mat Martineau
2022-05-27 15:27         ` Geliang Tang
2022-05-27 20:03           ` Mat Martineau
2022-05-23 11:33 ` [PATCH mptcp-next v2 4/5] Squash to "mptcp: add bpf_mptcp_sched_ops" Geliang Tang
2022-05-23 11:33 ` [PATCH mptcp-next v2 5/5] Squash to "selftests/bpf: add bpf_first scheduler" Geliang Tang
2022-05-23 11:43   ` Squash to "selftests/bpf: add bpf_first scheduler": Build Failure MPTCP CI
2022-05-23 13:33   ` Squash to "selftests/bpf: add bpf_first scheduler": Tests Results MPTCP CI
2022-05-24  1:02   ` Mat Martineau [this message]

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=b475a6e4-c734-e78c-bf90-19601686aac6@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.