diff options
Diffstat (limited to 'pkg/tcpip')
-rw-r--r-- | pkg/tcpip/network/fragmentation/reassembler_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/sock_err_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/stack/linkaddrentry_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/stack/neighbor_entry_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/stack/packet_buffer_list.go | 28 | ||||
-rw-r--r-- | pkg/tcpip/stack/tuple_list.go | 28 | ||||
-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 |
12 files changed, 336 insertions, 0 deletions
diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go index bb5bd75c4..673bb11b0 100644 --- a/pkg/tcpip/network/fragmentation/reassembler_list.go +++ b/pkg/tcpip/network/fragmentation/reassembler_list.go @@ -38,16 +38,22 @@ func (l *reassemblerList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *reassemblerList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *reassemblerList) Front() *reassembler { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *reassemblerList) Back() *reassembler { return l.tail } @@ -55,6 +61,8 @@ func (l *reassemblerList) Back() *reassembler { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *reassemblerList) Len() (count int) { for e := l.Front(); e != nil; e = (reassemblerElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *reassemblerList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *reassemblerList) PushFront(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *reassemblerList) PushFront(e *reassembler) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *reassemblerList) PushBack(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *reassemblerList) PushBack(e *reassembler) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *reassemblerList) PushBackList(m *reassemblerList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *reassemblerList) PushBackList(m *reassemblerList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *reassemblerList) InsertAfter(b, e *reassembler) { bLinker := reassemblerElementMapper{}.linkerFor(b) eLinker := reassemblerElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *reassemblerList) InsertAfter(b, e *reassembler) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *reassemblerList) InsertBefore(a, e *reassembler) { aLinker := reassemblerElementMapper{}.linkerFor(a) eLinker := reassemblerElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *reassemblerList) InsertBefore(a, e *reassembler) { } // Remove removes e from l. +// +//go:nosplit func (l *reassemblerList) Remove(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type reassemblerEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *reassemblerEntry) Next() *reassembler { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *reassemblerEntry) Prev() *reassembler { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *reassemblerEntry) SetNext(elem *reassembler) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *reassemblerEntry) SetPrev(elem *reassembler) { e.prev = elem } diff --git a/pkg/tcpip/sock_err_list.go b/pkg/tcpip/sock_err_list.go index 8935a8793..0be1993af 100644 --- a/pkg/tcpip/sock_err_list.go +++ b/pkg/tcpip/sock_err_list.go @@ -38,16 +38,22 @@ func (l *sockErrorList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *sockErrorList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *sockErrorList) Front() *SockError { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *sockErrorList) Back() *SockError { return l.tail } @@ -55,6 +61,8 @@ func (l *sockErrorList) Back() *SockError { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *sockErrorList) Len() (count int) { for e := l.Front(); e != nil; e = (sockErrorElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *sockErrorList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *sockErrorList) PushFront(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *sockErrorList) PushFront(e *SockError) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *sockErrorList) PushBack(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *sockErrorList) PushBack(e *SockError) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *sockErrorList) PushBackList(m *sockErrorList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *sockErrorList) PushBackList(m *sockErrorList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *sockErrorList) InsertAfter(b, e *SockError) { bLinker := sockErrorElementMapper{}.linkerFor(b) eLinker := sockErrorElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *sockErrorList) InsertAfter(b, e *SockError) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *sockErrorList) InsertBefore(a, e *SockError) { aLinker := sockErrorElementMapper{}.linkerFor(a) eLinker := sockErrorElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *sockErrorList) InsertBefore(a, e *SockError) { } // Remove removes e from l. +// +//go:nosplit func (l *sockErrorList) Remove(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type sockErrorEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *sockErrorEntry) Next() *SockError { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *sockErrorEntry) Prev() *SockError { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *sockErrorEntry) SetNext(elem *SockError) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *sockErrorEntry) SetPrev(elem *SockError) { e.prev = elem } diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go index 1250b89f8..8ae2ff09c 100644 --- a/pkg/tcpip/stack/linkaddrentry_list.go +++ b/pkg/tcpip/stack/linkaddrentry_list.go @@ -38,16 +38,22 @@ func (l *linkAddrEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *linkAddrEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *linkAddrEntryList) Front() *linkAddrEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *linkAddrEntryList) Back() *linkAddrEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *linkAddrEntryList) Back() *linkAddrEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *linkAddrEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (linkAddrEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *linkAddrEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { bLinker := linkAddrEntryElementMapper{}.linkerFor(b) eLinker := linkAddrEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) { aLinker := linkAddrEntryElementMapper{}.linkerFor(a) eLinker := linkAddrEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *linkAddrEntryList) Remove(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type linkAddrEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) Next() *linkAddrEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) Prev() *linkAddrEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) SetNext(elem *linkAddrEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) SetPrev(elem *linkAddrEntry) { e.prev = elem } diff --git a/pkg/tcpip/stack/neighbor_entry_list.go b/pkg/tcpip/stack/neighbor_entry_list.go index b732257d2..d78430080 100644 --- a/pkg/tcpip/stack/neighbor_entry_list.go +++ b/pkg/tcpip/stack/neighbor_entry_list.go @@ -38,16 +38,22 @@ func (l *neighborEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *neighborEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *neighborEntryList) Front() *neighborEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *neighborEntryList) Back() *neighborEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *neighborEntryList) Back() *neighborEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *neighborEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (neighborEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *neighborEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *neighborEntryList) PushFront(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *neighborEntryList) PushFront(e *neighborEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *neighborEntryList) PushBack(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *neighborEntryList) PushBack(e *neighborEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *neighborEntryList) PushBackList(m *neighborEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *neighborEntryList) PushBackList(m *neighborEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *neighborEntryList) InsertAfter(b, e *neighborEntry) { bLinker := neighborEntryElementMapper{}.linkerFor(b) eLinker := neighborEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *neighborEntryList) InsertAfter(b, e *neighborEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *neighborEntryList) InsertBefore(a, e *neighborEntry) { aLinker := neighborEntryElementMapper{}.linkerFor(a) eLinker := neighborEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *neighborEntryList) InsertBefore(a, e *neighborEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *neighborEntryList) Remove(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type neighborEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *neighborEntryEntry) Next() *neighborEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *neighborEntryEntry) Prev() *neighborEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *neighborEntryEntry) SetNext(elem *neighborEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *neighborEntryEntry) SetPrev(elem *neighborEntry) { e.prev = elem } diff --git a/pkg/tcpip/stack/packet_buffer_list.go b/pkg/tcpip/stack/packet_buffer_list.go index 27f15cb15..ce7057d6b 100644 --- a/pkg/tcpip/stack/packet_buffer_list.go +++ b/pkg/tcpip/stack/packet_buffer_list.go @@ -38,16 +38,22 @@ func (l *PacketBufferList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *PacketBufferList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *PacketBufferList) Front() *PacketBuffer { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *PacketBufferList) Back() *PacketBuffer { return l.tail } @@ -55,6 +61,8 @@ func (l *PacketBufferList) Back() *PacketBuffer { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *PacketBufferList) Len() (count int) { for e := l.Front(); e != nil; e = (PacketBufferElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *PacketBufferList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *PacketBufferList) PushFront(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *PacketBufferList) PushFront(e *PacketBuffer) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *PacketBufferList) PushBack(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *PacketBufferList) PushBack(e *PacketBuffer) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *PacketBufferList) PushBackList(m *PacketBufferList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *PacketBufferList) PushBackList(m *PacketBufferList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *PacketBufferList) InsertAfter(b, e *PacketBuffer) { bLinker := PacketBufferElementMapper{}.linkerFor(b) eLinker := PacketBufferElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *PacketBufferList) InsertAfter(b, e *PacketBuffer) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *PacketBufferList) InsertBefore(a, e *PacketBuffer) { aLinker := PacketBufferElementMapper{}.linkerFor(a) eLinker := PacketBufferElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *PacketBufferList) InsertBefore(a, e *PacketBuffer) { } // Remove removes e from l. +// +//go:nosplit func (l *PacketBufferList) Remove(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type PacketBufferEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *PacketBufferEntry) Next() *PacketBuffer { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *PacketBufferEntry) Prev() *PacketBuffer { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *PacketBufferEntry) SetNext(elem *PacketBuffer) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *PacketBufferEntry) SetPrev(elem *PacketBuffer) { e.prev = elem } diff --git a/pkg/tcpip/stack/tuple_list.go b/pkg/tcpip/stack/tuple_list.go index 0d1b98874..31d0feefa 100644 --- a/pkg/tcpip/stack/tuple_list.go +++ b/pkg/tcpip/stack/tuple_list.go @@ -38,16 +38,22 @@ func (l *tupleList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *tupleList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *tupleList) Front() *tuple { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *tupleList) Back() *tuple { return l.tail } @@ -55,6 +61,8 @@ func (l *tupleList) Back() *tuple { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *tupleList) Len() (count int) { for e := l.Front(); e != nil; e = (tupleElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *tupleList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *tupleList) PushFront(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *tupleList) PushFront(e *tuple) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *tupleList) PushBack(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *tupleList) PushBack(e *tuple) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *tupleList) PushBackList(m *tupleList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *tupleList) PushBackList(m *tupleList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *tupleList) InsertAfter(b, e *tuple) { bLinker := tupleElementMapper{}.linkerFor(b) eLinker := tupleElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *tupleList) InsertAfter(b, e *tuple) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *tupleList) InsertBefore(a, e *tuple) { aLinker := tupleElementMapper{}.linkerFor(a) eLinker := tupleElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *tupleList) InsertBefore(a, e *tuple) { } // Remove removes e from l. +// +//go:nosplit func (l *tupleList) Remove(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type tupleEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *tupleEntry) Next() *tuple { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *tupleEntry) Prev() *tuple { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *tupleEntry) SetNext(elem *tuple) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *tupleEntry) SetPrev(elem *tuple) { e.prev = elem } 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 } |