summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-09-27 21:16:51 +0000
committergVisor bot <gvisor-bot@google.com>2021-09-27 21:16:51 +0000
commit5de2e201f057efc38ae83fae9b3b46a841f79f26 (patch)
tree78fc5e2cdebf53c2ec0a477ef4c624dc9aadc24b /pkg/tcpip/transport/tcp
parent21a4133cd489b551c6bbf59c2a50d89dde1ba709 (diff)
parentdc64617d5493ff8d94f424a5340cc8228fa46baf (diff)
Merge release-20210921.0-35-gdc64617d5 (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r--pkg/tcpip/transport/tcp/endpoint.go9
-rw-r--r--pkg/tcpip/transport/tcp/tcp_state_autogen.go156
2 files changed, 151 insertions, 14 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go
index 407ab2664..7c8a11cfb 100644
--- a/pkg/tcpip/transport/tcp/endpoint.go
+++ b/pkg/tcpip/transport/tcp/endpoint.go
@@ -205,6 +205,8 @@ type SACKInfo struct {
}
// ReceiveErrors collect segment receive errors within transport layer.
+//
+// +stateify savable
type ReceiveErrors struct {
tcpip.ReceiveErrors
@@ -234,6 +236,8 @@ type ReceiveErrors struct {
}
// SendErrors collect segment send errors within the transport layer.
+//
+// +stateify savable
type SendErrors struct {
tcpip.SendErrors
@@ -257,6 +261,8 @@ type SendErrors struct {
}
// Stats holds statistics about the endpoint.
+//
+// +stateify savable
type Stats struct {
// SegmentsReceived is the number of TCP segments received that
// the transport layer successfully parsed.
@@ -612,8 +618,7 @@ type endpoint struct {
gso stack.GSO
- // TODO(b/142022063): Add ability to save and restore per endpoint stats.
- stats Stats `state:"nosave"`
+ stats Stats
// tcpLingerTimeout is the maximum amount of a time a socket
// a socket stays in TIME_WAIT state before being marked
diff --git a/pkg/tcpip/transport/tcp/tcp_state_autogen.go b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
index 13061d2b1..ba94228d9 100644
--- a/pkg/tcpip/transport/tcp/tcp_state_autogen.go
+++ b/pkg/tcpip/transport/tcp/tcp_state_autogen.go
@@ -66,6 +66,132 @@ func (s *SACKInfo) StateLoad(stateSourceObject state.Source) {
stateSourceObject.Load(1, &s.NumBlocks)
}
+func (r *ReceiveErrors) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.ReceiveErrors"
+}
+
+func (r *ReceiveErrors) StateFields() []string {
+ return []string{
+ "ReceiveErrors",
+ "SegmentQueueDropped",
+ "ChecksumErrors",
+ "ListenOverflowSynDrop",
+ "ListenOverflowAckDrop",
+ "ZeroRcvWindowState",
+ "WantZeroRcvWindow",
+ }
+}
+
+func (r *ReceiveErrors) beforeSave() {}
+
+// +checklocksignore
+func (r *ReceiveErrors) StateSave(stateSinkObject state.Sink) {
+ r.beforeSave()
+ stateSinkObject.Save(0, &r.ReceiveErrors)
+ stateSinkObject.Save(1, &r.SegmentQueueDropped)
+ stateSinkObject.Save(2, &r.ChecksumErrors)
+ stateSinkObject.Save(3, &r.ListenOverflowSynDrop)
+ stateSinkObject.Save(4, &r.ListenOverflowAckDrop)
+ stateSinkObject.Save(5, &r.ZeroRcvWindowState)
+ stateSinkObject.Save(6, &r.WantZeroRcvWindow)
+}
+
+func (r *ReceiveErrors) afterLoad() {}
+
+// +checklocksignore
+func (r *ReceiveErrors) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &r.ReceiveErrors)
+ stateSourceObject.Load(1, &r.SegmentQueueDropped)
+ stateSourceObject.Load(2, &r.ChecksumErrors)
+ stateSourceObject.Load(3, &r.ListenOverflowSynDrop)
+ stateSourceObject.Load(4, &r.ListenOverflowAckDrop)
+ stateSourceObject.Load(5, &r.ZeroRcvWindowState)
+ stateSourceObject.Load(6, &r.WantZeroRcvWindow)
+}
+
+func (s *SendErrors) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.SendErrors"
+}
+
+func (s *SendErrors) StateFields() []string {
+ return []string{
+ "SendErrors",
+ "SegmentSendToNetworkFailed",
+ "SynSendToNetworkFailed",
+ "Retransmits",
+ "FastRetransmit",
+ "Timeouts",
+ }
+}
+
+func (s *SendErrors) beforeSave() {}
+
+// +checklocksignore
+func (s *SendErrors) StateSave(stateSinkObject state.Sink) {
+ s.beforeSave()
+ stateSinkObject.Save(0, &s.SendErrors)
+ stateSinkObject.Save(1, &s.SegmentSendToNetworkFailed)
+ stateSinkObject.Save(2, &s.SynSendToNetworkFailed)
+ stateSinkObject.Save(3, &s.Retransmits)
+ stateSinkObject.Save(4, &s.FastRetransmit)
+ stateSinkObject.Save(5, &s.Timeouts)
+}
+
+func (s *SendErrors) afterLoad() {}
+
+// +checklocksignore
+func (s *SendErrors) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &s.SendErrors)
+ stateSourceObject.Load(1, &s.SegmentSendToNetworkFailed)
+ stateSourceObject.Load(2, &s.SynSendToNetworkFailed)
+ stateSourceObject.Load(3, &s.Retransmits)
+ stateSourceObject.Load(4, &s.FastRetransmit)
+ stateSourceObject.Load(5, &s.Timeouts)
+}
+
+func (s *Stats) StateTypeName() string {
+ return "pkg/tcpip/transport/tcp.Stats"
+}
+
+func (s *Stats) StateFields() []string {
+ return []string{
+ "SegmentsReceived",
+ "SegmentsSent",
+ "FailedConnectionAttempts",
+ "ReceiveErrors",
+ "ReadErrors",
+ "SendErrors",
+ "WriteErrors",
+ }
+}
+
+func (s *Stats) beforeSave() {}
+
+// +checklocksignore
+func (s *Stats) StateSave(stateSinkObject state.Sink) {
+ s.beforeSave()
+ stateSinkObject.Save(0, &s.SegmentsReceived)
+ stateSinkObject.Save(1, &s.SegmentsSent)
+ stateSinkObject.Save(2, &s.FailedConnectionAttempts)
+ stateSinkObject.Save(3, &s.ReceiveErrors)
+ stateSinkObject.Save(4, &s.ReadErrors)
+ stateSinkObject.Save(5, &s.SendErrors)
+ stateSinkObject.Save(6, &s.WriteErrors)
+}
+
+func (s *Stats) afterLoad() {}
+
+// +checklocksignore
+func (s *Stats) StateLoad(stateSourceObject state.Source) {
+ stateSourceObject.Load(0, &s.SegmentsReceived)
+ stateSourceObject.Load(1, &s.SegmentsSent)
+ stateSourceObject.Load(2, &s.FailedConnectionAttempts)
+ stateSourceObject.Load(3, &s.ReceiveErrors)
+ stateSourceObject.Load(4, &s.ReadErrors)
+ stateSourceObject.Load(5, &s.SendErrors)
+ stateSourceObject.Load(6, &s.WriteErrors)
+}
+
func (s *sndQueueInfo) StateTypeName() string {
return "pkg/tcpip/transport/tcp.sndQueueInfo"
}
@@ -199,6 +325,7 @@ func (e *endpoint) StateFields() []string {
"amss",
"sendTOS",
"gso",
+ "stats",
"tcpLingerTimeout",
"closed",
"txHash",
@@ -257,12 +384,13 @@ func (e *endpoint) StateSave(stateSinkObject state.Sink) {
stateSinkObject.Save(41, &e.amss)
stateSinkObject.Save(42, &e.sendTOS)
stateSinkObject.Save(43, &e.gso)
- stateSinkObject.Save(44, &e.tcpLingerTimeout)
- stateSinkObject.Save(45, &e.closed)
- stateSinkObject.Save(46, &e.txHash)
- stateSinkObject.Save(47, &e.owner)
- stateSinkObject.Save(48, &e.ops)
- stateSinkObject.Save(49, &e.lastOutOfWindowAckTime)
+ stateSinkObject.Save(44, &e.stats)
+ stateSinkObject.Save(45, &e.tcpLingerTimeout)
+ stateSinkObject.Save(46, &e.closed)
+ stateSinkObject.Save(47, &e.txHash)
+ stateSinkObject.Save(48, &e.owner)
+ stateSinkObject.Save(49, &e.ops)
+ stateSinkObject.Save(50, &e.lastOutOfWindowAckTime)
}
// +checklocksignore
@@ -310,12 +438,13 @@ func (e *endpoint) StateLoad(stateSourceObject state.Source) {
stateSourceObject.Load(41, &e.amss)
stateSourceObject.Load(42, &e.sendTOS)
stateSourceObject.Load(43, &e.gso)
- stateSourceObject.Load(44, &e.tcpLingerTimeout)
- stateSourceObject.Load(45, &e.closed)
- stateSourceObject.Load(46, &e.txHash)
- stateSourceObject.Load(47, &e.owner)
- stateSourceObject.Load(48, &e.ops)
- stateSourceObject.Load(49, &e.lastOutOfWindowAckTime)
+ stateSourceObject.Load(44, &e.stats)
+ stateSourceObject.Load(45, &e.tcpLingerTimeout)
+ stateSourceObject.Load(46, &e.closed)
+ stateSourceObject.Load(47, &e.txHash)
+ stateSourceObject.Load(48, &e.owner)
+ stateSourceObject.Load(49, &e.ops)
+ stateSourceObject.Load(50, &e.lastOutOfWindowAckTime)
stateSourceObject.LoadValue(10, new(EndpointState), func(y interface{}) { e.loadState(y.(EndpointState)) })
stateSourceObject.AfterLoad(e.afterLoad)
}
@@ -879,6 +1008,9 @@ func (e *segmentEntry) StateLoad(stateSourceObject state.Source) {
func init() {
state.Register((*cubicState)(nil))
state.Register((*SACKInfo)(nil))
+ state.Register((*ReceiveErrors)(nil))
+ state.Register((*SendErrors)(nil))
+ state.Register((*Stats)(nil))
state.Register((*sndQueueInfo)(nil))
state.Register((*rcvQueueInfo)(nil))
state.Register((*accepted)(nil))