MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next 6/8] mptcp: add use_id parameter for addresses_equal
Date: Wed, 21 Feb 2024 17:19:13 +0100	[thread overview]
Message-ID: <8f77ced8-5964-49ac-a5a6-d06093f91e93@kernel.org> (raw)
In-Reply-To: <a911da17e335a0dc22dd722e484d7a79a10967c9.1708497039.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 21/02/2024 7:31 am, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch adds a new parameter use_id for mptcp_addresses_equal() to
> test the address ids, as well as the address. This can be used to test
> if the two given addresses are identically equal, they have both the
> same address and the same address id.

(...)

> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 7905783c95e4..1c32f579e1a1 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -670,7 +670,8 @@ void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk);
>  void mptcp_set_state(struct sock *sk, int state);
>  
>  bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
> -			   const struct mptcp_addr_info *b, bool use_port);
> +			   const struct mptcp_addr_info *b,
> +			   bool use_port, bool use_id);

That's a lot of modifications just to introduce one new parameter. Would
it not be better to use a macro?

  #define mptcp_addresses_equal(a, b, use_port) \
    mptcp_addresses_equal_check_id(a, b, use_port, false)

Or maybe better with an "inline" function?

Or extending the function:

  bool mptcp_addresses_equal_check_id(...)
  {
      return mptcp_addresses_equal(...) ? a->id == b->id : false;
  }

=> Or only do this extra check in mptcp_lookup_anno_list_by_saddr()
where you need that, no?

I will check with Mat what he thinks about that.

>  void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr);
>  
>  /* called with sk socket lock held */

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.

  reply	other threads:[~2024-02-21 16:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  6:31 [PATCH mptcp-next 0/8] some cleanups Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 1/8] mptcp: make pm_remove_addrs_and_subflows static Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 2/8] mptcp: drop duplicate header inclusions Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 3/8] mptcp: update set_flags interfaces Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 4/8] mptcp: set error messages for set_flags Geliang Tang
2024-02-21 16:18   ` Matthieu Baerts
2024-02-21  6:31 ` [PATCH mptcp-next 5/8] mptcp: drop lookup_by_id in lookup_addr Geliang Tang
2024-02-21  6:31 ` [PATCH mptcp-next 6/8] mptcp: add use_id parameter for addresses_equal Geliang Tang
2024-02-21 16:19   ` Matthieu Baerts [this message]
2024-02-21  6:31 ` [PATCH mptcp-next 7/8] mptcp: add check_id for lookup_anno_list_by_saddr Geliang Tang
2024-02-21 16:20   ` Matthieu Baerts
2024-02-21  6:31 ` [PATCH mptcp-next 8/8] selftests: mptcp: flush userspace addrs list Geliang Tang
2024-02-21 15:47   ` selftests: mptcp: flush userspace addrs list: Tests Results MPTCP CI
2024-02-21 16:21   ` [PATCH mptcp-next 8/8] selftests: mptcp: flush userspace addrs list Matthieu Baerts
2024-02-21 16:18 ` [PATCH mptcp-next 0/8] some cleanups 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=8f77ced8-5964-49ac-a5a6-d06093f91e93@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@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