Skip to content

Commit 80d912f

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: pm: drop is_kernel in alloc_anno_list
To reduce the path manager's reliance on mptcp_pm_is_userspace() and mptcp_pm_is_kernel() helpers, this patch drops the check for mptcp_pm_is_kernel() in the function mptcp_pm_alloc_anno_list(). Instead, add a new parameter "reissue" for this function, pass "false" to this function in the in-kernel PM while pass "true" to it in the userspace PM. Signed-off-by: Geliang Tang <[email protected]>
1 parent 78bcd59 commit 80d912f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

net/mptcp/pm_netlink.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,
358358
}
359359

360360
bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
361-
const struct mptcp_addr_info *addr)
361+
const struct mptcp_addr_info *addr,
362+
bool reissue)
362363
{
363364
struct mptcp_pm_add_entry *add_entry = NULL;
364365
struct sock *sk = (struct sock *)msk;
@@ -369,7 +370,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
369370
add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
370371

371372
if (add_entry) {
372-
if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
373+
if (WARN_ON_ONCE(!reissue))
373374
return false;
374375

375376
sk_reset_timer(sk, &add_entry->add_timer,
@@ -595,7 +596,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
595596
/* If the alloc fails, we are on memory pressure, not worth
596597
* continuing, and trying to create subflows.
597598
*/
598-
if (!mptcp_pm_alloc_anno_list(msk, &local.addr))
599+
if (!mptcp_pm_alloc_anno_list(msk, &local.addr, false))
599600
return;
600601

601602
__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);

net/mptcp/pm_userspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)
232232
lock_sock(sk);
233233
spin_lock_bh(&msk->pm.lock);
234234

235-
if (mptcp_pm_alloc_anno_list(msk, &addr_val.addr)) {
235+
if (mptcp_pm_alloc_anno_list(msk, &addr_val.addr, true)) {
236236
msk->pm.add_addr_signaled++;
237237
mptcp_pm_announce_addr(msk, &addr_val.addr, false);
238238
mptcp_pm_nl_addr_send_ack(msk);

net/mptcp/protocol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,8 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
10231023
struct mptcp_addr_info *rem,
10241024
u8 bkup);
10251025
bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
1026-
const struct mptcp_addr_info *addr);
1026+
const struct mptcp_addr_info *addr,
1027+
bool reissue);
10271028
void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
10281029
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
10291030
struct mptcp_pm_add_entry *

0 commit comments

Comments
 (0)