MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v2 7/8] mptcp: add mptcp_pm_addr_id_bitmap_t type
Date: Thu, 09 Jan 2025 12:15:32 +0800	[thread overview]
Message-ID: <e0bf78833216705521b8c0e4c696d39f1efba53b.camel@kernel.org> (raw)
In-Reply-To: <0a9019be-238d-4b02-ae7e-b510503ff6ac@kernel.org>

Hi Matt,

On Mon, 2024-12-30 at 17:30 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 13/12/2024 08:35, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > Similar to defining types such as nodemask_t, dma_cap_mask_t and
> >    A. > > cpumask_t to simplify the use of bitmap, a new type for
> >       MPTCP
> > userspace pm id bitmap, mptcp_pm_addr_id_bitmap_t is defined to
> > easily modify dump_addr() interface of the path managers to accept
> > an mptcp_pm_addr_id_bitmap_t type parameter. It also allows this
> > parameter of dump_addr() can be modified by BPF program when
> > implementing this interface of a BFP path manager. Because a
> > dump_addr() interface that accepts an 'unsigned long *bitmap'
> > or 'unsigned long bitmap[]' parameter is difficult to implement
> > in BPF program.
> > 
> > In addition, this also makes it easier for us to implement similar
> > logic to mptcp_userspace_pm_append_new_local_addr() in BPF path
> > manager, because there's no way to use DECLARE_BITMAP macro in BPF
> > program, and it's not easy to reimplement it in BPF.
> > 
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> >  include/net/mptcp.h      |  7 +++++++
> >  net/mptcp/pm_userspace.c | 14 ++++++--------
> >  net/mptcp/protocol.h     |  3 ---
> >  3 files changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> > index 814b5f2e3ed5..220b1f60e8c1 100644
> > --- a/include/net/mptcp.h
> > +++ b/include/net/mptcp.h
> > @@ -120,6 +120,13 @@ struct mptcp_sched_ops {
> >   void (*release)(struct mptcp_sock *msk);
> >  } ____cacheline_aligned_in_smp;
> >  
> > +/* max value of mptcp_addr_info.id */
> > +#define MPTCP_PM_MAX_ADDR_ID U8_MAX
> > +
> > +typedef struct {
> > + DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1);
> > +} mptcp_pm_addr_id_bitmap_t;
> 
> Why do you need to declare it here and not in protocol.h? Is it for
> the
> future BPF PM?

Yes, it's for the BPF PM. If we define a struct mptcp_pm_addr_id_bitmap
as in the previous version [1], we can indeed put it in protocol.h:

struct mptcp_pm_addr_id_bitmap {
DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1);
};

and just declare it in include/net/mptcp.h:

struct mptcp_pm_addr_id_bitmap;

But as your comments in [1], 'why do you need a
specific structure with only one field?'

This new version uses 'typedef' to define a new type, similar to
nodemask_t, dma_cap_mask_t and cpumask_t. I think this is a good way to
handle structures with only one field. But on the other hand, we can't
declare a 'mptcp_pm_addr_id_bitmap_t' in include/net/mptcp.h, we need
to move the entire typedef to include/net/mptcp.h, and the
corresponding MPTCP_PM_MAX_ADDR_ID also needs to be moved together.

Which one do you prefer, mptcp_pm_addr_id_bitmap_t or struct
mptcp_pm_addr_id_bitmap? I will use it in the next version.

Thanks,
-Geliang

[1]https://patchwork.kernel.org/project/mptcp/patch/344964d66ab0250ae027ffd46a0e6782d572c33d.1729588019.git.tanggeliang@kylinos.cn/

> 
> Maybe you don't really need this bitmap if it is only needed for the
> dump interfaces that are probably not needed with BPF?
> 
> Then maybe there is no need to change anything here?
> 
> Cheers,
> Matt


  reply	other threads:[~2025-01-09  4:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  7:35 [PATCH mptcp-next v2 0/8] BPF path manager, part 2 Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 1/8] mptcp: make three pm wrappers static Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 2/8] mptcp: drop skb parameter of get_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 3/8] mptcp: add id parameter for get_addr Geliang Tang
2024-12-30 16:29   ` Matthieu Baerts
2024-12-13  7:35 ` [PATCH mptcp-next v2 4/8] mptcp: reuse sending nlmsg code in get_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 5/8] mptcp: change info of get_addr as const Geliang Tang
2024-12-30 16:29   ` Matthieu Baerts
2024-12-13  7:35 ` [PATCH mptcp-next v2 6/8] mptcp: add info parameter for dump_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 7/8] mptcp: add mptcp_pm_addr_id_bitmap_t type Geliang Tang
2024-12-30 16:30   ` Matthieu Baerts
2025-01-09  4:15     ` Geliang Tang [this message]
2025-01-09 15:37       ` Matthieu Baerts
2024-12-13  7:35 ` [PATCH mptcp-next v2 8/8] mptcp: reuse sending nlmsg code in dump_addr Geliang Tang
2024-12-30 16:33   ` Matthieu Baerts
2024-12-30 16:27 ` [PATCH mptcp-next v2 0/8] BPF path manager, part 2 Matthieu Baerts

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=e0bf78833216705521b8c0e4c696d39f1efba53b.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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