Skip to content

Commit

Permalink
mptcp: add set/get params wrappers
Browse files Browse the repository at this point in the history
Add two sched params wrappers: mptcp_sched_set_params() and
mptcp_sched_set_params(). Use these wrappers instead of get and set
msk->snd_burst directly.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Aug 23, 2023
1 parent f054b2d commit 891d831
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem +
READ_ONCE(ssk->sk_pacing_rate) * burst,
burst + wmem);
msk->snd_burst = burst;
mptcp_sched_set_params(msk, burst);
return ssk;
}

Expand All @@ -1454,7 +1454,7 @@ static void mptcp_update_post_push(struct mptcp_sock *msk,

dfrag->already_sent += sent;

msk->snd_burst -= sent;
mptcp_sched_set_params(msk, mptcp_sched_get_params(msk) - sent);

snd_nxt_new += dfrag->already_sent;

Expand Down Expand Up @@ -1507,7 +1507,7 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
}
WRITE_ONCE(msk->first_pending, mptcp_send_next(sk));

if (msk->snd_burst <= 0 ||
if (mptcp_sched_get_params(msk) <= 0 ||
!sk_stream_memory_free(ssk) ||
!mptcp_subflow_active(mptcp_subflow_ctx(ssk))) {
err = copied;
Expand Down Expand Up @@ -2291,7 +2291,7 @@ bool __mptcp_retransmit_pending_data(struct sock *sk)
mptcp_data_unlock(sk);

msk->first_pending = rtx_head;
msk->snd_burst = 0;
mptcp_sched_set_params(msk, 0);

/* be sure to clear the "sent status" on all re-injected fragments */
list_for_each_entry(cur, &msk->rtx_queue, list) {
Expand Down
2 changes: 2 additions & 0 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk,
struct mptcp_sched_data *data);
struct mptcp_subflow_context *
mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos);
int mptcp_sched_get_params(struct mptcp_sock *msk);
int mptcp_sched_set_params(struct mptcp_sock *msk, int burst);

static inline bool __tcp_can_send(const struct sock *ssk)
{
Expand Down
18 changes: 18 additions & 0 deletions net/mptcp/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,21 @@ mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos)
return NULL;
return data->contexts[pos];
}

int mptcp_sched_get_params(struct mptcp_sock *msk)
{
if (msk->sched == &mptcp_sched_default)
return msk->snd_burst;

return 0;
}

int mptcp_sched_set_params(struct mptcp_sock *msk, int burst)
{
if (msk->sched == &mptcp_sched_default) {
msk->snd_burst = burst;
return 0;
}

return 0;
}

0 comments on commit 891d831

Please sign in to comment.