Skip to content

Commit

Permalink
Squash to "selftests/bpf: Add bpf_burst scheduler & test"
Browse files Browse the repository at this point in the history
Use nr_active variable just like in mptcp_subflow_get_send().

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Sep 9, 2024
1 parent 99d4bb3 commit 11692ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
struct mptcp_subflow_context *subflow;
struct sock *sk = (struct sock *)msk;
__u32 pace, burst, wmem;
int i, nr_active = 0;
__u64 linger_time;
struct sock *ssk;
int i;

/* pick the subflow with the lower wmem/wspace ratio */
for (i = 0; i < SSK_MODE_MAX; ++i) {
Expand All @@ -97,6 +97,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
if (!mptcp_subflow_active(subflow))
continue;

nr_active += !backup;
pace = subflow->avg_pacing_rate;
if (!pace) {
/* init pacing rate from socket */
Expand All @@ -115,7 +116,7 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
mptcp_set_timeout(sk);

/* pick the best backup if no other subflow is active */
if (send_info[SSK_MODE_ACTIVE].subflow_id == MPTCP_SUBFLOWS_MAX)
if (!nr_active)
send_info[SSK_MODE_ACTIVE].subflow_id = send_info[SSK_MODE_BACKUP].subflow_id;

subflow = bpf_mptcp_subflow_ctx_by_pos(data, send_info[SSK_MODE_ACTIVE].subflow_id);
Expand Down

0 comments on commit 11692ae

Please sign in to comment.