From 3e6d607ee45b817d146c6a5b791a64608c1e9d0c Mon Sep 17 00:00:00 2001 From: Nayana Bidari Date: Tue, 18 Aug 2020 15:57:48 -0700 Subject: RACK: Create a new list for segments. RACK requires the segments to be in the order of their transmission or retransmission times. This cl creates a new list and moves the retransmitted segments to the end of the list. PiperOrigin-RevId: 327325153 --- pkg/tcpip/transport/tcp/segment.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'pkg/tcpip/transport/tcp/segment.go') diff --git a/pkg/tcpip/transport/tcp/segment.go b/pkg/tcpip/transport/tcp/segment.go index 94307d31a..a20755f78 100644 --- a/pkg/tcpip/transport/tcp/segment.go +++ b/pkg/tcpip/transport/tcp/segment.go @@ -30,12 +30,13 @@ import ( // // +stateify savable type segment struct { - segmentEntry - refCnt int32 - id stack.TransportEndpointID `state:"manual"` - route stack.Route `state:"manual"` - data buffer.VectorisedView `state:".(buffer.VectorisedView)"` - hdr header.TCP + segEntry segmentEntry + rackSegEntry rackSegmentEntry + refCnt int32 + id stack.TransportEndpointID `state:"manual"` + route stack.Route `state:"manual"` + data buffer.VectorisedView `state:".(buffer.VectorisedView)"` + hdr header.TCP // views is used as buffer for data when its length is large // enough to store a VectorisedView. views [8]buffer.View `state:"nosave"` @@ -61,6 +62,16 @@ type segment struct { xmitCount uint32 } +// segmentMapper is the ElementMapper for the writeList. +type segmentMapper struct{} + +func (segmentMapper) linkerFor(seg *segment) *segmentEntry { return &seg.segEntry } + +// rackSegmentMapper is the ElementMapper for the rcList. +type rackSegmentMapper struct{} + +func (rackSegmentMapper) linkerFor(seg *segment) *rackSegmentEntry { return &seg.rackSegEntry } + func newSegment(r *stack.Route, id stack.TransportEndpointID, pkt *stack.PacketBuffer) *segment { s := &segment{ refCnt: 1, -- cgit v1.2.3