Lines Matching defs:hc

25 static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hc)
31 if (hc->tx_seqbufc >= (sizeof(hc->tx_seqbuf) /
49 if (hc->tx_seqbufc == 0)
50 hc->tx_seqh = hc->tx_seqt = seqp;
53 hc->tx_seqh->ccid2s_next = seqp;
54 seqp->ccid2s_prev = hc->tx_seqh;
56 hc->tx_seqt->ccid2s_prev = &seqp[CCID2_SEQBUF_LEN - 1];
57 seqp[CCID2_SEQBUF_LEN - 1].ccid2s_next = hc->tx_seqt;
61 hc->tx_seqbuf[hc->tx_seqbufc] = seqp;
62 hc->tx_seqbufc++;
94 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
106 if (dccp_feat_nn_get(sk, DCCPF_ACK_RATIO) > hc->tx_cwnd)
107 ccid2_change_l_ack_ratio(sk, hc->tx_cwnd/2 ? : 1U);
129 struct ccid2_hc_tx_sock *hc = from_timer(hc, t, tx_rtotimer);
130 struct sock *sk = hc->sk;
131 const bool sender_was_blocked = ccid2_cwnd_network_limited(hc);
135 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + HZ / 5);
145 hc->tx_rto <<= 1;
146 if (hc->tx_rto > DCCP_RTO_MAX)
147 hc->tx_rto = DCCP_RTO_MAX;
150 hc->tx_ssthresh = hc->tx_cwnd / 2;
151 if (hc->tx_ssthresh < 2)
152 hc->tx_ssthresh = 2;
153 hc->tx_cwnd = 1;
154 hc->tx_pipe = 0;
157 hc->tx_seqt = hc->tx_seqh;
158 hc->tx_packets_acked = 0;
161 hc->tx_rpseq = 0;
162 hc->tx_rpdupack = -1;
169 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
189 static void ccid2_update_used_window(struct ccid2_hc_tx_sock *hc, u32 new_wnd)
191 hc->tx_expected_wnd = (3 * hc->tx_expected_wnd + new_wnd) / 4;
197 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
200 win_used = max(hc->tx_cwnd_used, init_win);
202 if (win_used < hc->tx_cwnd) {
203 hc->tx_ssthresh = max(hc->tx_ssthresh,
204 (hc->tx_cwnd >> 1) + (hc->tx_cwnd >> 2));
205 hc->tx_cwnd = (hc->tx_cwnd + win_used) >> 1;
207 hc->tx_cwnd_used = 0;
208 hc->tx_cwnd_stamp = now;
216 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
217 u32 cwnd = hc->tx_cwnd, restart_cwnd,
219 s32 delta = now - hc->tx_lsndtime;
221 hc->tx_ssthresh = max(hc->tx_ssthresh, (cwnd >> 1) + (cwnd >> 2));
226 while ((delta -= hc->tx_rto) >= 0 && cwnd > restart_cwnd)
228 hc->tx_cwnd = max(cwnd, restart_cwnd);
229 hc->tx_cwnd_stamp = now;
230 hc->tx_cwnd_used = 0;
238 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
243 if (ccid2_do_cwv && !hc->tx_pipe &&
244 (s32)(now - hc->tx_lsndtime) >= hc->tx_rto)
247 hc->tx_lsndtime = now;
248 hc->tx_pipe += 1;
251 if (ccid2_cwnd_network_limited(hc)) {
252 ccid2_update_used_window(hc, hc->tx_cwnd);
253 hc->tx_cwnd_used = 0;
254 hc->tx_cwnd_stamp = now;
256 if (hc->tx_pipe > hc->tx_cwnd_used)
257 hc->tx_cwnd_used = hc->tx_pipe;
259 ccid2_update_used_window(hc, hc->tx_cwnd_used);
261 if (ccid2_do_cwv && (s32)(now - hc->tx_cwnd_stamp) >= hc->tx_rto)
265 hc->tx_seqh->ccid2s_seq = dp->dccps_gss;
266 hc->tx_seqh->ccid2s_acked = 0;
267 hc->tx_seqh->ccid2s_sent = now;
269 next = hc->tx_seqh->ccid2s_next;
271 if (next == hc->tx_seqt) {
272 if (ccid2_hc_tx_alloc_seq(hc)) {
277 next = hc->tx_seqh->ccid2s_next;
278 BUG_ON(next == hc->tx_seqt);
280 hc->tx_seqh = next;
282 ccid2_pr_debug("cwnd=%d pipe=%d\n", hc->tx_cwnd, hc->tx_pipe);
305 hc->tx_arsent++;
307 if (hc->tx_ackloss) {
308 if (hc->tx_arsent >= hc->tx_cwnd) {
309 hc->tx_arsent = 0;
310 hc->tx_ackloss = 0;
320 denom = hc->tx_cwnd * hc->tx_cwnd / denom;
322 if (hc->tx_arsent >= denom) {
324 hc->tx_arsent = 0;
328 hc->tx_arsent = 0; /* or maybe set it to cwnd*/
333 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
337 struct ccid2_seq *seqp = hc->tx_seqt;
339 while (seqp != hc->tx_seqh) {
361 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
364 if (hc->tx_srtt == 0) {
366 hc->tx_srtt = m << 3;
367 hc->tx_mdev = m << 1;
369 hc->tx_mdev_max = max(hc->tx_mdev, tcp_rto_min(sk));
370 hc->tx_rttvar = hc->tx_mdev_max;
372 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
375 m -= (hc->tx_srtt >> 3);
376 hc->tx_srtt += m;
381 m -= (hc->tx_mdev >> 2);
390 m -= (hc->tx_mdev >> 2);
392 hc->tx_mdev += m;
394 if (hc->tx_mdev > hc->tx_mdev_max) {
395 hc->tx_mdev_max = hc->tx_mdev;
396 if (hc->tx_mdev_max > hc->tx_rttvar)
397 hc->tx_rttvar = hc->tx_mdev_max;
407 if (after48(dccp_sk(sk)->dccps_gar, hc->tx_rtt_seq)) {
408 if (hc->tx_mdev_max < hc->tx_rttvar)
409 hc->tx_rttvar -= (hc->tx_rttvar -
410 hc->tx_mdev_max) >> 2;
411 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
412 hc->tx_mdev_max = tcp_rto_min(sk);
423 hc->tx_rto = (hc->tx_srtt >> 3) + hc->tx_rttvar;
425 if (hc->tx_rto > DCCP_RTO_MAX)
426 hc->tx_rto = DCCP_RTO_MAX;
432 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
434 int r_seq_used = hc->tx_cwnd / dp->dccps_l_ack_ratio;
436 if (hc->tx_cwnd < dp->dccps_l_seq_win &&
438 if (hc->tx_cwnd < hc->tx_ssthresh) {
439 if (*maxincr > 0 && ++hc->tx_packets_acked >= 2) {
440 hc->tx_cwnd += 1;
442 hc->tx_packets_acked = 0;
444 } else if (++hc->tx_packets_acked >= hc->tx_cwnd) {
445 hc->tx_cwnd += 1;
446 hc->tx_packets_acked = 0;
459 if (hc->tx_cwnd * CCID2_WIN_CHANGE_FACTOR >= dp->dccps_l_seq_win)
461 else if (hc->tx_cwnd * CCID2_WIN_CHANGE_FACTOR < dp->dccps_l_seq_win/2)
477 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
479 if ((s32)(seqp->ccid2s_sent - hc->tx_last_cong) < 0) {
484 hc->tx_last_cong = ccid2_jiffies32;
486 hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U;
487 hc->tx_ssthresh = max(hc->tx_cwnd, 2U);
495 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
500 return dccp_ackvec_parsed_add(&hc->tx_av_chunks, optval, optlen,
509 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
510 const bool sender_was_blocked = ccid2_cwnd_network_limited(hc);
525 if (hc->tx_rpdupack == -1) {
526 hc->tx_rpdupack = 0;
527 hc->tx_rpseq = seqno;
530 if (dccp_delta_seqno(hc->tx_rpseq, seqno) == 1)
531 hc->tx_rpseq = seqno;
533 else if (after48(seqno, hc->tx_rpseq)) {
534 hc->tx_rpdupack++;
537 if (hc->tx_rpdupack >= NUMDUPACK) {
538 hc->tx_rpdupack = -1; /* XXX lame */
539 hc->tx_rpseq = 0;
559 if (hc->tx_seqh == hc->tx_seqt)
563 if (after48(ackno, hc->tx_high_ack))
564 hc->tx_high_ack = ackno;
566 seqp = hc->tx_seqt;
569 if (seqp == hc->tx_seqh) {
570 seqp = hc->tx_seqh->ccid2s_prev;
580 if (hc->tx_cwnd < hc->tx_ssthresh)
584 list_for_each_entry(avp, &hc->tx_av_chunks, node) {
599 if (seqp == hc->tx_seqt) {
627 hc->tx_pipe--;
629 if (seqp == hc->tx_seqt) {
647 seqp = hc->tx_seqt;
648 while (before48(seqp->ccid2s_seq, hc->tx_high_ack)) {
650 if (seqp == hc->tx_seqh) {
651 seqp = hc->tx_seqh->ccid2s_prev;
662 if (seqp == hc->tx_seqt)
683 hc->tx_pipe--;
685 if (seqp == hc->tx_seqt)
690 hc->tx_seqt = last_acked;
694 while (hc->tx_seqt != hc->tx_seqh) {
695 if (!hc->tx_seqt->ccid2s_acked)
698 hc->tx_seqt = hc->tx_seqt->ccid2s_next;
702 if (hc->tx_pipe == 0)
703 sk_stop_timer(sk, &hc->tx_rtotimer);
705 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
708 if (sender_was_blocked && !ccid2_cwnd_network_limited(hc))
710 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks);
715 struct ccid2_hc_tx_sock *hc = ccid_priv(ccid);
720 hc->tx_ssthresh = ~0U;
723 hc->tx_cwnd = rfc3390_bytes_to_packets(dp->dccps_mss_cache);
724 hc->tx_expected_wnd = hc->tx_cwnd;
727 max_ratio = DIV_ROUND_UP(hc->tx_cwnd, 2);
732 if (ccid2_hc_tx_alloc_seq(hc))
735 hc->tx_rto = DCCP_TIMEOUT_INIT;
736 hc->tx_rpdupack = -1;
737 hc->tx_last_cong = hc->tx_lsndtime = hc->tx_cwnd_stamp = ccid2_jiffies32;
738 hc->tx_cwnd_used = 0;
739 hc->sk = sk;
740 timer_setup(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire, 0);
741 INIT_LIST_HEAD(&hc->tx_av_chunks);
747 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
750 sk_stop_timer(sk, &hc->tx_rtotimer);
752 for (i = 0; i < hc->tx_seqbufc; i++)
753 kfree(hc->tx_seqbuf[i]);
754 hc->tx_seqbufc = 0;
755 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks);
760 struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk);
765 if (++hc->rx_num_data_pkts >= dccp_sk(sk)->dccps_r_ack_ratio) {
767 hc->rx_num_data_pkts = 0;