diff options
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/icmp/icmp_packet_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/transport/packet/packet_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/transport/raw/raw_packet_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_endpoint_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_segment_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/transport/udp/udp_packet_list.go | 28 |
6 files changed, 168 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go index f69543bda..0aacdad3f 100644 --- a/pkg/tcpip/transport/icmp/icmp_packet_list.go +++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go @@ -38,16 +38,22 @@ func (l *icmpPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *icmpPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *icmpPacketList) Front() *icmpPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *icmpPacketList) Back() *icmpPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *icmpPacketList) Back() *icmpPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *icmpPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (icmpPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *icmpPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *icmpPacketList) PushFront(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *icmpPacketList) PushFront(e *icmpPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *icmpPacketList) PushBack(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *icmpPacketList) PushBack(e *icmpPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *icmpPacketList) PushBackList(m *icmpPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *icmpPacketList) PushBackList(m *icmpPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { bLinker := icmpPacketElementMapper{}.linkerFor(b) eLinker := icmpPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) { aLinker := icmpPacketElementMapper{}.linkerFor(a) eLinker := icmpPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *icmpPacketList) Remove(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type icmpPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *icmpPacketEntry) Next() *icmpPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *icmpPacketEntry) Prev() *icmpPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *icmpPacketEntry) SetNext(elem *icmpPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *icmpPacketEntry) SetPrev(elem *icmpPacket) { e.prev = elem } diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go index 22a41872a..2c983aad0 100644 --- a/pkg/tcpip/transport/packet/packet_list.go +++ b/pkg/tcpip/transport/packet/packet_list.go @@ -38,16 +38,22 @@ func (l *packetList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *packetList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *packetList) Front() *packet { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *packetList) Back() *packet { return l.tail } @@ -55,6 +61,8 @@ func (l *packetList) Back() *packet { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *packetList) Len() (count int) { for e := l.Front(); e != nil; e = (packetElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *packetList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *packetList) PushFront(e *packet) { linker := packetElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *packetList) PushFront(e *packet) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *packetList) PushBack(e *packet) { linker := packetElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *packetList) PushBack(e *packet) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *packetList) PushBackList(m *packetList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *packetList) PushBackList(m *packetList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *packetList) InsertAfter(b, e *packet) { bLinker := packetElementMapper{}.linkerFor(b) eLinker := packetElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *packetList) InsertAfter(b, e *packet) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *packetList) InsertBefore(a, e *packet) { aLinker := packetElementMapper{}.linkerFor(a) eLinker := packetElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *packetList) InsertBefore(a, e *packet) { } // Remove removes e from l. +// +//go:nosplit func (l *packetList) Remove(e *packet) { linker := packetElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type packetEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *packetEntry) Next() *packet { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *packetEntry) Prev() *packet { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *packetEntry) SetNext(elem *packet) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *packetEntry) SetPrev(elem *packet) { e.prev = elem } diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go index 5f955e86a..48804ff1b 100644 --- a/pkg/tcpip/transport/raw/raw_packet_list.go +++ b/pkg/tcpip/transport/raw/raw_packet_list.go @@ -38,16 +38,22 @@ func (l *rawPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *rawPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *rawPacketList) Front() *rawPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *rawPacketList) Back() *rawPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *rawPacketList) Back() *rawPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *rawPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (rawPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *rawPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *rawPacketList) PushFront(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *rawPacketList) PushFront(e *rawPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *rawPacketList) PushBack(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *rawPacketList) PushBack(e *rawPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *rawPacketList) PushBackList(m *rawPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *rawPacketList) PushBackList(m *rawPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *rawPacketList) InsertAfter(b, e *rawPacket) { bLinker := rawPacketElementMapper{}.linkerFor(b) eLinker := rawPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *rawPacketList) InsertAfter(b, e *rawPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *rawPacketList) InsertBefore(a, e *rawPacket) { aLinker := rawPacketElementMapper{}.linkerFor(a) eLinker := rawPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *rawPacketList) InsertBefore(a, e *rawPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *rawPacketList) Remove(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type rawPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *rawPacketEntry) Next() *rawPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *rawPacketEntry) Prev() *rawPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *rawPacketEntry) SetNext(elem *rawPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *rawPacketEntry) SetPrev(elem *rawPacket) { e.prev = elem } diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go index 71ae11c81..a7dc5df81 100644 --- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go +++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go @@ -38,16 +38,22 @@ func (l *endpointList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *endpointList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *endpointList) Front() *endpoint { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *endpointList) Back() *endpoint { return l.tail } @@ -55,6 +61,8 @@ func (l *endpointList) Back() *endpoint { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *endpointList) Len() (count int) { for e := l.Front(); e != nil; e = (endpointElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *endpointList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *endpointList) PushFront(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *endpointList) PushFront(e *endpoint) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *endpointList) PushBack(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *endpointList) PushBack(e *endpoint) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *endpointList) PushBackList(m *endpointList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *endpointList) PushBackList(m *endpointList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *endpointList) InsertAfter(b, e *endpoint) { bLinker := endpointElementMapper{}.linkerFor(b) eLinker := endpointElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *endpointList) InsertAfter(b, e *endpoint) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *endpointList) InsertBefore(a, e *endpoint) { aLinker := endpointElementMapper{}.linkerFor(a) eLinker := endpointElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *endpointList) InsertBefore(a, e *endpoint) { } // Remove removes e from l. +// +//go:nosplit func (l *endpointList) Remove(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type endpointEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *endpointEntry) Next() *endpoint { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *endpointEntry) Prev() *endpoint { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *endpointEntry) SetNext(elem *endpoint) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *endpointEntry) SetPrev(elem *endpoint) { e.prev = elem } diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go index fcd0c7ec1..a14cff27e 100644 --- a/pkg/tcpip/transport/tcp/tcp_segment_list.go +++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go @@ -38,16 +38,22 @@ func (l *segmentList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *segmentList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *segmentList) Front() *segment { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *segmentList) Back() *segment { return l.tail } @@ -55,6 +61,8 @@ func (l *segmentList) Back() *segment { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *segmentList) Len() (count int) { for e := l.Front(); e != nil; e = (segmentElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *segmentList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *segmentList) PushFront(e *segment) { linker := segmentElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *segmentList) PushFront(e *segment) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *segmentList) PushBack(e *segment) { linker := segmentElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *segmentList) PushBack(e *segment) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *segmentList) PushBackList(m *segmentList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *segmentList) PushBackList(m *segmentList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *segmentList) InsertAfter(b, e *segment) { bLinker := segmentElementMapper{}.linkerFor(b) eLinker := segmentElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *segmentList) InsertAfter(b, e *segment) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *segmentList) InsertBefore(a, e *segment) { aLinker := segmentElementMapper{}.linkerFor(a) eLinker := segmentElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *segmentList) InsertBefore(a, e *segment) { } // Remove removes e from l. +// +//go:nosplit func (l *segmentList) Remove(e *segment) { linker := segmentElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type segmentEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *segmentEntry) Next() *segment { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *segmentEntry) Prev() *segment { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *segmentEntry) SetNext(elem *segment) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *segmentEntry) SetPrev(elem *segment) { e.prev = elem } diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go index 5436b9de1..c396f77c9 100644 --- a/pkg/tcpip/transport/udp/udp_packet_list.go +++ b/pkg/tcpip/transport/udp/udp_packet_list.go @@ -38,16 +38,22 @@ func (l *udpPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *udpPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *udpPacketList) Front() *udpPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *udpPacketList) Back() *udpPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *udpPacketList) Back() *udpPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *udpPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (udpPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *udpPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *udpPacketList) PushFront(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *udpPacketList) PushFront(e *udpPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *udpPacketList) PushBack(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *udpPacketList) PushBack(e *udpPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *udpPacketList) PushBackList(m *udpPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *udpPacketList) PushBackList(m *udpPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *udpPacketList) InsertAfter(b, e *udpPacket) { bLinker := udpPacketElementMapper{}.linkerFor(b) eLinker := udpPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *udpPacketList) InsertAfter(b, e *udpPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *udpPacketList) InsertBefore(a, e *udpPacket) { aLinker := udpPacketElementMapper{}.linkerFor(a) eLinker := udpPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *udpPacketList) InsertBefore(a, e *udpPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *udpPacketList) Remove(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type udpPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *udpPacketEntry) Next() *udpPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *udpPacketEntry) Prev() *udpPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *udpPacketEntry) SetNext(elem *udpPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *udpPacketEntry) SetPrev(elem *udpPacket) { e.prev = elem } |