All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Yonglong Li <liyonglong@chinatelecom.cn>
Cc: mptcp@lists.linux.dev,
	Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: Re: [PATCH v5 2/4] mptcp: make MPTCP_ADD_ADDR_SIGNAL and MPTCP_ADD_ADDR_ECHO separate
Date: Fri, 25 Jun 2021 18:33:42 +0800	[thread overview]
Message-ID: <CA+WQbws7CrpFct1pBVQ3EBVvMO--6QVxEvc+nJ8tL8BWDiiTfA@mail.gmail.com> (raw)
In-Reply-To: <1624337135-149084-3-git-send-email-liyonglong@chinatelecom.cn>

Yonglong Li <liyonglong@chinatelecom.cn> 于2021年6月22日周二 下午12:45写道:
>
> MPTCP_ADD_ADDR_SIGNAL only for action of sending ADD_ADDR
> MPTCP_ADD_ADDR_ECHO only for action of sending echo ADD_ADDR
> add a mptcp_addr_info in struct mptcp_out_options for echo ADD_ADDR
>
> to prepare for the next patch.
>
> Signed-off-by: Yonglong Li <liyonglong@chinatelecom.cn>
> ---
>  include/net/mptcp.h    |  1 +
>  net/mptcp/pm.c         | 13 ++++++++-----
>  net/mptcp/pm_netlink.c |  4 ++--
>  net/mptcp/protocol.h   |  6 ++++++
>  4 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index d61bbbf..637e90b 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -62,6 +62,7 @@ struct mptcp_out_options {
>         u64 rcvr_key;
>         u64 ahmac;
>         struct mptcp_addr_info addr;
> +       struct mptcp_addr_info remote;
>         struct mptcp_rm_list rm_list;
>         u8 join_id;
>         u8 backup;

This new struct member 'remote' isn't used in this patch, I think it's better
to add it in the next patch. So move this trunk into patch 3/4 "mptcp: build
ADD_ADDR/echo-ADD_ADDR option according pm.add_signal".


> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 6c427c8..107a5a2 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -18,7 +18,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
>  {
>         u8 add_addr = READ_ONCE(msk->pm.addr_signal);
>
> -       pr_debug("msk=%p, local_id=%d", msk, addr->id);
> +       pr_debug("msk=%p, local_id=%d, echo:%d", msk, addr->id, echo);
>
>         lockdep_assert_held(&msk->pm.lock);
>
> @@ -27,10 +27,13 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
>                 return -EINVAL;
>         }
>
> -       msk->pm.local = *addr;
> -       add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL);
> -       if (echo)
> +       if (echo) {
> +               msk->pm.remote = *addr;
>                 add_addr |= BIT(MPTCP_ADD_ADDR_ECHO);
> +       } else {
> +               msk->pm.local = *addr;
> +               add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL);
> +       }
>         if (addr->family == AF_INET6)
>                 add_addr |= BIT(MPTCP_ADD_ADDR_IPV6);
>         if (addr->port)
> @@ -214,7 +217,7 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
>
>  void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)
>  {
> -       if (!mptcp_pm_should_add_signal(msk))
> +       if (!mptcp_pm_should_add_signal_echo(msk))
>                 return;
>
>         mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_SEND_ACK);
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index d4732a4..0f302d2 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -317,14 +317,14 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
>         if (!entry->addr.id)
>                 return;
>
> -       if (mptcp_pm_should_add_signal(msk)) {
> +       if (mptcp_pm_should_add_signal_addr(msk)) {
>                 sk_reset_timer(sk, timer, jiffies + TCP_RTO_MAX / 8);
>                 goto out;
>         }
>
>         spin_lock_bh(&msk->pm.lock);
>
> -       if (!mptcp_pm_should_add_signal(msk)) {
> +       if (!mptcp_pm_should_add_signal_addr(msk)) {
>                 pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id);
>                 mptcp_pm_announce_addr(msk, &entry->addr, false);
>                 mptcp_pm_add_addr_send_ack(msk);
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 160c2ab..a0b0ec0 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -708,6 +708,12 @@ void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
>
>  static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk)
>  {
> +       return READ_ONCE(msk->pm.addr_signal) &
> +               (BIT(MPTCP_ADD_ADDR_SIGNAL) | BIT(MPTCP_ADD_ADDR_ECHO));
> +}
> +
> +static inline bool mptcp_pm_should_add_signal_addr(struct mptcp_sock *msk)
> +{
>         return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_SIGNAL);
>  }
>
> --
> 1.8.3.1
>

  reply	other threads:[~2021-06-25 10:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  4:45 [PATCH v5 0/4] mptcp: fix conflicts when using pm.add_signal in ADD_ADDR/echo and RM_ADDR process Yonglong Li
2021-06-22  4:45 ` [PATCH v5 1/4] mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other Yonglong Li
2021-06-22  4:45 ` [PATCH v5 2/4] mptcp: make MPTCP_ADD_ADDR_SIGNAL and MPTCP_ADD_ADDR_ECHO separate Yonglong Li
2021-06-25 10:33   ` Geliang Tang [this message]
2021-06-22  4:45 ` [PATCH v5 3/4] mptcp: build ADD_ADDR/echo-ADD_ADDR option according pm.add_signal Yonglong Li
2021-06-25  4:44   ` Geliang Tang
2021-06-25  9:43     ` Yonglong Li
2021-06-25 10:39   ` Geliang Tang
2021-06-25 11:43   ` Geliang Tang
2021-06-25 12:29   ` Geliang Tang
2021-06-22  4:45 ` [PATCH v5 4/4] mptcp: remove MPTCP_ADD_ADDR_IPV6 and MPTCP_ADD_ADDR_PORT Yonglong Li
2021-06-25 10:01   ` Geliang Tang
2021-06-25  0:28 ` [PATCH v5 0/4] mptcp: fix conflicts when using pm.add_signal in ADD_ADDR/echo and RM_ADDR process Mat Martineau
2021-06-25  1:47   ` Yonglong Li

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=CA+WQbws7CrpFct1pBVQ3EBVvMO--6QVxEvc+nJ8tL8BWDiiTfA@mail.gmail.com \
    --to=geliangtang@gmail.com \
    --cc=liyonglong@chinatelecom.cn \
    --cc=mathew.j.martineau@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.