MCPcopy Create free account
hub / github.com/encodeous/nylon / insert

Method insert

polyamide/tun/offload_linux.go:112–129  ·  view source on GitHub ↗

insert an item in the table for the provided packet and packet metadata.

(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffset, tcphLen, bufsIndex int)

Source from the content-addressed store, hash-verified

110
111// insert an item in the table for the provided packet and packet metadata.
112func (t *tcpGROTable) insert(pkt []byte, srcAddrOffset, dstAddrOffset, tcphOffset, tcphLen, bufsIndex int) {
113 key := newTCPFlowKey(pkt, srcAddrOffset, dstAddrOffset, tcphOffset)
114 item := tcpGROItem{
115 key: key,
116 bufsIndex: uint16(bufsIndex),
117 gsoSize: uint16(len(pkt[tcphOffset+tcphLen:])),
118 iphLen: uint8(tcphOffset),
119 tcphLen: uint8(tcphLen),
120 sentSeq: binary.BigEndian.Uint32(pkt[tcphOffset+4:]),
121 pshSet: pkt[tcphOffset+tcpFlagsOffset]&tcpFlagPSH != 0,
122 }
123 items, ok := t.itemsByFlow[key]
124 if !ok {
125 items = t.newItems()
126 }
127 items = append(items, item)
128 t.itemsByFlow[key] = items
129}
130
131func (t *tcpGROTable) updateAt(item tcpGROItem, i int) {
132 items, _ := t.itemsByFlow[item.key]

Callers 3

lookupOrInsertMethod · 0.95
tcpGROFunction · 0.45
udpGROFunction · 0.45

Calls 2

newItemsMethod · 0.95
newTCPFlowKeyFunction · 0.85

Tested by

no test coverage detected