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);
184 * @hc: socket to update window
192 static void ccid2_update_used_window(struct ccid2_hc_tx_sock *hc, u32 new_wnd)
194 hc->tx_expected_wnd = (3 * hc->tx_expected_wnd + new_wnd) / 4;
200 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
203 win_used = max(hc->tx_cwnd_used, init_win);
205 if (win_used < hc->tx_cwnd) {
206 hc->tx_ssthresh = max(hc->tx_ssthresh,
207 (hc->tx_cwnd >> 1) + (hc->tx_cwnd >> 2));
208 hc->tx_cwnd = (hc->tx_cwnd + win_used) >> 1;
210 hc->tx_cwnd_used = 0;
211 hc->tx_cwnd_stamp = now;
219 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
220 u32 cwnd = hc->tx_cwnd, restart_cwnd,
222 s32 delta = now - hc->tx_lsndtime;
224 hc->tx_ssthresh = max(hc->tx_ssthresh, (cwnd >> 1) + (cwnd >> 2));
229 while ((delta -= hc->tx_rto) >= 0 && cwnd > restart_cwnd)
231 hc->tx_cwnd = max(cwnd, restart_cwnd);
232 hc->tx_cwnd_stamp = now;
233 hc->tx_cwnd_used = 0;
241 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
246 if (ccid2_do_cwv && !hc->tx_pipe &&
247 (s32)(now - hc->tx_lsndtime) >= hc->tx_rto)
250 hc->tx_lsndtime = now;
251 hc->tx_pipe += 1;
254 if (ccid2_cwnd_network_limited(hc)) {
255 ccid2_update_used_window(hc, hc->tx_cwnd);
256 hc->tx_cwnd_used = 0;
257 hc->tx_cwnd_stamp = now;
259 if (hc->tx_pipe > hc->tx_cwnd_used)
260 hc->tx_cwnd_used = hc->tx_pipe;
262 ccid2_update_used_window(hc, hc->tx_cwnd_used);
264 if (ccid2_do_cwv && (s32)(now - hc->tx_cwnd_stamp) >= hc->tx_rto)
268 hc->tx_seqh->ccid2s_seq = dp->dccps_gss;
269 hc->tx_seqh->ccid2s_acked = 0;
270 hc->tx_seqh->ccid2s_sent = now;
272 next = hc->tx_seqh->ccid2s_next;
274 if (next == hc->tx_seqt) {
275 if (ccid2_hc_tx_alloc_seq(hc)) {
280 next = hc->tx_seqh->ccid2s_next;
281 BUG_ON(next == hc->tx_seqt);
283 hc->tx_seqh = next;
285 ccid2_pr_debug("cwnd=%d pipe=%d\n", hc->tx_cwnd, hc->tx_pipe);
308 hc->tx_arsent++;
310 if (hc->tx_ackloss) {
311 if (hc->tx_arsent >= hc->tx_cwnd) {
312 hc->tx_arsent = 0;
313 hc->tx_ackloss = 0;
323 denom = hc->tx_cwnd * hc->tx_cwnd / denom;
325 if (hc->tx_arsent >= denom) {
327 hc->tx_arsent = 0;
331 hc->tx_arsent = 0; /* or maybe set it to cwnd*/
336 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
340 struct ccid2_seq *seqp = hc->tx_seqt;
342 while (seqp != hc->tx_seqh) {
366 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
369 if (hc->tx_srtt == 0) {
371 hc->tx_srtt = m << 3;
372 hc->tx_mdev = m << 1;
374 hc->tx_mdev_max = max(hc->tx_mdev, tcp_rto_min(sk));
375 hc->tx_rttvar = hc->tx_mdev_max;
377 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
380 m -= (hc->tx_srtt >> 3);
381 hc->tx_srtt += m;
386 m -= (hc->tx_mdev >> 2);
395 m -= (hc->tx_mdev >> 2);
397 hc->tx_mdev += m;
399 if (hc->tx_mdev > hc->tx_mdev_max) {
400 hc->tx_mdev_max = hc->tx_mdev;
401 if (hc->tx_mdev_max > hc->tx_rttvar)
402 hc->tx_rttvar = hc->tx_mdev_max;
412 if (after48(dccp_sk(sk)->dccps_gar, hc->tx_rtt_seq)) {
413 if (hc->tx_mdev_max < hc->tx_rttvar)
414 hc->tx_rttvar -= (hc->tx_rttvar -
415 hc->tx_mdev_max) >> 2;
416 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
417 hc->tx_mdev_max = tcp_rto_min(sk);
428 hc->tx_rto = (hc->tx_srtt >> 3) + hc->tx_rttvar;
430 if (hc->tx_rto > DCCP_RTO_MAX)
431 hc->tx_rto = DCCP_RTO_MAX;
437 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
439 int r_seq_used = hc->tx_cwnd / dp->dccps_l_ack_ratio;
441 if (hc->tx_cwnd < dp->dccps_l_seq_win &&
443 if (hc->tx_cwnd < hc->tx_ssthresh) {
444 if (*maxincr > 0 && ++hc->tx_packets_acked >= 2) {
445 hc->tx_cwnd += 1;
447 hc->tx_packets_acked = 0;
449 } else if (++hc->tx_packets_acked >= hc->tx_cwnd) {
450 hc->tx_cwnd += 1;
451 hc->tx_packets_acked = 0;
464 if (hc->tx_cwnd * CCID2_WIN_CHANGE_FACTOR >= dp->dccps_l_seq_win)
466 else if (hc->tx_cwnd * CCID2_WIN_CHANGE_FACTOR < dp->dccps_l_seq_win/2)
482 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
484 if ((s32)(seqp->ccid2s_sent - hc->tx_last_cong) < 0) {
489 hc->tx_last_cong = ccid2_jiffies32;
491 hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U;
492 hc->tx_ssthresh = max(hc->tx_cwnd, 2U);
500 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
505 return dccp_ackvec_parsed_add(&hc->tx_av_chunks, optval, optlen,
514 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
515 const bool sender_was_blocked = ccid2_cwnd_network_limited(hc);
530 if (hc->tx_rpdupack == -1) {
531 hc->tx_rpdupack = 0;
532 hc->tx_rpseq = seqno;
535 if (dccp_delta_seqno(hc->tx_rpseq, seqno) == 1)
536 hc->tx_rpseq = seqno;
538 else if (after48(seqno, hc->tx_rpseq)) {
539 hc->tx_rpdupack++;
542 if (hc->tx_rpdupack >= NUMDUPACK) {
543 hc->tx_rpdupack = -1; /* XXX lame */
544 hc->tx_rpseq = 0;
564 if (hc->tx_seqh == hc->tx_seqt)
568 if (after48(ackno, hc->tx_high_ack))
569 hc->tx_high_ack = ackno;
571 seqp = hc->tx_seqt;
574 if (seqp == hc->tx_seqh) {
575 seqp = hc->tx_seqh->ccid2s_prev;
585 if (hc->tx_cwnd < hc->tx_ssthresh)
589 list_for_each_entry(avp, &hc->tx_av_chunks, node) {
604 if (seqp == hc->tx_seqt) {
632 hc->tx_pipe--;
634 if (seqp == hc->tx_seqt) {
652 seqp = hc->tx_seqt;
653 while (before48(seqp->ccid2s_seq, hc->tx_high_ack)) {
655 if (seqp == hc->tx_seqh) {
656 seqp = hc->tx_seqh->ccid2s_prev;
667 if (seqp == hc->tx_seqt)
688 hc->tx_pipe--;
690 if (seqp == hc->tx_seqt)
695 hc->tx_seqt = last_acked;
699 while (hc->tx_seqt != hc->tx_seqh) {
700 if (!hc->tx_seqt->ccid2s_acked)
703 hc->tx_seqt = hc->tx_seqt->ccid2s_next;
707 if (hc->tx_pipe == 0)
708 sk_stop_timer(sk, &hc->tx_rtotimer);
710 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
713 if (sender_was_blocked && !ccid2_cwnd_network_limited(hc))
715 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks);
720 struct ccid2_hc_tx_sock *hc = ccid_priv(ccid);
725 hc->tx_ssthresh = ~0U;
728 hc->tx_cwnd = rfc3390_bytes_to_packets(dp->dccps_mss_cache);
729 hc->tx_expected_wnd = hc->tx_cwnd;
732 max_ratio = DIV_ROUND_UP(hc->tx_cwnd, 2);
737 if (ccid2_hc_tx_alloc_seq(hc))
740 hc->tx_rto = DCCP_TIMEOUT_INIT;
741 hc->tx_rpdupack = -1;
742 hc->tx_last_cong = hc->tx_lsndtime = hc->tx_cwnd_stamp = ccid2_jiffies32;
743 hc->tx_cwnd_used = 0;
744 hc->sk = sk;
745 timer_setup(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire, 0);
746 INIT_LIST_HEAD(&hc->tx_av_chunks);
752 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
755 sk_stop_timer(sk, &hc->tx_rtotimer);
757 for (i = 0; i < hc->tx_seqbufc; i++)
758 kfree(hc->tx_seqbuf[i]);
759 hc->tx_seqbufc = 0;
760 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks);
765 struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk);
770 if (++hc->rx_num_data_pkts >= dccp_sk(sk)->dccps_r_ack_ratio) {
772 hc->rx_num_data_pkts = 0;