net/mptcp/pm_userspace.c | 7 +++++++ 1 file changed, 7 insertions(+)
Increase pm subflows counter when userspace pm creates a new subflow,
and decrease the counter when it closes a subflow.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
v2:
- hold pm locks.
---
net/mptcp/pm_userspace.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index a02d3cbf2a1b..9f7fc0b0d960 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -302,6 +302,10 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}
+ spin_lock_bh(&msk->pm.lock);
+ msk->pm.subflows++;
+ spin_unlock_bh(&msk->pm.lock);
+
lock_sock(sk);
err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
@@ -424,6 +428,9 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN);
mptcp_close_ssk(sk, ssk, subflow);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);
+ spin_lock_bh(&msk->pm.lock);
+ msk->pm.subflows--;
+ spin_unlock_bh(&msk->pm.lock);
err = 0;
} else {
err = -ESRCH;
--
2.35.3
Hi Geliang, On 13/01/2023 09:45, Geliang Tang wrote: > Increase pm subflows counter when userspace pm creates a new subflow, > and decrease the counter when it closes a subflow. > > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329 (sorry for the delay) Thank you, the patch looks good to me! But I don't think it is enough to close the ticket 329. I think there are other fields visible in `MPTCP_INFO` but only updated by the in-kernel PM. e.g. - add_addr_signaled - add_addr_accepted - local_addr_used I guess these counters should be modified as well (in different commits), no? Also, I don't know if we should consider this as a "new feature" for net-next: to me, it looks like we forgot to update the counters and it is not really a new feature to update them but more a bug-fix. So maybe we can target -net? I'm open to suggestions on that point :) Not directly related but for the issue #330 -- 'subflows' counters not incremented for the server side -- it could be considered as a bug fix as well depending on how it is implemented: if it is backported, we would have the same behaviour with all kernels. Or we add new field(s) in MPTCP_INFO but this is maybe not needed. Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net
On Wed, Jan 25, 2023 at 07:13:31PM +0100, Matthieu Baerts wrote: > Hi Geliang, > > On 13/01/2023 09:45, Geliang Tang wrote: > > Increase pm subflows counter when userspace pm creates a new subflow, > > and decrease the counter when it closes a subflow. > > > > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329 > > (sorry for the delay) > > Thank you, the patch looks good to me! But I don't think it is enough to > close the ticket 329. > > I think there are other fields visible in `MPTCP_INFO` but only updated > by the in-kernel PM. e.g. > > - add_addr_signaled > - add_addr_accepted > - local_addr_used > > I guess these counters should be modified as well (in different > commits), no? Yes, I'll modify these counters in v3. > > Also, I don't know if we should consider this as a "new feature" for > net-next: to me, it looks like we forgot to update the counters and it > is not really a new feature to update them but more a bug-fix. So maybe > we can target -net? I'm open to suggestions on that point :) Sure. I'll update this in v3. > > Not directly related but for the issue #330 -- 'subflows' counters not > incremented for the server side -- it could be considered as a bug fix > as well depending on how it is implemented: if it is backported, we > would have the same behaviour with all kernels. Or we add new field(s) > in MPTCP_INFO but this is maybe not needed. OK, I'll address #330 in v3 too. Thanks, -Geliang > > Cheers, > Matt > -- > Tessares | Belgium | Hybrid Access Solutions > www.tessares.net
Hi Geliang, On 28/01/2023 03:44, Geliang Tang wrote: > On Wed, Jan 25, 2023 at 07:13:31PM +0100, Matthieu Baerts wrote: >> Hi Geliang, >> >> On 13/01/2023 09:45, Geliang Tang wrote: >>> Increase pm subflows counter when userspace pm creates a new subflow, >>> and decrease the counter when it closes a subflow. >>> >>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329 >> >> (sorry for the delay) >> >> Thank you, the patch looks good to me! But I don't think it is enough to >> close the ticket 329. >> >> I think there are other fields visible in `MPTCP_INFO` but only updated >> by the in-kernel PM. e.g. >> >> - add_addr_signaled >> - add_addr_accepted >> - local_addr_used >> >> I guess these counters should be modified as well (in different >> commits), no? > > Yes, I'll modify these counters in v3. > >> >> Also, I don't know if we should consider this as a "new feature" for >> net-next: to me, it looks like we forgot to update the counters and it >> is not really a new feature to update them but more a bug-fix. So maybe >> we can target -net? I'm open to suggestions on that point :) > > Sure. I'll update this in v3. > >> >> Not directly related but for the issue #330 -- 'subflows' counters not >> incremented for the server side -- it could be considered as a bug fix >> as well depending on how it is implemented: if it is backported, we >> would have the same behaviour with all kernels. Or we add new field(s) >> in MPTCP_INFO but this is maybe not needed. > > OK, I'll address #330 in v3 too. Great, thank you! Happy New Year! Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net
© 2016 - 2025 Red Hat, Inc.