Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit d8da8ef

Browse files
committed
cut 200ms
1 parent faea95c commit d8da8ef

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

net/mptcp/mptcp_ratio.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
516516
mptcp_sched_probe_init(&sprobe);
517517
iter++;
518518

519-
/*These two are read for every function call, e.g, every segment
520-
* we log every 100ms or longer*/
521519
subflow_rate = READ_ONCE(tp_it->rate_delivered);
522520
subflow_intv = READ_ONCE(tp_it->rate_interval_us);
523521
if (subflow_rate && subflow_intv) {
@@ -555,6 +553,7 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
555553
meta_tp->rate_delivered += total_rate;//no use
556554
meta_tp->delivered++;
557555

556+
558557
iter = 0;
559558
mptcp_for_each_sub(mpcb, mptcp) {
560559
struct sock *sk_it = mptcp_to_sock(mptcp);
@@ -565,8 +564,21 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
565564
rsp_temp->delivered++;
566565
iter++;
567566
}
567+
568568

569569
time_diff = jiffies_to_msecs(jiffies - meta_tp->rate_interval_us);
570+
/*Cut the first 200ms when we are searching*/
571+
if(time_diff >= 200){
572+
/*Calculate # of ACKs for each interface*/
573+
mptcp_for_each_sub(mpcb, mptcp) {
574+
struct sock *sk_it = mptcp_to_sock(mptcp);
575+
struct tcp_sock *tp_it_temp = tcp_sk(sk_it);
576+
if(in_search)
577+
num_acks[iter] = tp_it_temp->delivered - tp_it_temp->prev_tx_bytes;//number of ACKs came back
578+
iter++;
579+
}/*Calculate # of ACKs for each interface*/
580+
581+
}
570582
/*start dynamic ratio search*/
571583
if (time_diff >= meta_tp->ratio_rate_sample) {
572584
/*Load parameter from previous probe interval*/
@@ -585,7 +597,7 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
585597
iter = 0;
586598
meta_tp->rate_delivered = 0; //reset this container so that we can use it to calculate rate
587599

588-
/*Value estimation per sampling interval*/
600+
/*Value estimation for each interface*/
589601
mptcp_for_each_sub(mpcb, mptcp) {
590602
struct sock *sk_it = mptcp_to_sock(mptcp);
591603
struct tcp_sock *tp_it_temp = tcp_sk(sk_it);
@@ -595,12 +607,15 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
595607
do_div(rsp_temp->buffer_size, meta_tp->delivered);
596608
do_div(buffer_sub[iter], 1000);//KB
597609
curr_tstamp = jiffies;
598-
subflow_rate = tp_it_temp->delivered - tp_it_temp->prev_tx_bytes;//number of ACKs came back
610+
subflow_rate = tp_it_temp->delivered - tp_it_temp->prev_tx_bytes-num_acks[iter];//number of ACKs came back
599611
num_acks[iter] = subflow_rate;
600612
tp_it_temp->prev_tx_bytes = tp_it_temp->delivered;
601613
subflow_intv = jiffies_to_msecs(curr_tstamp - tp_it_temp->prev_tstamp);
602614
tp_it_temp->prev_tstamp = curr_tstamp;
603615
subflow_rate64 = (u64)subflow_rate * tp_it_temp->mss_cache * 8 * MSEC_PER_SEC;
616+
if(in_search==1)
617+
//We cut the first 200 ms
618+
subflow_intv -= 200;
604619
do_div(subflow_rate64, subflow_intv);
605620
do_div(subflow_rate64, 1000000);//subflow_intv is in us
606621
srtt[iter] = tp_it_temp->srtt_us>>3;
@@ -609,7 +624,7 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
609624
meta_tp->rate_delivered += tput[iter];//cummulate rate on both interface
610625
rsp_temp->snd_una_saved = tp_it_temp->snd_una;
611626
iter++;
612-
}
627+
}/*Value estimation for each interface*/
613628

614629
for (iter = 0; iter < 5; iter++) {
615630
if (iter == 4)
@@ -917,7 +932,7 @@ static struct sk_buff *mptcp_ratio_next_segment(struct sock *meta_sk,
917932
}
918933
meta_tp->rate_interval_us = jiffies;
919934

920-
}/*end dynamic ratio_search*/
935+
}/*end dynamic ratio search*/
921936
// AUTO-RATE search
922937

923938
mptcp_for_each_sub(mpcb, mptcp) {

0 commit comments

Comments
 (0)