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 7/8] mptcp: add check_id for lookup_anno_list_by_saddr
Date: Wed, 21 Feb 2024 17:20:22 +0100 [thread overview]
Message-ID: <20f8644c-eb3a-47e0-8dac-1f05f27f6860@kernel.org> (raw)
In-Reply-To: <fe35233e351bbe2db9c3eb98dc13fff8ea5c60df.1708497039.git.tanggeliang@kylinos.cn>
On 21/02/2024 7:31 am, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Add a new parameter check_id for mptcp_lookup_anno_list_by_saddr(), and
> pass it to mptcp_addresses_equal(). Then in mptcp_pm_del_add_timer(),
> the input parameter check_id can be passed as the new parameter into
> mptcp_lookup_anno_list_by_saddr(). After this, this condition:
>
> (!check_id || entry->addr.id == addr->id)
>
> can be dropped, only test if 'entry' is NULL is enough.
(...)
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 1bf5c3440f84..4519dfa79775 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
(...)
> @@ -329,12 +330,12 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
> struct sock *sk = (struct sock *)msk;
>
> spin_lock_bh(&msk->pm.lock);
> - entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
> - if (entry && (!check_id || entry->addr.id == addr->id))
> + entry = mptcp_lookup_anno_list_by_saddr(msk, addr, check_id);
> + if (entry)
> entry->retrans_times = ADD_ADDR_RETRANS_MAX;
> spin_unlock_bh(&msk->pm.lock);
>
> - if (entry && (!check_id || entry->addr.id == addr->id))
> + if (entry)
Instead of all these modifications in mptcp_addresses_equal() and
mptcp_lookup_anno_list_by_saddr() just for this specific case here, can
we not use an extra variable?
bool stop_retrans;
(...)
spin_lock_bh(&msk->pm.lock);
entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
stop_retrans = entry && (!check_id || entry->addr.id == addr->id);
if (stop_retrans) // or in one line, merged with ↑ ?
entry->retrans_times = ADD_ADDR_RETRANS_MAX;
spin_unlock_bh(&msk->pm.lock);
if (stop_retrans)
sk_stop_timer_sync(sk, &entry->add_timer);
> sk_stop_timer_sync(sk, &entry->add_timer);
>
> return entry;
(...)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-02-21 16:20 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
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 [this message]
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=20f8644c-eb3a-47e0-8dac-1f05f27f6860@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