Skip to content

Commit 371136b

Browse files
Geliang Tangmatttbe
authored andcommitted
bpf: Export more bpf_burst related functions
sk_stream_memory_free() and tcp_rtx_and_write_queues_empty() are needed to export into the BPF context for bpf_burst scheduler. But these two functions are inline ones. So this patch added two wrappers for them, and export the wrappers in the BPF context. Add more bpf_burst related functions into bpf_mptcp_sched_kfunc_set to make sure these helpers can be accessed from the BPF context. Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Reviewed-by: Mat Martineau <martineau@kernel.org>
1 parent 0747d0b commit 371136b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

net/mptcp/bpf.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,22 @@ bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int p
213213
return data->contexts[pos];
214214
}
215215

216+
__bpf_kfunc bool bpf_mptcp_subflow_queues_empty(struct sock *sk)
217+
{
218+
return tcp_rtx_queue_empty(sk);
219+
}
220+
216221
__diag_pop();
217222

218223
BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids)
219224
BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)
220225
BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx_by_pos)
226+
BTF_ID_FLAGS(func, mptcp_subflow_active)
227+
BTF_ID_FLAGS(func, mptcp_set_timeout)
228+
BTF_ID_FLAGS(func, mptcp_wnd_end)
229+
BTF_ID_FLAGS(func, tcp_stream_memory_free)
230+
BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
231+
BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale)
221232
BTF_KFUNCS_END(bpf_mptcp_sched_kfunc_ids)
222233

223234
static const struct btf_kfunc_id_set bpf_mptcp_sched_kfunc_set = {

net/mptcp/protocol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DEFINE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);
5050
static struct net_device mptcp_napi_dev;
5151

5252
/* Returns end sequence number of the receiver's advertised window */
53-
static u64 mptcp_wnd_end(const struct mptcp_sock *msk)
53+
u64 mptcp_wnd_end(const struct mptcp_sock *msk)
5454
{
5555
return READ_ONCE(msk->wnd_end);
5656
}
@@ -489,7 +489,7 @@ static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subfl
489489
inet_csk(ssk)->icsk_timeout - jiffies : 0;
490490
}
491491

492-
static void mptcp_set_timeout(struct sock *sk)
492+
void mptcp_set_timeout(struct sock *sk)
493493
{
494494
struct mptcp_subflow_context *subflow;
495495
long tout = 0;

net/mptcp/protocol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,9 @@ void __mptcp_subflow_send_ack(struct sock *ssk);
720720
void mptcp_subflow_reset(struct sock *ssk);
721721
void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
722722
void mptcp_sock_graft(struct sock *sk, struct socket *parent);
723+
u64 mptcp_wnd_end(const struct mptcp_sock *msk);
724+
void mptcp_set_timeout(struct sock *sk);
725+
bool bpf_mptcp_subflow_queues_empty(struct sock *sk);
723726
struct mptcp_subflow_context *
724727
bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos);
725728
struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk);

0 commit comments

Comments
 (0)