summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-18 23:29:09 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-18 23:29:09 +0000
commit1e4671875d2f3d4432067d315c729f8c6429b407 (patch)
tree6b11e65c7e17a16871a9bff8bb4146b113086966 /pkg/tcpip/transport/tcp
parentefd9edb291b8fad2cf983dd5592249a27ff8f797 (diff)
parent92a00ca91affab8564b8875387758914ddc9785b (diff)
Merge release-20200219.0-195-g92a00ca (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r--pkg/tcpip/transport/tcp/segment.go6
-rw-r--r--pkg/tcpip/transport/tcp/snd.go3
-rwxr-xr-xpkg/tcpip/transport/tcp/tcp_state_autogen.go2
3 files changed, 7 insertions, 4 deletions
diff --git a/pkg/tcpip/transport/tcp/segment.go b/pkg/tcpip/transport/tcp/segment.go
index 1c10da5ca..5d0bc4f72 100644
--- a/pkg/tcpip/transport/tcp/segment.go
+++ b/pkg/tcpip/transport/tcp/segment.go
@@ -56,9 +56,9 @@ type segment struct {
options []byte `state:".([]byte)"`
hasNewSACKInfo bool
rcvdTime time.Time `state:".(unixTime)"`
- // xmitTime is the last transmit time of this segment. A zero value
- // indicates that the segment has yet to be transmitted.
- xmitTime time.Time `state:".(unixTime)"`
+ // xmitTime is the last transmit time of this segment.
+ xmitTime time.Time `state:".(unixTime)"`
+ xmitCount uint32
}
func newSegment(r *stack.Route, id stack.TransportEndpointID, pkt tcpip.PacketBuffer) *segment {
diff --git a/pkg/tcpip/transport/tcp/snd.go b/pkg/tcpip/transport/tcp/snd.go
index b74b61e7d..657c3146e 100644
--- a/pkg/tcpip/transport/tcp/snd.go
+++ b/pkg/tcpip/transport/tcp/snd.go
@@ -1229,7 +1229,7 @@ func (s *sender) handleRcvdSegment(seg *segment) {
// sendSegment sends the specified segment.
func (s *sender) sendSegment(seg *segment) *tcpip.Error {
- if !seg.xmitTime.IsZero() {
+ if seg.xmitCount > 0 {
s.ep.stack.Stats().TCP.Retransmits.Increment()
s.ep.stats.SendErrors.Retransmits.Increment()
if s.sndCwnd < s.sndSsthresh {
@@ -1237,6 +1237,7 @@ func (s *sender) sendSegment(seg *segment) *tcpip.Error {
}
}
seg.xmitTime = time.Now()
+ seg.xmitCount++
return s.sendSegmentFromView(seg.data, seg.flags, seg.sequenceNumber)
}
diff --git a/pkg/tcpip/transport/tcp/tcp_state_autogen.go b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
index 9c1514e62..6b446595e 100755
--- a/pkg/tcpip/transport/tcp/tcp_state_autogen.go
+++ b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
@@ -307,6 +307,7 @@ func (x *segment) save(m state.Map) {
m.Save("csumValid", &x.csumValid)
m.Save("parsedOptions", &x.parsedOptions)
m.Save("hasNewSACKInfo", &x.hasNewSACKInfo)
+ m.Save("xmitCount", &x.xmitCount)
}
func (x *segment) afterLoad() {}
@@ -322,6 +323,7 @@ func (x *segment) load(m state.Map) {
m.Load("csumValid", &x.csumValid)
m.Load("parsedOptions", &x.parsedOptions)
m.Load("hasNewSACKInfo", &x.hasNewSACKInfo)
+ m.Load("xmitCount", &x.xmitCount)
m.LoadValue("data", new(buffer.VectorisedView), func(y interface{}) { x.loadData(y.(buffer.VectorisedView)) })
m.LoadValue("options", new([]byte), func(y interface{}) { x.loadOptions(y.([]byte)) })
m.LoadValue("rcvdTime", new(unixTime), func(y interface{}) { x.loadRcvdTime(y.(unixTime)) })