Skip to content

Commit

Permalink
mptcp: add mptcp_snd_nxt helper
Browse files Browse the repository at this point in the history
It's better to get msk->snd_nxt with READ_ONCE() in get_subflow() of
the burst scheduler.

Similar to mptcp_wnd_end() helper, this patch defines a new helper
mptcp_snd_nxt(), and use it in mptcp_subflow_get_send().

It will be used in BPF burst scheduler too, so export it in protocol.h.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Jul 10, 2024
1 parent 8636fcd commit 58d5239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ u64 mptcp_wnd_end(const struct mptcp_sock *msk)
return READ_ONCE(msk->wnd_end);
}

u64 mptcp_snd_nxt(const struct mptcp_sock *msk)
{
return READ_ONCE(msk->snd_nxt);
}

static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk)
{
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
Expand Down Expand Up @@ -1465,7 +1470,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
if (!ssk || !sk_stream_memory_free(ssk))
return NULL;

burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt);
burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - mptcp_snd_nxt(msk));
wmem = READ_ONCE(ssk->sk_wmem_queued);
if (!burst)
return ssk;
Expand Down
1 change: 1 addition & 0 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ void mptcp_subflow_reset(struct sock *ssk);
void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
void mptcp_sock_graft(struct sock *sk, struct socket *parent);
u64 mptcp_wnd_end(const struct mptcp_sock *msk);
u64 mptcp_snd_nxt(const struct mptcp_sock *msk);
void mptcp_set_timeout(struct sock *sk);
bool bpf_mptcp_subflow_queues_empty(struct sock *sk);
struct mptcp_subflow_context *
Expand Down

0 comments on commit 58d5239

Please sign in to comment.