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 13/36] mptcp: add struct mptcp_id_bitmap
Date: Mon, 04 Nov 2024 17:12:16 +0800	[thread overview]
Message-ID: <d44a000cfe49a9fb2c868833694f4da61a457d16.camel@kernel.org> (raw)
In-Reply-To: <cbd9eaa2-e236-421e-82e9-784ae7054dca@kernel.org>

Hi Matt,

On Thu, 2024-10-31 at 19:45 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 22/10/2024 11:14, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > A new struct mptcp_id_bitmap is defined to unify all bitmap type of
> > address
> > IDs for both in-kernel PM and userspace PM.
> > 
> > This type can be used to easily refactor dump_addr() interface of
> > the path
> > managers to accept an mptcp_id_bitmap 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.
> > 
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> 
> (...)
> 
> > diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> > index 8282a6355765..4358a9a21270 100644
> > --- a/net/mptcp/protocol.h
> > +++ b/net/mptcp/protocol.h
> > @@ -211,6 +211,10 @@ enum mptcp_addr_signal_status {
> >  /* max value of mptcp_addr_info.id */
> >  #define MPTCP_PM_MAX_ADDR_ID		U8_MAX
> >  
> > +struct mptcp_id_bitmap {
> 
> This name is too generic, while here this bitmap is specific to the
> path-manager and its PM address:
> 
>   mptcp_pm_addr_avail_id?
> 
> > +	DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1);
> 
> Sorry, I'm not sure to understand this modification: why do you need
> a
> specific structure with only one field? I didn't check the next
> patches
> yet, but I saw that at the end of the series, the structure still
> only
> has one field.
> 
> Do you require this dedicated structure because of a limitation of
> BPF?

Yes, defining dump_addr interface as either

int userspace_pm_dump_addr(struct mptcp_sock *msk,
                           unsigned long *bitmap)

or

int userspace_pm_dump_addr(struct mptcp_sock *msk,
			   unsigned long id_bitmap[4])

is not allowed by BPF.

> Can we not use a typedef, a macro or something else to avoid all
> these
> modifications here?

In v3 I defined a type using typedef like this:

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

and only used it in the parameters of the dump_addr interfaces. The
rest of the places continue to use DECLARE_BITMAP. It works well, the
only downside is that checkpatch.pl complains about it:

$ ./scripts/checkpatch.pl 0001-mptcp-add-mptcp_pm_addr_id_bitmap_t-
type.patch 
WARNING: do not add new typedefs
#31: FILE: include/net/mptcp.h:124:
+typedef struct {

total: 0 errors, 1 warnings, 0 checks, 40 lines checked

We can ignore this warning.

WDYT?

Thanks,
-Geliang

> 
> > +};
> > +
> >  struct mptcp_pm_data {
> >  	struct mptcp_addr_info local;
> >  	struct mptcp_addr_info remote;
> > @@ -231,7 +235,7 @@ struct mptcp_pm_data {
> >  	u8		pm_type;
> >  	u8		subflows;
> >  	u8		status;
> > -	DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
> > +	struct mptcp_id_bitmap id_avail_bitmap;
> >  	struct mptcp_rm_list rm_list_tx;
> >  	struct mptcp_rm_list rm_list_rx;
> >  };
> 
> Cheers,
> Matt


  reply	other threads:[~2024-11-04  9:12 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  9:14 [PATCH mptcp-next v2 00/36] BPF path manager Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 01/36] mptcp: drop else in mptcp_pm_addr_families_match Geliang Tang
2024-10-22 17:01   ` Matthieu Baerts
2024-10-23  9:53     ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 02/36] mptcp: use __lookup_addr in pm_netlink Geliang Tang
2024-10-22 17:09   ` Matthieu Baerts
2024-10-23  9:59     ` Geliang Tang
2024-10-23 10:03       ` Matthieu Baerts
2024-10-23 10:06         ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 03/36] mptcp: add mptcp_for_each_address macros Geliang Tang
2024-10-30 18:20   ` Matthieu Baerts
2024-10-31  7:55     ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 04/36] mptcp: use sock_kfree_s instead of kfree Geliang Tang
2024-10-30 18:21   ` Matthieu Baerts
2024-10-31  7:43     ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 05/36] mptcp: add lookup_addr for userspace pm Geliang Tang
2024-10-30 18:21   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 06/36] mptcp: add mptcp_userspace_pm_get_sock helper Geliang Tang
2024-10-30 18:23   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 07/36] mptcp: make three pm wrappers static Geliang Tang
2024-10-30 18:31   ` Matthieu Baerts
2024-10-31  7:58     ` Geliang Tang
2024-10-31 16:33       ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 08/36] mptcp: drop skb parameter of get_addr Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 09/36] mptcp: add id parameter for get_addr Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 10/36] mptcp: add addr " Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 11/36] mptcp: reuse sending nlmsg code in get_addr Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 12/36] mptcp: change info of get_addr as const Geliang Tang
2024-10-31 18:41   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 13/36] mptcp: add struct mptcp_id_bitmap Geliang Tang
2024-10-31 18:45   ` Matthieu Baerts
2024-11-04  9:12     ` Geliang Tang [this message]
2024-11-04 10:16       ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 14/36] mptcp: refactor dump_addr with id bitmap Geliang Tang
2024-11-04 17:18   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 15/36] mptcp: refactor dump_addr with get_addr Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 16/36] mptcp: reuse sending nlmsg code in dump_addr Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 17/36] mptcp: update local address flags when setting it Geliang Tang
2024-11-04 18:20   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 18/36] mptcp: change rem type of set_flags Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 19/36] mptcp: drop skb parameter " Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 20/36] mptcp: add loc and rem for set_flags Geliang Tang
2024-11-04 18:36   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 21/36] mptcp: update address type of get_local_id Geliang Tang
2024-11-04 18:48   ` Matthieu Baerts
2024-11-07  7:35     ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 22/36] mptcp: change is_backup interfaces as get_flags Geliang Tang
2024-11-04 18:55   ` Matthieu Baerts
2025-01-14  9:27     ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 23/36] mptcp: drop struct mptcp_pm_local Geliang Tang
2024-11-04 19:08   ` Matthieu Baerts
2024-11-07  7:29     ` Geliang Tang
2024-11-07 10:00       ` Matthieu Baerts
2024-11-07 10:19         ` Geliang Tang
2024-11-10  4:32           ` Geliang Tang
2024-11-27  6:17             ` Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 24/36] mptcp: drop struct mptcp_pm_add_entry Geliang Tang
2024-11-04 19:13   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 25/36] mptcp: change local type of subflow_destroy Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 26/36] mptcp: hold pm lock when deleting entry Geliang Tang
2024-11-04 19:17   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 27/36] mptcp: rename mptcp_pm_remove_addrs Geliang Tang
2024-11-04 19:24   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 28/36] mptcp: drop free_list for deleting entries Geliang Tang
2024-11-04 19:27   ` Matthieu Baerts
2024-10-22  9:14 ` [PATCH mptcp-next v2 29/36] mptcp: define struct mptcp_pm_ops Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 30/36] mptcp: implement userspace pm interfaces Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 31/36] mptcp: register default userspace pm Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 32/36] bpf: Add mptcp path manager struct_ops Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 33/36] bpf: Register mptcp struct_ops kfunc set Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 34/36] Squash to "bpf: Export mptcp packet scheduler helpers" Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 35/36] selftests/bpf: Add mptcp userspace pm subtest Geliang Tang
2024-10-22  9:14 ` [PATCH mptcp-next v2 36/36] selftests/bpf: Add mptcp bpf path manager subtest Geliang Tang
2024-10-22 10:12 ` [PATCH mptcp-next v2 00/36] BPF path manager MPTCP CI
2024-10-22 10:24 ` MPTCP CI
2024-11-04 19:31 ` Matthieu Baerts
2024-11-05 10:12   ` 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=d44a000cfe49a9fb2c868833694f4da61a457d16.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