Merge branch 'mptcp-misc-cleanups'
Matthieu Baerts says: ==================== mptcp: misc. cleanups Here is a small collection of miscellaneous cleanups: - Patch 1 uses an MPTCP helper, instead of a TCP one, to do the same thing. - Patch 2 adds a similar MPTCP helper, instead of using a TCP one directly. - Patch 3 uses more appropriated terms in comments. Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> ==================== Link: https://lore.kernel.org/r/20240605-upstream-net-next-20240604-misc-cleanup-v1-0-ae2e35c3ecc5@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
@@ -2040,13 +2040,13 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
|
|||||||
do_div(grow, msk->rcvq_space.space);
|
do_div(grow, msk->rcvq_space.space);
|
||||||
rcvwin += (grow << 1);
|
rcvwin += (grow << 1);
|
||||||
|
|
||||||
rcvbuf = min_t(u64, __tcp_space_from_win(scaling_ratio, rcvwin),
|
rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin),
|
||||||
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
|
READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
|
||||||
|
|
||||||
if (rcvbuf > sk->sk_rcvbuf) {
|
if (rcvbuf > sk->sk_rcvbuf) {
|
||||||
u32 window_clamp;
|
u32 window_clamp;
|
||||||
|
|
||||||
window_clamp = __tcp_win_from_space(scaling_ratio, rcvbuf);
|
window_clamp = mptcp_win_from_space(sk, rcvbuf);
|
||||||
WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
|
WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
|
||||||
|
|
||||||
/* Make subflows follow along. If we do not do this, we
|
/* Make subflows follow along. If we do not do this, we
|
||||||
@@ -2202,7 +2202,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
|
|||||||
if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk))
|
if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* only the master socket status is relevant here. The exit
|
/* only the MPTCP socket status is relevant here. The exit
|
||||||
* conditions mirror closely tcp_recvmsg()
|
* conditions mirror closely tcp_recvmsg()
|
||||||
*/
|
*/
|
||||||
if (copied >= target)
|
if (copied >= target)
|
||||||
@@ -3521,7 +3521,7 @@ void mptcp_subflow_process_delegated(struct sock *ssk, long status)
|
|||||||
static int mptcp_hash(struct sock *sk)
|
static int mptcp_hash(struct sock *sk)
|
||||||
{
|
{
|
||||||
/* should never be called,
|
/* should never be called,
|
||||||
* we hash the TCP subflows not the master socket
|
* we hash the TCP subflows not the MPTCP socket
|
||||||
*/
|
*/
|
||||||
WARN_ON_ONCE(1);
|
WARN_ON_ONCE(1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -386,6 +386,11 @@ static inline int mptcp_win_from_space(const struct sock *sk, int space)
|
|||||||
return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
|
return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int mptcp_space_from_win(const struct sock *sk, int win)
|
||||||
|
{
|
||||||
|
return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int __mptcp_space(const struct sock *sk)
|
static inline int __mptcp_space(const struct sock *sk)
|
||||||
{
|
{
|
||||||
return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk));
|
return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk));
|
||||||
|
|||||||
+1
-1
@@ -1579,7 +1579,7 @@ int mptcp_set_rcvlowat(struct sock *sk, int val)
|
|||||||
if (sk->sk_userlocks & SOCK_RCVBUF_LOCK)
|
if (sk->sk_userlocks & SOCK_RCVBUF_LOCK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
space = __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, val);
|
space = mptcp_space_from_win(sk, val);
|
||||||
if (space <= sk->sk_rcvbuf)
|
if (space <= sk->sk_rcvbuf)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1719,7 +1719,7 @@ int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
|
|||||||
mptcp_sockopt_sync_locked(mptcp_sk(sk), sf->sk);
|
mptcp_sockopt_sync_locked(mptcp_sk(sk), sf->sk);
|
||||||
release_sock(sf->sk);
|
release_sock(sf->sk);
|
||||||
|
|
||||||
/* the newly created socket really belongs to the owning MPTCP master
|
/* the newly created socket really belongs to the owning MPTCP
|
||||||
* socket, even if for additional subflows the allocation is performed
|
* socket, even if for additional subflows the allocation is performed
|
||||||
* by a kernel workqueue. Adjust inode references, so that the
|
* by a kernel workqueue. Adjust inode references, so that the
|
||||||
* procfs/diag interfaces really show this one belonging to the correct
|
* procfs/diag interfaces really show this one belonging to the correct
|
||||||
|
|||||||
Reference in New Issue
Block a user