Skip to content

Commit 11692ae

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
Squash to "selftests/bpf: Add bpf_burst scheduler & test"
Use nr_active variable just like in mptcp_subflow_get_send(). Signed-off-by: Geliang Tang <[email protected]>
1 parent 99d4bb3 commit 11692ae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ static int bpf_burst_get_send(struct mptcp_sock *msk,
7474
struct mptcp_subflow_context *subflow;
7575
struct sock *sk = (struct sock *)msk;
7676
__u32 pace, burst, wmem;
77+
int i, nr_active = 0;
7778
__u64 linger_time;
7879
struct sock *ssk;
79-
int i;
8080

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

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

117118
/* pick the best backup if no other subflow is active */
118-
if (send_info[SSK_MODE_ACTIVE].subflow_id == MPTCP_SUBFLOWS_MAX)
119+
if (!nr_active)
119120
send_info[SSK_MODE_ACTIVE].subflow_id = send_info[SSK_MODE_BACKUP].subflow_id;
120121

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

0 commit comments

Comments
 (0)