@@ -103,13 +103,14 @@ struct mptcp_out_options {
#define MPTCP_SUBFLOWS_MAX 8
struct mptcp_sched_data {
- bool reinject;
u8 subflows;
struct mptcp_subflow_context *contexts[MPTCP_SUBFLOWS_MAX];
};
struct mptcp_sched_ops {
- int (*get_subflow)(struct mptcp_sock *msk,
+ int (*get_send)(struct mptcp_sock *msk,
+ struct mptcp_sched_data *data);
+ int (*get_retrans)(struct mptcp_sock *msk,
struct mptcp_sched_data *data);
char name[MPTCP_SCHED_NAME_MAX];
@@ -156,7 +156,13 @@ static int bpf_mptcp_sched_init(struct btf *btf)
return 0;
}
-static int __bpf_mptcp_sched_get_subflow(struct mptcp_sock *msk,
+static int __bpf_mptcp_sched_get_send(struct mptcp_sock *msk,
+ struct mptcp_sched_data *data)
+{
+ return 0;
+}
+
+static int __bpf_mptcp_sched_get_retrans(struct mptcp_sock *msk,
struct mptcp_sched_data *data)
{
return 0;
@@ -171,7 +177,8 @@ static void __bpf_mptcp_sched_release(struct mptcp_sock *msk)
}
static struct mptcp_sched_ops __bpf_mptcp_sched_ops = {
- .get_subflow = __bpf_mptcp_sched_get_subflow,
+ .get_send = __bpf_mptcp_sched_get_send,
+ .get_retrans = __bpf_mptcp_sched_get_retrans,
.init = __bpf_mptcp_sched_init,
.release = __bpf_mptcp_sched_release,
};
@@ -16,13 +16,25 @@
static DEFINE_SPINLOCK(mptcp_sched_list_lock);
static LIST_HEAD(mptcp_sched_list);
-static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk,
+static int mptcp_sched_default_get_send(struct mptcp_sock *msk,
+ struct mptcp_sched_data *data)
+{
+ struct sock *ssk;
+
+ ssk = mptcp_subflow_get_send(msk);
+ if (!ssk)
+ return -EINVAL;
+
+ mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true);
+ return 0;
+}
+
+static int mptcp_sched_default_get_retrans(struct mptcp_sock *msk,
struct mptcp_sched_data *data)
{
struct sock *ssk;
- ssk = data->reinject ? mptcp_subflow_get_retrans(msk) :
- mptcp_subflow_get_send(msk);
+ ssk = mptcp_subflow_get_retrans(msk);
if (!ssk)
return -EINVAL;
@@ -31,7 +43,8 @@ static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk,
}
static struct mptcp_sched_ops mptcp_sched_default = {
- .get_subflow = mptcp_sched_default_get_subflow,
+ .get_send = mptcp_sched_default_get_send,
+ .get_retrans = mptcp_sched_default_get_retrans,
.name = "default",
.owner = THIS_MODULE,
};
@@ -73,7 +86,7 @@ void mptcp_get_available_schedulers(char *buf, size_t maxlen)
int mptcp_register_scheduler(struct mptcp_sched_ops *sched)
{
- if (!sched->get_subflow)
+ if (!sched->get_send || !sched->get_retrans)
return -EINVAL;
spin_lock(&mptcp_sched_list_lock);
@@ -184,11 +197,10 @@ int mptcp_sched_get_send(struct mptcp_sock *msk)
return 0;
}
- data.reinject = false;
if (msk->sched == &mptcp_sched_default || !msk->sched)
- return mptcp_sched_default_get_subflow(msk, &data);
+ return mptcp_sched_default_get_send(msk, &data);
mptcp_sched_data_set_contexts(msk, &data);
- return msk->sched->get_subflow(msk, &data);
+ return msk->sched->get_send(msk, &data);
}
int mptcp_sched_get_retrans(struct mptcp_sock *msk)
@@ -207,9 +219,8 @@ int mptcp_sched_get_retrans(struct mptcp_sock *msk)
return 0;
}
- data.reinject = true;
if (msk->sched == &mptcp_sched_default || !msk->sched)
- return mptcp_sched_default_get_subflow(msk, &data);
+ return mptcp_sched_default_get_retrans(msk, &data);
mptcp_sched_data_set_contexts(msk, &data);
- return msk->sched->get_subflow(msk, &data);
+ return msk->sched->get_retrans(msk, &data);
}