MPTCP Linux Development
 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 v10 1/3] mptcp: add subflows array in sched data
Date: Mon, 2 May 2022 17:17:33 -0700 (PDT)	[thread overview]
Message-ID: <cc1c9fae-0d1-52b0-8520-737b9fab6de0@linux.intel.com> (raw)
In-Reply-To: <d944e0f6c9549f004d68083dd5ad2879b77126a0.1651413062.git.geliang.tang@suse.com>

On Sun, 1 May 2022, Geliang Tang wrote:

> This patch adds a subflow pointers array in struct mptcp_sched_data. Set
> the array before invoking get_subflow(), then get it in get_subflow() in
> the BPF contexts.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> include/net/mptcp.h                             | 3 +++
> net/mptcp/sched.c                               | 7 +++++++
> tools/testing/selftests/bpf/bpf_mptcp_helpers.h | 3 +++
> 3 files changed, 13 insertions(+)
>
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index bea7608d72d3..1a48e31f3ac7 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -96,10 +96,13 @@ struct mptcp_out_options {
> };
>
> #define MPTCP_SCHED_NAME_MAX	16
> +#define MPTCP_SUBFLOWS_MAX	8
>
> struct mptcp_sched_data {
> 	struct sock	*sock;
> 	bool		call_again;
> +	u8		subflows;
> +	struct mptcp_subflow_context *array[MPTCP_SUBFLOWS_MAX];

I suggest a more descriptive name here: 'contexts' instead of 'array'?

> };
>
> struct mptcp_sched_ops {
> diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c
> index 7a5654132ed3..1efbcfe80fe7 100644
> --- a/net/mptcp/sched.c
> +++ b/net/mptcp/sched.c
> @@ -93,9 +93,16 @@ void mptcp_release_sched(struct mptcp_sock *msk)
> static int mptcp_sched_data_init(struct mptcp_sock *msk,
> 				 struct mptcp_sched_data *data)
> {
> +	struct mptcp_subflow_context *subflow;
> +	int i = 0;
> +
> 	data->sock = NULL;
> 	data->call_again = 0;
>
> +	mptcp_for_each_subflow(msk, subflow)
> +		data->array[i++] = subflow;

Two things here:

The unused array elements should be set to NULL.

There should be strict checking of the MPTCP_SUBFLOWS_MAX array size 
limit, and if the length of conn_list is larger then pr_warn_once() about 
that unexpected condition.

- Mat

> +	data->subflows = i;
> +
> 	return 0;
> }
>
> diff --git a/tools/testing/selftests/bpf/bpf_mptcp_helpers.h b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h
> index e863954de701..1f991ff2e325 100644
> --- a/tools/testing/selftests/bpf/bpf_mptcp_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h
> @@ -7,10 +7,13 @@
> #include "bpf_tcp_helpers.h"
>
> #define MPTCP_SCHED_NAME_MAX	16
> +#define MPTCP_SUBFLOWS_MAX	8
>
> struct mptcp_sched_data {
> 	struct sock	*sock;
> 	bool		call_again;
> +	__u8		subflows;
> +	struct mptcp_subflow_context *array[MPTCP_SUBFLOWS_MAX];
> };
>
> struct mptcp_sched_ops {
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

  reply	other threads:[~2022-05-03  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 13:57 [PATCH mptcp-next v10 0/3] BPF round-robin scheduler Geliang Tang
2022-05-01 13:57 ` [PATCH mptcp-next v10 1/3] mptcp: add subflows array in sched data Geliang Tang
2022-05-03  0:17   ` Mat Martineau [this message]
2022-05-01 13:57 ` [PATCH mptcp-next v10 2/3] selftests: bpf: add bpf_rr scheduler Geliang Tang
2022-05-01 13:57 ` [PATCH mptcp-next v10 3/3] selftests: bpf: add bpf_rr test Geliang Tang

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=cc1c9fae-0d1-52b0-8520-737b9fab6de0@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox