标签:
"net/mptcp/mptcp_sched.c" line 114 of 496 114 static struct sock *get_available_subflow(struct sock *meta_sk, 115 struct sk_buff *skb, 116 bool zero_wnd_test) 117 { 118 struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; //MPTCP内核实现的三个组成部分之一:Multi-path control bock(mpcb) 119 struct sock *sk, *bestsk = NULL, *lowpriosk = NULL, *backupsk = NULL; 120 u32 min_time_to_peer = 0xffffffff, lowprio_min_time_to_peer = 0xffffffff; 121 int cnt_backups = 0; 122 123 /* if there is only one subflow, bypass the scheduling function */ 124 if (mpcb->cnt_subflows == 1) { 125 bestsk = (struct sock *)mpcb->connection_list; 126 if (!mptcp_is_available(bestsk, skb, zero_wnd_test)) 127 bestsk = NULL; 128 return bestsk; 129 } 130 131 /* Answer data_fin on same subflow!!! */ 132 if (meta_sk->sk_shutdown & RCV_SHUTDOWN && 133 skb && mptcp_is_data_fin(skb)) { 134 mptcp_for_each_sk(mpcb, sk) { 135 if (tcp_sk(sk)->mptcp->path_index == mpcb->dfin_path_index && 136 mptcp_is_available(sk, skb, zero_wnd_test)) 137 return sk; 138 } 139 }
"net/mptcp/mptcp_input.c" line 876 of 2293 875 /* Record it, because we want to send our data_fin on the same path */ 876 if (tp->mptcp->map_data_fin) { 877 mpcb->dfin_path_index = tp->mptcp->path_index; 878 mpcb->dfin_combined = !!(sk->sk_shutdown & RCV_SHUTDOWN); 879 }
"net/mptcp/mptcp_sched.c" line 142 of 496 141 /* First, find the best subflow */ 142 mptcp_for_each_sk(mpcb, sk) { 143 struct tcp_sock *tp = tcp_sk(sk); 144 145 if (tp->mptcp->rcv_low_prio || tp->mptcp->low_prio) 146 cnt_backups++; 147 148 if ((tp->mptcp->rcv_low_prio || tp->mptcp->low_prio) && 149 tp->srtt < lowprio_min_time_to_peer) { 150 if (!mptcp_is_available(sk, skb, zero_wnd_test)) 151 continue; 152 153 if (mptcp_dont_reinject_skb(tp, skb)) { 154 backupsk = sk; 155 continue; 156 } 157 158 lowprio_min_time_to_peer = tp->srtt; 159 lowpriosk = sk; 160 } else if (!(tp->mptcp->rcv_low_prio || tp->mptcp->low_prio) && 161 tp->srtt < min_time_to_peer) { 162 if (!mptcp_is_available(sk, skb, zero_wnd_test)) 163 continue; 164 165 if (mptcp_dont_reinject_skb(tp, skb)) { 166 backupsk = sk; 167 continue; 168 } 169 170 min_time_to_peer = tp->srtt; 171 bestsk = sk; 172 } 173 }
"net/mptcp/mptcp_sched.c" line 175 of 496 175 if (mpcb->cnt_established == cnt_backups && lowpriosk) { 176 sk = lowpriosk; 177 } else if (bestsk) { 178 sk = bestsk; 179 } else if (backupsk) { 180 /* It has been sent on all subflows once - let‘s give it a 181 * chance again by restarting its pathmask. 182 */ 183 if (skb) 184 TCP_SKB_CB(skb)->path_mask = 0; 185 sk = backupsk; 186 } 187 188 return sk; 189 }
ip link set dev eth0 multipath backup
标签:
原文地址:http://www.cnblogs.com/lxgeek/p/4330102.html