Skip to content

Commit

Permalink
mptcp: dismiss __mptcp_rmem()
Browse files Browse the repository at this point in the history
After the RX path refactor, it become a wrapper for sk_rmem_alloc
access, with a slightly misleading name. Just drop it.

Signed-off-by: Paolo Abeni <[email protected]>
Reviewed-by: Mat Martineau <[email protected]>
  • Loading branch information
Paolo Abeni authored and matttbe committed Jan 6, 2025
1 parent 89005e3 commit ee1b2fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
8 changes: 4 additions & 4 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied)
bool cleanup, rx_empty;

cleanup = (space > 0) && (space >= (old_space << 1)) && copied;
rx_empty = !__mptcp_rmem(sk) && copied;
rx_empty = !sk_rmem_alloc_get(sk) && copied;

mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
Expand Down Expand Up @@ -643,7 +643,7 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
WRITE_ONCE(tp->copied_seq, seq);
more_data_avail = mptcp_subflow_data_available(ssk);

if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) {
if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) {
done = true;
break;
}
Expand Down Expand Up @@ -780,7 +780,7 @@ static void __mptcp_data_ready(struct sock *sk, struct sock *ssk)
__mptcp_rcvbuf_update(sk, ssk);

/* over limit? can't append more skbs to msk, Also, no need to wake-up*/
if (__mptcp_rmem(sk) > sk->sk_rcvbuf)
if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
return;

/* Wake-up the reader only for in-sequence data */
Expand Down Expand Up @@ -2045,7 +2045,7 @@ static bool __mptcp_move_skbs(struct sock *sk)
mptcp_for_each_subflow(msk, subflow)
__mptcp_rcvbuf_update(sk, subflow->tcp_sock);

if (__mptcp_rmem(sk) > sk->sk_rcvbuf)
if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
return false;

do {
Expand Down
11 changes: 2 additions & 9 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,6 @@ static inline void msk_owned_by_me(const struct mptcp_sock *msk)
#define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk)
#endif

/* the msk socket don't use the backlog, also account for the bulk
* free memory
*/
static inline int __mptcp_rmem(const struct sock *sk)
{
return atomic_read(&sk->sk_rmem_alloc);
}

static inline int mptcp_win_from_space(const struct sock *sk, int space)
{
return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
Expand All @@ -397,7 +389,8 @@ static inline int mptcp_space_from_win(const struct sock *sk, int win)

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) -
sk_rmem_alloc_get(sk));
}

static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk)
Expand Down

0 comments on commit ee1b2fe

Please sign in to comment.