MPTCP Linux Development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Matthieu Baerts <matthieu.baerts@tessares.net>
Cc: Florian Westphal <fw@strlen.de>, Paolo Abeni <pabeni@redhat.com>,
	mptcp@lists.linux.dev
Subject: Re: [PATCH v3 mptcp-next 2/6] mptcp: introduce MPTCP_FULL_INFO getsockopt
Date: Wed, 24 May 2023 14:22:56 +0200	[thread overview]
Message-ID: <20230524122256.GB12567@breakpoint.cc> (raw)
In-Reply-To: <477af94a-d47e-d0c2-ba42-285dc5597fa4@tessares.net>

Matthieu Baerts <matthieu.baerts@tessares.net> wrote:
> > I added the "num_subflows_copied" for ease-of-use on userspace
> > side but I agree that its not required and userspace has
> > enough info to figure out which upper cap to use.
> 
> If I understand properly, it means that num_subflows_user and _kern will
> only be used to know the size of the arrays:
> 
> - num_subflows_user: size of the arrays in the buffer
> - num_subflows_kern: what has been written by the kernel, max _user

This is why I had the '_copied' in my proposal :-)

With only _user and _kern:

_user: size of the arrays in the buffer
_kern: subflow count of the kernel, i.e. can be larger than _user.

> I think it is still important to have somewhere a num_subflows field to
> know how many subflows are attached to an MPTCP connection (also for the
> userspace to know if it missed some info because it gave a too small
> buffer).

Yes, userspace must be able to infer that it only got partial
information due to lack of space.

E.g. if userspace expects a maximum amount of 16 subflows but connection
has 240 subflows then num_subflows_kern is 240 and _user is 16.

Userspace can only access up to 16 (since thats what it
provided/allocated).

The _copied proposal would have made this easier on userspace side
(_user is the allocated space, _kern what the kernel would like (real
count), and _copied what was written out).

But as Paolo said userspace can infer the valid count by checking
if _kern > _user, so it does:

bool truncated = kern > user;
subflows_copied = truncated ? user : kern;

  reply	other threads:[~2023-05-24 12:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 17:37 [PATCH v3 mptcp-next 0/6] mptcp: add some more diag info Paolo Abeni
2023-05-23 17:37 ` [PATCH v3 mptcp-next 1/6] mptcp: add subflow unique id Paolo Abeni
2023-05-23 17:37 ` [PATCH v3 mptcp-next 2/6] mptcp: introduce MPTCP_FULL_INFO getsockopt Paolo Abeni
2023-05-23 18:25   ` Florian Westphal
2023-05-24  6:34     ` Paolo Abeni
2023-05-24  6:36       ` Paolo Abeni
2023-05-24  7:36         ` Matthieu Baerts
2023-05-24  8:11           ` Paolo Abeni
2023-05-24  8:16             ` Matthieu Baerts
2023-05-24  9:56       ` Florian Westphal
2023-05-24 12:04         ` Matthieu Baerts
2023-05-24 12:22           ` Florian Westphal [this message]
2023-05-24 12:37             ` Matthieu Baerts
2023-05-24  8:13     ` Matthieu Baerts
2023-05-24  8:53       ` Paolo Abeni
2023-05-24  9:12         ` Matthieu Baerts
2023-05-24 10:04       ` Florian Westphal
2023-05-24 12:08         ` Matthieu Baerts
2023-05-23 17:37 ` [PATCH v3 mptcp-next 3/6] mptcp: move snd_una update earlier for fallback socket Paolo Abeni
2023-05-23 17:37 ` [PATCH v3 mptcp-next 4/6] mptcp: track some aggregate data counters Paolo Abeni
2023-05-23 18:49   ` Florian Westphal
2023-05-24  8:15     ` Paolo Abeni
2023-05-24 10:05       ` Florian Westphal
2023-05-23 17:37 ` [PATCH v3 mptcp-next 5/6] selftests: mptcp: explicitly tests aggregate counters Paolo Abeni
2023-05-23 17:37 ` [PATCH v3 mptcp-next 6/6] selftests: mptcp: add MPTCP_FULL_INFO testcase Paolo Abeni

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=20230524122256.GB12567@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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