--- cci/sys/netinet/tcp_input.c 2019/07/28 12:24:19 1.1.1.1 +++ cci/sys/netinet/tcp_input.c 2019/07/28 12:29:38 1.1.1.2 @@ -67,7 +67,7 @@ tcp_input(m0) short ostate; struct in_addr laddr; int dropsocket = 0; - struct ifnet *ifp; + struct ifnet *ifp, *ifnet; struct ifnet *tcp_getif(); u_short ifmss; @@ -142,8 +142,8 @@ tcp_input(m0) * Drop TCP and IP headers. */ off += sizeof (struct ip); - m->m_off += off; - m->m_len -= off; + m->m_off += sizeof(struct tcpiphdr); + m->m_len -= sizeof(struct tcpiphdr); /* * Convert TCP protocol specific fields to host format. @@ -565,6 +565,22 @@ trimthenstep6: tp->t_srtt = tcp_alpha * tp->t_srtt + (1 - tcp_alpha) * tp->t_rtt; + /* + * Kludge. We adjust the srtt value for x25/l2 interface + * or serial line to reduce the number of retries when + * the line is loaded. The value is proportional to + * the load, i.e., the route's reference count. + */ + if (tp->t_inpcb->inp_route.ro_rt) { + ifnet = tp->t_inpcb->inp_route.ro_rt->rt_ifp; + if (tp->t_srtt && + ifnet && + ifnet->if_name[0] == 's' && + (ifnet->if_name[1] == 'd' || + ifnet->if_name[1] == 'l')) { + tp->t_srtt += tp->t_inpcb->inp_route.ro_rt->rt_refcnt; + } + } tp->t_rtt = 0; } @@ -574,6 +590,7 @@ trimthenstep6: TCPT_RANGESET(tp->t_timer[TCPT_REXMT], tcp_beta * tp->t_srtt, TCPTV_MIN, TCPTV_MAX); tp->t_rtt = 1; + tp->t_rtseq = ti->ti_ack; tp->t_rxtshift = 0; } if (acked > so->so_snd.sb_cc) {