Skip to content

Commit

Permalink
add back mptcp_subflow_set_scheduled
Browse files Browse the repository at this point in the history
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang committed Nov 18, 2024
1 parent 129119d commit 058541a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions net/mptcp/bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ BTF_ID_FLAGS(func, mptcp_subflow_shutdown, KF_SLEEPABLE)
BTF_ID_FLAGS(func, mptcp_close_ssk, KF_SLEEPABLE)
BTF_ID_FLAGS(func, BPF_MPTCP_INC_STATS)
BTF_ID_FLAGS(func, mptcp_pm_nl_mp_prio_send_ack, KF_SLEEPABLE)
BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
BTF_ID_FLAGS(func, mptcp_subflow_active)
BTF_ID_FLAGS(func, mptcp_set_timeout)
BTF_ID_FLAGS(func, mptcp_wnd_end)
Expand Down
9 changes: 2 additions & 7 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,18 +758,13 @@ void mptcp_sched_init(void);
int mptcp_init_sched(struct mptcp_sock *msk,
struct mptcp_sched_ops *sched);
void mptcp_release_sched(struct mptcp_sock *msk);
void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
bool scheduled);
struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk);
struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk);
int mptcp_sched_get_send(struct mptcp_sock *msk);
int mptcp_sched_get_retrans(struct mptcp_sock *msk);

static inline void
mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
bool scheduled)
{
WRITE_ONCE(subflow->scheduled, scheduled);
}

static inline u64 mptcp_data_avail(const struct mptcp_sock *msk)
{
return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed);
Expand Down
6 changes: 6 additions & 0 deletions net/mptcp/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ void mptcp_release_sched(struct mptcp_sock *msk)
bpf_module_put(sched, sched->owner);
}

void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
bool scheduled)
{
WRITE_ONCE(subflow->scheduled, scheduled);
}

int mptcp_sched_get_send(struct mptcp_sock *msk)
{
struct mptcp_subflow_context *subflow;
Expand Down
5 changes: 4 additions & 1 deletion tools/testing/selftests/bpf/progs/mptcp_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
#define WRITE_ONCE(x, val) ((*(volatile typeof(x) *) &(x)) = (val))

static __always_inline void
mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled)
bpf_mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled)
{
WRITE_ONCE(subflow->scheduled, scheduled);
}

extern void
mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, bool scheduled) __ksym;

/* ksym */
extern struct mptcp_sock *bpf_mptcp_sock_acquire(struct mptcp_sock *msk) __ksym;
extern void bpf_mptcp_sock_release(struct mptcp_sock *msk) __ksym;
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk)
msk->snd_burst = burst;

out:
mptcp_subflow_set_scheduled(subflow, true);
bpf_mptcp_subflow_set_scheduled(subflow, true);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ int BPF_PROG(bpf_rr_get_subflow, struct mptcp_sock *msk,
}

out:
next = bpf_core_cast(next, struct mptcp_subflow_context);
mptcp_subflow_set_scheduled(next, true);
//bpf_printk("rr subflow=%u/%u", next->subflow_id, msk->pm.subflows + 1);
ptr->last_snd = mptcp_subflow_tcp_sock(next);
Expand Down

0 comments on commit 058541a

Please sign in to comment.