Author: lstewart
Date: Thu Aug 25 13:33:32 2016
New Revision: 304803
URL: https://svnweb.freebsd.org/changeset/base/304803
Log:
Pass the number of segments coalesced by LRO up the stack by repurposing the
tso_segsz pkthdr field during RX processing, and use the information in TCP
for
more correct accounting and as a congestion control input. This is only a
start,
and an audit of other uses for the data is left as future work.
Reviewed by: gallatin, rrs
Sponsored by: Netflix, Inc.
Differential Revision:https://reviews.freebsd.org/D7564
Modified:
head/sys/netinet/cc/cc.h
head/sys/netinet/cc/cc_newreno.c
head/sys/netinet/tcp_input.c
head/sys/netinet/tcp_lro.c
head/sys/netinet/tcp_var.h
head/sys/sys/mbuf.h
Modified: head/sys/netinet/cc/cc.h
==
--- head/sys/netinet/cc/cc.hThu Aug 25 13:24:11 2016(r304802)
+++ head/sys/netinet/cc/cc.hThu Aug 25 13:33:32 2016(r304803)
@@ -86,6 +86,7 @@ struct cc_var {
struct tcpcb*tcp;
struct sctp_nets*sctp;
} ccvc;
+ uint16_tnsegs; /* # segments coalesced into current chain. */
};
/* cc_var flags. */
Modified: head/sys/netinet/cc/cc_newreno.c
==
--- head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/cc/cc_newreno.cThu Aug 25 13:33:32 2016
(r304803)
@@ -137,7 +137,8 @@ newreno_ack_received(struct cc_var *ccv,
*/
if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max))
incr = min(ccv->bytes_this_ack,
- V_tcp_abc_l_var * CCV(ccv, t_maxseg));
+ ccv->nsegs * V_tcp_abc_l_var *
+ CCV(ccv, t_maxseg));
else
incr = min(ccv->bytes_this_ack, CCV(ccv,
t_maxseg));
}
Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Aug 25 13:24:11 2016
(r304802)
+++ head/sys/netinet/tcp_input.cThu Aug 25 13:33:32 2016
(r304803)
@@ -300,10 +300,12 @@ hhook_run_tcp_est_in(struct tcpcb *tp, s
* CC wrapper hook functions
*/
void
-cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type)
+cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
+uint16_t type)
{
INP_WLOCK_ASSERT(tp->t_inpcb);
+ tp->ccv->nsegs = nsegs;
tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
if (tp->snd_cwnd <= tp->snd_wnd)
tp->ccv->flags |= CCF_CWND_LIMITED;
@@ -313,7 +315,7 @@ cc_ack_received(struct tcpcb *tp, struct
if (type == CC_ACK) {
if (tp->snd_cwnd > tp->snd_ssthresh) {
tp->t_bytes_acked += min(tp->ccv->bytes_this_ack,
-V_tcp_abc_l_var * tcp_maxseg(tp));
+nsegs * V_tcp_abc_l_var * tcp_maxseg(tp));
if (tp->t_bytes_acked >= tp->snd_cwnd) {
tp->t_bytes_acked -= tp->snd_cwnd;
tp->ccv->flags |= CCF_ABC_SENTAWND;
@@ -1502,6 +1504,7 @@ tcp_do_segment(struct mbuf *m, struct tc
int thflags, acked, ourfinisacked, needoutput = 0, sack_changed;
int rstreason, todrop, win;
u_long tiwin;
+ uint16_t nsegs;
char *s;
struct in_conninfo *inc;
struct mbuf *mfree;
@@ -1521,6 +1524,7 @@ tcp_do_segment(struct mbuf *m, struct tc
inc = >t_inpcb->inp_inc;
tp->sackhint.last_sack_ack = 0;
sack_changed = 0;
+ nsegs = max(1, m->m_pkthdr.lro_nsegs);
/*
* If this is either a state-changing packet or current state isn't
@@ -1759,7 +1763,7 @@ tcp_do_segment(struct mbuf *m, struct tc
/* Run HHOOK_TCP_ESTABLISHED_IN helper hooks. */
hhook_run_tcp_est_in(tp, th, );
- TCPSTAT_INC(tcps_rcvackpack);
+ TCPSTAT_ADD(tcps_rcvackpack, nsegs);
TCPSTAT_ADD(tcps_rcvackbyte, acked);
sbdrop(>so_snd, acked);
if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
@@ -1772,7 +1776,7 @@ tcp_do_segment(struct mbuf *m, struct tc
* typically means increasing the congestion
* window.
*/
- cc_ack_received(tp, th, CC_ACK);
+ cc_ack_received(tp, th, nsegs, CC_ACK);
tp->snd_una = th->th_ack;