From: Geliang Tang <tanggeliang@kylinos.cn>
In order to make it easier to implement similar logic to the burst
scheduler in BPF program, the sk_stream_memory_free() check is moved
forward into mptcp_for_each_subflow loop.
Assignment like "ssk = send_info[SSK_MODE_ACTIVE].ssk" is not allowed
in BPF, so bpf_core_cast() is used to cast it. But a casted pointer can't
pass to a kfunc (sk_stream_memory_free). To solve this, In BPF burst
scheduler sk_stream_memory_free check is moved forward to the position
of mptcp_subflow_active() in bpf_for_each() loop.
To keep mptcp_subflow_get_send() and BPF burst scheduler code consistent,
this patch also synchronizes the change in BPF burst scheduler into
mptcp_subflow_get_send().
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/protocol.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 21bc3586c33e..f36e63b84b88 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1444,7 +1444,8 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
trace_mptcp_subflow_get_send(subflow);
ssk = mptcp_subflow_tcp_sock(subflow);
- if (!mptcp_subflow_active(subflow))
+ if (!mptcp_subflow_active(subflow) ||
+ !sk_stream_memory_free(ssk))
continue;
tout = max(tout, mptcp_timeout_from_subflow(subflow));
@@ -1482,7 +1483,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
* to check that subflow has a non empty cwin.
*/
ssk = send_info[SSK_MODE_ACTIVE].ssk;
- if (!ssk || !sk_stream_memory_free(ssk))
+ if (!ssk)
return NULL;
burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt);
--
2.45.2